Asymmetric Activation and Causal Encoder-Decoder for LLM Inference Optimization

    This article examines why symmetric MoE is costly for long-read, short-write agent workloads and how causal encoder-decoder designs with asymmetric activation, shared KV, sparse indexing, and N-gram lookup can reduce prefill cost and KV footprint. It also outlines multimodal throughput metrics, orchestration-aware training, deployment considerations on elastic cloud infrastructure, and an engineering checklist.

    Asymmetric Activation and Causal Encoder-Decoder for LLM Inference Optimization

    As large models move into large-scale production, users often care less about doubling the total parameter count and more about whether latency, throughput, and cost per token can improve together on the same task. This is especially true in agent workflows, where systems often read long contexts, tool outputs, and multimodal material while generating relatively short new text. If such workloads continue to use a traditional mixture-of-experts (MoE) path in which Prefill and Decode symmetrically activate the same experts and the same global KV, computation is constrained by the long-sequence prefill stage. Recently, both open-source and closed-source routes have been splitting the network into a causal Encoder–Decoder design (often referred to as a CED-style approach), making activation asymmetric, and separating “the part that needs reasoning” from “local patterns that only need memory.” This article provides a neutral review across mechanisms, scenario benefits, engineering deployment, and evaluation methods to help with architecture selection on self-built clusters or elastic compute such as Baidu AI Cloud.

    Why Symmetric MoE Is Expensive in Long-Read, Short-Write Scenarios

    Traditional MoE often activates experts of similar scale on both the Prefill and Decode sides, and the number of activated parameters on the input side and output side is also close. Its advantages are simple implementation and a consistent graph for training and inference. Its disadvantages are that attention over long contexts and expert routing are fully exercised during Prefill, while each Decode step may still maintain a set of global KV bound to its own hidden states. A typical agent profile is: retrieval results, pages, logs, image descriptions, and tool JSON form an extremely long input, while the final instruction often requires only a few paragraphs of conclusions. In this case, Prefill FLOPs account for a much higher share than Decode. Simply increasing total parameters or symmetric activation does not reduce the cost of “reading.”

    A more reasonable optimization objective can therefore be stated as follows: while preserving generation quality, make Prefill activation smaller and representations more compact; let Decode run only the half of the network that generation truly needs; and obtain global KV by projection from the final Encoder layer rather than constructing another set from the Decoder’s own hidden states at every layer.

    Causal Encoder–Decoder: Splitting the Network into “Context Compression” and “Stepwise Generation”

    A CED-style structure is not mysterious. In engineering terms, it can be understood as follows:

    • The lower half (or a separate Encoder stack) mainly works during Prefill, compressing variable-length, multimodal-aligned context into a more compact representation.
    • The upper half serves as the Decoder and is the main part run during Decode. Global KV is projected from the final Encoder layer’s hidden states, so Decoder layers do not each need to maintain a complete global KV construction path.

    This brings two direct benefits. First, context is compressed before entering the generation stage, reducing attention span and KV size. Second, activation can be made asymmetric: Prefill activates a smaller scale (for example, the commonly discussed “lighter read side”), while Decode activates somewhat more per token to ensure generation quality. It is important to emphasize that the exact number of activated parameters and total parameters depends on each lab’s implementation. This article does not treat any single release number as a universal fact; readers should measure Prefill latency, Decode throughput, and end-to-end wall-clock time on their own evaluation sets.

    From the perspective of attention organization, shared KV and two-level sparse indexing are also often used together: a coarse-grained index first identifies candidate blocks, and a fine-grained stage then retrieves the KV that actually participates in computation. This is particularly useful for long contexts and multi-turn tool calls, avoiding dense attention over the full sequence at every layer.

    Separating Memory from Computation: N-gram Lookup for Local Patterns

    Transformers are good at compositional reasoning, but they are not economical for high-frequency local patterns, entity aliases, and fixed collocations. Such content has low computational value but occupies a large amount of capacity. A common approach is to split capabilities: reasoning is handled by the main Transformer, while a large amount of memory-type content is provided through N-gram hash lookup tables (which can be viewed as external or semi-external embedding memory). This differs from “stuffing everything into expert weights.” The lookup path has more controllable latency and makes it easier to hot-update vocabularies and domain phrases without fine-tuning the entire network.

    Three points need attention in deployment: hash collisions and load balancing; the fusion location of lookup and backbone representations (usually in shallow layers or as a parallel bypass); and, in multimodal scenarios, whether text N-grams and visual discrete units share the same memory. During training, run controlled comparisons with and without the table to prevent the model from lazily offloading reasoning to lookup as well.

    Multimodal and End-to-End Throughput: What to Measure and How

    Native multimodality means images and text share the same routing and KV strategy, rather than attaching a frozen vision tower and concatenating it. Evaluation should not look only at text metrics such as GSM-style benchmarks. It should cover at least the following:

    1. Long image-text mixed Prefill: fix the output length and compare wall-clock time and the number of activated experts.
    2. Short-output Decode: report tokens/s while also recording cache hit rate (prefix cache, multi-turn session reuse).
    3. Agent trajectories: tool-call rounds, failed retries, total tokens, and total time, rather than isolated generation speed.
    4. Cost structure: whether the Prefill share falls. If read-side activation decreases and write-side activation increases slightly, the total bill should still fall under a long-read, short-write distribution.

    The community often observes “several-fold generation speed improvements, with total time and total tokens both decreasing.” This usually comes from cheaper Prefill, more compact KV, and cache hits, rather than simply raising the Decode clock. Self-built evaluations should fix hardware, batch size, quantization precision, and scheduling policy to avoid mistaking framework optimization for model-structure benefits.

    Tight Coupling with the Orchestration Layer: Align Training Objectives with Real Configurations

    If the model sees real tool protocols, context concatenation templates, cache chunking, and multimodal packing during training, the distribution shift at inference time will be much smaller. In practice, it is recommended to treat orchestration-layer configurations (maximum tool rounds, number of retrieved items, image resolution tiers, system prompt version) as training condition variables and perform per-configuration fine-tuning or mixed sampling, rather than feeding only “clean dialogue.” When releasing a new version of an orchestration component, regress it against the same trajectory set to confirm that latency and success rate have not regressed.

    When deploying on Baidu AI Cloud, elastic GPUs can be used, object storage can hold multimodal corpora and lookup vocabularies, and logging services and monitoring alerts can track Prefill/Decode segment latency and cache hits. A container platform makes it easier to split replicas by Encoder/Decoder or expert parallelism. These are general capabilities and do not depend on any vendor’s marketing claims.

    Engineering Deployment Checklist

    • Graph partitioning: the Encoder appears only in the Prefill graph; the Decode graph loads the Decoder and KV projection, avoiding running the symmetric path twice.
    • Activation logging: separately count read-side and write-side expert hits, and verify that asymmetric activation takes effect as designed.
    • KV strategy: align the block size of shared KV plus sparse indexing with the page cache to reduce fragmentation.
    • Memory tables: shard N-gram tables, version them, and roll out canaries; if the collision rate exceeds the threshold, expand buckets or rehash.
    • Quantization and batching: Prefill can use higher-throughput batches, while Decode uses low-latency batches; the two can use different quantization levels.
    • Evaluation gates: agent total wall-clock time, output tokens, cache hits, and multimodal consistency should all be included in the gate. Looking only at tokens/s is not enough.

    Conclusion

    The core of asymmetric activation and causal encoder-decoder design is to acknowledge that Prefill and Decode are two workloads: one reads and compresses, and the other writes and reasons. Combined with shared KV, sparse indexing, and N-gram memory lookup, the cost per task for long-context agents has a real chance to fall. When selecting an architecture, use your own trajectories and hardware as evidence, and measure structural benefits, framework scheduling, and cloud elasticity separately to avoid being misled by a comparison table in a single release note. For businesses that need stable throughput, prioritize Prefill cost, cache hits, and alignment between orchestration configuration and training. This is closer to production goals than chasing nominal total parameters.