Optimizing LLM Inference: PD Separation vs. Asymmetric Activation

    This article examines two key strategies for optimizing large language model (LLM) inference: Prefill-Decode (PD) separation and asymmetric activation. It explains the distinct computational characteristics of the prefill and decode phases, details how asymmetric activation works in Mixture-of-Experts (MoE) models, and compares native versus plug-in multimodal approaches. The discussion covers practical considerations for workload scheduling, KV cache persistence, and provides a technical checklist for model selection and deployment.

    Large language model inference typically consists of two phases. The Prefill phase reads the entire input prompt, generates the KV cache, and outputs the first token. The Decode phase then generates subsequent tokens one by one. The computational characteristics of these two phases differ significantly, so optimizing them separately is a common approach to reducing time-to-first-token (TTFT) and improving throughput. This article explains the significance of asymmetric activation and PD separation from a computational perspective and provides concrete conditions to check during scheduling, caching, and model selection. Architectural names and parameter scales mentioned here should be verified against the official technical reports from model vendors; this article does not independently validate them.

    I. Prefill and Decode Are Computationally Asymmetric

    The Prefill phase handles two tasks. First, it computes the KV cache for every token in the input prompt for use by attention layers during subsequent generation. Second, it predicts the first answer token based on the output of the last input token. Attention layers manage token-to-token dependencies, while the MLP and LM Head handle feature transformation and probability mapping.

    An often-overlooked fact is that the KV cache is determined solely by the input to each layer’s attention mechanism. The outputs of the MLP and LM Head in the final layer for non-terminal tokens neither contribute to subsequent cache computation nor affect the final output. Therefore, if inference only needs to predict the first output token, the MLP and LM Head computations for non-terminal tokens in the last layer can be skipped.

    This conclusion has explicit prerequisites. It applies only to the Prefill phase of autoregressive inference where only the logits at the final position are needed. In training, where prediction loss is computed for every position, these computations cannot be skipped. Additionally, the skipped computation represents a limited fraction of total work, and whether it yields measurable speedup depends on whether the inference framework supports this truncation.

    II. The Core Idea of Asymmetric Activation

    Mixture-of-Experts (MoE) models scale parameter counts by adding expert networks. In conventional implementations, the number of activated experts during the input phase and the output phase is typically the same. This symmetric design simplifies routing, but when processing long prompts, Prefill computational overhead grows rapidly with input length, increasing TTFT.

    Asymmetric activation proposes using different scales of activated parameters for the two phases. The input side uses fewer activated parameters to handle long text, while the output side uses more to maintain generation quality. One architecture mentioned in the original text sets input-side activation to approximately 8B and output-side to approximately 16B. These figures illustrate the design direction but cannot be directly applied to other models. When selecting models, check the activation parameter definitions in the model card and confirm whether the number is computed per token or averaged across the entire model.

    Cache sharing is another performance factor. When multiple requests or multi-turn conversations share a common prefix, the KV cache for that prefix needs to be computed only once. The computational savings are proportional to the ratio of the reusable prefix to the total input. Requests with completely different prefixes cannot share, making gains near zero. Therefore, cache-sharing benefits depend on the proportion of repeated prefixes in your workload—there is no universal multiplier.

    III. Performance Pressure from Native Multimodal Design

    Plug-in multimodal approaches typically use a standalone encoder to convert images or audio into text descriptions or vectors, which are then passed to the language model. This approach reuses existing language models but introduces latency through intermediate steps and risks information loss during conversion.

    Native multimodal models process images, audio, and text directly within the same framework. The advantage is more complete cross-modal information retention; the disadvantage is higher training and inference costs, as well as longer input sequences. A single image may correspond to hundreds of visual tokens. As input length increases, Prefill computation and memory consumption grow accordingly. Increased parameter scale and faster inference can occur simultaneously, but only if the inference path is specifically optimized—this cannot be assumed by default.

    The table below provides a qualitative comparison across several dimensions. Specific values require testing with your own datasets.

    Dimension Plug-in Multimodal Native Multimodal
    Time to first token Intermediate encoding adds latency Depends on Prefill optimization; higher pressure with longer inputs
    Memory usage Encoder and language model deployed separately More input tokens increase KV cache consumption
    Training cost Relatively lower; reuses existing models Requires large-scale multimodal data and compute
    Information retention Conversion may lose detail More complete cross-modal information retention

    IV. How to Split Scheduling Between Prefill and Decode?

    Prefill is compute-intensive, while Decode is more dependent on memory bandwidth and cache reads. The two phases have different requirements across GPU, CPU, and memory resources. Split scheduling can be implemented as follows:

    1. Deploy Prefill and Decode in separate instance pools, scaling each independently based on its own queue length.
    2. Monitor queueing time for each phase rather than only overall QPS.
    3. Set up dedicated queues for long-prompt requests to prevent them from blocking short requests’ first-token response.

    The underlying cloud platform must support scaling based on business metrics—for example, custom metric auto-scaling in container platforms, or load balancing that routes by request path. Specific capabilities depend on the platform in use and should be confirmed in the platform documentation.

    V. KV Cache Persistence: What to Watch For

    Placing KV caches for hot sessions in distributed cache or object storage reduces redundant computation and enables fast context recovery after scaling or failure. However, this type of caching introduces several risks:

    • Data isolation: Caches from different users or tenants must be strictly isolated to prevent requests with identical prefixes from incorrectly reusing another party’s data.
    • Privacy protection: KV caches may contain sensitive information from user inputs; they require encrypted storage and access control.
    • Invalidation policy: When model versions, tokenizers, or system prompts change, old caches must be invalidated; otherwise, they may produce incorrect outputs.
    • Cleanup mechanism: Set expiration times and periodically delete unused caches to control storage costs.

    Cache hit conditions must also be well-defined. A cache can only be reused when the prefix token sequences are exactly identical and the model version is the same.

    VI. Developer’s Model Selection Checklist

    When choosing a model or inference service, verify the following three items:

    1. Prefix reuse rate: Measure the proportion of repeated system prompts and long documents in your workload. Low reuse rates mean limited cache-sharing benefit.
    2. Time-to-first-token target: Test P50 and P95 TTFT with your real request length distribution rather than relying on official single-point figures.
    3. Decode throughput: Measure tokens generated per second at your target concurrency level, and confirm performance under long-output scenarios.

    Additionally, use monitoring and logging services from your cloud provider to record latency and cost per phase, identifying the true bottleneck.

    VII. Summary

    The core of PD separation and asymmetric activation is acknowledging that Prefill and Decode have different computational requirements and allocating resources accordingly. Cache-sharing benefits depend on prefix reuse ratios, and the value of native multimodal design depends on the input patterns of your workloads. Before making a selection, developers should run tests with their own request distributions and make decisions based on cost and latency targets.