跳到正文
arXiv cs.AI· Cosmo Santoni·· 12 小时前AI 评分38

Contextual Memory Virtualisation:面向 LLM 智能体的 DAG 状态管理与结构无损裁剪

Contextual Memory Virtualisation: DAG-Based State Management and Structurally Lossless Trimming for LLM Agents

AI 导读

研究者提出 Contextual Memory Virtualisation(CMV),把 LLM 智能体在上下文窗口中积累的状态建模为有向无环图(DAG),提供快照、分支、裁剪原语,支持跨并行会话复用上下文。

正文 · 原文

View PDF HTML (experimental)

Abstract:As large language models engage in extended reasoning tasks, they accumulate significant state -- architectural mappings, trade-off decisions, codebase conventions -- within the context window. This understanding is lost when sessions reach context limits and undergo lossy compaction. We propose Contextual Memory Virtualisation (CMV), a system that treats accumulated LLM understanding as version-controlled state. Borrowing from operating system virtual memory, CMV models session history as a Directed Acyclic Graph (DAG) with formally defined snapshot, branch, and trim primitives that enable context reuse across independent parallel sessions. We introduce a three-pass structurally lossless trimming algorithm that preserves every user message and assistant response verbatim while reducing token counts by a mean of 20% and up to 86% for sessions with significant overhead by stripping mechanical bloat such as raw tool outputs, base64 images, and metadata. A single-user case-study evaluation across 76 real-world coding sessions demonstrates that trimming remains economically viable under prompt caching, with the strongest gains in mixed tool-use sessions, which average 39% reduction and reach break-even within 10 turns. A reference implementation is available at this https URL.
Comments: 11 pages. 6 figures. Introduces a DAG-based state management system for LLM agents. Evaluation on 76 coding sessions shows up to 86% token reduction (mean 20%) while remaining economically viable under prompt caching. Includes reference implementation for Claude Code
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI); Human-Computer Interaction (cs.HC); Operating Systems (cs.OS)
Cite as: arXiv:2602.22402 [cs.SE]
  (or arXiv:2602.22402v2 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2602.22402

arXiv-issued DOI via DataCite

Submission history

From: Cosmo Santoni [view email]
[v1] Wed, 25 Feb 2026 20:52:52 UTC (682 KB)
[v2] Thu, 22 Oct 2026 22:21:54 UTC (682 KB)

来源:arXiv cs.AI · arxiv.org