Memory Grafting: 通过离线条件记忆实现语言模型预训练的扩展
Memory Grafting: Scaling Language Model Pre-training via Offline Conditional Memory
AI总结:
本文提出Memory Grafting方法,通过利用冻结的隐藏状态作为条件n-gram记忆,实现语言模型预训练的扩展,通过离线处理和高效检索机制提升模型容量,实验表明其在不同规模下均优于MoE和Vanilla Engram基线。
摘要:
扩大条件记忆为提高语言模型容量提供了一种有前途的方法,但现有方法如Engram在预训练过程中从头学习大型记忆表,使记忆扩展成本高昂且有时效果不佳。我们提出Memory Grafting,一种利用冻结的隐藏状态作为条件n-gram记忆的条件记忆扩展方法。鉴于频繁的局部n-gram,我们离线运行grafting模型,将最终token的隐藏表示存储为记忆值,并让接收模型通过精确的最长匹配后缀查找来检索它们。检索到的记忆通过轻量级投影和门控进行适应,同时基于哈希的Engram回退机制保留了未匹配上下文的覆盖范围。由于grafting模型仅在离线运行,且精确查找的复杂度相对于内存库大小具有预期O(1)的复杂度,Memory Grafting在有限的训练和推理开销下扩展了外部潜在容量。在匹配的接收架构和预训练预算下进行的实验表明,Memory Grafting在MoE和Vanilla Engram基线之上有所改进。在2.8B规模下,其平均基准分数从MoE的51.95和Vanilla Engram的52.43提升到53.86。在0.92B规模下,所有grafting模型变体均优于基线,其中Qwen3.5-35B-A3B表现最佳。这些结果表明,预训练模型可以作为外部潜在记忆的可重用构造器,为未来语言模型超越仅可训练参数的扩展提供了实用步骤。
英文摘要:
Scaling conditional memory offers a promising way to increase language-model capacity, but existing methods such as Engram learn large memory tables from scratch during pre-training, making memory scaling expensive and sometimes ineffective. We propose Memory Grafting, a conditional memory scaling method that utilizes frozen hidden states from a grafting model as conditional n-gram memory. Given frequent local n-grams, we run the grafting model offline, store final-token hidden representations as memory values, and let the recipient model retrieve them through exact longest-match suffix lookup. Retrieved memories are adapted by lightweight projections and gates, while a hash-based Engram fallback preserves coverage for unmatched contexts. Since the grafting model is only run offline and exact lookup has expected O(1) complexity with respect to memory-bank size, Memory Grafting expands external latent capacity with limited training and inference overhead. Experiments under matched recipient architectures and pre-training budgets show that Memory Grafting improves over both MoE and vanilla Engram baselines. In the 2.8B-scale setting, it improves the average benchmark score from 51.95 for MoE and 52.43 for vanilla Engram to 53.86. In the 0.92B-scale setting, all grafting-model variants improve over the baselines, with Qwen3.5-35B-A3B giving the strongest gains. These results suggest that pretrained models can serve as reusable constructors of external latent memory, providing a practical step toward scaling future language models beyond trainable parameters alone.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。