arXiv(opens in a new tab)cs.CLOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.10533

EngramEdit: Decoupled Knowledge Updates in LLMs through Conditional Memory

Hongru Cai, Ran Wei, Wenjie Wang, Chengfa Wu, Ning Song, Yongqi Li, Wenjie Li

Abstract

Conditional memory architectures such as DeepSeek Engram use input n-grams to look up learned embeddings, expanding the capacity of large language models (LLMs) with limited additional computation. Beyond model scaling, this architecture has demonstrated the potential to decouple factual knowledge storage from general-purpose computation, offering a promising route to updating factual knowledge while keeping the Transformer backbone fixed. Realizing this potential is challenging because different expressions of a fact may activate different n-gram embeddings, while updating shared embeddings can unintentionally change the model's predictions about other facts. We propose EngramEdit for decoupled knowledge updates through conditional memory. EngramEdit first computes target memory representations that make the model predict the updated fact across multiple expressions. It then jointly updates the shared n-gram embeddings to match these targets across expressions and edits, penalizing updates to frequently reused embeddings more strongly to preserve unrelated knowledge. Experiments show that EngramEdit enables independent factual knowledge updates through conditional memory, achieving near-perfect editing success. Revised knowledge is usable across unseen expressions and in multi-hop reasoning, with nearly 3× the strongest baseline's accuracy under chain-of-thought (CoT) prompting. Unrelated knowledge and general capabilities are largely preserved even as factual updates accumulate. These findings show that EngramEdit turns conditional memory into an editable knowledge interface, extending its role beyond model scaling to support decoupled knowledge updates.

GitHub: https://github.com/ModalityDance/EngramEdit

1 Introduction

Sparsity in large language models (LLMs) provides a promising way to scale model capacity without proportionally increasing per-token computation. Mixture-of-Experts (MoE) [1, 2] achieves this through conditional computation, activating only a subset of expert networks for each token. More recently, DeepSeek Engram [3] explores a complementary approach through conditional memory. At each token position, the model uses n-grams of different lengths ending at that position to look up their learned embeddings. These embeddings provide input-dependent memory representations for the Transformer backbone computation (see Figure 1(a)). This design is increasingly used to expand the capacity of LLMs such as DeepSeek-V4.1-Flash [4] and Qwen3.8-Flash-Next [5].

†^{\dagger}Corresponding author.

(a) Conditional Memory in LLMs

Figure

(b) Disabling Memory in Engram

(c) Overview of EngramEdit

Figure 1: Conditional memory and knowledge updating with EngramEdit. (a) Input n-grams look up learned embeddings for backbone computation. (b) Disabling memory in DeepSeek Engram causes larger relative performance drops on factual-knowledge benchmarks [3]. (c) EngramEdit computes target memory representations and jointly updates the corresponding n-gram embeddings, with stronger penalties on frequently reused embeddings.

Beyond model scaling, conditional memory offers a promising architectural basis for decoupling factual knowledge storage from general-purpose computation in LLMs. In DeepSeek Engram, n-gram embeddings store reusable local representations, while the Transformer backbone dynamically integrates and processes these representations in context [3]. Ablation experiments on Engram further show that disabling conditional memory severely degrades factual knowledge performance while largely preserving the ability to understand and reason about information provided in context (see Figure 1(b)).

This division of roles suggests a promising possibility: independently update factual knowledge in conditional memory without modifying the general-purpose backbone. Such updates would turn conditional memory into an editable knowledge interface, allowing LLMs to revise outdated facts while largely preserving general capabilities. Prior work mainly studies model scaling [3, 6], personalization [7], and domain adaptation [8], leaving this potential for decoupled knowledge updates largely unexplored.

However, updating factual knowledge through conditional memory is non-trivial because memory lookup is determined by n-grams rather than facts. 1) Efficacy. Different facts being edited may require conflicting changes to a shared n-gram embedding, so an update that makes one edit succeed may cause another to fail. 2) Generalization. Rephrasing the same fact may activate different n-grams whose embeddings were not updated, causing the edit to fail on the new expression. 3) Specificity. Embeddings associated with shorter or more frequently used n-grams are also activated by many unrelated inputs, so updating them may change unrelated factual predictions.

To enable decoupled knowledge updates through conditional memory, we propose EngramEdit. The key idea is to first compute memory representations that make the LLM predict the updated facts, and then jointly translate these target representations into updates to the underlying shared n-gram embeddings. As shown in Figure 1(c), we first generate multiple expressions of each fact to broaden n-gram coverage. For each edit, a shared learnable perturbation is temporarily added to the memory representations of its expressions. Optimizing only this perturbation by backpropagating the prediction loss for the new fact produces a target memory representation for each expression (see Sec. 3.1). We then map each target to the n-gram embeddings used by its expression, identifying embeddings shared across expressions and edits (see Sec. 3.2). The embedding updates are solved jointly to match these targets, with each shared embedding receiving one update that accounts for all expressions and edits using it. To preserve unrelated knowledge, we include stronger penalties on large updates to frequently reused embeddings in this joint optimization (see Sec. 3.3).

Our experiments show that EngramEdit enables effective and generalizable factual knowledge updates through conditional memory while largely preserving unrelated knowledge and general capabilities. 1) Factual knowledge can be effectively updated. By updating only conditional memory, EngramEdit achieves near-perfect editing success on both CounterFact [9] and ZsRE [10]. 2) Updated knowledge remains usable. EngramEdit achieves strong generalization to unseen expressions, and the revised facts support multi-hop reasoning. On MQuAKE [11], it achieves nearly 3×3\times the strongest baseline's multi-hop accuracy under chain-of-thought (CoT) prompting. 3) Unrelated knowledge and general capabilities are largely preserved. Overall performance on unrelated factual queries and general-ability tasks remains largely unchanged during extended sequential editing. Together, these findings show that EngramEdit turns conditional memory into an editable knowledge interface for decoupled knowledge updates. This extends its role beyond model scaling and opens a promising path toward LLMs that continually update their knowledge while largely preserving their general capabilities.

References (64)