让大模型学会挑重点记忆,省72%内存还能保持高精度。
BudgetMem: Learning Selective Memory Policies for Cost-Efficient Long-Context Processing in Language Models
- 根据实体密度、关键词权重等指标,自动判断哪些内容该记
- 长文档处理时仅损失1%准确率,内存减少72.4%
- 适合资源有限但需处理长文本的场景,如移动端或边缘设备
大语言模型在处理长上下文时面临严重的计算与内存限制,尽管对超长文档推理、多轮对话和书籍级文本的需求不断增长。虽然近期方法将上下文窗口扩展至10万至100万词符,但其部署成本过高。本文提出BudgetMem,一种新型记忆增强架构,通过学习选择性记忆策略而非全量存储。系统结合基于特征的显著性评分(实体密度、TF-IDF、话语标记、位置偏置)与可学习门控机制,决定在严格预算下哪些信息值得保留,并采用BM25稀疏检索实现高效访问。在Llama-3.2-3B-Instruct上,针对短文档(237词符)和长文档(5K-10K词符)共700个问答对进行实验,结果表明:相比基线RAG,BudgetMem在长文档上仅造成1.0%的F1分数下降,同时节省72.4%内存。通过预算敏感性分析(7种预算比例)、朴素基线对比和文档长度分析验证,发现其优势随文档长度增加而提升。本工作为在普通硬件上部署强健的长上下文系统提供了可行路径,推动先进语言理解能力的普及。
原文摘要 · Abstract (English)
Large Language Models (LLMs) face significant computational and memory constraints when processing long contexts, despite growing demand for applications requiring reasoning over extensive documents, multi-session dialogues, and book length texts. While recent advances have extended context windows to 100K-1M tokens, such approaches incur prohibitive costs for resource constrained deployments. We propose BudgetMem, a novel memory augmented architecture that learns what to remember rather than remembering everything. Our system combines selective memory policies with feature based salience scoring (entity density, TF-IDF, discourse markers, position bias) to decide which information merits storage under strict budget constraints. Unlike existing retrieval augmented generation (RAG) systems that store all chunks, BudgetMem employs learned gating mechanisms coupled with BM25 sparse retrieval for efficient information access. Through comprehensive experiments on 700 question answer pairs across short (237 tokens) and long (5K-10K tokens) documents with Llama-3.2-3B-Instruct, we demonstrate that BudgetMem achieves remarkable results on long documents: only 1.0% F1 score degradation while saving 72.4% memory compared to baseline RAG. We validate our approach through budget sensitivity analysis (testing 7 budget ratios), naive baseline comparisons, and document length analysis, showing that BudgetMem's benefits increase with document length. Our work provides a practical pathway for deploying capable long context systems on modest hardware, democratizing access to advanced language understanding capabilities.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。