Understanding Asymmetric Activation in LLM Inference: Prefill vs. Decode

    This article explains why prefill and decode are fundamentally different workloads in autoregressive LLM inference, and why asymmetric activation is an inherent model property rather than a new architectural invention. It shows how skipping the final-layer MLP and LM Head projection for non-final positions during prefill offers little gain in traditional designs, and how redesigning cache sharing and stage responsibilities can turn this asymmetry into measurable latency improvements. You will also learn how to compare total, input-active, and output-active parameter counts, and how to verify real speedups using TTFT, TPOT, throughput, and peak memory measurements.

    1. The Starting Point: Prefill and Decode Are Not the Same Workload

    In discussions of LLM inference serving, the “prefill-decode asymmetry” is often presented as a selling point of some new architecture. But if you go back to the computation graph itself, this asymmetry is not an invention of any new architecture; it is an inherent property of autoregressive generation models. Understanding this is the prerequisite for judging whether any “architectural innovation” claim holds up.

    Generating text with an autoregressive model is typically split into two phases:

    • Prefill: Process all T input tokens in parallel at once, build the key-value cache (KV Cache), and produce the first output token.
    • Decode: Take the cache as input, process only 1 new token per step, and loop T_out times.

    The two phases have completely different workload characteristics:

    Dimension Prefill Decode
    Tokens processed per step T (parallelizable) 1
    Compute bottleneck Compute-bound Memory-bound
    Main cost Total multiply-accumulate operations in matrix multiplications Bandwidth for moving weights and cache
    Parallelism High, high hardware utilization Low, limited hardware utilization

    Precisely because the cost structures differ, the upside of any optimization that only operates at the “phase split” level is capped by the theoretical lower bound of each phase. The real headroom lies in a frequently overlooked fact inside prefill.

    2. The Overlooked Fact: Not Both Prefill Goals Need the LM Head

    The prefill phase actually performs two tasks at the same time:

    1. Compute the cache: Generate K/V for every layer so later decoding can reuse them;
    2. Predict the first token: Only this step needs to go through the final output projection.

    The key observation is that the MLP and the output vocabulary projection (LM Head) contribute nothing to the cache. In other words, except for the last position, the final-layer MLP and vocabulary projection for the other T-1 positions are skippable with respect to the goal of “building the cache.”

    The following illustrative pseudocode expresses this “position pruning”:

    1. # Standard implementation: every position goes through the full network
    2. for layer in layers[:-1]:
    3. hidden = layer(hidden) # includes attention and MLP, writes cache
    4. hidden = layers[-1](hidden) # last layer
    5. logits = lm_head(hidden) # vocabulary projection, V is very large
    6. first_token = argmax(logits[-1]) # only the last position is used
    1. # After pruning: intermediate positions stop after the penultimate layer
    2. for layer in layers[:-1]:
    3. hidden = layer(hidden)
    4. penultimate = hidden
    5. last = layers[-1](penultimate) # only meaningful for the last position
    6. logits = lm_head(last[-1:]) # project 1 position only
    7. first_token = argmax(logits)

    The cost of the vocabulary projection is often underestimated: its multiply-accumulate count is roughly T × d × V. When the vocabulary size reaches the order of one hundred thousand and the hidden dimension is in the thousands, this term takes a considerable share of total prefill cost. After pruning, this cost drops from T × d × V to 1 × d × V.

    But it must be stated honestly: under traditional architectures, the absolute gain from this optimization is very small. The reason is that cache computation spans all layers, and the last-layer MLP plus vocabulary projection account for only a single-digit percentage of total compute. The time saved is often swallowed by fixed overheads such as kernel launches and memory allocation. This is a typical case of “theoretically valid, but imperceptible in engineering.”

    3. The Key to Amplifying the Gain: End Prefill’s Main Compute Early

    Where asymmetric activation is truly valuable is not that it “discovered the asymmetry,” but that it changes the magnitude of the asymmetry. The idea can be abstracted into one design principle:

    End the main computation of the prefill phase where “the cache is fully ready,” and compress output-related computation onto a tiny set of positions.

    One implementation path discussed fairly often in the industry is an encoder-decoder-style causal structure (understandable as a Causal Encoder-Decoder class of approach): the encoder side is responsible for compressing the input into a set of reusable representations and writing them to the cache, while the decoder side only handles “predicting the next token from the cache.” Because the decoder does not need to recompute representations for all input positions, the heavy work of prefill is concentrated in the first half, leaving only a very lightweight projection at the end.

    The boundary must be emphasized here: different approaches vary greatly in cache-sharing granularity, layer allocation, and attention mask shape, and there is no unified “standard implementation.” To judge whether an approach really delivers a gain, engineering practice can only rely on self-testing, not on marketing claims.

    4. The Parameter-Counting Trap: Total, Input-Active, and Output-Active Parameters

    The three sets of numbers most easily confused when discussing this class of architecture are:

    • Total parameters: The model weight size, which determines memory footprint and loading cost;
    • Input-active parameters: The number of parameters each token actually involves in computation when processing input tokens;
    • Output-active parameters: The number of parameters each token actually involves in computation during generation.

    Traditional sparse Mixture-of-Experts (MoE) usually keeps input and output symmetric, meaning both phases activate the same scale of parameters; asymmetric approaches allow the two to differ, such as activating 8B on the input side and 16B on the output side. This design has its rationale: prefill throughput determines first-token latency, while decode quality determines generation quality. The two have different demands, and forcing symmetry means making one side accommodate the other.

    Three disciplines should be upheld when evaluating:

    1. Do not infer speed from total parameters, and do not infer quality from active parameters;
    2. Require the measurement conditions to be stated (input length, output length, concurrency, precision, hardware);
    3. Focus on end-to-end metrics, not single-operator timings.

    5. Engineering Practice: How to Verify Whether “Asymmetric” Is Really Faster

    A set of controlled experiments is recommended instead of subjective judgment:

    1. Fixed: hardware model, precision, concurrency, input length distribution
    2. Variable: architecture approach (symmetric / asymmetric)
    3. Metrics:
    4. TTFT = time to first token (mainly affected by prefill)
    5. TPOT = time per output token (mainly affected by decode)
    6. Throughput = tokens/s, measured separately for input and output
    7. Peak memory = weights + cache + activations

    A practical rule of thumb: if the new approach significantly reduces TTFT while TPOT stays roughly flat, the gain indeed comes from pruning on the prefill side; if both drop by the same proportion, it more likely comes from overall engineering optimization (operator fusion, quantization, scheduling) and is unrelated to “asymmetry.”

    Reproducing this kind of experiment in the cloud usually requires only a combination of general-purpose capabilities: a container platform to host the inference service, object storage for models and datasets, a message queue for request peak shaving, and logging plus monitoring and alerting to collect tail latency. Baidu AI Cloud also provides these general capability categories in such scenarios; for specific parameters and pricing, refer to the official documentation.

    6. The Costs You Should Not Ignore

    Asymmetric design is not free:

    • Higher implementation complexity: Cache layout, mask construction, and incremental decoding paths all need to be rewritten, significantly increasing debugging cost;
    • Framework adaptation cost: Existing inference engines’ operator and scheduling assumptions are mostly built on the symmetric path;
    • Gains depend on the scenario: When inputs are extremely short, prefill accounts for a low share and the pruning gain is diluted; with long inputs, RAG, and long-document scenarios, the gain is more pronounced;
    • Quality needs regression validation: Any change that alters the information flow must be confirmed with a unified evaluation set to ensure quality has not degraded.

    7. Conclusion

    The asymmetry between prefill and decode is a property that comes with the model structure, not a patent of some version upgrade. Under traditional architectures, the gain from “skipping end-stage computation” is negligible; only when cache sharing and stage responsibilities are re-partitioned, and prefill’s main compute is compressed to where the cache is ready, does this property turn into observable latency gains. The advice for developers is straightforward: check whether the active-parameter definition is clear, check whether end-to-end tail latency is reproducible, and check whether long-input scenarios truly improve—judge the value of an architectural change with data, not with version numbers.