Reducing Long-Context Inference Costs in Flash-Class MoE Models: Half the Prefill Compute, Smaller KV Caches, and Decoupled Knowledge
A new Flash-class MoE architecture targets the main costs of long-context inference through asymmetric prefill computation, cross-layer KV cache reuse, FP4 storage, and decoupled knowledge memory. This article explains how CED, CSA2, and Engram work together, examines the reported reductions in compute and cache size, and outlines their implications for deploying long-running AI agents.
1. Why Long-Context Inference Is Becoming a Cost Bottleneck
As AI agents become more capable, the amount of context they must process is growing rapidly. A complex software engineering task may involve hundreds of tool calls, hundreds of thousands of tokens of terminal output, and an entire code repository. Deep research tasks, GUI-based agents, and enterprise workflows also require models to retain and use interaction histories spanning extended periods.
These workloads place two major cost pressures on traditional decoder-only Transformers.
The first is prefill computation. For a model with L layers and a prompt containing N tokens, each layer normally processes the entire prompt. The layer-wise processing workload scales approximately as O(NL). At hundreds of thousands or even millions of tokens, prefill can dominate request latency and compute consumption. Although this phase primarily encodes facts already supplied by the user, it can consume as much compute as generation—or more.
The second is KV cache storage and movement. Traditional models typically maintain separate key-value caches for each layer. As context grows, these caches occupy increasing amounts of GPU high-bandwidth memory (HBM). Multi-turn conversations can also incur host-memory overhead, SSD persistence costs, and cross-node network transfers, raising the cost of long-context and agent inference.
A recently released Flash-class mixture-of-experts (MoE) model addresses these pressures at the architecture level. With 552B backbone parameters and support for up to 1M tokens of context, its design targets four dimensions of cost:
- The storage required for each KV entry.
- The number of historical positions that actually participate in attention.
- Duplicate KV storage across Transformer layers.
- The number of network layers that must be fully executed during prefill.
2. CED: Asymmetric Computation Nearly Halves Prefill Work
One of the architecture’s central changes is its Causal Encoder-Decoder (CED) mechanism. The underlying observation is that prefill and decoding have different computational requirements.
During decoding, each generated token uses the full network depth and all active parameters. This complete forward path provides the computation used to produce the next token. During prefill, however, most prompt tokens serve as contextual facts to be encoded and do not require the same depth of processing.
CED uses this asymmetry: most prompt tokens pass primarily through the first half of the network during prefill. Active parameters per token fall from 16B during decoding to 8B during prefill, bringing prefill computation close to half its previous level.
The reported reduction concerns active parameter count, rather than an arbitrary layer-skipping or truncation strategy. The architecture is designed to keep the effect on context encoding within acceptable bounds.
The following pseudocode illustrates the routing concept, rather than the actual implementation:
# Illustrative logic, not the actual implementationdef forward(token, phase):if phase == DECODE:return full_network(token) # Full network, 16B active parameterselif phase == PREFILL:if is_key_token(token):return full_network(token) # A small number of key tokens take the full pathelse:return front_half(token) # Most prompt tokens use only the front half
For engineering teams, this approach substantially reduces prefill work on agent requests containing hundreds of thousands of tokens. It can lower both time to first token (TTFT) and compute costs, making it particularly relevant to workflows that call tools frequently and repeatedly rebuild large contexts.
3. CSA2 and FP4: Reducing the Global KV Cache to About One-Quarter
The second set of changes targets the KV cache itself. According to the official architecture report, global KV cache storage falls from 3,514 bytes per token to 890 bytes per token—approximately one-quarter of the original size.
Two mechanisms contribute to this reduction.
Cross-Layer Reuse with CSA2
In a conventional architecture, each layer stores its own Main KV and indexer KV. Yet attention patterns in neighboring layers can overlap substantially.
CSA2 reuses Main KV, Indexer K, and Top-K selection results across layers. This reduces both duplicate cache storage and repeated indexing computation.
The reuse therefore extends beyond the cached keys and values: layers also share the results identifying which historical positions deserve attention. Savings come from both memory usage and computation.
FP4 Storage for the Main KV Cache
On top of cross-layer reuse, the Main KV cache is stored in FP4 precision, further reducing its per-token footprint.
The engineering trade-off is tied to sparse selection. A Top-K mechanism has already narrowed the historical positions that participate in attention, so the global KV cache largely acts as a candidate pool. Storing that pool at very low precision while using higher precision to compute attention over the selected positions enables substantial compression while keeping accuracy loss controlled.
The official report places the GPU-resident global KV cache at approximately 890 bytes per token. For deployment teams, this means the same memory capacity can support several times as much aggregate cached context across concurrent sessions. It can also reduce reliance on costly host-memory swapping for long, multi-turn conversations, lowering inference-serving costs.
4. Engram: Decoupling Knowledge Memory from Backbone Computation
The third change addresses another persistent tension in MoE models: the link between knowledge capacity and computational cost.
Traditional MoE models expand knowledge capacity by increasing expert capacity. When those experts are activated, however, they incur computation.
The new architecture introduces Engram to decouple knowledge memory from backbone computation, expanding knowledge capacity with relatively low activation overhead. Conceptually, it resembles an auxiliary memory system: the backbone handles reasoning and language capabilities, while relatively static knowledge is stored and accessed more cheaply, retrieved as needed rather than fully activated.
This direction is consistent with broader work on retrieval augmentation and external memory. Its engineering value is that increasing knowledge capacity no longer needs to drive a proportional increase in computation for every inference request. The model can grow in parameter scale while retaining the low-latency positioning of a Flash-class system.
5. How the Changes Work Together—and What They Mean for Deployment
These architectural changes address distinct but complementary parts of the inference cost structure:
- CED reduces prefill computation, improving latency and compute efficiency for long prompts.
- CSA2 and FP4 compress the KV cache, reducing memory and data-movement costs for long contexts and multi-turn conversations.
- Engram expands knowledge capacity efficiently, helping separate capability growth from inference-cost growth.
Together, they improve the model’s efficiency and capabilities for complex reasoning, software engineering, and long-running agent tasks. The reported KV cache performance curves indicate that performance continues to improve despite the substantial reduction in cache footprint. In this case, architectural efficiency and model capability are not necessarily a zero-sum trade-off.
For developers and enterprises, three practical lessons stand out.
First, inference optimization is moving beyond post-training techniques such as quantization and distillation toward architecture-native design. Model evaluation should therefore include prefill efficiency and KV cache footprint per token, not just generation performance.
Second, in agent and long-context workloads, the largest costs may come from prefill and KV storage rather than decoding. Capacity planning should reflect that workload mix.
Third, established cloud infrastructure—including container platforms, GPU scheduling, and monitoring and alerting—can help translate architectural savings into reliable production cost reductions.
As more vendors adopt asymmetric computation and cache compression, long-context inference has the potential to become more broadly affordable.
