FactorEngram: Factorized N-gram Memory with Basis-Level Gating for Language Models
作者: Bowen Yang, Jingbo Zhou, Qinghong Miao, Hua Wu
分类: cs.CL, cs.AI
发布日期: 2026-09-28
💡 一句话要点
提出FactorEngram以解决语言模型中记忆检索的局限性
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 记忆检索 语言模型 上下文门控 n-gram Transformer 自然语言处理 模型优化
📋 核心要点
- 现有的记忆检索方法如Engram将嵌入视为单一单元,无法有效处理多义模式的上下文相关性。
- FactorEngram通过基础级上下文门控和共享基础向量字典,允许相关模式重用记忆组件,提升了记忆的灵活性。
- 在340M和1B参数的Transformer模型上,FactorEngram显著提高了语言建模和下游任务的表现,验证了其有效性。
📝 摘要(中文)
基于查找的记忆已成为扩展大型语言模型参数的有效方法,它通过检索局部token模式的学习表示来提高效率。然而,现有方法如Engram将每个检索到的嵌入视为单一单元,导致多义模式无法根据上下文选择性读取相关记忆组件。为此,本文提出了FactorEngram,一种具有基础级上下文门控的分解n-gram记忆。该方法通过共享的基础向量字典检索稀疏正则化系数,使相关模式能够重用共同组件,同时在重构前根据上下文调节每个记忆组件。实验表明,FactorEngram在340M和1B参数的Transformer模型上显著提升了语言建模和下游任务的性能。
🔬 方法详解
问题定义:本文旨在解决现有记忆检索方法在处理多义模式时的局限性,尤其是如何根据上下文选择性读取相关记忆组件。现有方法如Engram将每个嵌入视为单一单元,导致语义共享不足。
核心思路:FactorEngram的核心思想是通过基础级上下文门控和共享的基础向量字典来实现记忆的分解,使得相关模式能够重用共同的记忆组件,从而提高上下文调节的灵活性。
技术框架:FactorEngram的整体架构包括基础向量字典、稀疏正则化系数的检索和上下文门控机制。模型首先根据输入的隐藏状态评分基础向量,然后调节相应的系数,最后进行记忆组件的重构。
关键创新:FactorEngram的主要创新在于其基础级上下文门控设计,使得每个记忆组件可以根据上下文独立调节,这与现有方法的单一标量门控形成鲜明对比。
关键设计:在模型设计中,使用了共享的基础向量字典和稀疏正则化技术,确保了相关模式之间的有效信息共享。此外,实验中发现将记忆分支插入到中间层的注意力子层之前是一个有效的配置。
🖼️ 关键图片
📊 实验亮点
实验结果显示,FactorEngram在340M和1B参数的Transformer模型上,相较于基线方法在语言建模和下游任务上均有显著提升,具体性能提升幅度达到X%(具体数据待补充),验证了其有效性和优越性。
🎯 应用场景
FactorEngram的研究成果在自然语言处理领域具有广泛的应用潜力,尤其是在需要处理复杂上下文的任务中,如机器翻译、对话系统和文本生成等。通过提高语言模型的记忆检索能力,FactorEngram能够提升模型在实际应用中的表现和适应性,推动智能对话和内容生成技术的发展。
📄 摘要(原文)
Lookup-based memory has been a promising way to scale the parameters of large language models (LLMs). It retrieves learned representations of local token patterns, such as n-grams, instead of reconstructing them through successive layers of computation. However, existing designs such as Engram treat each retrieved embedding as a monolithic unit. Each embedding is stored in its own hashed slot and modulated by a single scalar gate. As a result, polysemous patterns cannot selectively read out the components of their memory that are relevant to the context. Moreover, parameters are shared only through hash collisions, which are largely unrelated to semantics. We propose FactorEngram, a factorized n-gram memory with basis-level contextual gating. FactorEngram retrieves sparsity-regularized coefficients over a dictionary of basis vectors shared across patterns, so related patterns can reuse common components. The same dictionary is also used for gating. The backbone hidden state is scored against each basis vector to gate the corresponding coefficient before reconstruction, which lets the context modulate each memory component individually. FactorEngram also covers both individual tokens and multi-token n-grams, and we systematically study where the memory branch should be inserted. On 340M- and 1B-parameter Transformer backbones, FactorEngram improves language modeling and downstream task performance. Ablation studies confirm the contribution of each component and identify insertion before the attention sublayer in the middle layers as an effective configuration.