TokenMizer: Graph-Structured Session Memory for Long-Horizon LLM Context Management

📄 arXiv: 2606.06337v1 📥 PDF

作者: Shweta Mishra

分类: cs.AI

发布日期: 2026-06-04

备注: 12 pages, 10 figures. Code and benchmark available at https://github.com/Shweta-Mishra-ai/tokenmizer


💡 一句话要点

提出TokenMizer以解决长时间任务中的上下文管理问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 知识图谱 上下文管理 大型语言模型 会话恢复 信息结构化 任务回忆 决策支持

📋 核心要点

  1. 现有方法在处理长时间任务时,无法有效管理超出上下文窗口的历史信息,导致重要信息丢失。
  2. TokenMizer通过将会话历史建模为类型化知识图谱,保留了信息的结构性和关联性,从而提高了会话的可恢复性。
  3. 在实验中,TokenMizer的恢复块平均为78个令牌,较基线减少了约2倍,同时决策回忆率提高了9-17个百分点。

📝 摘要(中文)

大型语言模型(LLM)在长时间任务中的应用面临一个基本限制:上下文窗口是有限的,而工作会话却不是。当历史信息超过最大有效上下文窗口(MECW)时,重要的结构化信息会被默默丢弃。现有的解决方案将历史视为平面文本,破坏了会话的关系结构。本文提出了TokenMizer,一个开源代理系统,将LLM会话历史建模为一个类型化知识图谱。该图谱定义了14种节点类型和7种边类型,采用混合提取管道逐步填充图谱,并通过三层检查点系统将其序列化为紧凑的恢复块。实验结果表明,TokenMizer在21个会话的控制基准测试中表现出显著的令牌经济性,恢复块的平均大小为78个令牌,显著小于基线的159-170个令牌,同时实现了更高的决策回忆率。

🔬 方法详解

问题定义:本文旨在解决大型语言模型在长时间任务中的上下文管理问题,现有方法将历史信息视为平面文本,导致重要结构化信息的丢失。

核心思路:TokenMizer通过将会话历史建模为类型化知识图谱,保留了信息的关系结构,从而实现更高效的上下文管理和恢复。

技术框架:TokenMizer的整体架构包括一个混合提取管道用于逐步填充知识图谱,一个三层检查点系统用于序列化恢复块,以及一个8层压缩管道和语义缓存以减少上下文开销和查询延迟。

关键创新:TokenMizer的主要创新在于其知识图谱的构建和管理方式,能够有效保留会话中的决策理由,而不仅仅是提及的技术。

关键设计:该系统定义了14种节点类型和7种边类型,采用模糊标签匹配技术显著提高了任务回忆率,同时实现了47.3%的令牌减少,且无外部依赖。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,TokenMizer的恢复块平均为78个令牌,较基线减少约2倍(基线为159-170个令牌),同时在任务回忆率、决策回忆率和文件回忆率上均表现出显著提升,分别达到51.0%、46.6%和58.7%。

🎯 应用场景

TokenMizer在需要长时间跟踪和管理上下文信息的应用场景中具有广泛的潜在价值,如软件开发、项目管理和研究领域。通过提高信息的可恢复性和查询效率,能够显著提升工作效率和决策质量。

📄 摘要(原文)

Large language model (LLM) deployments for long-horizon tasks face a fundamental constraint: context windows are finite while productive work sessions are not. When history exceeds the Maximum Effective Context Window (MECW), critical structured information - architectural decisions, task transitions, file histories - is silently discarded. Existing mitigations treat history as flat text, destroying the relational structure that makes sessions resumable. We present TokenMizer, an open-source proxy system that models LLM session history as a typed knowledge graph. The schema defines 14 node types and 7 edge types. A hybrid extraction pipeline populates the graph incrementally, while a three-tier checkpoint system serializes it into compact resume blocks. An 8-layer compression pipeline reduces context overhead, and a semantic cache reduces repeated-query latency. Evaluated on a controlled benchmark of 21 sessions spanning 5 domains, TokenMizer demonstrates significant token economy. It produces resume blocks averaging 78 tokens (range: 42-124) - 2x smaller than evaluated baselines (159-170 tokens) - while achieving higher decision recall (+9-17 percentage points). Crucially, baselines only preserve that a technology was mentioned; TokenMizer preserves the rationale. Across all sessions, TokenMizer achieves mean task recall 51.0%, decision recall 46.6%, and file recall 58.7%. Variance reflects domain heterogeneity: explicit imperative phrasing (software engineering) scores higher than implicit reasoning (research). Ablation studies show fuzzy label matching is the dominant improvement factor (+33 pp task recall). The heuristic compression achieves 47.3% token reduction with zero external dependencies. TokenMizer provides a queryable alternative to text-retention baselines at half the token cost.