Sequence modeling layers in modern language models typically face a trade-off between storage capacity and computational efficiency. While Softmax attention offers unbounded storage at prohibitive quadratic costs, linear variants provide efficiency but suffer from limited, fixed-size storage. We propose Fast-weight Product Key Memory (FwPKM), a novel architecture that resolves this tension by transforming the sparse Product Key Memory (PKM) from a static module into a dynamic, "fast-weight" episodic memory. Unlike PKM, FwPKM updates its parameters dynamically at both training and inference time via local chunk-level gradient descent, allowing the model to rapidly memorize and retrieve new key-value pairs from input sequences. Experiments reveal that FwPKM functions as an effective episodic memory that complements the semantic memory of standard modules, yielding significant perplexity reductions on long-context datasets. Notably, in Needle in a Haystack evaluations, FwPKM generalizes to 128K-token contexts despite being trained on only 4K-token sequences.


翻译:现代语言模型中的序列建模层通常面临存储容量与计算效率之间的权衡。Softmax注意力机制虽能提供无界存储,却以难以承受的二次计算成本为代价;线性变体虽计算高效,却受限于固定大小的有限存储。我们提出快速权重乘积键值记忆(FwPKM),这是一种新颖的架构,通过将稀疏的乘积键值记忆(PKM)从静态模块转变为动态的“快速权重”情景记忆,从而解决了这一矛盾。与PKM不同,FwPKM在训练和推理阶段均通过局部块级梯度下降动态更新其参数,使模型能够快速记忆并检索输入序列中的新键值对。实验表明,FwPKM作为一种有效的情景记忆,能够补充标准模块的语义记忆,在长上下文数据集上显著降低了困惑度。值得注意的是,在“大海捞针”评估中,尽管仅在4K词元序列上训练,FwPKM能够泛化至128K词元的上下文长度。

0
下载
关闭预览

相关内容

数学上,序列是被排成一列的对象(或事件);这样每个元素不是在其他元素之前,就是在其他元素之后。这里,元素之间的顺序非常重要。
TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
【Google】高效Transformer综述,Efficient Transformers: A Survey
专知会员服务
66+阅读 · 2022年3月17日
专知会员服务
21+阅读 · 2021年8月17日
专知会员服务
16+阅读 · 2021年6月4日
【普林斯顿大学-微软】加权元学习,Weighted Meta-Learning
专知会员服务
40+阅读 · 2020年3月25日
Meta-Learning 元学习:学会快速学习
GAN生成式对抗网络
20+阅读 · 2018年12月8日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关VIP内容
相关基金
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员