分词器无关的Engram模块 Tokenizer-Agnostic Engram Module 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-07-31
👁️ 预览文献
💡 AI 中文简介
DeepSeek提出的Engram是一种条件记忆模块,用于在大语言模型中权衡存储与推理。但它依赖词元级N-gram哈希来查找Engram嵌入,导致模型与分词器紧密绑定,换分词器就得从头训练嵌入。本文修改哈希方式,把N-gram视为从所有可能字节序列中采样有用片段,用多项式哈希替代异或哈希,并采用跨N的联合嵌入空间。实验表明性能相当,且实现了分词器无关:字节等价的词元序列得到相同哈希,从而让不同分词器的模型可以复用Engram嵌入。
领域自然语言处理 / 大语言模型架构与嵌入表示
适合谁读需要一定专业背景(了解Transformer、分词器与哈希嵌入的读者)
核心贡献1. 明确定义了Engram模块在哈希组件上的分词器无关性目标;2. 用通用多项式哈希替代异或哈希,并采用跨N的联合嵌入空间,在保持算法效率的同时实现字节等价词元序列的哈希等价,支持跨分词器迁移预训练Engram嵌入。
关键数据实验显示替换哈希后性能与原始XOR哈希相当,无明显下降;实现了字节等价词元序列的哈希等价,并成功用不同分词器在预训练Engram嵌入上训练模型完成跨分词器迁移。
推荐理由如果你关心大模型嵌入复用和分词器灵活性,这篇工作用一次哈希替换就解开了Engram与分词器的死绑,简单又实用,值得一读。
关键词["Engram模块", "分词器无关", "多项式哈希", "N-gram嵌入", "条件记忆", "大语言模型"]

原文摘要

查看英文原文摘要

Deepseek's Engram, a conditional memory module, was introduced to trade-off storage versus reasoning in large language models. However, the module relies on token-level $N$-gram hashing for Engram embedding lookup, introducing a tight coupling to the tokenizer used: a model with a different tokenizer would have to train its own Engram embeddings from scratch. To improve the reusability of Engram embeddings, we propose a change to the hashing routine, enabling compatibility between Engram models using different tokenizers. Instead of modelling disjoint $N$-gram spaces, we treat $N$-gram as a method to sample potentially useful byte sequences, from all possible byte sequences across tokens. We replace the XOR-based hashing with the general polynomial hashing with a joint embedding space across $N$. This work investigates the possible trade-offs and shows that this simple substitution produces comparable performance and achieves tokenizer-agnosticism: hash equivalence for byte-equivalent token sequences.