Dense vs. MoE: Choosing the Right LLM for AI Agents
How Mixture-of-Experts models work, why active parameters matter, and what to consider when choosing an LLM for a real agent.
If you've been building AI agents, you've probably faced this question: which model should I actually use?
You want a model that reasons well, follows instructions and uses tools correctly, at low latency and cost. Those goals don't always go together, especially in agents, where a single request can mean many LLM calls.
One architecture makes this trade-off interesting: Mixture-of-Experts (MoE). Here's what it means when you're choosing a model.
Dense models: every token uses the same weights
A model's parameters are the learned values that make it up. More of them generally means more capacity, if the model is trained well.
In a conventional dense transformer, each layer's feed-forward network uses the same weights for every token. That's regular and predictable, which hardware likes. But computation per token generally grows with model size, and an agent pays that cost on every call.
So the practical question is: how can we increase capacity without increasing computation at the same rate?
How MoE works
An MoE layer replaces one large feed-forward network with many smaller ones, called experts. A router scores them for each token and activates only a few.
A few details are easy to get wrong:
- Experts aren't subject specialists. There's no "coding expert" or "maths expert". Their specializations are learned, and are usually subtler than that.
- Routing happens per token, per layer. A request isn't assigned to one expert, and the same token can use different experts in different layers.
- Not every layer has to be MoE. Many architectures mix dense components with MoE layers.
A real example: DeepSeek-V3
| Specification | DeepSeek-V3 |
|---|---|
| Total parameters | 671 billion |
| Active parameters per token | About 37 billion |
| Routed experts per MoE layer | 256 |
| Selected per token | 8, plus 1 shared expert |
Total parameters describe how much learned capacity a model has. Active parameters describe how much of it works on each token.
Does that make it faster?
Not automatically. 37B active parameters doesn't mean it behaves like a 37B dense model:
- Memory. The full set of weights still has to be stored. 671B parameters at two bytes each is about 1.34 TB before caches and buffers, though quantization can reduce that.
- Communication. Experts may sit on different GPUs, so a token's hidden state has to travel between them.
- Batching. Tokens scattered across many experts can mean small batches and lower GPU utilization.
What MoE does is let capacity grow without per-token computation growing in proportion. Whether that becomes better latency or cost has to be measured.
Why this matters for agents
Ask a research agent to compare three databases and recommend one. It might work out the requirements, search documentation, retrieve information, compare the options, weigh the trade-offs and write a recommendation. That could be 10 LLM calls, and the delays add up.
But a faster model isn't necessarily a faster agent. If Model A answers in two seconds but often needs retries, and Model B takes four seconds but gets it right the first time, Model B may still win on both latency and cost.
What the research says
An October 2026 paper compared dense and MoE models on automated program repair: 130 bugs, on the same local hardware. Speed here is relative to the fastest model.
| Model | Active | Correct | Speed |
|---|---|---|---|
| Qwen2.5-Coder-3B (dense) | 3B | 15.4% | 1.00 |
| Qwen2.5-Coder-7B (dense) | 7B | 30.8% | 0.48 |
| Qwen2.5-Coder-14B (dense) | 14B | 40.0% | 0.24 |
| DeepSeek-Coder-V2-Lite (MoE) | 2.4B | 32.3% | 0.81 |
The MoE model has 16B parameters in total, yet generated about 3.4 times faster than the 14B dense model in this setup. Its correctness wasn't significantly different from the 7B or 14B models, though that doesn't prove they're equally capable.
The finding I found most useful is that quality isn't one number. When the researchers scored correctness, maintainability, security and efficiency together, the rankings changed with how those were weighted. The best model depends on what you're optimizing for.
There are limits. It's one MoE model on small code-repair tasks, and it measured token throughput rather than complete agent latency. It also tested DeepSeek-Coder-V2-Lite, not DeepSeek-V3. So it doesn't show MoE is universally better, only that total parameter count can mislead.
How I'd evaluate a model for an agent
I wouldn't start with parameter count. I'd define the task and its constraints, then test candidates on these:
| Check | What I'd want to know |
|---|---|
| Task success | Does it complete representative tasks correctly? |
| Tool calling | Does it pick the right tool, pass valid arguments and recover from errors? |
| End-to-end latency | How long from request to finished task, not just tokens per second? |
| Cost per successful task | Total evaluation cost ÷ successful tasks, retries included |
| Deployment | What do memory, GPU use and concurrency look like on my hardware? |
A cheaper model with poor reliability can end up costing more per completed task.
When I'd choose each
- Dense for smaller, simpler deployments. A quantized 7B model may be perfectly adequate for extraction, classification or simple tool routing, and it's easier to plan for.
- MoE when you need more capacity while controlling per-token computation, and can handle the serving complexity.
- Both when the workflow suits it: a small model for routing, and a larger one for complex reasoning.
Neither guarantees stronger reasoning, better tool use or lower latency. Those still have to be evaluated.
The takeaway
What first caught my attention was the gap between 671B total and 37B active parameters. But the more useful lesson is that choosing an LLM isn't about the strongest benchmark score. It's about how the model behaves inside the complete system.
The goal isn't necessarily to use the largest or fastest LLM. It's to choose the model that completes the task reliably within the performance and cost constraints of the system.
References
- Beyond the Leaderboard: Multi-Dimensional Evaluation of Dense and Mixture-of-Experts Models for Automated Program Repair, Anvi Kalpesh Shah and Umamaheswara Sharma B, October 2026.
- DeepSeek-V3 Technical Report, DeepSeek-AI, December 2024.
- DeepSeek-V3 model repository.