Causal Encoding-Decoding and Asymmetric Activation: A New Paradigm for LLM Inference
LLM inference cost is not uniform across prefill and decode. This article explains why symmetric sparse activation is often inefficient for long-read, short-write workloads, how asymmetric activation splits compute budgets by stage, and how causal encoder-decoder designs compress context while generating tokens. It covers a simple cost model, engineering risks, throughput metrics, and how to evaluate such architectures against real traffic rather than a single speed number.
Why inference cost should be split by stage
Large-model inference typically has two phases: prefill and decode. Prefill processes the input context in one pass. Compute is high, parallelism is high, and the bottleneck is usually a mix of FLOPs and memory bandwidth. Decode generates tokens one by one. Per-step compute is smaller, but the phase is more sensitive to memory bandwidth, KV cache reads and writes, and batch scheduling.
Dense models and symmetrically sparse models often use the same activated-parameter scale in both phases. That design is simple, but it is not always economical for long context, long input, and short output. As applications shift from single-turn Q&A to agents, coding assistants, document analysis, and multimodal understanding, the input side often includes large context, tool results, trajectories, and retrieved snippets, while the output may be a short decision, call arguments, or a summary. Prefill then dominates cost. Asymmetric activation and causal encoder-decoder architectures exist to split the “read” and “write” budgets so each stage can use different activation policies and representations, with finer control over quality, throughput, and cost.
From symmetric sparsity to asymmetric activation
Symmetric sparse activation means prefill and decode use the same activated-parameter budget, or at least the same routing and expert-selection logic. Training and inference paths stay aligned, engineering is mature, and performance is predictable. The downside is limited stage-specific optimization.
Asymmetric activation allows different budgets: fewer activated parameters in prefill to cut long-context cost; more in decode to improve per-token quality. Different “input activation parameters” and “output activation parameters” are essentially this staged allocation.
A simplified cost model:
C_prefill ≈ N_prefill × p_prefillC_decode ≈ T_out × p_decodeC_total ≈ C_prefill + C_decode + C_kv
N_prefill is input token count, T_out is output token count, p_prefill and p_decode are per-token compute/memory cost in each phase, and C_kv is KV cache overhead. When N_prefill is much larger than T_out, reducing p_prefill pays off more. When output is long, raising p_decode for quality is more justified.
Asymmetric activation is not free. Training must keep the two paths consistent. Inference must keep routing, batching, and cache coherence aligned. Otherwise you get representation mismatch, quality loss, or fragmented scheduling.
Causal encoder-decoder: compress context, then generate tokens
Causal encoder-decoder splits roles. In prefill, the encoder processes full context and compresses it into a more compact representation. In generation, the decoder mainly runs its own layers and obtains a global KV representation by projecting from the encoder’s last layer. Unlike a pure decoder-only stack, decoder layers do not need to rebuild a full global KV from their own hidden states at every layer, which reduces repeated work and cache pressure on long context.
Illustrative flow:
def inference(context, prompt):# Prefill: encoder compresses context with a lower activation budgetenc_hidden = encoder.prefill(context + prompt, activate="prefill_budget")# Global KV projection from the encoder last-layer representationglobal_kv = project_global_kv(enc_hidden[-1])# Decode: decoder generates tokens with a higher activation budgetstate = decoder.init(global_kv)for step in range(max_new_tokens):logits, state = decoder.step(state, activate="decode_budget")token = sample(logits)state = decoder.update(state, token)
Three engineering points matter more than the sketch:
- Encoder output must keep enough information; compression must not become an information bottleneck.
- The global KV projection must align with decoder layers; training should keep the projected distribution stable.
- The decoder still needs local state and position information. Global KV reduces repeated construction; it does not eliminate caching.
If projection quality is weak, long-context recall, detail retention, and generation stability can degrade. Long-context eval, attention visualization, and ablations are required.
Long-read, short-write: where the design pays off
Agents, RAG, and multimodal document understanding often read far more than they write: tens of thousands of tokens of context, image encodings, and tool history, with structured decisions or short answers as output. Prefill is the main cost. Lowering the prefill activation budget can improve time-to-first-token and overall throughput. Decode has fewer tokens, but each step affects quality, so a higher decode budget can preserve reasoning and generation.
Benefits have limits. If output length approaches or exceeds input length—long-form writing, complex code, long chain-of-thought—decode cost grows quickly and the asymmetry is diluted. If input is short, prefill optimization has little room. Engineering teams should evaluate a load matrix: short-read/short-write, long-read/short-write, long-read/long-write, and mixed multimodal input, measuring TTFT, per-output-token latency, total time, peak memory, and cost per task. Architecture choice should follow the actual load mix.
Where throughput gains come from, and how to measure them
Throughput usually comes from several stacked effects: cheaper prefill activation, more compact global KV, better batching, prefix-cache reuse, and runtime/toolchain co-optimization. Do not report a single “generation speed” number. Separate:
- Time to first token: prefill and queueing, interactive experience
- Per-output-token latency: decode efficiency, streaming feel
- Overall throughput: requests or tokens per unit time, service capacity
- Cache hit rate: prefix and context reuse
- Total tokens and wall time: end-to-end task cost
High cache hit rate means many requests share a stable prefix or system prompt, so prefix cache can skip repeated prefill. Cache design still needs invalidation, version isolation, tenant isolation, and consistency. For multimodal input, cache visual encoding, text encoding, and fusion separately to avoid cross-modal misalignment.
Engineering risk checklist
- Representation alignment. Encoder compression and decoder global KV projection need enough training and calibration, or long-context detail recall drops.
- Routing and batch fragmentation. Different stage budgets need finer dynamic batching so GPU utilization does not swing.
- Cache consistency. Global KV projection cache, prefix cache, and local state cache need unified versioning so updates do not serve stale representations.
- Quantization and precision. Projection, KV cache, and routing are quantization-sensitive; measure loss layer by layer.
- Multimodal fusion. Visual and audio encodings entering context compression must keep modality alignment and spatial/temporal position.
- Observability. Monitor prefill/decode time, activation-parameter distribution, cache hits, peak memory, and long-context recall to catch regressions.
Conclusion: judge new architectures with load and cost models
Do not rank an asymmetric-activation, causal encoder-decoder model by total parameter count or a single speed peak. Return to load distribution and the cost model: how long is input, how long is output, can cache be reused, is quality loss acceptable, does the runtime match. Asymmetric activation splits prefill and decode budgets. Causal encoder-decoder splits context compression and token generation. Together they have a clear theoretical gain on long-read, short-write traffic, with higher engineering complexity around alignment and cache consistency. For production selection, run staged load tests on real traffic and combine TTFT, per-token latency, throughput, cache hits, and task quality—rather than chasing one headline metric.
