KALAVAI: Predicting When Independent Specialist Fusion Works -- A Quantitative Model for Post-Hoc Cooperative LLM Training
Organizations: Murai Labs
Abstract
Independently trained domain specialists can be fused post-hoc into a single model that outperforms any individual specialist, and the gain is predictable: gain = 0.82 x divergence - 2.72 (R^2 = 0.856, n=6, 3-26% divergence). This enables practitioners to estimate cooperative value before committing compute. Below ~3.3% divergence, gains approach zero.In the KALAVAI protocol, contributors fine-tune copies of a shared checkpoint independently, then submit for lightweight MoE routing (500 steps). Gains are consistent: +7.72% at 410M (+/-0.02%, 3 seeds), +7.49% at 1B (+/-0.01%, 3 seeds), +6.53% at 6.9B, each over the best specialist. The router matches domain-oracle routing within <10^{-5} nats. Cross-lingual fusion (Tamil/Yoruba/Welsh/Code) achieves +21.76%, with Yoruba perplexity falling 41.9 to 7.7. A 20-contributor federation achieves +16.71% (+/-0.07pp, 3 seeds).Three requirements bound the protocol. Shared initialisation is necessary: checkpoint mismatch degrades routing. Frozen layers are optional below ~10,000 steps and beneficial beyond. Learned routing is essential: uniform averaging degrades by -1.2% vs. best specialist, while any trained router achieves oracle-optimal assignment.
Figures & tables
| Scale | Method | EW Loss | vs. Best Spec. | vs. Base | Seeds | Std |
| Pythia-410M | Base model | 2.651 | — | — | — | — |
| Best specialist | 2.404 | — | +9.3% | 3 | 0.02% | |
| Weight averaging | 2.486 | 3.4% | +6.2% | 3 | 0.00% | |
| Monolithic baseline | 2.229 | — | +16.0% | 3 | 0.00% | |
| Kalavai (MoE) | 2.218 | +7.70% | +16.3% | 3 | 0.02% | |
| Pythia-1B | Base model | 2.474 | — | — | — | — |
| Model | Code div. | Sci. div. | Fiction div. | Mean div. | Fusion gain | Conv. rate |
|---|---|---|---|---|---|---|
| Pythia-410M | 9.97% | 11.60% | 25.37% | 15.65% | +7.72% | 0.49 |
| Pythia-1B | 11.05% | 9.39% | 25.41% | 15.28% | +7.49% | 0.49 |
| Pythia-6.9B | 9.28% | 10.16% | 6.76% | 8.73% | +6.53% | 0.75 |
| Qwen-1.5B † | 1.76% | — | 4.56% | 3.16% | +1.06% | 0.34 |
| Method | Code | Science | Fiction | EW Avg |
|---|---|---|---|---|
| Base model | 2.0872 | 2.8920 | 2.9739 | 2.6510 |
| Code specialist | 1.8791 | 2.9085 | 2.9768 | 2.5881 |
| Science specialist | 2.1738 | 2.5565 | 3.0613 | 2.5972 |
| Fiction specialist | 2.1018 | 2.8904 | 2.2194 | 2.4039 |
| Monolithic (6k) | 1.9644 | 2.6389 | 2.0832 | 2.2288 |
| Weight averaging | 2.0142 | 2.7323 | 2.7106 | 2.4857 |
| Scale | Method | EW Loss | vs. Base | vs. Monolithic |
|---|---|---|---|---|
| 410M | Base model | 2.651 | — | — |
| Best specialist | 2.404 | +9.3% | — | |
| Monolithic (6k steps) | 2.229 | +16.0% | — | |
| Kalavai MoE | 2.218 | +16.3% | +0.47% | |
| 1B | Base model | 2.474 | — | — |
| Best specialist | 2.259 | +8.7% | — |
| Steps | Freeze=0 (% vs. base) | Freeze=4 (% vs. base) | Leader |
|---|---|---|---|
| 50 | +4.0% | +3.5% | Freeze=0 |
| 100 | +5.1% | +4.5% | Freeze=0 |
| 500 | +9.2% | +8.3% | Freeze=0 |
| 1,000 | +12.1% | +10.8% | Freeze=0 |
| 2,000 | +15.5% | +14.2% | Freeze=0 |
| 5,000 | +17.7% | +17.5% | Freeze=0 |
| Condition | Init Revisions | Best Spec. Loss | MoE Loss | vs. Base | Seeds |
|---|---|---|---|---|---|
| Control (matched) | 10k / 10k / 10k | 2.089 | 2.015 | +10.4% | 3 |
| Small gap | 8k / 10k / 12k | 2.122 | 2.034 | +9.5% | 1 |
| Large gap | 5k / 10k / 20k | 2.157 | 2.036 | +9.4% | 3 |
| Condition | MoE EW Loss | vs. Spec | vs. Base | vs. control |
|---|---|---|---|---|
| Control (identical) | 2.2185 | +7.72% | +16.33% | — |
| diff_batch | 2.2401 | +7.74% | +15.49% | +0.01pp |
| diff_lr | 2.1576 | +7.73% | +18.63% | +0.01pp |
| diff_steps | 2.2001 | +7.33% | +17.00% | 0.39pp |
| Scale | Method | EW Loss | vs. Best Spec. | vs. Mono. | Seeds | Std |
|---|---|---|---|---|---|---|
| Pythia-410M | Base model | 2.954 | — | — | — | — |
| Best specialist | 2.694 | — | — | 3 | — | |
| Monolithic (6k) | 2.462 | — | — | 1 | — | |
| Weight avg. | 2.709 | — | — | — | — | |
| Kalavai (MoE) | 2.418 | +10.17% | +1.78% | 3 | 0.15pp |
| Domain | Divergence | Base PPL | Specialist PPL | MoE PPL |
|---|---|---|---|---|
| Tamil | 23.3% | 4.2 | 3.0 | 3.0 |
| Yoruba | 45.5% | 41.9 | 7.7 | 7.7 |
| Welsh | 33.2% | 102.7 | 22.1 | 22.1 |
| Code | 0.4% | 8.2 | 8.1 | 8.1 |
| Seed | Base EW | MoE EW | vs. Spec. | vs. Base |
|---|---|---|---|---|
| 42 | 2.790 | 2.311 | 16.79% | 17.17% |
| 137 | 2.790 | 2.314 | 16.65% | 17.04% |
| 2026 | 2.790 | 2.314 | 16.68% | 17.06% |
| Mean | 2.790 | 2.313 | 16.71% | 17.09% |
| Std | — | — | 0.07pp | 0.07pp |
| Language Specialists | Domain Specialists | ||
|---|---|---|---|
| Specialist | Gain | Specialist | Gain |
| Tamil | +25.29% | Code | +2.70% |
| Yoruba | +58.37% | Medical | +14.41% |
| Welsh | +37.21% | Legal | +36.48% |
| Spanish | +5.20% | Patent | +8.37% |
| Hindi | +18.04% | Math | +22.47% |
| Condition | Mean Div. | Gain vs Spec | Conv. rate | Pred. gain | Residual |
|---|---|---|---|---|---|
| Qwen-1.5B (Ph.1) | 3.16% | +1.06% | 0.34 | 0% † | — |
| Pythia-6.9B (Ph.1) | 8.73% | +6.53% | 0.75 | +4.41% | +2.12pp |
| Pythia-1B (Ph.1) | 15.28% | +7.49% | 0.49 | +9.81% | 2.32pp |
| Pythia-410M (Ph.1) | 15.65% | +7.72% | 0.49 | +10.11% | 2.39pp |
| Exp 2: private (Ph.2) | 18.52% | +10.17% | 0.55 | +12.43% | 2.26pp |
| Exp 1: cross-lingual (Ph.2) | 25.65% | +21.76% | 0.85 | +18.18% | +3.58pp |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Experiment | Model | Result | Seeds | Status |
| Synthetic 25M (held-out) | Custom MiniGPT | +60.7% 0.7% | 3 | Done |
| Pythia-410M 3-domain | Pythia-410M | +7.70% 0.02pp (seed 42: +7.72%) | 3 | Done |
| Pythia-1B 3-domain | Pythia-1B | +7.49% 0.01% | 3 | Done |
| Pythia-6.9B 3-domain | Pythia-6.9B | +6.53% 0.024% | 3 | Done |
| Qwen-1.5B code+fiction | Qwen-1.5B | +1.06% 0.01% | 3 | Done |
| Router ablation | Pythia-410M | Linear= , 2-layer= , Uniform= vs. spec | 1 | Done |
| Method | LR | Mean div. | MoE vs. spec | MoE vs. base |
|---|---|---|---|---|
| LoRA | 2e-4 | 1.48% | 0.32% | 0.65% |
| LoRA | 2e-4 | 5.57% | 2.65% | 2.62% |
| LoRA | 2e-4 | 12.05% | 7.73% | 8.11% |
| LoRA | 2e-4 | 20.31% | 13.85% | 14.92% |
| LoRA | 5e-4 | 29.25% | 15.22% | 19.97% |
| Full FT (freeze=4) | 2e-4 | 15.65% | 7.72% | 16.3% |
| Freeze Layers | % Frozen | MoE Loss | Improvement (seed 42) | Std (3 seeds) |
|---|---|---|---|---|
| 0 | 0% | 2.199 | +7.92% | 0.012% |
| 2 | 8% | 2.207 | +7.86% | 0.015% |
| 4 | 17% | 2.218 | +7.72% | — |
| 6 | 25% | 2.241 | +7.49% | — |
| 8 | 33% | 2.269 | +7.17% | — |
| 12 | 50% | 2.346 | +6.03% | — |
| Router | EW Loss | vs. Best Spec. | Gate Pattern |
|---|---|---|---|
| Uniform ( , no training) | 2.432 | Equal | |
| Simple linear (trained) | 2.219 | Hard-switches | |
| 2-layer MLP (trained) | 2.218 | Hard-switches |
| Method | Specialists Run | Routing | EW Loss | vs. Best Spec. |
|---|---|---|---|---|
| Base model | — | — | 2.651 | — |
| Best specialist (fiction) | 1 of 3 | Fixed | 2.404 | — |
| Uniform routing (no training) | 3 of 3 | Equal | 2.432 | |
| MoE soft routing (trained) | 3 of 3 | Softmax weights | 2.218 | |
| MoE hard routing (argmax) | 3 of 3 | Argmax (all run) | 2.218 | |
| Oracle dispatch (per domain) | 1 of 3 | Domain oracle | 2.218 |
| Method | Params (unfrozen) | EW Loss | vs. Best Spec. |
|---|---|---|---|
| Monolithic Pythia-410M (6,000 steps) | 1 | 2.229 | |
| Kalavai MoE (3 specialists, 2,000 steps each) | 3 unfrozen | 2.218 | |
| Multi-head baseline (same params as MoE) | 3 unfrozen | 2.218 | |
| Wider single model (Pythia-1.4B, 6,000 steps) | 3.5 total | 2.143 |
| Checkpoint | % Training | Base Loss | MoE Loss | Improvement |
|---|---|---|---|---|
| step5000 | 3.5% | 2.855 | 2.324 | +8.81% |
| step10000 | 7.0% | 2.651 | 2.218 | +7.72% |
| step20000 | 14.0% | 2.496 | 2.122 | +7.03% |
| step50000 | 35.0% | 2.270 | 2.015 | +7.25% |
| step100000 | 70.0% | 2.159 | 1.955 | +7.06% |
| step143000 | 100.0% | 2.157 | 1.960 | +7.51% |
| Checkpoint | % Training | Base Loss | MoE Loss | Improvement |
|---|---|---|---|---|
| step5000 | 3.5% | 2.703 | 2.194 | +8.75% |
| step20000 | 14.0% | 2.279 | 2.007 | +6.68% |
| step50000 | 35.0% | 2.109 | 1.928 | +6.40% |
| step143000 | 100.0% | 1.992 | 1.960 | +0.40% |
| Checkpoint | % Training | Base Loss (EW) | MoE Loss (EW) | Improvement |
|---|---|---|---|---|
| step10000 | 7.0% | 2.320 | 2.118 | +6.53% |
| step143000 | 100.0% | 1.900 | 1.758 | +5.19% |
| Specialists | Domains | Improvement | Std | Note |
|---|---|---|---|---|
| 2 | Code, Fiction | 0.007% | 3/5 uncovered | |
| 3 | Code, Science, Fiction | 0.024% | 2/5 uncovered | |
| 4 | Code, Science, Fiction, Math (GSM8K) | 0.022% | 1/5 uncovered | |
| 5 | + Multilingual (Spanish Wikipedia) | 0.022% | All 5 covered |
| Model | HellaSwag | ARC-Easy | LAMBADA | SciQ | WinoGrande | Average |
|---|---|---|---|---|---|---|
| Base model | 34.4 | 40.4 | 60.2 | 68.4 | 49.6 | 50.6 |
| Code specialist | 34.2 | 39.4 | 57.4 | 65.8 | 50.0 | 49.4 |
| Sci. specialist | 34.2 | 41.0 | 56.4 | 65.8 | 48.2 | 49.1 |
| Fict. specialist | 34.4 | 39.8 | 58.6 | 66.8 | 48.2 | 49.6 |
| Weight average | 34.6 | 39.0 | 57.8 | 67.8 | 48.6 | 49.6 |
| Monolithic | 33.4 | 38.4 | 58.2 | 67.0 | 49.4 | 49.3 |
| Model | HellaSwag | ARC-Easy | LAMBADA | SciQ | WinoGrande | Average |
|---|---|---|---|---|---|---|
| Base model | 35.4 | 43.6 | 61.2 | 66.8 | 51.0 | 51.6 |
| Kalavai MoE | 35.6 | 45.2 | 62.8 | 67.8 | 49.4 | 52.2 |
| Prompt | Token | Dominant Expert | Weight |
|---|---|---|---|
| “Write Python code to simulate the plot of Romeo and Juliet” | “Write” | Fiction | 0.787 |
| “Python” | Fiction | 0.821 | |
| “simulate” | Fiction | 0.929 | |
| “plot” | Code | 0.540 | |
| “Juliet” | Fiction | 1.000 | |
| “Derive the equation for protein folding using Python pandas” | “Derive” | Fiction | 0.703 |
| Scale | Config | Params (M) | VRAM (GB) | Lat. (ms) | Rel. Lat. | Rout. Agr. |
|---|---|---|---|---|---|---|
| 410M | Base model | 405 | 1.15 | 17.9 | 1.00 | — |
| Single specialist | 405 | 1.97 | 17.3 | 0.97 | — | |
| Monolithic | 405 | 1.97 | 17.4 | 0.97 | — | |
| Kalavai dense (3 ) | 1216 | 3.46 | 51.2 | 2.86 | — | |
| Kalavai sparse top-1 | 1216 | 2.67 | 16.8 | 0.94 | 100% | |
| 1B | Base model | 1012 | 2.39 | 16.1 | 1.00 | — |
| Seed | Med. div. | Legal div. | Patent div. | Mean div. | Gain vs spec | Verdict |
|---|---|---|---|---|---|---|
| 42 | 12.71% | 34.16% | 8.68% | 18.52% | +10.23% | GO |
| 137 | 12.71% | 34.15% | 8.67% | 18.51% | +10.27% | GO |
| 2026 | 12.71% | 34.15% | 8.68% | 18.51% | +10.00% | GO |
| Mean | 12.71% | 34.15% | 8.68% | 18.51% | +10.17% | GO |
| Std | — | — | — | — | 0.15pp | — |
| Seed | Tamil div. | Yoruba div. | Welsh div. | Mean div. | Gain vs spec | Verdict |
|---|---|---|---|---|---|---|
| 42 | 23.28% | 45.54% | 33.69% | 25.74% | +6.14% | PIVOT (collapse ∗ ) |
| 137 | 23.26% | 45.52% | 33.19% | 25.60% | +21.76% | GO |
| 2026 | 23.35% | 45.50% | 33.21% | 25.62% | +21.75% | GO |
| Mean (all) | — | — | — | 25.65% | +16.55% | GO |
| Clean seeds | — | — | — | 25.61% | +21.76% | GO ( 0.005pp) |
Language Model Merging
Language model merging combines capabilities from multiple models or adapters by composing their weights, updates, or outputs.
See all 105 papers