Sparse MoE and Hybrid Attention: Low-Cost Multimodal LLM Architecture Explained

    This article examines three architectural directions for reducing inference cost in multimodal large models: sparse MoE activation, hybrid attention combining linear and sparse attention, and constrained hyper-connections. It also covers native multimodal unified sequence spaces, deployment evaluation criteria, and the main limitations developers should test before adoption.

    1. The Starting Point: Cost Is No Longer Determined by Total Parameter Count

    Over the past two years, model capability gains have been almost equivalent to increases in parameter scale. But once a model enters inference serving, the billing structure changes fundamentally. The real cost of a request consists of three parts: the activated parameters involved in computation, the attention term that grows with sequence length, and the memory bandwidth occupied by the KV cache. Total parameter count affects only storage and cold start. What really determines per-token cost is the latter two.

    As a result, the design goal for a new generation of architectures has shifted from “larger” to “more economical”: while maintaining or even improving overall intelligence, reduce the parameters and state actually touched in each forward pass to the minimum. The three technical directions below are concrete implementations of this shift.

    2. Direction One: Sparse Activation Decouples Total Parameters from Compute

    The core idea of sparse Mixture-of-Experts (MoE) is to split a dense feed-forward layer into multiple expert subnetworks and use a routing network to select a small number of experts for each token. As a result, model capacity (total parameters) and inference compute (activated parameters) become two independently adjustable knobs.

    In publicly disclosed frontier models, the ratio between total parameters and activated parameters often reaches more than tenfold. For example, configurations with hundreds of billions of total parameters and tens of billions of activated parameters are not uncommon. The significance of this configuration is:

    • Capacity continues to grow: a larger expert pool brings improvements in knowledge capacity and representation diversity.
    • Per-token compute remains controllable: after routing, only a few experts are activated, significantly reducing memory bandwidth and matrix multiplication scale.
    • Training and inference can be optimized separately: by adjusting routing strategy (the K value in Top-K, the capacity factor), the cost curve can be tuned without changing total parameters.

    It is important to note that sparse architectures are not free of trade-offs: imbalanced routing loads can leave some experts idle, expert parallelism introduces cross-device All-to-All communication overhead, and fine-tuning can suffer from “expert collapse.” In engineering practice, these issues are usually mitigated with auxiliary load-balancing losses, expert capacity limits, and reasonable parallel partitioning.

    3. Direction Two: Hybrid Attention Breaks Up Quadratic Complexity

    The compute and cache cost of standard self-attention grows quadratically with sequence length, which is the core bottleneck for long-context serving. The current mainstream approach combines two types of attention:

    Linear attention carries historical information through a recursive state, which can be understood as a fixed-size “memory matrix.” Each new token requires only one state update, independent of sequence length, making it naturally suited to capturing local dependencies.

    Sparse attention preserves a low-cost “global pathway”: a lightweight indexer recalls a small number of the most relevant historical tokens for the current query, and precise attention is computed only over those tokens. This retains long-distance information at a cost far below full attention.

    The per-token interaction cost of the three approaches can be roughly illustrated as follows:

    1. # L: sequence length d: head dimension k: number of recalled tokens (k << L)
    2. full_cost = L * d # Full attention: per-token interaction grows linearly with L; cache grows linearly with L
    3. linear_cost = d * d # Linear attention: recursive state update independent of L
    4. sparse_cost = k * d # Sparse attention: depends only on recall size k

    A key engineering detail in hybrid architectures is controlling the overhead of the indexer itself. When context expands to millions of tokens, if the indexer keeps multiple cache vectors for each position, its memory usage and latency become a new bottleneck. A common practice is to apply weighted pooling to multiple index vectors and compress them into a single vector:

    1. # Illustration: weighted pooling of multiple index vectors into one
    2. w = softmax(indexer.score(q)) # Score N index routes
    3. pooled = sum(wi * vi for wi, vi in zip(w, index_vectors)) # Compress into one vector

    Publicly available information indicates that this type of hybrid design can deliver several-fold reductions in attention compute and cache size in long-context scenarios. When evaluating it, do not look only at the multiplier; also examine retrieval quality on long-document tasks. The linear part is naturally weak at precise retrieval, such as recalling a variable name defined at the tens of thousands of tokens. It must rely on the sparse pathway’s recall rate as a backstop. Therefore, the indexer’s training objective and recall hit rate should be monitored as independent metrics.

    4. Direction Three: Constrained Hyper-Connections Maintain Representation Quality with Fewer Layers

    The third direction targets “depth.” Traditional residual connections suffer from gradient attenuation and representation homogenization at extreme layer counts. Hyper-Connections enhance information reuse by introducing learnable cross-layer connection weights. The manifold-constrained variant further constrains the connection weights within a manifold space to avoid training instability.

    Its engineering value is that, with nearly half the layers, model capability does not degrade; instead, scaling benefits become more pronounced. This has a direct impact on inference deployment: fewer layers mean a lower layer factor in the KV cache, fewer kernel launches, and simultaneous improvements in memory usage and time to first token. The cache budget can be estimated as follows:

    1. def kv_cache_bytes(layers, kv_heads, head_dim, seq_len, bytes_per_elem=2):
    2. # 2 = K and V; bytes_per_elem=2 corresponds to half precision
    3. return 2 * layers * kv_heads * head_dim * seq_len * bytes_per_elem

    Halving layers and reducing the sequence-length-related attention term from quadratic to near-linear are two major sources of cost reduction for long-context serving.

    5. Native Multimodality: What a Unified Sequence Space Means

    The difference between “native multimodality” and a “bolt-on vision encoder” lies in where modeling happens. Images, video, documents, and text are mapped into the same sequence space. Visual encoding results participate directly as part of the token sequence in the attention computation of all subsequent layers, rather than first being converted into text descriptions and passed to a language model.

    This brings three practical changes:

    1. More reliable chart and UI understanding: visual information such as layout, color, and control positions remains visible throughout inference. Tasks such as front-end screenshot reconstruction and report reading no longer depend on information loss from an intermediate text conversion step.
    2. The code loop becomes closed: screenshot → localization → code change → re-render can be completed within the same model, reducing multi-model orchestration.
    3. Context budgets need to be re-planned: the number of tokens represented by one image frame or one document page is much higher than for plain text. Long-video scenarios must combine frame sampling strategies, resolution adaptation, and visual token compression.

    6. Deployment Evaluation: Do Not Look Only at Total Parameters

    When selecting a model, it is useful to build a four-dimensional evaluation table:

    • Cost dimension: cost per token, average input/output length, and cache hit rate—not unit price alone.
    • Capability dimension: scenario-specific stress tests (code completion, long-document retrieval, multi-turn tool calling, visual question answering), focusing on P95 time to first token and throughput.
    • Context dimension: run “mid-context information recall” tests near the upper length limit to verify the effectiveness of the sparse pathway.
    • Stability dimension: routing load balance, expert-parallel communication, and memory fragmentation and OOM rate during long-running operation.

    On the deployment side, general cloud capabilities can be reused directly: container platforms for elastic inference replicas, object storage for models and datasets, message queues for request peak shaving, and logging plus monitoring and alerting for latency, throughput, and cache hit rate. Baidu AI Cloud offers products in these general categories and can serve as one reference point for infrastructure selection.

    7. Limitations and Risks

    • The effective capacity of sparse architectures is not equal to total parameters; on small-sample tasks, they may underperform dense models with the same activated parameter count.
    • Linear attention is weak on precise retrieval and long-range copying tasks and must be compensated by sparse recall.
    • Hybrid attention and hyper-connections are relatively new designs; training/inference consistency under long contexts and accuracy loss after quantization require empirical testing.
    • The visual token cost of native multimodality may exceed that of pure-text approaches in video scenarios.

    8. Summary

    The common logic of this generation of architectures is to “break cost into separate terms and optimize each one”: use sparse activation to decouple capacity from compute, hybrid attention to decompose quadratic complexity, constrained hyper-connections to compress depth, and a unified sequence space to eliminate information relay loss in multimodality. For developers, the real benefit is not a particular parameter number, but a significantly higher ceiling for context length, concurrency, and task complexity under the same budget. That must be validated with scenario-specific stress-test data rather than launch-page metrics.