comparing-methods.md

reference

← Back to skill

Content hash: 2c87599a28dcf8b5d8cfd3702f91daedb2256bfc0e74c5b1785735d22c44095b
## Model Merging Methods Comparison

### The delta perspective
All methods decompose each fine-tuned model as `base + delta` and differ in
how they combine deltas.

### Method comparison table

| Method | Num models | Best for | Complexity | Key parameter |
|--------|-----------|----------|------------|---------------|
| Model Soup (avg) | 2+ | Similar parents | Minimal | None |
| SLERP | Exactly 2 | Two-model merge | Low | `t` (0=modelA, 1=modelB, 0.5=midpoint) |
| Task Arithmetic | 2+ | Combining task vectors | Medium | `weight` (strength) |
| TIES | 2+ | Reducing interference | High | `density` (0.5-0.8) |
| DARE-TIES | 2+ | TIES + sparsity bonus | High | `density` + `weight` |

### When each method fails

| Method | Failure mode |
|--------|-------------|
| SLERP | Only 2 models; can't handle 3+ directly |
| TIES | Needs base model to compute deltas |
| DARE | Too low density -> loses signal; too high -> keeps noise |
| Task Arithmetic | Interference between tasks degrades both |
| Model Soup | Catastrophic interference if parents diverge significantly |

### Prerequisites for ALL methods
1. Same base model AND same tokenizer/vocabulary
2. Same architecture (all Llama, all Mistral, etc.)
3. `base_model` correctly set for delta-based methods

### mergekit execution
```bash
# Small models: CPU is fine
mergekit-yaml config.yml ./merged-output

# Large models with VRAM (optional)
mergekit-yaml config.yml ./merged-output --cuda

# Push to Hub after merge
mergekit-yaml config.yml ./merged-output --cuda --lazy-unpickle
huggingface-cli upload myorg/merged-model ./merged-output
```

### Verification checklist
- [ ] Tokenizer from base model loads correctly with merge
- [ ] Both parent strengths evaluated (math + code benchmarks)
- [ ] Safety/alignment checks pass (run red-team probes)
- [ ] Compared against linear averaging baseline