← Back to Blog

What Is MoE Routing? How Mixture-of-Experts Models Cut Inference Costs 60-80%

By Eric Bush · July 7, 2026 · 8 min read

Network of branching fiber optic paths representing neural routing

The Core Idea: Why Activate Everything When You Only Need a Few Experts?

Traditional dense transformer models activate every single parameter for every token processed. A 200B parameter dense model uses all 200 billion parameters whether you're asking it to write a haiku or refactor a complex distributed system. This is wildly inefficient — like turning on every light in a skyscraper to illuminate one office.

Mixture-of-Experts (MoE) models solve this by splitting the feed-forward layers into dozens or hundreds of smaller "expert" sub-networks, then using a routing mechanism to activate only a handful of experts for each token. The result: a model with massive total capacity but dramatically lower per-token compute cost.

For AI coding tools, this translates directly to cheaper API calls. When a model only fires 10-15% of its parameters per token, the provider's GPU costs drop proportionally — and those savings get passed to you.

How MoE Routing Works: Top-K Expert Selection

The routing mechanism sits at the heart of every MoE layer. Here's the step-by-step process for each token:

  • Gate computation: A small neural network (the "router" or "gate") takes the token's hidden state as input and outputs a probability score for each expert.
  • Top-K selection: Only the K experts with the highest scores are selected. Typical values are K=2 (used in Mixtral) or K=8 (used in DeepSeek V3/V4).
  • Weighted combination: The selected experts process the token independently, and their outputs are combined using the router's probability scores as weights.
  • Sparse activation: All non-selected experts perform zero computation for that token — their parameters sit idle.

For a model with 256 experts and top-8 routing, each token only activates 3.1% of the expert parameters. When you add the shared attention layers (which all tokens pass through), total active parameters typically land at 10-15% of the full model size.

Load Balancing: Preventing Expert Collapse

Naive routing creates a critical problem: the router learns to send most tokens to a small handful of "popular" experts while others atrophy from disuse. This is called expert collapse — the model effectively degenerates into a much smaller dense model, losing the capacity benefits of MoE.

The solution is a load balancing loss added during training. This auxiliary loss penalizes uneven expert utilization by measuring two things:

  • Fraction of tokens routed to each expert: Ideally uniform (1/N for N experts).
  • Average routing probability per expert: Prevents the gate from assigning high confidence to few experts.

The load balancing coefficient is typically small (0.01-0.1) to avoid overpowering the main training objective, but it's enough to keep expert utilization relatively even. DeepSeek V4 additionally uses an auxiliary-loss-free approach with bias terms that gently steer tokens toward underutilized experts without degrading model quality.

Capacity Factors: The Throughput Limiter

In production inference, each expert has a capacity factor — the maximum number of tokens it can process in a single batch. If an expert receives more tokens than its capacity allows, overflow tokens are either dropped or rerouted to a second-choice expert.

Capacity factor = (tokens_per_expert × capacity_multiplier) / batch_size. A capacity factor of 1.0 means each expert handles exactly its fair share. In practice, values of 1.25-1.5 are used to accommodate natural routing imbalance without dropping too many tokens.

This matters for cost because tighter capacity factors mean more predictable memory allocation per expert, enabling providers to pack more concurrent requests onto the same hardware — directly reducing per-token serving costs.

Real-World MoE Models: The Numbers That Matter

Let's look at concrete MoE architectures shipping today and what the sparsity means for cost:

Model Total Params Active Params Experts Active %
DeepSeek V4 671B 37B 256 (top-8) 5.5%
LongCat 2.0 1.6T 48B 512 (top-8) 3.0%
Mixtral 8x22B 176B 44B 8 (top-2) 25%
Grok-3 314B ~80B 16 (top-2) ~25%

DeepSeek V4 is the standout example: 671 billion total parameters but only 37 billion active per token. This means it achieves performance competitive with dense models in the 200B+ range while using compute equivalent to a ~37B model. The cost savings are enormous — DeepSeek V4's API pricing is $0.27/$1.10 per million tokens (input/output), roughly 80% cheaper than comparably capable dense models.

LongCat 2.0 pushes this even further: 1.6 trillion total parameters with only 48B active, achieving a 3% activation ratio. At this sparsity level, the model stores enormous knowledge capacity while keeping per-request compute costs in line with mid-tier dense models.

Quantifying Cost Savings: MoE vs Dense Equivalents

The cost advantage of MoE comes from a simple relationship: inference FLOPs scale with active parameters, not total parameters. A 671B MoE model with 37B active uses roughly the same compute per token as a 37B dense model — but delivers quality closer to a 200B+ dense model.

Here's the cost math for a team generating 50 million tokens per day in coding tasks:

  • Dense 200B model (hypothetical, ~$4/$12 per M tokens): $200 input + $600 output = $800/day
  • DeepSeek V4 671B MoE ($0.27/$1.10 per M tokens): $13.50 input + $55 output = $68.50/day
  • Savings: ~91% cost reduction with comparable or better quality on coding benchmarks

Even comparing against more moderately priced dense models like Claude Sonnet 4 ($3/$15 per M tokens = $150 + $750 = $900/day), the MoE model delivers 92% savings. The tradeoff is that MoE models require more total VRAM for their full parameter set, making them harder to self-host — but for API consumers, that's the provider's problem.

Why MoE Matters for AI Coding Specifically

Coding tasks are uniquely well-suited to MoE because they involve highly varied sub-tasks: understanding natural language requirements, reasoning about architecture, generating syntax in specific languages, debugging error messages, and writing tests. Different experts can specialize in different aspects of the coding workflow.

Additionally, coding agents generate large volumes of tokens (often 100K+ per complex task), making per-token cost savings compound rapidly. A team running 200 agent sessions per day sees MoE savings in the thousands of dollars monthly.

Limitations and Tradeoffs

MoE isn't free magic. Key tradeoffs include:

  • Memory requirements: All parameters must be loaded into VRAM even though only a fraction are active. DeepSeek V4 requires ~1.2TB VRAM just for model weights in FP16.
  • Communication overhead: In distributed inference across multiple GPUs, routing tokens to the correct expert requires all-to-all communication that can bottleneck throughput.
  • Batch efficiency: Small batches may underutilize experts. MoE models perform best at scale with large request volumes.
  • Training instability: The router can be finicky to train, requiring careful hyperparameter tuning of load balancing coefficients.

For API consumers, these tradeoffs are invisible — they only see the cost-per-token price. But they explain why MoE models are predominantly offered by large providers with massive GPU clusters, not small self-hosted setups.

The Bottom Line for Your AI Coding Budget

MoE routing is the single most impactful architecture innovation for reducing inference costs. By activating only the experts needed for each token, these models deliver frontier-quality coding assistance at a fraction of dense model pricing. When selecting models for your AI coding workflow, check whether a model is MoE — it's often the difference between $0.27 and $3.00 per million input tokens.

Use our AI Cost Estimator to compare MoE and dense model pricing for your specific project size and see exactly how much routing-based sparsity can save your team.

Want to calculate exact costs for your project?

Frequently Asked Questions

What is Mixture-of-Experts (MoE) routing in LLMs?

MoE routing is a mechanism where a small neural network (the router/gate) selects only a few expert sub-networks to process each token, rather than activating all model parameters. This dramatically reduces compute per token while maintaining model quality through massive total parameter capacity.

How much do MoE models save compared to dense models?

MoE models typically save 60-80% on inference costs compared to dense models of equivalent quality. For example, DeepSeek V4 (671B MoE, 37B active) costs $0.27/$1.10 per million tokens versus $3-5/$15-25 for comparably capable dense models.

What does 'top-K expert selection' mean?

Top-K selection means only the K experts with the highest router scores are activated for each token. Common values are K=2 (Mixtral) or K=8 (DeepSeek V4). Lower K means more sparsity and lower cost, but potentially less quality per token.

Why do MoE models need load balancing?

Without load balancing, the router learns to send most tokens to a few popular experts while others go unused (expert collapse). Load balancing loss penalizes uneven utilization during training, ensuring all experts contribute and the full parameter capacity is leveraged.

Can I self-host MoE models to save even more?

Self-hosting MoE models is challenging because all parameters must fit in VRAM even though only a fraction are active per token. DeepSeek V4 requires ~1.2TB VRAM. For most teams, using MoE models via API is more cost-effective than the hardware investment needed to self-host.