Mixture-of-Experts Model Merging: How It Works, the Workflow, and a Practical Checklist
Merging pretrained mixture-of-experts (MoE) models offers a low-cost way to combine the deep reasoning of long chain-of-thought models with the concise output of efficient general-purpose models—without any fine-tuning or retraining. This article explains why MoE architectures are well suited to weight merging, walks through the full merging workflow including coefficient search, compares selective merging strategies per layer type, and provides an engineering checklist covering structure validation, licensing, and go/no-go evaluation criteria.
Mixture-of-Experts Model Merging: How It Works, the Workflow, and a Practical Checklist
1. Background: The Efficiency Problem with Reasoning Models
In recent years, large language models have made clear progress on complex reasoning tasks such as mathematics and science QA. One class of models—reasoning models—improves accuracy by generating longer chains of thought. The cost is that they produce large volumes of intermediate reasoning tokens before giving a final answer, which increases response latency and compute cost, and puts pressure on the throughput and user experience of online services.
Another class of general-purpose base models typically uses a mixture-of-experts (MoE) architecture. They answer concisely and follow instructions well, but are relatively conservative in deep reasoning. Each type involves a trade-off: reasoning models produce more reliable answers but verbose output, while general models produce polished output but shallower reasoning. Can we combine the strengths of both without expensive fine-tuning or retraining? That is the problem model merging addresses.
2. What Is Model Merging?
Model merging refers to performing direct arithmetic operations on the weights of multiple pretrained models to produce a new model. It does not update gradients and requires no training data. Its core operations fall into three categories: linear interpolation of expert tensors, synchronized merging of router weights, and source selection for shared layers and attention layers.
The main advantage is low cost. The main drawback is that the result is unpredictable, so validation is essential. Whether a merged model is usable depends on whether the parent models are structurally compatible and whether the coefficients have been vetted through evaluation.
3. Why MoE Architectures Are Well Suited to Weight Merging
A mixture-of-experts architecture splits the feed-forward network into multiple expert subnetworks, with a router selecting a small number of experts to activate for each token. This structure distributes capabilities modularly at the parameter level. In two models with identical structure, experts at the same layer and same index may serve similar functions—for example, handling code-related intermediate representations.
It is important to note that “experts at corresponding positions serve similar functions” is a hypothesis that must be verified, not an established fact. Two models may develop different expert specializations during training, and experts with the same index need not correspond to the same function. Therefore, before merging any layer, perform the following checks:
- Prepare a probe set that covers the target capabilities—for example, a mix of math problems, coding tasks, and general conversation.
- Record each expert’s activation frequency on the probe set and compare the activation distributions of experts at the same position across parent models.
- For the same batch of inputs, compare the output similarity of corresponding experts, using metrics such as cosine similarity or CKA.
- If similarity at a given position is notably low, do not interpolate that position; instead, keep a single parent model’s expert or perform only selective replacement.
Skipping these checks and merging directly commonly leads to failures such as: misaligned expert functions causing clear degradation on certain task types, and imbalanced routing where a few experts absorb excessive load.
4. The Merging Workflow and Coefficient Search
The compute cost of merging scales linearly with the total number of elements in the parameter tensors. The main operations are reading tensors, computing weighted sums, and writing results back to disk. Actual runtime is more often limited by disk read speed, memory bandwidth, and storage write speed than by the arithmetic itself. Before merging, confirm that machine memory can hold all tensors required for at least one layer at a time.
The following code shows the interpolation logic for a single expert tensor. The weight values are illustrative only; actual coefficients must be obtained through search.
# Illustrative code: w holds demo initial values; actual coefficients# should be determined by search on a validation setdef merge_expert(t_a, t_b, t_c, w=(0.5, 0.25, 0.25)):"""Weighted linear combination of three expert tensors at the sameposition; all three must have identical shapes"""assert t_a.shape == t_b.shape == t_c.shapereturn w[0] * t_a + w[1] * t_b + w[2] * t_c
The full workflow can be executed as follows:
1. Validate structural parameters: layer count, expert count, hiddendimension, activated experts per token, routing type, tokenizer2. For each layer:- Shared layers and attention layers: select directly from thedesignated source- Routed expert tensors: linear interpolation using candidatecoefficients- Router weights: merge in sync with the experts using the samecoefficient set3. Evaluate on the validation set, recording per-benchmark scores andoutput lengths4. Update coefficients according to the search strategy, repeat steps 2and 3, for at most N rounds (N determined by compute budget)5. If a key metric falls below the rollback threshold, revert to theprevious version of the coefficients
Coefficient search can use grid search or Bayesian optimization. Grid search suits cases with few parent models and low coefficient dimensionality. When coefficients are high-dimensional, search on a few representative layers first, then generalize the results to all layers. The rollback threshold should be defined before you start—for example, failing if a key benchmark drops below the strongest parent model by more than a preset margin. The specific threshold values must be set by the team according to business requirements.
5. Comparing Selective Merging Strategies
Not every layer needs interpolation. The table below lists three common treatments and the corresponding validation focus.
| Layer type | Typical source | Treatment | Validation focus | Notes |
|---|---|---|---|---|
| Shared and attention layers | Usually the parent model with more concise responses | Inherit wholesale, no interpolation | Output length distribution, instruction following | Direct inheritance controls generation style, but reasoning capability may be limited |
| Routed expert tensors | Multiple reasoning models | Linear interpolation by coefficients | Per-benchmark reasoning scores, expert activation distributions | Must pass functional alignment checks first |
| Router weights | Same sources as the experts | Merged in sync with experts | Routing entropy, expert load balance | Do not reuse a single parent model’s router as-is |
Router weights deserve special attention. After expert tensors are merged, if the router still uses a single parent model’s parameters, the routing distribution may not match the new experts’ functions, and performance can drop significantly. The router should therefore use the same sources and coefficients as the experts.
6. Three-Way Fusion: Approach and Boundaries
Three-way fusion means using three parent models as merging sources, with each contributing a different capability dimension. One common configuration is shown below; it is illustrative only and not a best practice.
| Source model type | Expected contribution | Merging strategy emphasis | Basis for weight determination |
|---|---|---|---|
| Newer reasoning model | Deep reasoning | Higher weight in expert layers | Scores on per-benchmark tests such as math and code |
| Older reasoning model | Structured reasoning patterns | Medium weight in expert layers | Performance on metrics such as reasoning-step consistency |
| Efficient general model | Concise output and instruction following | Dominates attention and shared layers | Output length and instruction-following test results |
Weights are determined as follows. First, test each parent model individually on each benchmark and use the per-benchmark scores as the basis for initial weights. Then search within the candidate coefficient ranges for the combination that performs best on the aggregate metric without violating the rollback threshold. Weights obtained this way are grounded in measured results and should not be set on experience alone.
Regarding efficiency and accuracy gains, this article does not provide specific numbers. Any gain figures must be measured under clearly stated conditions, including benchmark name, hardware model, batch size, generation length limit, and inference framework version. Reported results should also include error ranges from repeated experiments. Gain figures lacking these conditions should not be used for capacity planning or cost estimation.
7. Engineering Checklist
Before merging, confirm each of the following items:
- Layer count, total expert count, and hidden dimension must match exactly.
- The number of experts activated per token (top-k) must match.
- Routing type must match—for example, both using softmax with top-k, or both using sigmoid with normalization.
- Tokenizer and vocabulary must match, including special token IDs.
- Key fields in the config files should be compared one by one, such as positional encoding, normalization type, and activation function.
- Weight numerical precision (dtype) must be unified. If not, convert to a common precision first and record the error introduced by the conversion.
- The inference framework version must be confirmed; the merged model should load and run inference correctly on the target version.
- The weight licenses of each parent model must be reviewed individually.
Handling strategies for inconsistencies are as follows. If layer count, hidden dimension, expert count, or tokenizer mismatch, reject the merge outright, because position-wise interpolation is meaningless. If routing types mismatch, unify the routing function and re-evaluate; if unification is impossible, reject the merge. If precision mismatch, unify precision, merge, and record the evaluation differences caused by the conversion. If framework versions mismatch, complete loading and inference testing on the target version first, and only proceed to evaluation after passing.
8. Licensing and Compliance
The license obligations of a derived model depend on the license terms of each parent model. Common permissive licenses such as Apache-2.0 and MIT generally allow derivation and redistribution, but require retaining copyright notices and license text. Some models use custom community licenses that may impose restrictions on commercial scale, fields of use, or redistribution methods—read these terms carefully, item by item.
When redistributing a merged model, state the parent model sources and their respective license terms. If the model is intended for commercial deployment, have legal counsel review it to confirm that all parent models’ terms can be satisfied in combination.
9. How to Judge Whether the Merged Model Is Usable
Before deploying a merged model, check at least the following metrics and compare them against the parent models:
- Per-benchmark scores: report math, code, and instruction following separately.
- Output length distribution: median, 90th percentile, and the proportion of overlong outputs.
- Latency metrics: time-to-first-token and end-to-end latency, tested under the same conditions as the parent models.
- Routing load: activation ratio of each expert, checking for obvious hot experts or chronically idle ones.
- Online error rate: proportion of format errors, refusals, or abnormal truncations.
Deployment thresholds should be set before merging. For example, you might require that key benchmarks stay at or above a defined ratio of a parent model’s score, while output length distribution stays within a target. Once thresholds are set, decide whether to deploy based on evaluation results.
10. Conclusion
Model merging offers a low-training-cost option for reasoning services. It rests on three prerequisites: structural parameters that match exactly, expert alignment that has been verified, and coefficients determined by measured results. If any one prerequisite is missing, the merged model may be unusable.
In practice, start with a pair of structurally identical parent models, complete functional alignment and coefficient search following the checklist in this article, then gradually add more source models. At every step, keep evaluation records and rollback versions so that problems can be quickly recovered from.
