MoE Multimodal Large Models: Architecture Explained and a Deployment Guide
Large language models are evolving from text-only systems toward multimodal models that process both text and images, while rapidly growing parameter counts make inference cost the main barrier to adoption. Sparse Mixture-of-Experts (MoE) architectures address this tension by decoupling total parameter count from the parameters activated per token. Using a sparse multimodal model with roughly 25.2B total parameters and about 3.8B activated parameters as a reference, this article explains how these models work, walks through key designs such as routing, load balancing, shared experts, and sliding-window attention, shows how to read benchmark results beyond the headline scores, and provides practical guidance on selection, fine-tuning, and deployment—including memory budgeting, parallelism strategies, and inference optimization.
1. Introduction: Sparse Multimodal Large Models
Large language models are evolving from “text only” toward multimodal forms that handle both text and images. At the same time, model parameter counts keep climbing, making inference cost the main bottleneck for real-world adoption. Sparse architectures such as Mixture-of-Experts (MoE) offer a new way to resolve this tension: a model can have a high total parameter count and a low activated parameter count at the same time.
Using a sparse multimodal model with about 25.2B total parameters and roughly 3.8B activated parameters at inference time as a reference, this article systematically explains the architecture principles, key designs, benchmark interpretation, and engineering considerations of this class of models, to help developers make informed decisions during selection, fine-tuning, and deployment.
2. The Dense Model Dilemma: Parameters and Computation Are Tightly Coupled
In a dense model, every input token passes through all parameters, so the forward-pass computation is approximately:
forward compute ≈ 2 × total parameters × number of tokens (FLOPs)
This leads to two direct consequences:
- Doubling the parameter count doubles the inference computation as well;
- Model capability and deployment cost are bound together and hard to optimize separately.
A single business card may contain a product description, user reviews, pricing, and several images—easily thousands of tokens of input. If you simply pick a dense model with tens of billions of parameters to improve quality, the per-request compute cost grows several times over.
3. MoE Fundamentals: Decoupling Parameter Capacity from Computation
3.1 From “everyone participates” to “call on demand”
The core idea of MoE can be summarized as “division of specialized labor”: replace the feed-forward layer with multiple parallel “expert” sub-networks and add a router. The router scores each token and selects only the few highest-scoring experts to participate in the computation, while the rest stay “dormant.”
As a result, the total parameter count determines the model’s knowledge capacity, while the activated parameter count determines the computation per token, decoupling the two. This also explains the meaning of naming like “total params A, activated params B” (AxxB):
- The first number is the total parameter scale;
- The second number is the parameter count actually activated per token.
3.2 Compute comparison
Still estimating at 2 FLOPs per parameter per token:
- A model with 25.2B total parameters and 3.8B activated parameters uses about 7.6 GFLOPs per token;
- A dense model with a similar parameter count, around 31B, uses about 62 GFLOPs—the former is less than one-eighth of the latter.
3.3 Why compute savings are smaller than the expert activation ratio
Take the configuration “8 routed experts activated out of 128 total, plus 1 shared expert” as an example. The activation ratio at the routed-expert level is only about 6.25%, but the activation ratio for the whole model is about 3.8B ÷ 25.2B ≈ 15%. The gap comes from two kinds of “must-be-activated” components:
- Shared expert: it does not go through routing and is computed for every token, carrying general knowledge;
- Attention layers: sparsification generally only applies to the feed-forward layers; attention is still dense computation.
So when evaluating the benefits of sparsification, you should use the “overall activated parameter count” rather than the “number of activated routed experts.”
4. Key Design Analysis
4.1 Router: the “scheduling hub” of sparsification
A typical MoE feed-forward layer executes as follows; the pseudocode only expresses the general logic:
def moe_feed_forward(x, router, experts, top_k):# x: input with shape [num_tokens, hidden_dim]scores = softmax(router(x), dim=-1) # score each token against every expertweights, indices = topk(scores, k=top_k) # select the top_k highest-scoring expertsoutput = zeros_like(x)for j in range(top_k):for expert_id in unique(indices[:, j]):mask = indices[:, j] == expert_idout = experts[expert_id](x[mask]) # each expert processes only the tokens routed to itoutput[mask] += out * weights[mask, j:j+1]return x + output # residual connection
Routing quality directly determines quality: when routing is accurate, relevant tokens are handled by the “right” experts; when routing is off, you may get “general tasks occupying specialized capacity” or “expert collapse.”
4.2 Load balancing: key to training stability
If the router concentrates many tokens on a few experts, three problems arise:
- Popular experts get overloaded while others are under-trained, which wastes parameter capacity;
- Training becomes unstable, and routing may collapse further;
- Inference load becomes skewed, causing a bucket effect in distributed deployment.
Common countermeasures:
- Auxiliary balancing loss: penalize the deviation between load and routing probability so that both trend toward uniform;
- Capacity factor and token dropping: set a processing limit for each expert; excess tokens pass through directly or fall back to the next-best expert;
- Dynamic bias: introduce a bias term per expert that adjusts with load, balancing routing during training and generally removed at inference time.
The balancing loss can be summarized in pseudocode:
# f_i: fraction of tokens actually assigned to expert i; p_i: average routing probability of expert i over all tokensload_balance_loss = num_experts * sum(f[i] * p[i] for i in range(num_experts))# about 1.0 when load is perfectly balanced; the more skewed the load, the larger the value
4.3 Shared experts: division between general and specialized knowledge
Relying on routing alone means general patterns like grammar and common sense have to be re-learned by every expert, wasting parameters. Reserving one shared expert that applies to all tokens lets the routed experts focus on their respective “specialties,” improving parameter utilization.
4.4 Sliding-window attention: controlling long-context cost
Attention computation and the KV cache grow with context length, making them the main cost of long-context inference. This class of models uses a hybrid scheme that alternates local (sliding-window) and global attention, with an illustrative configuration below:
{"num_layers": 30,"num_routed_experts": 128,"num_activated_experts": 8,"num_shared_experts": 1,"attention_pattern": ["sliding_window(1024)","sliding_window(1024)","sliding_window(1024)","global"],"max_context_length": 262144,"max_output_tokens": 8192}
Local layers attend only to the most recent ~1024 tokens, which suits capturing local dependencies; the periodically inserted global layers retain the ability to relate distant information. Working together, they balance long-context quality and inference cost.
5. Multimodal Capabilities: The Advantage of Sparse Architecture in Image-Text Scenarios
5.1 Input form: interleaved image-text sequences
These models accept both text and image input and support interleaved arrangements of the two. A typical mixed image-text input looks like this:
messages = [{"role": "user","content": [{"type": "image", "image": "invoice_page_1"},{"type": "image", "image": "invoice_page_2"},{"type": "text", "text": "Compare the two invoice pages, list any items where the amount and the issue date do not match, and output them as a table."}]}]
Multimodal input is converted by a vision encoder into a token sequence, then fed into the model together with text tokens.
5.2 Capability scope
- Text and image understanding: object detection, screen and UI understanding, chart parsing, optical character recognition (OCR), handwriting recognition, and visual grounding;
- Document understanding: parsing of visually complex materials such as long documents and PDF pages;
- Multilingual capability: works out of the box in more than 35 languages, with pretraining covering over 140 languages;
- Built-in reasoning and code generation: performs intermediate reasoning before giving an answer, and supports function calling;
- Interleaved reasoning: alternates text and thinking within a single reply, making the reasoning chain easier to audit.
5.3 The amplifying effect of sparsification
After tiling and visual encoding, an image often expands into hundreds or thousands of tokens. A single high-resolution document image may be equivalent to thousands of text tokens, yet each image token still activates only about 15% of the parameters in the feed-forward layers.
As a result, long-input scenarios with interleaved and multiple images are among the cases where sparse architecture pays off most clearly:
- Long-text tasks can amortize the fixed cost of visual encoding;
- Multi-image tasks can incorporate more images without a significant increase in compute.
6. Reading the Benchmarks: What to Look at Beyond the Scores
This class of models has publicly reported results across many benchmarks, which can be grouped by capability dimension as follows (the data below comes from public evaluation methodologies and is for reference only):
| Capability dimension | Representative task type | Public score |
|---|---|---|
| General knowledge | Multiple-choice questions spanning humanities, social sciences, and STEM | MMLU Pro 82.6% |
| English multi-subject | English multi-subject knowledge Q&A | MMMLU 86.3% |
| Graduate-level reasoning | Hard questions in biology, physics, chemistry, and more | GPQA Diamond 82.3% |
| Math reasoning (no tools) | High-difficulty competition math | AIME 2026 88.3% |
| Code generation | Code completion for real repository issues | LiveCodeBench v6 77.1% |
| Competitive programming | Competition problem ratings | Codeforces ELO 1718 |
| Visual reasoning | Combined image-text reasoning | MMMU Pro 73.8% |
| Visual math | Chart and geometry visual math problems | MATH-Vision 82.4% |
| Long-context retrieval | 128K-context multi-needle retrieval (average) | 44.1% |
When interpreting results, pay attention to three things:
- Distinguish tool-use conditions. “No-tools” scores reflect the model’s native ability; in business use, if retrieval or code execution is allowed, real-world results are usually higher;
- Watch for nonlinear decay in long-context scores. The 128K multi-needle retrieval averages only about 44.1%, clearly lower than short-context performance—so “supports long context” does not mean “the entire long context is usable.” For key-information retrieval tasks, it is better to preprocess by extracting the key content first, then hand it to the model for reasoning;
- Benchmark scores are just a starting point. Final quality should be judged against your own in-house evaluation set, covering the real business distribution, prompt templates, and output format requirements.
7. Engineering Deployment: Memory, Parallelism, and Inference Optimization
7.1 Memory budget: calculate by total parameters
This is the most common mistake in deploying sparse models. All experts of an MoE must reside in memory permanently, so memory requirements depend on the total parameter count rather than the activated parameter count.
memory need ≈ weight memory + KV cache + runtime overheadweight memory ≈ total parameters × bytes per parameter (+ metadata such as quantization scale factors)
Taking 25.2B total parameters as an example:
| Weight precision | Weight memory (theoretical) |
|---|---|
| FP16/BF16 | ~50.4 GB (~46.9 GiB) |
| INT8 | ~25.2 GB (~23.5 GiB) |
| 4-bit | ~12.6 GB (~11.7 GiB) |
This explains two seemingly contradictory phenomena:
- A “4B-class” model cannot run smoothly on a consumer GPU;
- In long-context scenarios, the KV cache may take up more memory than the weights.
The KV cache can be estimated as:
KV cache ≈ 2 × num_layers × num_kv_heads × head_dim × bytes per element × sequence length
Assuming 30 layers, 8 KV heads per attention layer, head dimension of 128, and FP16 storage:
| Context length | Estimated KV cache |
|---|---|
| 1K | ~256 MB (~244 MiB) |
| 8K | ~2.0 GB (~1.9 GiB) |
| 128K | ~32.9 GB (~30.6 GiB) |
Local-window layers only need to maintain the cache within the window, so actual usage is usually lower than this. But global layers still need to retain the full history, so during deployment you should still reserve memory for long context.
7.2 Parallelism strategy: the “communication tax” of sparse models
- Tensor parallelism: splits a single layer’s computation across multiple cards, with frequent communication, and is generally limited to multi-card setups within a single machine;
- Expert parallelism: distributes different experts across different cards, with each token sent to its target expert via “all-to-all” communication and results gathered back. Communication cost scales with the spread of expert distribution and the cluster network performance, so network bandwidth needs careful evaluation for cross-node deployment;
- Pipeline parallelism: splits by layers across multiple devices, suitable when the model cannot fit on a single node, but introduces pipeline bubbles.
7.3 Inference optimization essentials
- Continuous batching: dynamically batch at the request level to reduce GPU idle time;
- Chunked prefill: split long inputs into small chunks interleaved with decoding, reducing the blocking effect of long inputs on requests that are generating;
- Prefix caching: repeated prefixes such as system prompts and knowledge base snippets can reuse computed results, skipping repeated prefill;
- Speculative decoding: use a lightweight draft model or the model’s own multi-head predictions to propose candidate tokens, then verify them all at once with the large model, reducing the number of decoding steps.
7.4 Fine-tuning considerations
- Routing stability: for parameter-efficient fine-tuning such as low-rank adaptation, freeze the router at the same time, or use a smaller learning rate only for the routing layers, to avoid drastic drift in expert assignment;
- Catastrophic forgetting: sufficiently unfreeze expert parameters to ensure new knowledge lands in the appropriate experts;
- Vision adapter: for multimodal fine-tuning, evaluate the adaptation approach for the vision-side modules separately.
8. Selection Practice: When to Choose a Sparse Multimodal Model
Recommended scenarios:
- Mixed image-text, long input: product detail understanding, contract clause comparison, receipt and form recognition, UI walkthroughs, financial report chart Q&A, and more;
- High-concurrency online services: computation close to a 4B-class model, with more controllable per-token cost;
- Multilingual business: broad language coverage out of the box, reducing multilingual adaptation cost.
Scenarios to approach cautiously:
- Edge or device-side with limited single-card memory: memory must be evaluated by total parameters, and a small dense model may be more suitable;
- Offline batch processing where memory is sufficient but latency requirements are loose: a large dense model is also worth comparing;
- Precise long-context retrieval: prefer retrieval augmentation, or combine with context compression.
Before selection, it is recommended to take a smaller version from the candidate models for small-scale validation, evaluate quality and resource usage with real business data, and then decide the final scale. For cloud deployment, you can wrap the inference service with a container platform, run the compute on GPU instances, and build observability with common capabilities such as logging and monitoring alerts.
9. FAQ
Does a small number of activated parameters mean weaker capability?
Knowledge capacity is mainly determined by the total parameter count. Activated parameters determine the computation per token, so sparse models are closer to a “large-capacity, low-compute” tradeoff.Why can’t memory be estimated by activated parameters?
All experts must reside in memory permanently. Memory should be estimated by total parameter count, then add the KV cache and runtime overhead.Why set a sliding window for long context?
Attention cost and the KV cache grow linearly or even quadratically with context length. Local-window layers only maintain the cache within the window, while periodic global layers ensure distant information remains reachable.How does interleaved image-text input affect efficiency?
After an image expands into visual tokens, they participate in sparse computation together with text tokens. Each image brings a fixed encoding cost, but the compute cost per subsequent token remains low, and multi-image long inputs benefit the most.What does the open-source license mean for commercial use?
This class of models is usually released under permissive licenses such as Apache 2.0, allowing commercial use, modification, and redistribution, but requiring you to retain copyright and license notices and comply with clauses such as trademarks in the license. The license published by the model provider is authoritative.
10. Conclusion
The core value of sparse multimodal large models lies in “decoupling parameter capacity from inference compute.” With 25.2B total parameters and 3.8B activated parameters as a reference, its per-token computation is already close to a 4B-class dense model, while retaining the knowledge capacity and multimodal ability of a large-parameter model. To use this class of models well, you need to understand three things:
- Look at activated parameters for compute;
- Look at total parameters for memory;
- For long context, watch the cache cost introduced by global layers.
On this basis, combine real business data to complete evaluation and fine-tuning, and pair it with reasonable parallelism and inference optimization strategies, and you can obtain high-quality multimodal intelligence at a controllable cost.
