Mixture of Experts and Post-Training: A Developer's Guide to LLM Selection
Large language model parameter counts continue to grow, but total parameters alone do not indicate inference cost. This guide explains how developers should evaluate sparse activation, active versus total parameters, post-training data reporting, thinking-token reduction, long-context memory trade-offs, and long-running agents. It closes with practical selection criteria based on verifiable technical details and measured accuracy, latency, and per-task cost.
Large language model parameter counts continue to grow, but total parameter count alone does not directly indicate inference cost. When selecting a model, developers need to distinguish between total parameters, active parameters, post-training data, and long-context capabilities. This article focuses on verifiable technical principles; unconfirmed online figures are not treated as conclusions.
1. Sparse Activation: Total Parameters vs. Active Parameters
In a dense model, the forward computation for every token passes through all parameters. Compute is roughly proportional to parameter count: if parameters double, per-token compute also roughly doubles.
A Mixture of Experts (MoE) model splits the feed-forward layer into multiple experts. A router network selects a small number of experts to participate in computation for each token. As a result, the model can have a very large total parameter count while only a subset of parameters is actually used for each token.
This design has boundaries. Routing adds extra computation, and when load is uneven across experts, some devices may sit idle. In multi-GPU deployment, memory still needs to hold all expert weights, so total parameter count still affects the deployment threshold. When evaluating cost, look at active parameters, memory footprint, and actual throughput together.
2. Post-Training: Data Scale Depends on Reporting Methodology
Post-training typically includes methods such as instruction tuning and reinforcement learning from human feedback (RLHF). It determines how the model follows instructions and how it performs in tool calling and multi-turn conversations.
When comparing post-training data scale between two models, several details need to be confirmed. Are tokens counted from raw text, or does the count include synthetic data? Is the data deduplicated? Does it include multi-turn conversations and tool-call traces? What is the domain mix? Without these definitions, two numbers cannot be compared directly. Data scale without official documentation should be treated as unverified information.
3. Reducing Thinking Tokens: One Path to Lower Cost
Before producing a final answer, reasoning models often generate a large number of intermediate reasoning tokens. These tokens are billed and also increase response latency.
Self-distillation is a common approach. A stronger model or a longer reasoning chain acts as the teacher, and the student model learns to produce a shorter reasoning process while preserving answer correctness.
When reducing thinking tokens, do not look only at the drop in length. Record three metrics together: task accuracy, end-to-end latency, and per-task cost. Optimization is valuable only when accuracy remains roughly unchanged while cost and latency decrease. Different tasks require different reasoning lengths, so the maximum thinking-token limit should be set after testing on the target task.
The pseudo-code below shows the loop structure for an agent that fixes bugs. It is not directly runnable, and its key functions need to be implemented by specific tools.
# Pseudocode: loop structure for an agent iteratively fixing a bugMAX_STEPS = 10 # Maximum steps to prevent an infinite loopdef fix_bug_with_agent(model, file_path, bug_report, run_tests):context = read_file(file_path)history = []for step in range(MAX_STEPS):reasoning = model.generate(prompt=f"Bug: {bug_report}\nContext: {context}",max_thinking_tokens=500, # Illustrative value; adjust based on task testing)action = parse_action(reasoning) # Parse model output into a structured actionresult = execute(action) # Modify code or run commands in an isolated sandboxhistory.append((reasoning, result))if run_tests() == "pass": # Use test results to determine whether the bug is fixedreturn historycontext = update_context(context, result)raise RuntimeError("Reached maximum steps without fixing the bug; manual intervention required")
When executing modification actions, run them in an isolated environment and restrict accessible files and commands. Actions generated by the model should not directly receive production environment permissions.
4. Long Context: Memory and Retrieval Trade-Offs
At the million-token context level, the main challenge is KV cache usage. KV cache memory grows with sequence length, and the more concurrent requests there are, the greater the pressure.
PagedAttention divides the KV cache into blocks for management, reducing memory fragmentation and making it suitable for high-concurrency inference services. Ring Attention distributes long sequences across multiple devices for computation, making it suitable when a single sequence exceeds single-GPU capacity, but inter-device communication overhead is relatively high. The two approaches solve different problems and should be selected based on request characteristics.
Long context also does not have to replace retrieval. Passing all documents in at once increases latency and cost. Retrieval-augmented generation (RAG) first filters relevant snippets and then passes them to the model, which is usually more economical. When combining the two, what enters the context and how long it is retained should be determined by evaluation results.
5. Long-Running Agents: A Checkable Capability Checklist
A long-running agent is an agent that executes tasks across multiple steps. To judge whether it is ready for use, check the following five items:
- State persistence: Are task progress and intermediate results stored in external storage, and can the task recover after a process interruption?
- Error recovery: When a tool call fails, is there a retry, rollback, or reporting mechanism?
- Context trimming: When history exceeds the window, which information is kept and which is discarded, and are there clear rules?
- Tool-call auditing: Are the parameters, return values, and latency of each call logged, and can they be replayed?
- Permission control: Have the files, network access, and commands available to the agent been reduced to the minimum necessary scope?
6. Three Selection Judgments
First, compare active parameters and deployment cost, not only total parameters.
Second, verify the reporting methodology, domain coverage, and evaluation results of post-training data, and prioritize official model cards or papers.
Third, evaluate with your own long-context and agent tasks, record accuracy, latency, and per-task cost, and then make decisions based on measured data.
On the infrastructure side, multi-node inference usually requires container orchestration, high-speed networking, and monitoring and alerting. The specific approach should be chosen based on the team’s existing cloud environment and operations capabilities.
Parameter scale is only a starting point. Understanding the computational boundaries of sparse activation, verifying the reporting methodology of training data, and measuring inference cost with real tests are what allow you to judge whether a model fits your business.
