ContextFact: Preserving Contextual Facts for Long-Term Conversational Agents

ContextFact solves the tension between evidence retrieval and context preservation in long-term conversations via context-preserving factual memory and source-anchored entity representations.
ContextFact tackles scattered facts and the need to balance evidence with context in long-term conversational agents by combining context-preserving factual memory with source-anchored entity representations. It finds context gaps that retrieval cannot fix must be preserved at memory construction; adjacent-turn grouping helps under equal turn budgets, but larger windows don't. It collects interpretive context per fact within sessions, aligns coreference and revisits source dialogues across sessions, and reranks dual fact/entity views at query time. With Qwen3.5-27B and ~1/5 the evidence tokens of the strongest baseline, it leads on LoCoMo and LongMemEval-S, with ablations validating both core designs and entity readout.
Long-term conversational agents face a fundamental tension: a user's factual information is scattered across turns and sessions, and retrieval must both find the right evidence and preserve enough context to interpret it correctly. ContextFact's research centers on this tension, proposing a combination of "context-preserving factual memory" and "source-anchored entity representations."

Problem: Scattered Facts, and Retrieval Unit Boundaries Determine Answerability
The study first examines how memory construction methods and retrieval unit boundaries affect answerability and evidence accessibility. A key finding: even when the entire memory store is read in, there remain gaps that retrieval selection cannot compensate for—meaning some context must be preserved at the memory construction stage rather than patched at retrieval time.
In retrieval unit design, adjacent-turn grouping improves evidence accessibility under the same unique-turn budget; but further widening the window does not yield consistent gains. This points to a design principle: fact-relevant context should be preserved locally, while cross-session evidence needs to be organized separately.
Retrieval unit refers to the smallest text chunk that a memory system indexes, scores, and returns as a whole during retrieval. In long-term conversations, the choice of unit boundary directly determines evidence accessibility: too small a unit (e.g., a single turn) loses the adjacent context needed to understand a fact, while too large a unit introduces noise and wastes the token budget. Adjacent-turn grouping balances the two by packing several consecutive turns into one unit, and the "unique-turn budget" constraint ensures different grouping strategies are compared under equal information volume, avoiding inflation from returning more turns.
ContextFact's Method Design
ContextFact links context-preserving factual memory with source-anchored entity representations, handling two levels: within-session and cross-session.
Within-Session: Collecting Interpretive Context for Each Fact
Within a single session, the system collects the context necessary to understand each fact, so that the factual memory itself carries sufficient contextual information. This directly addresses the "context gap at the memory construction stage" identified earlier.
Cross-Session: Aligning Coreference and Revisiting Source Dialogues
Across sessions, ContextFact aligns recurring referents and revisits source dialogues to reconstruct coherent entity representations. These entity representations are linked to supporting facts, maintaining referential consistency over long-term interactions rather than relying on isolated text fragments.
Coreference alignment refers to identifying expressions across different sessions that point to the same entity or object—for example, "the camera I mentioned last time" and "it" must be merged under the same entity across sessions. In long-term conversations, users often use ellipsis and pronouns; if retrieval relies only on text fragments, the same entity fragments into multiple isolated memories, making multi-hop questions impossible to chain. ContextFact reconstructs entity representations by revisiting source dialogues, giving each entity a stable cross-session anchor, so that at query time scattered evidence can be recalled along entity threads rather than relying on literal matching.
At Query Time: Dual-View Retrieval and Entity Linking Expansion
At the query stage, the system retrieves the fact view and the entity view separately, reranks each independently, and uses entity linking expansion to surface related facts; the full entity representation provides organized cross-session evidence. This dual-channel design covers both needs: "precisely matching a specific fact" and "tracing the complete thread of an entity."
Entity linking here refers to mapping entities or references mentioned in a query to entity representations already built in the memory store, then expanding to facts associated with that representation. Unlike traditional entity linking (linking to a knowledge base), the linking target here is an entity node dynamically constructed from dialogue history. In dual-view retrieval, the fact view is responsible for precisely hitting a statement, while the entity view expands recall along entity relations; the two are independently reranked and then fused, enabling the system to answer both "did something happen" and "what related facts exist about this person/object."
Experimental Results and Ablation Validation
Using Qwen3.5-27B as the backbone model, ContextFact achieves state-of-the-art performance while consuming only about one-fifth of the evidence tokens required by the strongest baseline, reaching 86.49% judge accuracy (overall) on LoCoMo and 91.00% on LongMemEval-S.
Ablation experiments support two core designs: context-preserving fact boundaries and source-anchored entity reconstruction. In addition, the multi-hop accuracy gain from entity readout exceeds the effect of simply increasing the number of facts—indicating that in long-term conversational memory, structured entity views are more valuable than stacking more fact fragments.
Ablation study observes performance changes by removing or replacing a design component one at a time to judge its contribution. Here, removing "context-preserving fact boundaries" or "source-anchored entity reconstruction" degrades performance, showing neither is redundant. Entity readout refers to directly reading and aggregating relevant information from entity representations at query time to answer questions, rather than relying solely on matching fact fragments; ablations show its multi-hop accuracy gain is larger than simply increasing the number of facts, indicating that structured entity views have independent value in long-term memory.
Implications for Long-Term Memory System Design
ContextFact's value is not just a higher score, but that it designs "memory construction" and "retrieval strategy" as a whole. Several practical takeaways:
- Fact boundaries should not be cut too finely; grouping adjacent turns is a cost-effective compromise;
- Cross-session evidence needs to be organized independently of individual facts, otherwise referential ambiguity accumulates over long-term interactions;
- Retrieving entity views and fact views separately and then reranking improves answerability of multi-hop questions without significantly increasing token overhead.
For conversational agents that need to maintain long-term relationships with users, this approach of "remembering facts, and remembering the context of facts" is closer to the essence of the problem than simply expanding memory capacity.
One-line Summary
ContextFact resolves the tension between evidence retrieval and context preservation in long-term conversations through context-preserving factual memory and source-anchored entity representations.
Paragraph Summary
ContextFact addresses the problem in long-term conversational agents where facts are scattered and retrieval must balance evidence with context, proposing a combination of "context-preserving factual memory" and "source-anchored entity representations." The study finds that even when the entire memory store is read in, there remain context gaps that retrieval cannot compensate for, so some context must be preserved at the memory construction stage; adjacent-turn grouping improves evidence accessibility under the same turn budget, but larger windows yield no consistent gains. Methodologically, within a session it collects interpretive context for each fact; across sessions it aligns coreference and revisits source dialogues to reconstruct entity representations; at query time it independently reranks the fact and entity views and uses entity linking expansion. With Qwen3.5-27B as the backbone and only about one-fifth of the strongest baseline's evidence tokens, it achieves leading results on LoCoMo and LongMemEval-S, with ablations validating the two core designs and the value of entity readout.
Related articles

Nothing CMF Buds 2A Drops to $17.89 on Black Friday: A New Low for ANC Earbuds
Nothing CMF Buds 2A wireless earbuds Black Friday deal: just $17.89 on Amazon, about $11 off retail and a record low. ANC earbuds at an entry-level price.

When AI Creation Gets Accused of "Spitting": Hacker News Heats Up Over the Glaude Controversy
A Hacker News post, "Spitting in the Face of Glaude," sparks debate on AI creation transparency and attribution ethics. This analysis examines the blurred creator identity behind the controversy and offers practical advice for AI content production.

Akai Embraces Custom Firmware: MPC Sample 1.4 Lets Users AI-Program Their Sampler
Akai embraces the modding community with MPC Sample 1.4 firmware, supporting vibe-coded custom firmware and effects. We analyze the impact of this open strategy on music hardware and AI-assisted programming.