Evaluating PD Asymmetric Inference Architectures in Next-Generation Large Models

    This article examines how to assess updates to large-model inference architectures, focusing on the asymmetry between Prefill and Decode. It explains the different workload characteristics of the two phases, the computation that can already be skipped in a standard decoder-only Transformer during Prefill, and how cross-layer shared KV caches can amplify this asymmetry. It also outlines trade-offs in speed, memory, and quality and provides a framework for evaluating a model update.

    1. What Model Version Numbers Can Tell Us

    Model version numbers are often treated as a signal of a technical leap. However, a minor version update may only reflect changes to training data or post-training, while a major version may only adjust interfaces. To judge whether an update is substantive, first check whether the architecture changes the computation graph, and then examine measured results for inference efficiency and business quality.

    2. The Division of Labor Between Prefill and Decode

    Large language model text generation consists of two stages.

    The Prefill stage processes the entire user prompt. All prompt tokens can be fed into the network in parallel. Each layer computes attention and writes keys (Key) and values (Value) into the KV cache. At the end of this stage, the model must also produce the probability distribution for the first output token.

    The Decode stage generates tokens one by one. For each generated token, it reads the existing KV cache, completes one forward pass, and appends the new token’s K and V to the cache. The per-step computation in this stage is small, but the cache must be read repeatedly, so it is usually limited by memory bandwidth.

    The two stages have different computation characteristics and therefore different optimization approaches. Prefill is closer to a compute-intensive workload, while Decode is closer to a memory-access-intensive workload.

    3. Asymmetry That Already Exists in a Standard Transformer

    Many readers assume that the computation volume in the two stages is exactly the same. In fact, a standard decoder-only model already has computation in the Prefill stage that can be omitted.

    Prefill has two goals: first, generate the KV cache for all prompt tokens; second, predict the first output token. The second goal depends only on the output at the last position. For other positions, the feed-forward network (MLP) output of the last layer will not be used by subsequent layers, and the language model head (LM Head) only needs the result at the last position. Therefore, the last-layer MLP and LM Head computation at those positions can be skipped.

    The following pseudocode illustrates this logic:

    1. def prefill(tokens, model, kv_cache):
    2. h = model.embed(tokens) # [N, d]
    3. last = len(model.layers) - 1
    4. for i, layer in enumerate(model.layers):
    5. h = layer.attention(h, kv_cache[i]) # All positions must write to this layer's KV
    6. if i < last:
    7. h = layer.mlp(h) # Intermediate layers: all positions are needed
    8. else:
    9. h = layer.mlp(h[-1:]) # Last layer: keep only the last position
    10. return model.lm_head(h) # Compute logits only for the last position

    This saving is usually limited in practice. Most inference frameworks already compute the LM Head only for the last position, and omitting the last-layer MLP accounts for only a small part of total computation. Therefore, this asymmetry does exist, but its impact on total latency needs to be confirmed with measured data.

    4. How Cross-Layer Shared Caches Amplify the Asymmetry

    If multiple layers in a model reuse the same KV cache, the structure changes. Imagine that only the first k layers each generate a cache, and subsequent layers directly read these shared caches. In this case, Prefill only needs to compute up to the layer that produces the final shared cache, and computation for prompt tokens in later layers can be omitted. The Decode stage still needs to run the full network token by token, so the computation gap between the two stages becomes larger.

    The benefit of this design can be roughly estimated: the Prefill saving ratio is approximately equal to the proportion of skipped layers in the total number of layers, multiplied by Prefill’s share of total latency. In long-prompt scenarios, Prefill accounts for a higher share, so the benefit is more obvious.

    However, this type of design also has costs.

    • Shared caches mean that representations from different layers are compressed into the same key-value space, which may affect the model’s representational capacity.
    • The structure is determined during training and cannot be directly applied to existing models.
    • Cache sharing changes the memory layout and scheduling logic, so the inference engine needs dedicated adaptation.

    Therefore, when evaluating this type of design, speed, memory, and quality must all be considered.

    5. A Framework for Evaluating a Model Update

    An update can be broken down along the following five dimensions.