DeepSeek-V4.1-Flash 中的 Engram

Engram 是一个条件记忆(conditional memory)模块,用于把"记忆"与"计算"解耦。 其思想来自 DeepSeek 的既有工作 Conditional Memory via Scalable Lookup[1], 把记忆视为大语言模型的一种新的稀疏性维度。

配置

配置项 取值
参数总量 196B(均分给两个模块)
N-gram 阶数 {2, 3, 4}
hash head 数 8
每阶嵌入维度 2048
每 head 表大小 约 16M 条目(表大小取不同素数)
精度 嵌入表与 KV 投影均 FP8
放置位置 第 1、14 层(0 索引)

两个模块放在第 1、14 层是为了平衡各训练流水线阶段的内存占用

相比原始 Engram 的改动

  1. 去掉短因果卷积:其性能收益不足以抵消在推理栈中增加的复杂度。
  2. 优化嵌入更新:改用 momentum-based update + Sinkhorn 平衡

设计要点

  • 沿用原始 Engram 的四个组成部分:tokenizer 压缩、multi-head hashing、 context-aware gating、multi-branch integration。
  • 确定性寻址:Engram lookup 索引只依赖输入 token 序列, 因此推理时可从主机内存通过后台 RDMA 预取嵌入, 第一个模块的预取可与第一个 Transformer block 的计算重叠。

参考文献

[1] CHENG X, TIAN R, ZENG W, et al. Conditional memory via scalable lookup: a new axis of sparsity for large language models[J/OL]. arXiv preprint arXiv:2601.07372, 2026. https://arxiv.org/abs/2601.07372.


© 2026 Yang Huan · yanghuan9812@qq.com

results matching ""

    No results matching ""