TASK Memory: Beyond Text-Only Memory with Activation Steering and Knowledge Editing against Memory Hallucination
Authors: Jinkun Zhao, Wenjun Wu
Organizations: SKLCCSE, Institute of Artificial Intelligence Beihang University, Beijing, China · Beijing Advanced Innovation Center for Future Blockchain and Privacy Computing Beihang University, Beijing, China
LLM agents increasingly rely on external memory, yet they still hallucinate about what they remember. Often the correct memory is retrieved and placed in the prompt, but the answer contradicts it or the memory is applied to the wrong question. We call these use-time memory hallucinations. Across five open models, we find that they arise from the conflict between parametric knowledge and external memory and take three forms: memory-ignoring, where the model returns to a stale fact in its weights (up to 46% of queries); memory-misapplying, where it attributes the memory to unrelated entities (up to 24%, and 49% when retrieval is combined with weight editing); and version confusion, where 53% of answers about revised facts assert the superseded value when both versions remain stored. We propose TASK memory, which goes beyond text-only memory by combining a Text note with Activation Steering and Knowledge editing that share one in-model address. The text holds the content. A removable knowledge edit supplies the address through its subject key and supports multi-hop composition. A pair of steering vectors decides, query by query, whether the model adopts the memory or keeps its own answer; the vectors store no content and control how the text memory is used. On frozen models under a pre-registered, test-once protocol, TASK reduces memory-ignoring hallucinations to at most 1.5% in all ten model-dataset cells and cuts neighbour misuse from 39.2% to 7.5% (+10.8 pp composite on CounterFact). It improves a 300-memory library over BM25 RAG by 16.4 pp, an advantage that holds at 3,000 memories, resolves fact revisions without fact IDs, and adds 7.5 pp of multi-hop accuracy on MQuAKE. 21 of 23 cross-model comparisons (8B-27B, four families) are significant, and TASK beats three recent context-steering methods in 9 of 10 model-dataset cells.
Figures & tables
Figure 1: Memory hallucination: the memory is correct, the answer is not. (a) Text-only memory or RAG puts the retrieved note into the prompt and leaves the rest to the frozen model, where the note in the context conflicts with the stale fact in the weights. On a question about the memory, the weights win and the model answers with the stale fact (Type I, memory-ignoring). On a question about another entity, the note wins and the model assigns the memory to the wrong entity (Type II, memory-misapplying). Across our five models these rates reach 46% and 24%, and Type II reaches 49% when retrieval is combined with weight editing. (b) TASK memory goes beyond text-only memory. Each memory object holds T ext content, a K nowledge edit ΔWm whose key u^m serves as the in-model address, and a pair of A ctivation- S teering vectors (v+,v−) that carry no content. For a query x , the address response rm(x) is compared with the threshold τm . A relevant query shows T , loads E and adds v+ , so the model adopts the memory; an unrelated query leaves T and E off and adds v− , so the model keeps its own answer.
Figure 2: Use-time memory hallucinations caused by the conflict between parametric knowledge and external memory (test splits, text memory in context, greedy decoding). (a) Type I, memory-ignoring: adoption of the memory’s answer on paraphrased questions. Filled markers: queries on which the no-memory model states the stale fact, i.e. the old fact is in the weights. Hollow markers: all other queries. The gap is in percentage points; ∗ marks a paired world-level bootstrap 95% CI that excludes 0. (b) Type II, memory-misapplying: on neighbour questions (same relation, different subject) that the no-memory model answers correctly, the rate at which the model instead states the memory’s answer. Without memory this is ≤ 0.9%. With text memory it rises on every model, and with text memory plus a weight edit (T+E) it rises further on four of the five models. All numbers come from frozen predictions ( Appendix A ).
Paradigm
Memory content
Written into the model
Base-model training
Arbitration with parametric knowledge
Per-memory removal
Text memory / RAG [ 22 , 8 , 54 ]
text
nothing
none
left to the model
delete record
Knowledge editing [ 32 , 33 , 11 ]
weights
fact (weight delta)
none
edit replaces parametric fact
partly (side memories)
Context-faithfulness steering [ 2 , 29 , 42 ]
text
one global direction / decoding rule
none
always favour context
–
Parametric RAG [ 43 ]
text + generated LoRA
document content
hypernetwork
left to the model
drop adapter
MemT-1.0 [ 31 ]
trained native memory state
history content
34B-token memory training
imitate full-context backbone
no (fixed-size state)
TASK (ours)
text (+ local patch)
address + adopt/restrain policy
none (frozen)
per query, address-gated v+ / v−
yes (versioned, unloadable)
Table 1: Where the memory lives and who arbitrates. “Content in model”: whether the fact or history itself is written into weights or a trained state. “Arbitration”: how the system decides, per query, between the memory and parametric knowledge.
Figure 3: TASK memory overview. (a) Write. A visible observation (s,p,o∗) is compiled into a memory object bound to the model hash, scope and version. The object contains a text record T , an address key km at layer ℓE with a threshold τm calibrated at write time, a closed-form, low-rank and removable patch E keyed on the same address, and steering vectors S =(vm+,vm−) trained on the frozen model; these are kept in a text store, a patch library and a steering bank. (b) Read , against memory-ignoring (Type I) and memory-misapplying (Type II) hallucination. Candidates are retrieved by BM25 or semantic search, and one partial forward pass to layer ℓE computes each candidate’s address response rm . The shared gate gm=1[rm≥τm] decides whether the note is shown, whether the patch is loaded as W+BA , and whether vm+ or vm− is added at the decision positions of layer ℓS ; multi-hop composition uses v+ only. All hooks and patches are unloaded after generation. (c) Revise , against version confusion (Type III). A new observation is matched to the top-2 active records by BM25, checked with the address and judged by the agent’s own model. On update the old version’s T , E and S are retired together; on different the existing record stays active. No fact IDs are used.
Benchmark
TASK configuration
Baseline
TASK
Baseline
Δ [95% CI]
RQ1
CounterFact (300 worlds)
T + S
T
0.919
0.811
+10.80 [7.80, 14.16] ∗
zsRE (300 worlds)
T + S
T
0.892
0.835
+5.65 [1.20, 10.20] ∗
LoCoMo (1,230 q.)
retrieved T + S
retrieved T
0.342
0.328
+1.38 [0.21, 2.75] ∗
RQ2
CounterFact library (300)
address-verified T + gated E + S
BM25 RAG
0.946
0.782
+16.36 [12.99, 20.31] ∗
zsRE library (300)
address-verified T + gated E + S
BM25 RAG
0.965
0.803
+16.23 [11.29, 22.11] ∗
LoCoMo
semantic-address T + S
BM25 RAG
0.342
0.308
+3.41 [0.07, 7.05] ∗
Table 2: Pre-registered test comparisons (Qwen3-8B; one frozen configuration; each test set run once). Δ in percentage points with 95% paired-bootstrap CI; bold and ∗ : CI excludes 0. The upper bound 0.00 in the last row is exactly zero, so that interval includes 0. Composite = harmonic mean of paraphrase accuracy, canonical accuracy and locality preserved.
CounterFact (300)
zsRE (300)
Method
Para.
Canon.
Loc.
Misuse ↓
Comp.
Para.
Canon.
Loc.
Misuse ↓
Comp.
No memory
1.8
0.7
100.0
1.7
0.015
1.7
1.3
100.0
0.0
0.022
T (text memory)
88.2
91.7
67.8
39.2
0.811
91.7
92.7
70.4
5.7
0.835
T + global evidence vector (ungated)
88.2
93.3
60.9
43.5
0.780
93.0
95.0
66.7
8.3
0.827
T + random vector (norm-matched)
88.3
91.0
69.1
38.8
0.816
92.7
92.3
70.4
5.0
0.837
T + vector at wrong layer
88.3
91.7
68.7
39.2
0.816
91.7
92.7
68.5
5.7
0.827
Table 3: Provided evidence (test, Qwen3-8B). The note is in context for related and unrelated queries. Para./Canon.: adoption on paraphrased/canonical queries (%); Loc.: locality preserved (%); Misuse: neighbour answers that assert the memory’s object (%, all neighbours); Comp.: composite.
Figure 4: TASK reduces both types of use-time memory hallucination on five models and two datasets (test). (a) Type I, memory-ignoring: reversion to the stale parametric answer on queries whose stale fact is in the weights. (b) Type II, memory-misapplying: misuse on neighbour questions that the no-memory model answers correctly. This subset is why the values differ from the misuse over all neighbours in Table 3 (e.g. 24.3% vs. 39.2% for Qwen3-8B with T ). Bars give values in %. Per-cell bootstrap CIs are in Appendix A .
Table 4: One agent, 300 memories (test; BM25 top-2 candidates) and continual revision (dev; 100 insertions then 50 revisions). E all : one joint patch over all memories, always on.
Figure 5: Scaling the library to 3,000 memories (CounterFact test queries; distractors are training-split memories written by the same writer). Dashed: BM25 retrieval; solid: address-verified reading. Colours follow the carriers as in Figures 2 and 4 . At 300 memories, address-verified T and T + S have the same locality (96.9%), so their markers coincide in (b). The full configuration with gated E (address-verified T + gated E + S , Table 4 ) scores 0.946 / 0.928 / 0.916 and lies between the two upper curves in (a); it is omitted for legibility.
Table 5: Composition and the parametric carrier. Left: MQuAKE-CF-3k test (200 cases, 600 questions; only edited base facts are written). Right: our closed-form E against the original EasyEdit implementations on zsRE test (300 edits).
Model
CF: T
CF: T+S
CF Δ1
CF lib. Δ2
zsRE Δ1
zsRE lib. Δ2
MQuAKE Δ3
Qwen3-8B
0.811
0.919
+10.80 ∗
+16.36 ∗
+5.65 ∗
+16.23 ∗
+7.50 ∗
Llama-3.1-8B
0.518
0.948
+43.02 ∗
+49.37 ∗
+28.04 ∗
+41.40 ∗
+33.83 ∗
Qwen3-14B
0.923
0.945
+2.19 ∗
+6.05 ∗
+7.90 ∗
+11.60 ∗
+1.17
Phi-4 (14B)
0.756
0.956
+19.97 ∗
+12.99 ∗
+8.20 ∗
+20.12 ∗
+36.00 ∗
Gemma-3-27B
0.849
0.888
+3.92 ∗
+17.65 ∗
− 4.61
n/a
n/a
Model ⋅ dataset
− IKE
− CAD
− CAA
− KSD
− ContextFocus
− CAST
Table 6: Same frozen protocol on five models (test). Top: gains of TASK . Δ1 : T+S − T; Δ2 : address-verified T + gated E + S − BM25 RAG (300-memory library); Δ3 : T+E+S + − T (MQuAKE). Bottom: T+S ( TASK ) minus each context-use baseline with the same note (composite, pp). Bold and ∗ : 95% CI excludes 0, in either direction (full CIs in Appendix D ). n/a: not run for Gemma-3-27B, as fixed in advance for compute reasons.
Method
Qwen3-8B judge
Qwen3-14B judge
GLM-5.3 judge
Input tokens
BM25 top-5 facts (T)
30.8
28.5
33.6
299
Semantic-address T
32.8
30.3
34.6
298
Semantic-address T + S ( TASK )
34.2
31.0
39.3
298
Mem0, top-5
17.9
16.1
19.5
257
Mem0, top-30
26.1
24.2
30.4
1,226
A-Mem, token-matched to ours
28.6
27.1
30.7
294
Table 7: LoCoMo test (8 conversations, 1,230 questions; same answering model, Qwen3-8B). Accuracy under three judges and mean input tokens. Bold: best among methods with at most about 300 input tokens. Paired differences use a conversation-level bootstrap.
Table 9: Change in reversion to the stale parametric answer from T to T + S (stored-fact queries).
Carrier / setting
Memories
Seconds / memory
Forward passes / memory
E (closed-form patch), CounterFact
300
4.0
18.8
S ind (paired vectors), CounterFact
300
25.0
86
S cond , CounterFact
300
25.0
86
S (semantic address), LoCoMo
1,749
25.0
86
Appendix
Table 10: Write-time and read-time cost per memory (Qwen3-8B, BF16, one GPU).
Model ⋅ method
No sup.
No sup.: stale ↓
Oracle
Auto
Auto: stale ↓
Auto: unrevised
Qwen3-8B ⋅ address-verified T
0.333
0.533
0.860
0.793
0.087
0.893
Qwen3-8B ⋅ address-verified T + S
0.340
0.547
0.933
0.827
0.100
0.940
Qwen3-8B ⋅ address-verified T + gated E + S
0.420
0.473
0.940
0.893
0.053
0.953
Llama-3.1-8B ⋅ address-verified T
0.700
0.133
0.593
0.593
0.000
0.453
Llama-3.1-8B ⋅ address-verified T + S
0.413
0.480
0.960
0.960
0.000
0.967
Llama-3.1-8B ⋅ address-verified T + gated E + S
0.380
0.500
0.953
0.953
0.000
0.967
Appendix
Table 11: Revised facts in the version-conflict test (150 revised facts per model). Accuracy columns give the rate of answers with the current value; stale columns give the rate of answers with the superseded value (Type III). For reference, BM25 RAG without supersession has a stale rate of 0.533 (Qwen3-8B) and 0.140 (Llama-3.1-8B).
Comparison
Qwen3-8B
Llama-3.1-8B
Addr. T+S − addr. T
+7.02 [4.84, 9.38] ∗
+27.55 [23.81, 31.41] ∗
Addr. T+gated E − addr. T
+7.22 [4.90, 9.71] ∗
+19.61 [15.48, 23.74] ∗
Addr. T − BM25 T (text only)
− 1.86 [-3.44, -0.31] ∗
− 4.95 [-7.34, -2.48] ∗
Addr. T+gated E+S − addr. T+S
+0.10 [-1.12, 1.24]
− 1.44 [-2.97, 0.10]
S cond− S ind
+0.93 [-0.10, 1.93]
− 0.93 [-2.63, 0.83]
Ungated joint E (accuracy)
0.015
0.013
Appendix
Table 12: Same-subject library (accuracy differences, pp). Bold and ∗ : 95% CI excludes 0, in either direction.
Variant
Para.
Canon.
Loc.
Comp. (full S − variant, pp)
T
88.2
91.7
67.8
0.811 (+10.80 ∗ )
T + full S
96.7
99.3
81.7
0.919
T + shared direction only
93.3
97.0
83.5
0.909 (+0.99 [-1.07, 3.00] )
T + memory-specific residual only
95.0
99.0
71.3
0.866 (+5.32 ∗ )
Appendix
Table 13: Shared/memory-specific decomposition of S (CounterFact test, Qwen3-8B; exploratory). Shared = mean of all 300 memories’ v+ (and v− ); residual = own vector minus shared. Every variant keeps the memory’s own address gate.
Setting
Split
Metric
Δ (pp) [95% CI]
CounterFact, Qwen3-8B
test
composite
+1.55 [-1.41, 4.22]
CounterFact, Qwen3-8B, writer seeds 17 / 29 / 41
dev
composite
+0.84 / − 1.05 / +2.76 ∗
CounterFact, Mistral-7B
dev
composite
+1.16 [-3.56, 6.20]
CounterFact library, address-verified + gated E
test
composite
+0.01 [-0.51, 0.52]
CounterFact library, BM25 + E all
test
composite
− 5.18 [-8.26, -2.33] ∗
MQuAKE, paired vectors
test
multi-hop acc.
− 2.67 [-4.50, -0.67] ∗
Appendix
Table 14: Edit-aware steering: S cond− S ind under the same edit (positive favours S cond ). Bold and ∗ : 95% CI excludes 0, in either direction. An upper bound printed as 0.00 is exactly zero, so that interval includes 0.
Method
Qwen3-8B seed 17
seed 29
seed 41
Mistral-7B
T
0.825
0.825
0.825
0.639
T + ungated global vector
0.762
0.762
0.762
0.719
T + S ind
0.897
0.881
0.898
0.933
T + E
0.701
0.730
0.717
0.765
T + E + S ind
0.830
0.811
0.849
0.856
E only
0.890
0.891
0.898
0.898
Appendix
Table 15: Robustness on development data (100 worlds, composite).
State Key Laboratory for Novel Software Technology, Nanjing University, China · National Institute of Healthcare Data Science, Nanjing University, China