Inference Cost Design for Asymmetric Mixture-of-Experts Architectures
This article examines how long-context agents, multi-turn tool calls, and native visual understanding are shifting inference cost from single completions to persistent state. It breaks down the main cost drivers and explains how sparse activation, asymmetric encoding/decoding, KV-cache management, serving and versioning practices, evaluation, and rollout order can keep more capable models within an acceptable operating budget.
Long-context agents, multi-turn tool calling, and native visual understanding are pushing inference cost away from a simple “one completion at a time” model and toward persistent state. Once parameter counts grow, the expensive part is often not a single forward pass. It is the KV cache, memory bandwidth, and accelerator time held for long periods.
One design direction worth taking seriously is to put mixture-of-experts, asymmetric encoding/decoding, and more aggressive context compression on the same technical path: preserve a high capability ceiling during training, but activate only the computation and storage required for the current token during serving.
Where the cost actually comes from
A request bill is usually made up of four parts.
- Effective compute: the matrix multiplications that actually participate in predicting the current token.
- Memory capacity: model weights, activations, and KV cache all need to fit.
- Bandwidth: for long contexts, every generated token requires reading back historical keys and values.
- Latency-throughput coupling: over-provisioning instances to reduce time-to-first-token still costs money when they are idle.
Agent scenarios amplify the last two parts. Tool round trips, web summaries, code repositories, and image descriptions can make contexts very long, and the same prefix may be hit repeatedly. Cache hits may save prefill work, but they also pin hot data to expensive storage. If cache and compute grow under the same “large and symmetric” structure, the cost curve can become steeper than the business can accept.
The design goals can therefore be stated in four sentences:
- The capability ceiling should scale with parameter count.
- The activated amount per request should be clearly smaller than the total parameter count.
- Context storage should grow sublinearly with sequence length, or at least with a much smaller coefficient.
- The serving interface should remain stable so applications do not need to be rewritten when models iterate.
Sparse activation: separating total parameters from per-step cost
Mixture-of-experts splits fully connected layers into multiple experts, and a router sends each token to only a few of them. Total parameters determine the breadth of representable knowledge. Activated parameters determine per-step floating-point operations and memory access. The two do not have to be proportional.
In practice, the important thing is not the headline “number of experts.” Three observable metrics matter more:
- Average number of activated experts.
- Whether load-balancing loss skews traffic toward a small number of experts.
- Whether communication after expert parallelism eats into the compute gains.
If experts are too fragmented and communication is too heavy, wall-clock speed may get worse rather than better. If experts are too coarse, the cost advantage of sparsity disappears.
Routing should also consider within-sequence consistency. If adjacent tokens frequently jump to completely different experts, cache locality worsens and batching becomes harder during decoding. A common engineering approach is to use shared experts or a lightweight always-on branch to cover general language capability, while sparse experts handle domain differences. This avoids paying repeatedly for “common sense” on every token.
Asymmetric encoding/decoding: input and output do not need the same width
A traditional decoder binds “reading context” and “writing the next token” to the same width. Reading may need to fuse a long history and optional image blocks. Writing produces only a small amount of new information at each step, yet it still maintains all state at the writing width.
The intuition behind asymmetric structures is that the encoder side handles highly compressed understanding, while the decoder side handles quality-sensitive generation. The activation scale on the two sides can differ.
The input side is better suited to early aggregation. Text tokens and image blocks can first pass through a relatively narrow encoding stack, compressing local patterns into shorter internal representations before handing them to the generation stack. The output side keeps wider activations to reduce representational bottlenecks over long-range dependencies and avoid making open-ended generation “blurry” just to save compute.
This asymmetry is not free. Training objectives, positional encoding, and cross-layer residuals must be aligned. Otherwise, computation saved on the encoder side may be paid back on the decoder side as repeated attention.
Multimodal input should not be an afterthought bolted on later. Visual tokens usually far outnumber text tokens. If raw block sequences enter the same cache as text, memory can be overwhelmed by images. A safer approach is to perform spatial aggregation on the encoder side and send only task-relevant visual summaries into the generation cache. Evaluation should separately examine charts, UI screenshots, and dense text images rather than relying only on text-only scores.
What pre-training and post-training each solve
The ceiling of a new architecture mainly comes from whether pre-training can learn stable expert specialization under sparse routing. It is not something fixed by changing a serving parameter right before launch. Data mixtures should cover long documents, multi-turn dialogue, tool trajectories, and image-text pairs. Otherwise, routing may only learn shortcuts for short text.
Reinforcement learning or preference optimization is suitable for fixing “can compute but not easy to use” issues: tool-call formatting, refusal boundaries, and whether multi-step planning loses constraints midway. It cannot repair information loss caused by cache compression. If a compression strategy was never seen during pre-training, relying only on post-training to “adapt” can cause factual mix-ups in the later part of long contexts. The value of post-training is behavior alignment, not rewriting the memory subsystem.
KV cache: treat residency cost as a first-class concern
The size of the attention cache roughly grows with the number of layers, head dimension, sequence length, and batch size. Reducing the cache usually requires combinations of techniques rather than a single trick:
- Lower head dimension or grouped-query attention.
- Keeping only necessary heads per layer.
- Merging distant tokens or applying low-bit quantization.
- Swapping cold cache to cheaper storage media.
To judge whether compression is worthwhile, look at both quality and hierarchy. Hot data stays in high-bandwidth memory. Warm data can use lower precision. Cold prefixes can be moved to local disk. Swapping is not free: if an agent backtracks to a very early tool result, swap-in latency can become a user-visible pause. In practice, prioritize compressing prefixes that are repetitive and reconstructable, while preserving high fidelity for the recent window and system constraints.
Compared with first-generation full caches, order-of-magnitude reductions have appeared in both literature and engineering practice, but the exact multiplier depends heavily on sequence length, precision, and whether quality regression is allowed. When making external claims, provide your own evaluation set and acceptable quality loss instead of citing someone else’s compression ratio.
Capacity planning should at least estimate:
- Peak concurrency.
- P95 context length.
- Cache hit rate.
- Decode time per token.
- The share of memory used by weights versus cache.
After the cache is reduced, the bottleneck often shifts from memory capacity to batch scheduling and networking.
Serving: versions, routing, and billing semantics
Models iterate faster than applications release. Compatibility policy should be explicit in the contract. Old names may be forwarded to a new implementation for a limited window, but the actual executed version must be indicated in response headers or billing dimensions. Otherwise, “the name did not change, but the behavior changed” becomes impossible to trace. Forwarding is not a long-term solution. Before the window closes, provide a difference note: context limits, whether visual input is enabled by default, and whether stop sequences or tool-call formats changed.
When a smaller serving form already covers the main workload of the original flagship in latency, unit token price, and end-to-end time, keeping two sets of weights creates double cache fragmentation and release cost. Deprecation should be staged: first compare shadow traffic, then roll out by tenant, and finally keep only a rollback image. Billing must follow the model actually executed, not the old name written in the user request. Otherwise reconciliation will become chaotic.
The calling interface can stay very thin. Applications depend only on stable model aliases, message lists, and optional image inputs. Specific weights, activation widths, and cache policies remain internal to the service. For example:
POST /v1/chat/completions{"model": "reasoning-flash","messages": [{"role": "user", "content": [{"type": "text", "text": "Summarize the key changes from the screenshot"},{"type": "image", "url": "oss://bucket/shot.png"}]}],"max_tokens": 1024}
The alias reasoning-flash represents a service level, not a specific weight version. Object storage handles images and long attachments. Message queues smooth out peaks. Container platforms scale by cache water level. Logs and monitoring should separately track prefill latency, decode latency, cache hits, and swap-in counts. These are general capabilities and should not be tied to one model architecture.
How to evaluate “better across the board”
“Faster, cheaper, and stronger” must be measured separately. Otherwise, short-QA scores can hide regressions on long tasks. At least four groups are recommended:
- Capability: knowledge, math, code, multimodal understanding, and tool-use success rate. Report confidence intervals rather than a single run.
- Cost: cost per successful task, not list price per token. Failed retries and cache misses must be included.
- Speed: time-to-first-token, decode speed, and total time under fixed concurrency.
- Stability: factual consistency in the later part of very long contexts, and whether expert load is skewed.
Baselines should use the same prompts, stop conditions, and retry policy. Leading only on agent benchmarks does not prove that interactive short QA also leads, and vice versa. If a new architecture wins on cost and speed while matching capability, there is reason to move most traffic to the smaller serving form and reserve the larger parameter version for tail tasks where a clear quality difference can still be measured.
Risks and boundaries
Sparse models may suddenly weaken in niche domains because the router does not send tokens to the right experts. Compressed caches may drop a row from a table or an early constraint. Asymmetric widths may cause “understood but not written in detail.” These are not fixed by tuning a temperature parameter.
Launch gates should include:
- Routing entropy monitoring.
- Joint alerts for cache hits and quality regression.
- Automatic fallback to more conservative precision or less compression by task type.
It is also unwise to present unpublished, unreproduced parameter counts, activation counts, or cache multipliers as inevitable architectural results. What can be restated are the design principles: total parameters serve the capability ceiling, activated parameters serve per-step cost, and cache policy serves the long-context bill. Specific numbers must come from your own load tests.
Suggested rollout order
First, use real agent logs to measure context-length distribution and prefix repetition rate. Confirm that the cache is the main bill driver before investing in architectural changes. Second, make compression and routing the default path during training, not an external add-on at inference time. Third, establish version aliases, billing fields, and canary rollback. Only then consider retiring the old large serving form. If the order is reversed, saved memory will be offset by compatibility incidents and unexplained quality regressions.
For developers, the value of this path is not chasing a particular model variant. It is separating “scalable intelligence” from “affordable serving” into variables that can be optimized independently: experts determine where knowledge comes from, asymmetric widths determine how much compute reading and writing each cost, and cache hierarchy determines whether long tasks stay within budget.
