Skip to content

Search

Articles, tools, solutions and knowledge base guides

Start typing to search across articles, tools and apps.

Mixture of Experts (MoE) vs Dense Models: how do they differ and when should you use them?

A language model with many parameters does not necessarily use every parameter for each token. Mixture of Experts (MoE) can conditionally activate expert networks, whereas a typical dense model reuses common computational blocks. The choice depends on quality, memory, throughput, latency and total deployment cost. This guide explains how to compare those properties without mistaking active parameter counts for hardware requirements.

AI
Published Written by Reading time 10 min read
On this page Contents: quick navigation between sections

How does a dense model work?

Architecture comparison
Criterion Dense Sparse MoE
FFN selection Shared network Selected experts
Weight memory All weights All weights accessible
Communication Depends on partitioning Extra routing with EP
Training More regular computation Expert balancing
Performance Deployment-dependent Also expert-load-dependent

In a typical Transformer, a token is represented as a vector and successive blocks apply attention and a feed-forward network (FFN). In a dense model, tokens use the same FFN weights within each layer. This does not mean every weight in the entire model is read for every token: embedding lookups and other components have different access patterns. [1][2]

Regular matrix operations make grouping work on GPUs easier. A dense model can still use quantization, distributed computation or sparse attention. Dense here refers to the absence of selective expert routing in FFNs, not the absence of every form of sparsity.

How does Mixture of Experts work?

Data flow in dense and sparse MoE layers

Dense: token → attention → common FFN → next layer

MoE: token → attention → router → selected experts A and C → weighted aggregation → next layer

Experts B and D are inactive for this token. Simplified top-2 routing among four experts.

A typical sparse MoE replaces selected FFNs with E expert networks. A trained router scores the token representation and selects k experts (top-k). Their outputs are combined using routing weights. Other layers, including attention, can remain shared; some architectures also use shared experts independently of routed selection. [1][2][6]

For example, if the router chooses expert A with weight 0.7 and C with weight 0.3, the layer may return 0.7 × A(x) + 0.3 × C(x). This illustrates normalized weights, not a universal algorithm. The next token or layer may select differently. Experts learn representations during training; they are not manually assigned coding, medical or legal specialists, or agents that invoke tools.

Top-k routing applies to a token representation in a particular layer, not to an entire request. Mixtral 8×7B selects two of eight experts, whereas Qwen3-30B-A3B selects eight of 128 in an MoE layer. These fractions do not determine the active parameter fraction of the full model because shared layers and routers also exist. Mixtral routing analysis shows patterns associated with syntax and repetition, not fixed experts dedicated to particular knowledge domains. [3][13]

Total versus active parameters

Example models and parameters
Model Architecture Total (billions) Active (billions, approx.)
Qwen3-32B Dense 32.8 Not reported
Qwen3-30B-A3B MoE 30.5 3.3
Mixtral 8×7B MoE ≈ 47 ≈ 13
DeepSeek-V3 MoE 671 37

With equally sized experts, an illustrative model has P_total = P_shared + E × P_expert and P_active ≈ P_shared + k × P_expert, where P_expert represents one expert's aggregate contribution across MoE layers and P_shared includes common components and routers. Assume 8 billion shared parameters, eight experts of 4 billion each and top-2 routing. Total: 40 billion; active: approximately 16 billion. This is a calculation model, not an actual library configuration.

In the general case, sum expert parameters separately for each layer: total parameters include every expert and the shared components, whereas active parameters include the selected experts and relevant shared components. Weight tying, embeddings, the output head and the counting convention for active parameters can affect reported values. Compare consistent counting conventions rather than relying on model names alone.

The ratio 16/40 = 40% is not the fraction of total FLOPs (floating-point operations), latency or energy. Attention, sequence length, routing, data movement, output and implementation change the result. The Mixtral paper reports approximately 47 billion total and 13 billion active parameters for Mixtral 8×7B; DeepSeek-V3 reports 671 and 37 billion respectively. Qwen3 includes dense and MoE variants. These illustrate architectures, not a quality ranking. [3][4][5][13][14]

Training and expert balancing

MoE increases capacity while limiting operations per token. The router must learn assignments that provide experts with useful training examples without concentrating excessive load. Auxiliary balancing objectives, capacity constraints or alternative strategies may be used. Exceeding capacity can result in token dropping, rerouting or extra work, depending on implementation. [1][2][4]

Artetxe and colleagues found computational benefits in several evaluated settings, but results varied by scale, domain and task. No result establishes universal MoE superiority. Training also requires optimizer state, gradients, activations, communication and checkpoints. For fine-tuning, verify expert adapter support, which layers change, routing balance and regressions outside the target domain. [8]

Expert capacity limits assignments within a group of tokens. Skipping expert processing does not necessarily remove a token from the sequence: its representation may still pass through a residual connection. MegaBlocks demonstrates block-sparse computation without this dropping or conventional fixed-capacity padding. DeepSeek-V3 primarily balances routing through score adjustments without an auxiliary loss, but retains a small complementary sequence-wise balancing loss. Its authors report no token dropping in their training and deployment. This is not a guarantee for other implementations. [2][4][12]

Artetxe and colleagues compared training under specific conditions: at modest budgets, similar results were achieved with roughly one quarter of the computation, but the gap narrowed with scale, and fine-tuning on the full task training set (full-shot fine-tuning) was an exception to the general compute-efficiency advantage. This does not imply fourfold faster inference or the same outcome for contemporary models. [8]

GPU memory and quantization

An ideal weight-only footprint is parameter count × bytes per parameter. Forty billion BF16 weights at two bytes each require 80 GB; a 16-billion dense model requires 32 GB. Ideal four-bit storage gives 20 and 8 GB respectively. These are decimal GB, not GiB, and exclude quantization scales, metadata, alignment and mixed data types.

In typical serving, all MoE weights must be accessible on devices or through an offloading mechanism. CPU RAM offload can lower VRAM usage at a latency cost. Include attention key-value (KV) cache, buffers, activations and concurrent requests. For conventional attention, KV memory depends on sequence length, layer count, KV head count, head dimension and precision; it is not determined by k. Other attention variants change this calculation. [6][7]

For a simplified KV cache of one active request, use 2 × L × S × H_kv × D × B: L is the number of attention layers, S stored tokens, H_kv KV heads, D head dimension and B bytes per element. With 32 layers, 8 KV heads, dimension 128, 4096 tokens and BF16 (2 bytes), the result is 536,870,912 bytes, or 0.5 GiB. Eight independent requests of that size require 4 GiB before allocation overhead. Prefix sharing, sliding windows, compression or other attention mechanisms can change the result. [6][10]

An illustrative 24 GB VRAM capacity is about 22.35 GiB if the vendor uses decimal GB. Ideal four-bit 40B weights occupy 20 GB, leaving only 4 GB (about 3.73 GiB) for other data. Eight independent contexts from the preceding KV example already need 4 GiB, so this configuration does not fit even before other overheads. This is an illustrative calculation, not a compatibility guarantee for a particular GPU. DeepSeek-V3 uses Multi-head Latent Attention (MLA), caching a compressed KV representation and a separate positional component; the conventional KV formula above does not directly describe that format. [4]

Inference and communication

Prefill processes the input sequence; decode generates subsequent tokens autoregressively. During single-request decoding, small token groups may underutilize GPUs, while larger groups improve weight reuse but may increase queuing and latency. Expert assignments affect both phases. Active parameters alone cannot predict speed. [6][9]

Expert Parallelism (EP) distributes experts across devices; tokens travel to selected experts and back for aggregation, often using all-to-all communication. Tensor Parallelism (TP) partitions matrix computation and Data Parallelism (DP) distributes work across replicas or groups. These strategies can be combined. Skewed routing creates bottlenecks; vLLM offers expert load-balancing mechanisms. Verify GPU topology, interconnect bandwidth and kernel support. [6][7]

Decoding can be limited by memory bandwidth rather than operation count. Different expert assignments reduce weight reuse in small token groups; memory occupied by the full expert pool reduces room for KV cache. A preprint by Adhinarayanan and Jayasena analyzes these two effects, but conclusions depend on the model, configuration and workload. Replicating experts to balance load can improve throughput at the cost of additional memory. [7][9]

Deployment cost and cost per accepted result

Illustrative monthly cost
Metric Dense MoE
GPU-hours 100 140
Accepted tasks 9 000 9 500
Cost (USD) 200 280
Cost per accepted result (USD) 0.0222 0.0295

Suppose two deployments each process 10,000 tasks per month at USD 2 per GPU-hour. Dense consumes 100 GPU-hours and delivers 9,000 accepted results; MoE consumes 140 and delivers 9,500. Costs are USD 200 and USD 280, or about USD 0.0222 and USD 0.0295 per accepted result. GPU-hours sum time across devices: two GPUs for one hour consume two GPU-hours.

The additional 500 accepted results cost USD 80, or USD 0.16 per extra result. With other costs and effects equal, incremental value above that threshold justifies MoE in this example. This is neither a benchmark nor a price quote. Include memory, spare capacity, energy (unless included), networking, operations and retries. Hosted API charges follow provider tariffs rather than active weights. Include input and output tokens and available cache discounts.

How to compare the models?

Define tasks, test data, languages, quality criteria and acceptable risk. Separate experiments at similar active parameter counts, at the same hardware budget and at equivalent quality. These are different comparisons. Keep generation settings, input/output lengths, quantization level, hardware, runtime version and traffic distribution comparable. Repeat measurements, include warmup and report cold starts separately.

Measure time to first token (TTFT), inter-token latency (ITL), end-to-end task time, p50 and p95, per-request and aggregate tokens/s, peak memory, rejections and cost per accepted result. For MoE, monitor token distribution across experts and communication. Test short and long inputs, low and high concurrency and overload. Compare acceptable answer rates within serving constraints, not just peak throughput. [7][10]

Before measuring, define service-level objectives (SLOs). For example, count the fraction of correct responses delivered within the specified time and the number of such responses per second (quality-qualified goodput). Test fixed concurrency separately from a controlled arrival rate; include queues, errors and timeouts. Compare identical tasks, not necessarily identical token counts, because tokenizers and generated lengths may differ. Record model revision, weight format, engine, generation settings, parallelism and memory utilization. [10][15]

When should you choose dense or MoE?

For a local assistant with limited GPU memory, start with a dense model that fits together with its KV cache. A smaller MoE can also work if the runtime supports it and measured latency meets requirements. For a service processing many concurrent tasks across GPUs, consider MoE after comparing quality, expert placement and interconnect throughput.

MoE does not replace RAG, fine-tuning, context windows or agent architecture. Nor does it provide authorization or data isolation. Check the specific weight license, artifact provenance, runtime dependencies and data handling. Keep independent validation, limits and access controls in the application. Start with the simplest solution meeting requirements and scale only when measurements support the change.

For the separate decision about retrieval, adaptation and context length, see the related POLPROG article on RAG, fine-tuning and long context. [11]

Select an architecture based on quality, total memory requirements, latency and cost per accepted result. MoE scales capacity through conditional computation, but efficiency depends on deployment. Dense remains a valuable and often simpler baseline. Instead of comparing parameter counts alone, measure real workloads and verify product requirements.

Tools for this topic

Mixture of Experts MoE Dense Models LLM AI Architecture AI Costs Context Window Expert Routing Inference GPU Memory Quantization Expert Parallelism AI Evals

Frequently asked questions

Is MoE faster than dense?

Not always. Weight size, memory, hardware, routing, token grouping and context length matter.

Does a 40B model with 16B active need memory like a dense 16B model?

No. At the same precision, complete 40B weights occupy approximately 2.5 times the space of 16B; calculate extra buffers separately.

Are experts separate AI models?

Usually not. They are subnetworks within selected layers of one model, not independent agents.

Does quantization work with MoE?

Yes, when the format and runtime support the architecture; savings and quality depend on implementation.

Do active parameters determine API price?

No. Providers set tariffs, and self-hosted cost depends on the entire infrastructure.

Can MoE be fine-tuned?

Yes. Choose a compatible method and runtime, then test routing, quality and memory effects.

Sources and references

  1. Shazeer et al., Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer↩1↩2↩3
  2. Fedus et al., Switch Transformers↩1↩2↩3↩4
  3. Jiang et al., Mixtral of Experts↩1↩2
  4. DeepSeek AI, DeepSeek-V3 Technical Report↩1↩2↩3↩4
  5. Qwen Team, Qwen3↩
  6. Hugging Face, Mixture of Experts (MoEs) in Transformers↩1↩2↩3↩4↩5
  7. vLLM, Expert Parallel Deployment↩1↩2↩3↩4
  8. Artetxe et al., Efficient Large Scale Language Modeling with Mixtures of Experts↩1↩2
  9. Adhinarayanan and Jayasena, The qs Inequality: Quantifying the Double Penalty of Mixture-of-Experts at Inference (preprint)↩1↩2
  10. vLLM, Metrics↩1↩2↩3
  11. POLPROG, RAG vs Fine-tuning vs Long Context↩
  12. Gale et al., MegaBlocks: Efficient Sparse Training with Mixture-of-Experts↩
  13. Qwen, Qwen3-30B-A3B model card↩1↩2
  14. Qwen, Qwen3-32B model card↩
  15. GuideLLM, Goodput SLO↩

Was this helpful?

Get new articles by email

One short email per new Learning article. No spam, unsubscribe in one click.

We only use your email to send new articles. No third-party sharing.

Back to Learning