ContextFact: Remembering Facts in Context for Long-Term Conversational Agents
Organizations: Australian Institute for Machine Learning (AIML), Adelaide University · Responsible AI Research Centre · CSIRO · Oracle
Abstract
Agents built on large language models must maintain continuity across repeated interactions with users. However, long-term conversations scatter facts across turns and sessions, making it difficult to retrieve the right evidence with enough context. Memory for such conversations must therefore preserve facts with their context while keeping evidence selectively accessible. We first study how memory construction and retrieval-unit boundaries affect answerability and evidence access. Reading the entire memory bank reveals gaps that cannot be resolved by retrieval selection alone, showing that some context must be preserved during memory construction. Adjacent-turn grouping improves evidence access at matched unique-turn budgets, while wider windows do not consistently help. This motivates keeping fact-specific context local while organizing cross-session evidence separately. We propose ContextFact, which links context-preserving fact memories with source-grounded entity representations. Within sessions, it gathers the context needed to interpret each fact. Across sessions, it aligns recurring referents and revisits the source dialogue to reconstruct coherent entity representations linked to the supporting facts. At query time, ContextFact retrieves fact and entity views, reranks them independently, and uses entity-linked expansion to surface related facts; complete entity representations then provide organized cross-session evidence. With Qwen3.5-27B as the backbone, ContextFact achieves state-of-the-art performance while using only of the evidence tokens consumed by the strongest evaluated baseline, obtaining overall judge accuracy on LoCoMo and on LongMemEval-S. Controlled ablations support context-preserving fact boundaries and source-grounded entity reconstruction, while entity readout improves multi-hop accuracy beyond adding more facts.
Figures & tables
| Method | Tokens | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GPT-4.1-mini | ||||||||||||||||
| Full Context | 20,441 | 64.36 | 56.73 | 89.77 | 58.98 | 48.29 | 80.06 | 44.46 | 33.38 | 80.14 | 27.29 | 22.00 | 58.33 | 57.28 | 48.53 | 84.03 |
| RAG | 1,945 | 49.64 | 43.45 | 70.04 | 48.74 | 42.43 | 57.32 | 36.09 | 23.03 | 58.51 | 24.14 | 19.65 | 47.92 | 45.38 | 38.01 | 63.90 |
| SeCom | 1,707 | 54.61 | 48.12 | 79.07 | 50.20 | 40.50 | 62.93 | 37.64 | 27.15 | 64.18 | 28.20 | 21.28 | 56.25 | 48.94 | 41.02 | 71.56 |
| Mem0 | 1,408 | 41.70 | 36.63 | 63.85 | 49.24 | 42.24 | 65.11 | 34.64 | 25.17 | 60.64 | 20.96 | 15.33 | 41.67 | 40.68 | 34.37 | 62.14 |
| Method | Tokens | Single-User | Single-Assistant | Multi-Session | Temporal | Knowledge-Update | Single-Preference | Overall |
|---|---|---|---|---|---|---|---|---|
| Full Context | 103,726 | 94.29 | 98.21 | 75.19 | 77.44 | 91.03 | 70.00 | 83.20 |
| RAG | 1,965 | 77.14 | 92.86 | 24.06 | 28.57 | 60.26 | 73.33 | 49.00 |
| SeCom | 6,537 | 88.57 | 100.00 | 65.41 | 68.42 | 87.18 | 83.33 | 77.80 |
| Mem0 | 1,192 | 94.29 | 14.29 | 78.20 | 82.71 | 91.03 | 83.33 | 76.80 |
| LightMem | 2,896 | 94.29 | 14.29 | 78.95 | 87.97 | 92.31 | 80.00 | 78.40 |
| SimpleMem | 1,231 | 90.00 | 50.00 | 74.44 | 77.44 | 84.62 | 80.00 | 76.60 |
| Variant | Input | Tokens | Multi-hop | Overall | |||
|---|---|---|---|---|---|---|---|
| Recall | |||||||
| (a) Disable fact expansion and/or entity readout; vs. Full method | |||||||
| Full method | CF10+E10 | 2,907 | 84.04 | 92.02 | 45.33 | 36.25 | 86.49 |
| w/o fact expansion | CF10+E10 | 2,889 | 82.27 ( 1.77) | 91.43 ( 0.59) | 45.20 ( 0.13) | 36.35 ( 0.10) | 86.04 ( 0.45) |
| w/o entity readout | CF10 | 1,171 | 78.37 ( 5.67) | 86.14 ( 5.88) | 44.19 ( 1.14) | 34.52 ( 1.73) | 85.84 ( 0.65) |
| w/o both | CF10 | 1,153 | 76.95 ( 7.09) | 80.03 ( 11.99) | 43.00 ( 2.33) | 33.80 ( 2.45) | 85.32 ( 1.17) |
| Memory bank | Mean evidence tokens | Overall (%) | |||
| +Budget | +Entity | +Budget | +Entity | (pp) | |
| GPT-4.1-mini | |||||
| SeCom | 5,354 | 5,358 | 80.58 | 84.68 | +4.10 |
| SimpleMem | 5,960 | 5,930 | 83.38 | 84.81 | +1.43 |
| EMem | 4,040 | 4,027 | 83.12 | 84.22 | +1.10 |
| Qwen3.5-27B | |||||
Appendix figures & tables24 assets
Supplementary material from the paper’s appendix.
Appendix
| Symbol | Definition |
|---|---|
| Conversation and fact memories | |
| Conversation history of ordered sessions. | |
| The -th session, represented as an ordered sequence of conversational turns. | |
| Temporally annotated history produced before memory extraction. | |
| A fact memory, the fact memories extracted from session , and the complete fact bank. | |
| Entity construction | |
| Method | Tokens | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3.5-27B | ||||||||||||||||
| Full Context | 20,441 | 65.67 | 55.22 | 92.15 | 52.07 | 42.69 | 66.36 | 45.18 | 34.26 | 78.72 | 26.27 | 23.63 | 50.00 | 56.63 | 46.80 | 81.69 |
| Gold-Session | - | 66.92 | 53.60 | 93.22 | 61.71 | 47.90 | 83.80 | 50.93 | 39.08 | 83.33 | 30.70 | 25.89 | 57.29 | 60.65 | 48.03 | 87.21 |
| Mem0 | 6,774 | 47.26 | 41.16 | 69.80 | 34.85 | 27.02 | 49.84 | 39.43 | 30.20 | 68.44 | 20.58 | 18.15 | 37.50 | 41.58 | 34.77 | 63.38 |
| LightMem | 16,771 | 57.16 | 48.01 | 85.61 | 54.88 | 44.92 | 79.75 | 42.80 | 33.35 | 76.24 | 20.81 | 18.63 | 44.79 | 51.79 | 42.85 | 80.13 |
| Method | Tokens | Single-User | Single-Assistant | Multi-Session | Temporal | Knowledge-Update | Single-Preference | Overall |
|---|---|---|---|---|---|---|---|---|
| Full Context | 103,726 | 94.29 | 98.21 | 75.19 | 77.44 | 91.03 | 70.00 | 83.20 |
| Gold-Session | - | 97.14 | 100.00 | 88.72 | 91.73 | 92.31 | 90.00 | 92.60 |
| Mem0 | 6,687 | 92.86 | 14.29 | 79.70 | 78.20 | 88.46 | 86.67 | 75.60 |
| LightMem | 16,065 | 94.29 | 16.07 | 84.96 | 90.98 | 87.18 | 83.33 | 80.40 |
| SimpleMem | 18,425 | 92.86 | 51.79 | 75.19 | 75.94 | 87.18 | 93.33 | 78.20 |
| EMem | 97,648 | 95.71 | 98.21 | 75.94 | 87.22 | 92.31 | 76.67 | 86.80 |
| Unit | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Recall | Recall | Recall | Recall | Recall | |||||||||||
| 10 | Turn | 71.70 | 68.49 | 51.62 | 44.10 | 61.06 | 66.93 | 55.67 | 35.76 | 44.79 | 33.77 | 64.87 | 60.10 | 46.54 | 37.87 |
| 10 | Window-2 | 76.69 | 76.92 | 55.35 | 47.42 | 56.39 | 64.43 | 57.09 | 33.71 | 41.67 | 34.57 | 66.69 | 63.87 | 47.85 | 39.29 |
| 10 | Window-3 | 75.74 | 76.13 | 54.42 | 47.08 | 55.14 | 59.94 | 50.71 | 30.38 | 39.58 | 34.87 | 64.61 | 61.91 | 46.27 | 38.04 |
| 10 | Window-5 | 75.03 | 72.86 | 53.28 | 45.69 | 45.48 | 52.10 | 48.94 | 28.08 | 41.67 | 34.88 | 62.01 | 58.05 | 43.89 | 35.59 |
| 20 | Turn | 79.07 | 78.71 | 57.93 | 49.79 | 67.29 | 75.49 | 62.06 | 45.73 | 47.92 | 38.06 | 71.56 | 69.57 | 51.41 | 42.44 |
| Budget | Method | Units | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.5k | A-Mem | 3.2 | 35.65 | 31.17 | 50.54 | 27.41 | 23.59 | 35.83 | 21.00 | 12.47 | 34.75 | 14.57 | 12.20 | 31.25 | 29.93 | 24.98 | 43.38 |
| MemoryOS | 8.4 | 41.92 | 37.00 | 58.98 | 30.76 | 23.00 | 32.71 | 24.41 | 15.77 | 39.01 | 22.15 | 18.02 | 41.67 | 35.15 | 29.01 | 48.77 | |
| SeCom | 1.4 | 43.57 | 34.88 | 63.73 | 35.11 | 26.93 | 40.81 | 21.86 | 13.80 | 42.20 | 20.35 | 17.60 | 36.46 | 36.38 | 28.29 | 53.31 | |
| Mem0 | 23.7 | 40.46 | 33.65 | 58.98 | 49.19 | 37.05 | 55.76 | 33.82 | 24.02 | 55.32 | 19.54 | 16.17 | 36.46 | 39.76 | 31.51 | 56.23 | |
| LightMem | 15.9 | 51.36 | 40.36 | 77.29 | 58.07 | 44.62 | 75.08 | 34.77 | 26.14 | 63.48 | 22.45 | 18.11 | 43.75 | 47.92 | 37.26 | 72.21 | |
| Budget | Method | Units | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Dense | |||||||||||||||||
| 0.5k | ContextFact | 4.7 | 54.42 | 44.56 | 80.86 | 58.89 | 49.40 | 81.62 | 35.60 | 27.22 | 64.89 | 21.60 | 17.85 | 43.75 | 49.86 | 40.73 | 75.78 |
| Sentence split | 15.9 | 51.78 | 42.35 | 74.67 | 60.43 | 50.24 | 79.13 | 36.88 | 28.75 | 67.73 | 21.12 | 17.78 | 41.67 | 48.94 | 39.97 | 72.27 | |
| Atomic Fact | 20.8 | 53.47 | 42.76 | 80.26 | 64.01 | 53.51 | 81.62 | 37.30 | 26.94 | 69.15 | 22.50 | 18.96 | 41.67 | 50.77 | 40.62 | 76.10 | |
| 1k | ContextFact | 9.8 | 56.72 | 46.43 | 85.02 | 62.51 | 52.86 | 84.11 | 38.92 | 30.96 | 69.15 | 24.69 | 20.54 | 54.17 | 52.67 | 43.32 | 80.00 |
| Method | Tokens | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GPT-4.1-mini | ||||||||||||||||
| P0: No temporal guidance | 833 | 59.44 | 52.44 | 89.42 | 59.94 | 47.35 | 80.06 | 43.74 | 33.97 | 76.60 | 29.64 | 23.28 | 58.33 | 54.81 | 46.18 | 83.18 |
| P1: Joint normalization | 855 | 58.80 | 51.98 | 88.59 | 61.90 | 51.55 | 81.93 | 43.56 | 33.92 | 78.72 | 31.66 | 24.87 | 61.46 | 54.96 | 46.89 | 83.70 |
| P2: Rule-guided normalization | 932 | 59.45 | 52.42 | 90.37 | 62.47 | 53.47 | 85.67 | 43.01 | 32.61 | 78.37 | 32.90 | 27.24 | 64.58 | 55.41 | 47.44 | 85.58 |
| Qwen3.5-27B | ||||||||||||||||
| Type | Rule |
|---|---|
| Reference time | Use the session date by default. |
| Day offsets | Resolve expressions such as “yesterday” to individual dates. |
| Week offsets | Resolve expressions such as “last week” to the corresponding start–end intervals. |
| Month/year offsets | Resolve the corresponding month or year while retaining the original granularity. |
| Weekday references | Interpret “last” and “next” as the nearest previous and future occurrences. |
| Unresolved expressions | Leave vague or unsupported expressions unchanged. |
| Variant | Tokens | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GPT-4.1-mini | ||||||||||||||||
| Provisional entities | 4,568 | 60.23 | 52.62 | 90.37 | 61.68 | 53.32 | 86.60 | 45.16 | 35.52 | 81.56 | 31.88 | 26.03 | 60.42 | 56.00 | 47.98 | 86.10 |
| Recon. (CF) | 4,144 | 58.52 | 51.31 | 90.73 | 63.22 | 54.59 | 88.16 | 44.60 | 34.92 | 81.56 | 26.73 | 21.96 | 56.25 | 54.97 | 47.16 | 86.36 |
| Recon. (Source) | 4,139 | 59.36 | 51.81 | 91.44 | 64.31 | 55.28 | 89.72 | 45.06 | 35.43 | 81.56 | 29.82 | 24.05 | 59.38 | 55.93 | 47.80 | 87.27 |
| Qwen3.5-27B | ||||||||||||||||
| Setting | Path | E | Reader Input | Tokens | Single | Temp. | Multi-hop | Open | Overall | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| A | B | Recall | |||||||||
| Expansion without entity readout | |||||||||||
| R0: No expansion | ✗ | ✗ | ✗ | CF10 | 1,153 | 90.49 | 88.47 | 76.95 | 80.03 | 54.17 | 85.32 |
| R1: Fact-seeded expansion | ✓ | ✗ | ✗ | CF10 | 1,168 | 90.37 | 89.10 | 77.66 | 84.18 | 52.08 | 85.39 |
| R2: Entity-seeded expansion | ✗ | ✓ | ✗ | CF10 | 1,170 | 90.84 | 89.41 | 79.08 | 85.60 | 55.21 | 86.17 |
| R3: Dual-path expansion | ✓ | ✓ | ✗ | CF10 | 1,171 | 90.84 | 88.79 | 78.37 | 86.14 | 54.17 | 85.84 |
| Setting | Avg. tokens | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Direct-retrieval references | ||||||||||||||||
| RRF-10 | 1,132 | 59.18 | 48.52 | 87.04 | 64.44 | 54.29 | 86.60 | 37.01 | 28.42 | 67.02 | 24.07 | 20.46 | 46.88 | 54.03 | 44.29 | 80.78 |
| RRF-30 | 3,383 | 60.97 | 50.64 | 90.37 | 64.57 | 55.34 | 85.36 | 42.91 | 34.08 | 76.60 | 24.56 | 20.74 | 47.92 | 56.14 | 46.72 | 84.16 |
| RRF-30 rerank-10 | ||||||||||||||||
| MemReranker-4B | 1,153 | 61.71 | 50.27 | 90.49 | 65.54 | 54.53 | 88.47 | 43.00 | 33.80 | 76.95 | 25.51 | 20.80 | 54.17 | 56.83 | 46.30 | 85.32 |
| Method | Build (k) | Search (s) | E2E (s) | Acc. (%) | |||||
| Input | Output | Mean | P50 | P95 | Mean | P50 | P95 | ||
| Mem0 | 1122.9 | 123.9 | 0.06 | 0.06 | 0.07 | 0.93 | 0.84 | 1.13 | 62.14 |
| MemoryOS | 305.3 | 102.0 | 1.64 | 1.44 | 2.50 | 2.50 | 2.30 | 3.44 | 71.88 |
| LightMem | 71.6 | 20.0 | 0.02 | 0.02 | 0.03 | 0.86 | 0.82 | 1.06 | 79.61 |
| SimpleMem | 40.7 | 77.2 | 0.06 | 0.06 | 0.07 | 1.50 | 1.42 | 2.07 | 80.06 |
| EMem | 56.8 | 17.7 | 2.27 | 1.58 | 6.24 | 3.09 | 2.40 | 7.12 | 79.42 |
| Qwen3.5-27B | GPT-4.1-mini | |||
|---|---|---|---|---|
| Construction stage | Input(k) | Output(k) | Input(k) | Output(k) |
| Context-preserving fact extraction | 132.2 | 34.4 | 122.7 | 30.8 |
| Cross-session entity binding | 92.1 | 14.7 | 89.7 | 23.3 |
| Topic-based entity grouping | 5.6 | 3.8 | 3.2 | 2.0 |
| Source-grounded entity reconstruction | 66.5 | 21.7 | 57.9 | 15.0 |
| Total | 296.5 | 74.6 | 273.5 | 71.1 |
| Method | Tokens | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GPT-4.1-mini | ||||||||||||||||
| SeCom | 1,707 | 54.61 | 48.12 | 79.07 | 50.20 | 40.50 | 62.93 | 37.64 | 27.15 | 64.18 | 28.20 | 21.28 | 56.25 | 48.94 | 41.02 | 71.56 |
| +Budget | 5,354 | 59.81 | 52.97 | 86.33 | 57.85 | 47.94 | 75.70 | 44.32 | 32.69 | 77.30 | 26.36 | 20.52 | 56.25 | 54.48 | 46.18 | 80.58 |
| +Entity | 5,358 | 61.86 | 54.29 | 90.73 | 57.01 | 44.92 | 81.00 | 44.64 | 33.70 | 80.50 | 28.41 | 23.79 | 56.25 | 55.61 | 46.67 | 84.68 |
| SimpleMem | 2,016 | 56.96 | 49.87 | 86.80 | 37.73 | 30.12 | 78.19 | 40.06 | 30.43 | 72.34 | 24.64 | 19.46 | 50.00 | 47.84 | 40.29 | 80.06 |
| Construction | Reader | Single-hop | Temporal | Multi-hop | Open-domain | Overall | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ContextFact-F | ||||||||||||||||
| Qwen3.5-27B | Qwen3.5-27B | 61.91 | 50.30 | 90.49 | 65.48 | 54.49 | 88.79 | 42.98 | 33.83 | 76.60 | 24.94 | 20.04 | 54.17 | 56.88 | 46.27 | 85.32 |
| GPT-4.1-mini | 61.37 | 53.94 | 91.20 | 63.63 | 54.30 | 85.98 | 43.43 | 34.13 | 78.01 | 28.29 | 21.63 | 55.21 | 56.50 | 48.37 | 85.45 | |
| Sol 6.1 | 61.92 | 45.07 | 91.91 | 67.54 | 49.42 | 89.41 | 44.77 | 32.47 | 80.14 | 32.66 | 21.70 | 59.38 | 58.13 | 42.21 | 87.21 | |
| Sonnet 5.0 | 61.66 | 53.64 | 92.39 | 61.16 | 51.68 | 85.67 | 43.16 | 34.21 | 80.85 | 25.76 | 19.46 | 66.67 | 55.93 | 47.54 | 87.27 | |
| Question type | F: CF10 | E: CF10 | E: CF10 + entity links |
|---|---|---|---|
| Single-hop | 98.41 | 98.89 | 99.37 |
| Multi-hop | 80.03 | 86.14 | 92.02 |
| Temporal | 96.34 | 96.91 | 97.51 |
| Open-domain | 71.60 | 73.76 | 87.04 |
| Overall | 93.00 | 94.63 | 96.89 |
| Construction | Method | Qwen3.5-27B | GPT-4.1-mini | Sol 6.1 | Sonnet 5.0 | Opus 5.5 |
|---|---|---|---|---|---|---|
| Qwen3.5-27B | F | 54.17 | 55.21 | 59.38 | 66.67 | 77.08 |
| E | 51.04 | 59.38 | 60.42 | 66.67 | 79.17 | |
| GPT-4.1-mini | F | 57.29 | 62.50 | 62.50 | 66.67 | 77.08 |
| E | 53.12 | 58.33 | 64.58 | 67.71 | 80.21 |
Long-Term Conversational Memory
Long-term conversational memory helps AI assistants retain, update, and use information from past conversations across sessions.
See all 296 papers