Sparse Modeling Beyond MoE: Co-Designing Conditional Memory and Computation for LLMs
This article explores a new dimension of model sparsification: conditional memory, which complements Mixture-of-Experts (MoE) by decoupling static knowledge storage from dynamic computation. It introduces a lookup-based memory module with O(1) access, a U-shaped scaling rule for distributing capacity between memory and computation, and experimental evidence showing that adding a memory axis improves not only knowledge tasks but also reasoning and code performance under equal parameters and FLOPs. The piece also discusses engineering implications for architecture design, training strategy, and inference cost structure.
A New Dimension of Sparsification for Large Models: Co-Designing Conditional Memory and Computation
1. Why Sparsification Needs a “Second Leg”
Current scaling of large language models primarily relies on Mixture-of-Experts (MoE) architectures. The core idea behind MoE is conditional computation: for each token, only a subset of expert networks is activated during the forward pass, allowing a large total parameter count while keeping inference costs manageable. This paradigm has proven effective and has become a de facto standard for large-scale model training.
However, conditional computation only addresses “allocating compute on demand” – it does not solve “retrieving knowledge on demand.” Existing Transformer architectures lack a native knowledge lookup primitive. To recall a specific fact, the model must simulate a retrieval operation through a combination of multi-layer attention and feedforward networks. This approach – using computation to emulate lookup – has two major drawbacks. First, shallow layers are forced to reconstruct a large amount of static knowledge, consuming effective depth that should be reserved for complex reasoning. Second, attention capacity is drained by local dependencies, weakening long-context modeling. In other words, inefficient memory overhead indirectly suppresses the model’s reasoning potential.
To address this structural deficiency, the industry has begun exploring a sparsification path complementary to conditional computation: conditional memory. The basic idea is to separate static knowledge from the computation process and offload it to an independent, scalable lookup module. The model can then retrieve knowledge with constant overhead when needed, leaving precious compute resources for actual reasoning tasks.
2. Design Principles of Conditional Memory and Lookup Modules
The core vehicle of conditional memory is a scalable lookup module (referred to as an “Engram”). It is not a simple reuse of classic N-gram embeddings, but rather a modernized adaptation that fits the engineering constraints of large-scale neural network training. Its key design points can be summarized in three aspects:
First, O(1) time complexity for knowledge lookup. The module uses index structures such as hashing or bucketing to map input patterns to corresponding entries in a memory table. Lookup cost is essentially decoupled from table size. This makes “scaling memory” feasible, since expanding memory capacity does not linearly increase per-token compute.
Second, a sparse dimension orthogonal to conditional computation. MoE sparsity means “only compute a subset of experts per token.” Conditional memory sparsity means “only look up a subset of entries per token.” The two mechanisms are different and non-conflicting; they can be combined to form a dual-axis structure of “compute sparsity + memory sparsity.”
Third, learnable memory write and update mechanisms. The memory table is not a static corpus, but is jointly optimized during training so that the distribution of entries gradually aligns with the knowledge patterns the model actually needs to retrieve. This makes conditional memory a part of the model parameters, not an external retrieval system.
From a system perspective, this design decouples “where knowledge is stored” from “how knowledge is used.” The memory module handles high-capacity, low-cost static recall; the computation module handles dynamic composition and reasoning. The division of labor avoids forcing the same set of parameters to act as both a database and a reasoning engine.
3. Sparse Allocation: A U-Shaped Scaling Law
After introducing a second sparsity axis, a natural engineering question arises: given a fixed total parameter count or compute budget, how should capacity be split between computation and memory? Too much memory reduces computational capacity, harming reasoning tasks; too little memory leaves static knowledge to be simulated by computation, yielding limited benefits.
The research team formalized this as a sparse allocation problem and, through experiments, observed a U-shaped scaling pattern: as the memory capacity ratio increases from low to high, overall model performance first rises and then falls, with an optimal intermediate region that balances neural computation and static memory. This pattern transforms “guessing the ratio” into “making trade-offs based on a rule.” Architects can use the U-shaped curve to locate the appropriate allocation point for their target task distribution, rather than blindly stacking one dimension.
Guided by this rule, the conditional memory module was scaled to 27 billion parameters. Under strictly equal parameter counts and equal FLOPs, it outperformed a pure MoE baseline by a significant margin. This comparison setting is critical: it rules out the “more parameters means stronger” confound, proving that the gain comes from architectural reallocation of sparsity, not sheer scale.
4. Experimental Observations: Unexpected Gains from the Memory Module
The most notable aspect of the experimental results is the distribution of gains. The design intent of the memory module was to improve knowledge retrieval, and it does – MMLU improved by about 3.4 points, CMMLU by about 4.0 points. But even larger gains appeared on general reasoning, code, and math tasks: BBH improved by about 5.0 points, ARC-Challenge by about 3.7 points, HumanEval by about 3.0 points, and MATH by about 2.4 points.
The phenomenon that “memory augmentation boosts reasoning even more” aligns with the mechanism hypothesis discussed earlier. Further analysis offers two explanations:
- Effective depth is released. Once the burden of reconstructing static knowledge is removed from shallow layers, deep layers can focus more on multi-step reasoning and compositional generalization – effectively increasing the depth available for complex reasoning.
- Attention capacity is returned. After local dependencies are handled by the lookup mechanism, the attention mechanism can concentrate its capacity on global context modeling, significantly improving long-context retrieval.
Together, these points show that the benefit of conditional memory is not an isolated knowledge bonus. It indirectly amplifies the model’s reasoning potential by improving the allocation of computational resources. For engineering practice, this means that when evaluating a memory module, one should not look only at knowledge-oriented benchmarks; reasoning and long-context metrics are equally important.
5. Engineering Perspective: How to Understand This Architecture Evolution
From an architectural evolution standpoint, conditional memory fills a crucial gap in the sparsification toolkit. Previously, discussions of sparsification were almost synonymous with MoE routing strategies and expert granularity. The dual-axis sparsity framework suggests that model capacity expansion has at least two independently adjustable knobs: “compute expansion” and “memory expansion.”
For developers, this direction offers several practical implications:
First, architecture selection gains a new evaluation dimension. When planning model size, in addition to the number of experts and activated parameters, memory table capacity and its ratio to compute capacity should also be design variables. Although the U-shaped rule cannot be directly copied, its methodology – using small-scale ablation experiments to locate the optimal allocation interval – has general reference value.
Second, inference cost structure may change. The constant-time lookup characteristic makes memory expansion relatively controllable in terms of latency impact. For knowledge-intensive scenarios, this offers a different scaling path than simply increasing dense parameters.
Third, training strategies need coordinated adjustments. Joint optimization of the memory table and the computation network involves handling sparse gradients, cold-start entries, and hot-entry imbalance. These require targeted design in data mixing and optimizer settings. A schematic module interface can be abstracted as follows:
class ConditionalMemory(nn.Module):def __init__(self, num_entries, entry_dim):super().__init__()self.table = nn.Embedding(num_entries, entry_dim)self.index_fn = build_index(num_entries) # hashing/bucketing indexdef forward(self, token_pattern):idx = self.index_fn(token_pattern) # O(1) lookupreturn self.table(idx) # return memory vector
It should be emphasized that the above code is only a structural illustration. Real implementation must handle index collisions, capacity eviction, distributed sharding, and other engineering details.
6. Summary and Outlook
The introduction of conditional memory is, in essence, a re-answer to the fundamental question: “Where should a model spend its budget?” Instead of letting the computation network inefficiently emulate retrieval, it is better to open an independent sparse channel for memory. The dual-axis sparsity, the U-shaped allocation rule, and the equal-parameter/equal-FLOPs comparison form a relatively complete chain of technical argumentation.
Of course, this direction is still in its early stages. The interaction between memory and computation, training stability at extreme scales, and combination with other sparsification techniques all require further public research and validation. But one thing is certain: discussions of sparsification have advanced from “should we use MoE?” to “how should sparsity be allocated across different functional modules?” – a sign that architecture design is becoming more refined. For developers tracking the underlying architecture of large models, following this trajectory offers more long-term value than chasing single-point metrics.
