Asymmetric Activation Architectures for Long-Context Agent Inference

    Asymmetric activation architectures address the uneven costs of long-context agent workloads by using a lighter input-side encoder and a higher-capacity output-side decoder. This article explains the causal encoder–decoder design, shared global KV representations, two-level sparse indexing, training challenges, and integration with agent runtimes. It also outlines evaluation metrics, deployment steps, and limitations for balancing end-to-end inference cost against task quality.

    As long-context inputs, multimodal processing, and agent tasks become more common, inference bottlenecks extend beyond the computation required for a single forward pass. A typical agent request may include a lengthy system prompt, tool descriptions, conversation history, retrieved documents, and screenshots, while generating only a few hundred to a few thousand output tokens.

    This creates a clear long-input, short-output workload. Prefill must process substantial context, while decoding generates tokens sequentially. Both time to first token and sustained throughput matter.

    Conventional mixture-of-experts architectures with symmetric activation typically activate the same parameter budget for each token, applying a common cost model to prefill and decoding. This makes it difficult to optimize the two stages independently. An alternative is to split the network into a causal encoder and a decoder, with different activation budgets on the input and output sides.

    1. Why Long-Context Workloads Need Asymmetric Activation

    The cost of a long-context request can be roughly divided into three components:

    • Prefill computation: Encoding the context into reusable representations, with work that grows approximately with context length.
    • KV cache storage: Memory consumption that increases with layer count, attention-head count, and context length, directly affecting GPU memory usage and concurrency.
    • Decoding computation: Sequential output generation, whose throughput depends on activated decoder parameters, memory bandwidth, and batching efficiency.

    Using the same activation budget for prefill and decoding can introduce unnecessary work. When the input is long, the decoder’s larger parameter capacity may not need to participate fully in context processing. When the output is short, expensive context construction can dominate the request’s total cost.

    Asymmetric activation recognizes that the two stages have different cost structures. Its aim is to make prefill lighter while preserving sufficient decoding capacity, reducing per-request cost for long-context agent workloads.

    2. Dividing Responsibilities Between a Causal Encoder and Decoder

    This architecture divides the network into two parts. The lower, encoder-oriented portion processes the context during prefill and produces compact representations. During decoding, execution primarily uses the upper, decoder-oriented portion, reusing global key-value (KV) representations projected from the encoder’s final-layer hidden states.

    The key change is not simply removing layers. It is changing how global KV representations are constructed. Instead of each decoder layer rebuilding its own global KV from its hidden states, decoder layers reuse shared KV projected from the encoder’s final-layer output.

    This can reduce repeated projections and cache writes while making context representations more compact. The input side can therefore use a smaller activated parameter budget, while the output side retains a larger one.

    A schematic cost model is:

    1. T_prefill ≈ L_ctx × A_enc + C_compress + C_kv_proj
    2. T_decode ≈ L_out × A_dec

    Here:

    • L_ctx is the context length.
    • L_out is the output length.
    • A_enc and A_dec represent the encoder and decoder activation budgets, with A_enc < A_dec.
    • C_compress is the context-compression cost.
    • C_kv_proj is the KV projection cost.

    This simplified model illustrates why reducing A_enc is particularly valuable when L_ctx is much larger than L_out. For workloads dominated by very long outputs, the advantage may shrink, and the capacity balance between the two sides may need to be reconsidered.

    3. Shared KV and Two-Level Sparse Indexing

    Shared KV does not mean merging every layer and attention head into a single representation. Instead, responsibility for constructing global-context KV moves to the encoder’s final layer, with projection matrices making those representations available to the decoder.

    Two-level sparse indexing controls how the decoder accesses the context:

    1. Coarse block indexing quickly identifies relevant context blocks.
    2. Fine-grained segment or token indexing retrieves more precise information within the candidate blocks.

    This preserves access to long contexts while reducing the cost of attending to the entire context during decoding. Important implementation considerations include index construction timing, block size, retrieval recall, cache eviction, and numerical precision.

    The following pseudocode illustrates the division of responsibilities:

    1. class CausalEncoderDecoder:
    2. def prefill(self, context):
    3. enc_states = self.encoder(context)
    4. compact_ctx = self.compress(enc_states)
    5. global_kv = self.kv_proj(enc_states[-1])
    6. block_index = self.build_level1_index(compact_ctx)
    7. fine_index = self.build_level2_index(compact_ctx)
    8. return compact_ctx, global_kv, block_index, fine_index
    9. def decode_step(self, prefix, global_kv, block_index, fine_index):
    10. h = self.embed(prefix)
    11. for layer in self.decoder_layers:
    12. candidates = self.query_level1(block_index, h)
    13. sparse_kv = self.query_level2(fine_index, candidates, h)
    14. h = layer(h, shared_global_kv=global_kv, sparse_kv=sparse_kv)
    15. return self.lm_head(h)

    Prefill handles compression, projection, and index construction. Decoding handles index queries, sparse retrieval, and token-by-token generation.

    A production implementation must also address consistency between indexes and KV caches, variable-length contexts within batches, unified representations for multimodal segments, and reuse when cached context is available.

    4. Training Challenges When Separating Memory and Computation

    Separating model capabilities into retrievable memory and online computation allows static knowledge, historical context, and tool results to reside in indexed memory, while reasoning and generation remain with the decoder.

    However, training must jointly constrain three properties:

    • The reconstructability of compressed representations.
    • The accuracy of index-based retrieval.
    • The consistency of generated results.

    Optimizing only language-modeling loss may produce index representations that are poorly aligned with generation needs. Optimizing only retrieval metrics may leave the decoder unable to make effective use of retrieved segments.

    A multi-task training objective can address these competing requirements through context reconstruction, next-token prediction, segment relevance ranking, and routing load balancing. Sparse routing must also avoid expert collapse, while index updates must avoid introducing a mismatch between training and inference distributions.

    5. Coordinating the Architecture with Agent Runtimes

    To work effectively with an agent runtime, asymmetric activation needs coordinated decisions about context trimming, cache reuse, tool-call formatting, and batch scheduling.

    For example, the runtime can:

    • Mark stable system prompts and tool descriptions as cacheable prefixes.
    • Place retrieved documents in a compressible context region.
    • Organize tool results into indexed blocks.

    The model can then be trained to compress and retrieve context according to these configurations.

    This coordination can improve cache hit rates and reduce time to first token. However, optimizing too closely for one runtime configuration may reduce the benefits when the model moves to a different environment.

    Evaluation should therefore treat runtime configuration as a variable. Tests should cover cold and warm caches, different context-trimming strategies, and different output lengths.

    6. Performance Evaluation Must Go Beyond Generation Speed

    A useful evaluation should cover at least:

    • Time to first token.
    • Time per output token.
    • End-to-end throughput.
    • Total token consumption.
    • Cache hit rate.
    • Task success rate.
    • Cost per request.

    Faster generation does not necessarily mean better end-to-end performance. Cache hit rate, output length, and batch size can all affect the result.

    A sound experiment should hold hardware, output-length distribution, and cache conditions constant across comparisons. Cold-start and warm-cache results should be reported separately, along with failure cases.

    For long-context agents, measurements should also isolate prefill time, index construction time, and sparse retrieval time during decoding. Otherwise, a prefill improvement may be incorrectly attributed to faster decoding.

    7. Deployment Recommendations and Limitations

    Deployment should proceed in stages:

    1. Validate compression and retrieval offline. Measure information loss in compressed representations and index retrieval recall.
    2. Run a limited production rollout. Assess behavior before expanding traffic.
    3. Set memory budgets and eviction policies. Account for both KV caches and indexes.
    4. Check numerical accuracy. Validate shared KV projections and sparse retrieval.
    5. Retain a full-attention fallback. Preserve a path for cases where sparse access is insufficient.
    6. Establish observability. Track prefill, decoding, indexing, and caching overhead separately.

    This architecture is best suited to long-input, short-output workloads with reusable context and frequent tool calls. Its benefits may be limited for short-context, high-concurrency workloads or tasks that generate very long outputs.

    Key selection risks include shared-KV consistency, missed retrievals in the two-level index, information loss from multimodal compression, and excessive dependence on a particular agent runtime configuration.

    Asymmetric activation is therefore not a single-operator optimization. It is a system-level design spanning network architecture, cache organization, and runtime coordination. Its practical value ultimately depends on the balance between end-to-end cost and task quality.