M5 - Merging with mergekit
Combine an abliterated model with a stronger baseline through weight arithmetic. No training, only tensor math. Charles Goddard's mergekit is the tool covered here, DavidAU's MoE constructions the extreme case.
M5 obtains an uncensored model not by abliterating it directly but by merging an already-abliterated model with one or more other models. The refusal-free behavior can transfer into the merged result through weight arithmetic. mergekit, maintained by Arcee AI and created by Charles Goddard, is the tool covered here. Common algorithms: SLERP (two-model blend), TIES and DARE (multi-model with sparsification), task_arithmetic (add/subtract capabilities), passthrough (build a larger frankenmerge). No training required, only enough memory to hold the tensors.
- How weight merging propagates abliteration into new models without retraining
- Five mergekit algorithms, with config examples
- Charles Goddard, mergekit's history, and the license landscape (LGPL, BUSL-1.1, LGPL again)
- DavidAU's MoE constructions and why they document what they do
- The provenance problem: when 'abliterated' describes a distant ancestor
- When merging loses the abliteration and how to fix it
What M5 is
M5 obtains an uncensored model not by abliterating it directly but by merging an already-abliterated model with one or more other models, so the refusal-free behavior can transfer into the merged result through weight arithmetic. The abliteration is performed once - on one of the ingredients - and propagated into an arbitrary number of downstream merges without ever being redone.
Model merging combines the weights of two or more models, which must share an architecture, into a single model without any training. The mechanism is arithmetic on weight tensors: average them, blend along a curved path, sparsify and reconcile differences, drop random components. Each algorithm is a different way of doing that arithmetic. Except with passthrough, the result is a new model file the same size as its inputs - no gradient descent, no optimizer state, no training run.
The point for M5 specifically: if model A is abliterated and model B is a strong general model, a merge of A and B can inherit A's refusal-free behavior and B's capability. The refusal-removal was encoded in A's weights as a specific edit, and the merge partly carries that edit through. This is why the abliteration catalog contains 331 merges whose "abliterated" label can come from an ancestor several merges deep in the family tree.
What you need before starting
- Two or more compatible models. Same architecture and tokenizer family for most algorithms. At least one abliterated, if you want the merge to inherit refusal-free behavior.
- Hardware. mergekit uses an out-of-core approach and lazy tensor loading for low memory use, and merges can run entirely on CPU or be accelerated with as little as 8 GB of VRAM.
The tool
mergekit, maintained by Arcee AI, is the tool covered here. As of 2026-11-08 the GitHub repository has 7,440 stars and 803 forks, per api.github.com/repos/arcee-ai/mergekit. Created by Charles Goddard (GitHub username cg123). He joined Arcee, where the project is now housed.
Licensing caveat worth knowing: mergekit's history is mixed. Its legacy release notes state that "later versions of mergekit are licensed under the LGPL" (with legacy scripts MIT). In February 2025 (v0.1) it switched to BUSL-1.1 (Business Source License 1.1), and in October 2025 it returned to LGPL-3.0 (commit "Return to LGPL (#638)"); the current pyproject.toml declares LGPL-3.0-only. Check the license in the exact version you install before any commercial use.
$ git clone https://github.com/arcee-ai/mergekit $ cd mergekit $ pip install -e . # provides CLIs including: # mergekit-yaml ← single-config merges # mergekit-moe ← mixture-of-experts # python >= 3.10 # CPU is the default. add --cuda to any # merge command for GPU acceleration. # license note: LGPL-3.0-only in current # pyproject.toml (BUSL-1.1 in Feb-Oct # 2025 releases). check before commercial # use.
Clone from Arcee's repository and install in editable mode. This gives you, among others, the mergekit-yaml CLI (the main entry point for single-config runs) and the mergekit-moe CLI (for mixture-of-experts constructions - see DavidAU below).
Python 3.10+ required. mergekit works on CPU by default; add --cuda to any merge command if you want GPU acceleration for the tensor operations.
The five algorithms
mergekit implements many merge methods (its README also lists NuSLERP, DELLA, Model Breadcrumbs, SCE and others); the five below are the ones this page covers. Pick by the shape of your input.
SLERP - two-model spherical blend
SLERP (spherical linear interpolation) blends two models along a spherical path between their weights, preserving geometric structure that a straight-line average would lose. Labonne's January 2024 merge guide called it the most popular merging method. Use when you have exactly two models and want a smooth blend.
slices:
- sources:
- model: OpenPipe/mistral-ft-optimized-1218
layer_range: [0, 32]
- model: mlabonne/NeuralHermes-2.5-Mistral-7B
layer_range: [0, 32]
merge_method: slerp
base_model: OpenPipe/mistral-ft-optimized-1218
parameters:
t:
- filter: self_attn
value: [0, 0.5, 0.3, 0.7, 1]
- filter: mlp
value: [1, 0.5, 0.7, 0.3, 0]
- value: 0.5
dtype: bfloat16 Two source models with matching layer ranges. merge_method: slerp. The interesting parameter is t, the interpolation factor: 0 means pure base model, 1 means pure other model. Here it varies per layer, with attention layers weighted differently from MLP layers.
The variable-per-layer t arrays are what make SLERP subtle in practice. A uniform t: 0.5 is a plain 50-50 blend; the per-layer curves let a practitioner shape which parts of each model dominate at which depth.
TIES and DARE - many-model sparsification
TIES (Trim, Elect Sign, Merge) merges many task-specific models by trimming redundant deltas relative to a base and electing signs where models disagree. DARE (Drop And REscale) adds random pruning of deltas before merging; dare_ties keeps the TIES sign-election step, dare_linear drops it. Both handle multiple input models where a plain average would let opposing edits cancel each other out.
models:
- model: mistralai/Mistral-7B-v0.1
# No parameters necessary for base model
- model: samir-fama/SamirGPT-v1
parameters:
density: 0.53
weight: 0.4
- model: abacusai/Slerp-CM-mist-dpo
parameters:
density: 0.53
weight: 0.3
- model: EmbeddedLLM/Mistral-7B-Merge-14-v0.2
parameters:
density: 0.53
weight: 0.3
merge_method: dare_ties
base_model: mistralai/Mistral-7B-v0.1
parameters:
int8_mask: true
dtype: bfloat16 Base model gets no parameters (it is the reference point). Every other model contributes with a density (what fraction of its deltas survive the sparsification) and a weight (how strongly it contributes). Density 0.53 keeps roughly half the deltas; weights sum to about 1.0.
int8_mask: true is a memory optimization that stores the sign-consensus mask in int8 rather than the model's float dtype.
Task arithmetic - add or subtract capabilities
Task arithmetic treats the difference between a fine-tuned model and its base as a task vector - a bundle of weight edits that encode whatever the fine-tune taught. Vectors can be added to introduce a capability or subtracted to remove one. This is the method that can, in principle, remove refusal by subtracting a "refusal task vector" from a model.
models:
- model: WizardLMTeam/WizardMath-7B-V1.1
parameters:
weight: 0.7 # task vector = model - base
merge_method: task_arithmetic
base_model: mistralai/Mistral-7B-Instruct-v0.2
dtype: bfloat16
# a negative weight (not shown but supported)
# would subtract the constituent's task vector
# from the base. this is the theoretical basis
# for arithmetic-style refusal removal. Positive weights add task vectors; negative weights (not shown but supported) subtract them. In this example the merge starts from an instruct model and adds, at weight 0.7, the math-tuned model's difference from that base (mergekit computes each task vector against base_model). A negative-weight component would attempt to remove whatever capability that constituent encodes - the theoretical basis for arithmetic-style refusal removal; compare M1 direct removal.
Passthrough - build a frankenmerge
Passthrough concatenates layers from different models to build a larger model of a new depth. No interpolation - each layer comes verbatim from one donor. Used to grow a model by stacking layer ranges (for example: take layers 0-16 from one 32-layer model, layers 8-32 from another, producing a 40-layer frankenmerge). Labonne calls the technique very experimental, but it produces models with parameter counts not otherwise available.
Linear - the model soup
Linear merging takes a plain weighted average across models - the "model soup" approach. Simpler than SLERP and TIES. mergekit's guide suggests it for averaging checkpoints of the same fine-tuning run and for models with very similar architectures and training data.
Running a merge
$ mergekit-yaml \
./config.yml \
./merged-model/ \
--cuda \
--lazy-unpickle
# --cuda → GPU for tensor ops
# --lazy-unpickle → experimental lazy
# unpickler, lower RAM
# output: full safetensors model.
# from there, quantize to GGUF via M8
# for laptop-friendly distribution. Point mergekit-yaml at your config file and an output directory. Drop --cuda to run entirely on CPU (slower but no VRAM required). Add --lazy-unpickle, mergekit's experimental lazy unpickler, for lower memory usage.
The output directory receives a full safetensors model. From there, quantize to GGUF via M8 if you want laptop-friendly distribution.
Worked example: fold abliteration into a baseline
One M5 use case: take an abliterated model and merge it with another model to try to inherit both properties.
models:
- model: meta-llama/Meta-Llama-3-8B-Instruct
# base - no parameters
- model: failspy/Meta-Llama-3-8B-Instruct-abliterated-v3
parameters:
density: 0.6
weight: 0.5
- model: NousResearch/Hermes-2-Pro-Llama-3-8B
parameters:
density: 0.6
weight: 0.5
merge_method: dare_ties
base_model: meta-llama/Meta-Llama-3-8B-Instruct
parameters:
int8_mask: true
dtype: bfloat16
# after merge: test against AdvBench.
# if refusal count climbs vs the abliterated
# input, the merge partner likely pulled
# refusal back. see failure modes. Two components at equal weight, both with moderate density (0.6 keeps 60% of deltas after sparsification). Base is the vanilla instruct model. dare_ties because we have multiple opinionated components and want to resolve conflicts by sign election rather than let them average out.
Labonne's guide says the weights should sum to between 0.9 and 1.1. Test the merge immediately: if refusal count on AdvBench climbs versus the abliterated input, the merge partner likely pulled refusal weights back - see failure modes below.
DavidAU's mixture-of-experts merges
A high-order M5 practice comes from DavidAU. His "Dark Champion" and "8X3B" models are Mixtral-architecture MoE merges whose cards credit mergekit, combining eight ~3B Llama-3.2 models into an ~18.4B MoE. The Dark Champion 18.4B card lists eight experts: an abliterated model (huihui-ai/Llama-3.2-3B-Instruct-abliterated), an uncensored fine-tune (chuanli11/Llama-3.2-3B-Instruct-uncensored), and several ordinary instruct or creative fine-tunes, including the stock meta-llama/Llama-3.2-3B-Instruct; the assembled MoE combines their behaviors through the routing mechanism.
The config format (from mergekit's docs/moe.md) requires a base_model whose self-attention weights are used, a gate_mode (hidden, cheap_embed, or random), and a list of experts each with positive_prompts that steer the router:
base_model: meta-llama/Llama-3.2-3B-Instruct
gate_mode: hidden
dtype: bfloat16
experts:
- source_model: huihui-ai/Llama-3.2-3B-Instruct-abliterated
positive_prompts:
- "how do I"
- "explain in detail"
- source_model: chuanli11/Llama-3.2-3B-Instruct-uncensored
positive_prompts:
- "write a story"
- "roleplay as"
# ... six more experts, one per specialty
# run with:
# mergekit-moe ./config.yml ./output/ The gate_mode: hidden option computes routing weights from the model's inner state (higher-quality routing, more compute), cheap_embed uses the embedding matrix directly (faster, lower quality), random initializes the gates randomly, for models you plan to fine-tune afterwards. The positive_prompts per expert are how you tell the gate what each expert should specialize in: in hidden mode their hidden-state representations are used as the gate parameters.
Run with mergekit-moe ./config.yml ./output. DavidAU documents the inference side on his cards (default num_experts_per_tok: 2 in config.json, editable to activate more or fewer experts) but does not publish his exact per-model gate_mode or expert-list YAML, so his specific recipes are not fully reproducible from the cards. Per docs/moe.md, both hidden and cheap_embed produce a model usable without further training, so the cards do not settle which was used.
Choices you have to make
Which algorithm. Two models, smooth blend → SLERP. Three or more models → TIES or DARE-TIES. Add or remove a specific capability → task_arithmetic. Grow depth into a new model size → passthrough. Many similar models, want a stable average → linear.
Density (TIES / DARE). Density is the fraction of each component's deltas that survives sparsification. Labonne's DARE-TIES example uses 0.53, a little above the under-0.5 value he says the DARE paper recommends, and he reports consistently better results with it.
Weights. Labonne's guide says DARE-TIES weights should sum to between 0.9 and 1.1. Higher weights on abliterated components may help preserve refusal-free behavior; higher weights on capability-strong components may help capability. Balance by testing.
Tokenizer handling. mergekit has tokenizer union handling for cases where merged models have slightly different vocabularies. Tokenizer configuration only aligns vocabularies; all non-vocabulary dimensions must still match, so stick within one family (e.g. do not merge Llama into Mistral) unless you know exactly what you are doing.
What good output looks like
A merged model the same size as its components (except passthrough, whose size depends on the layers stacked), that runs coherently and answers questions in the expected style. Coherence checks: run 10-20 diverse prompts, look for grammatical stability, no repeating loops, no token soup. A merge that fails coherence checks can indicate tokenizer or architecture mismatch, or interference between components.
For M5-specific verification: benchmark refusals on walledai/AdvBench and compare against the abliterated input. The whole point of an abliteration merge is that refusal stays gone. If refusal count climbs, see failure modes.
When it does not work
Merge loses abliteration. Symptom: refusal count on AdvBench jumps up after merging, undoing the M1 removal. Likely cause: the merge partner (especially the base in task_arithmetic, or a high-weight censored component) pulled refusal weights back. Diagnostic: post-merge refusal count exceeds pre-merge count on the same held-out prompts. Fix: increase the abliterated model's weight, lower the censored partner's weight, use dare_ties to trim conflicting deltas via sign election, or abliterate the result again post-merge.
Tokenizer / architecture mismatch. Symptom: merged model produces garbage on any prompt - token soup, garbled output, repeating patterns. Cause: incompatible tokenizers between merge partners, or incompatible architectures forced together with mergekit's --allow-crimes flag ("Allow mixing architectures"). Fix: match model families (all Llama-3.x, or all Mistral, or all Qwen), or use mergekit's explicit tokenizer union handling.
Coherence damage without obvious cause. Symptom: output is grammatical but rambling, off-topic, or losing instruction-following. Possible cause: interference between components, or too many equally-weighted opinionated components. Fix: lower density, reduce number of components, or heal via M4 DPO pass post-merge.
Cost and time
Merging is cheap. Labonne's merge guide estimates about 10 minutes for a two-model 7B merge, and mergekit can run entirely on CPU, so no GPU is required.
This is a fundamentally different cost gradient from methods that involve training (M4, M6, M7). M5 is arithmetic.
Related literature
Three papers formalize the merge algorithms M5 uses, alongside the mergekit tool paper.
- Ilharco, G., Ribeiro, M. T., Wortsman, M., et al. (2022). Editing Models with Task Arithmetic. ICLR 2023. arXiv:2212.04089.
Introduces the task vector - the parameter-space delta between a fine-tuned model and its base. Foundation of the
task_arithmeticalgorithm in mergekit. Adding task vectors combines abilities; negating one removes an ability. The paper reports that negating a task vector decreases performance on the target task with little change on control tasks. - Yadav, P., Tam, D., Choshen, L., Raffel, C., Bansal, M. (2023). TIES-Merging: Resolving Interference When Merging Models. NeurIPS 2023. arXiv:2306.01708.
Trim low-magnitude updates, elect a consensus sign per parameter, merge only sign-aligned values. Solves the interference problem that plain task-arithmetic averaging suffers when many task vectors point in conflicting directions. Baseline of the
tiesanddare_tiesmethods in mergekit. - Yu, L., Yu, B., Yu, H., Huang, F., Li, Y. (2024). Language Models are Super Mario: Absorbing Abilities from Homologous Models as a Free Lunch (DARE). ICML 2024. arXiv:2311.03099.
Randomly drops delta parameters with rate p and rescales the survivors by 1/(1-p). Reports eliminating 90% or 99% of delta parameters with minimal loss. Combined with TIES sign election in mergekit's
dare_tiesmethod. - Goddard, C., et al. (2024). Arcee's MergeKit: A Toolkit for Merging Large Language Models. arXiv:2403.13257. The tool paper. Documents SLERP, task_arithmetic, TIES, DARE, DARE-TIES, and passthrough in a single toolkit.
For the full bibliography see the wiki references, training methods section. Coverage gap: none of the papers cited here evaluates whether merging preserves or re-introduces refusal signal when one of the merged models is abliterated.
Where to go next
Quantize the merged model to GGUF for distribution via M8 repackaging. If the merge damaged capability, heal it via M4 DPO healing. If refusal came back in the merge, re-abliterate via M1 or Heretic.
Frequently asked questions
What is model merging?
Model merging combines the weights of two or more models (sharing an architecture) into one model, without any training. mergekit is the tool covered here. Algorithms include SLERP (two-model blend), TIES and DARE (multi-model with sparsification), task_arithmetic (add/subtract capabilities), passthrough (concatenate layers), linear (plain weighted average). For every algorithm except passthrough, the result is a new model file the same size as its inputs, with behaviors combined from its constituents.
How does merging propagate abliteration?
If model A is abliterated and model B is a strong general model, a merge of A and B can inherit A's refusal-free behavior and B's capability. The refusal-removal is encoded in A's weights as a specific edit; the merge partly carries that edit through. So you can perform the abliteration once (on A) and propagate it into an arbitrary number of downstream merges without redoing the operation. This is why 331 merges in the catalog carry an "abliterated" label that can describe an ancestor several merges back rather than the released artifact itself.
Who wrote mergekit?
Charles Goddard (GitHub cg123) created mergekit and later joined Arcee AI, where the project is now maintained. The mergekit paper (Goddard et al. 2024) documents the algorithms formally.
What license is mergekit under?
Mixed history. Legacy release notes say "later versions of mergekit are licensed under the LGPL" (legacy scripts MIT). In February 2025 (v0.1) the license changed to BUSL-1.1 (Business Source License 1.1), and in October 2025 the project returned to LGPL-3.0 (commit "Return to LGPL (#638)"); the current pyproject.toml declares LGPL-3.0-only. Check the license in the specific version you install before any commercial use. BUSL-1.1 releases in particular have restrictions on production use that automatically convert to a more permissive license after a set period.
Which algorithm should I use?
Depends on your inputs. Two models, smooth blend → SLERP. Three or more models → TIES or DARE-TIES. Adding or removing a specific capability → task_arithmetic. Growing depth into a new model size → passthrough. Many similar models where you want stability → linear. For three or more models, Labonne's DARE-TIES example uses density 0.53 with weights summing to 1.
What is DavidAU doing with MoE merges?
DavidAU builds Mixtral-style mixture-of-experts models by combining eight ~3B Llama-3.2 models (one abliterated, one uncensored fine-tune, the rest ordinary instruct or creative fine-tunes) into an ~18.4B MoE with mergekit. The result is a single larger model that routes prompts to different experts. The Dark Champion card lists every constituent by repository (so you can see which were abliterated, which were uncensored and which were stock instruct models) and warns that the censored constituents can sometimes interfere; it does not give a refusal rate for the assembled MoE. This is the highest-visibility example of high-order M5 in the catalog: the most-downloaded M5-frankenstein model, with 60,234 downloads.
Why did my merge lose the abliteration?
Likely cause: the merge partner - especially the base in task_arithmetic or a high-weight censored component - pulled refusal weights back. Fix: increase the abliterated model's weight, lower the censored partner's weight, use dare_ties which uses sign election to trim conflicting deltas, or re-abliterate the merge output.
Does merging need a GPU?
No. Merging is tensor arithmetic, and mergekit can run it entirely on CPU. GPU acceleration via --cuda is available. Use --lazy-unpickle (mergekit's experimental lazy unpickler) for lower memory usage if RAM is tight.
How much does merging cost?
Very little. Labonne's merge guide estimates about 10 minutes for a two-model 7B merge, with no GPU required. This is a fundamentally different cost gradient from training-based methods (M4/M6/M7) because merging does no gradient descent - only arithmetic on stored tensors.
References
- Goddard, C., et al. (2024). Arcee's MergeKit: A Toolkit for Merging Large Language Models. arXiv:2403.13257
- mergekit repository. github.com/arcee-ai/mergekit
- mergekit MoE documentation. github.com/arcee-ai/mergekit/blob/main/docs/moe.md
- Labonne, M. (2024). Merge Large Language Models with MergeKit. mlabonne.github.io
- mlabonne/Daredevil-8B (DARE-TIES mega-merge). huggingface.co/mlabonne/Daredevil-8B
- DavidAU Hugging Face profile (MoE merges). huggingface.co/DavidAU
- DavidAU/Llama-3.2-8X3B-MOE-Dark-Champion-Instruct-uncensored-abliterated-18.4B-GGUF. huggingface.co/DavidAU/...Dark-Champion
- Arditi, A., et al. (2024). Refusal in Language Models Is Mediated by a Single Direction. NeurIPS 2024. arXiv:2406.11717
- Rafailov, R., et al. (2023). Direct Preference Optimization. arXiv:2305.18290
- Business Source License 1.1 text. mariadb.com/bsl11