simbal-table2-repro / README.md
Varshith19's picture
README: protocol, results vs paper, verdict
59ed59a verified
|
Raw History Blame Contribute Delete
4.38 kB
# Reproduction: Table 2 of "Load Balancing Mixture of Experts with Similarity Preserving Routers"
Reproduction of the Table 2 claim from [arXiv:2506.14038v2](https://arxiv.org/abs/2506.14038) (Omi, Sen, Farhadi — NeurIPS 2026):
**100 loss-based router updates yield lower post-cast Gram-matrix error than fp32 direct orthogonal
parameterization and orthogonal initialization, in bfloat16.**
- Paper: https://arxiv.org/abs/2506.14038v2
- Author baseline repo (pinned): https://github.com/lucidrains/st-moe-pytorch/tree/d94e65d8a1f50eb5b41efa5317b0d1b17c9dbfad
(provides only the LBL baseline and the `nn.Linear` transposed-weight convention; the Table 2
experiment script is not released — it was re-implemented here from the paper's Sec. 4.1 and Fig. 6.)
- Files: `simbal_table2.py` (experiment), `results_summary.json` (numbers), `full.log` (verbatim run log).
## Protocol
Router stored as `nn.Linear` weight, shape (E, D) = (32, 1536) (paper's Appendix convention), Gram = W Wᵀ = RᵀR.
Metrics computed in **float32 on the bf16-cast matrix**: Max Dev = max|G − I|, L1 Dist = mean|G − I|.
100 trials (seeds 0–99), mean ± SD. Trained arm: AdamW, no weight decay, LR cosine-decayed
1e-4 → 1e-5 over 100 steps, matrix kept in bfloat16. Hardware: 1× A10G, torch 2.11.0+cu128.
## Results (100 trials, mean ± SD)
| Arm | Max Dev | L1 Dist |
|---|---|---|
| *Paper Trained* | *1.03e-5 ± 2.76e-6* | *8.52e-7 ± 5.84e-8* |
| **trained_fp32loss_orthoinit** | 3.41e-5 ± 4.35e-5 (median 1.97e-5) | 1.66e-6 ± 8.75e-8 |
| **trained_bf16loss_orthoinit** (verbatim Fig. 6 arithmetic) | 5.19e-4 ± 8.60e-5 | 3.85e-5 ± 1.21e-6 |
| *Paper Param* | *2.00e-4 ± 2.31e-5* | *4.80e-5 ± 1.60e-6* |
| **param_trained100** | 3.47e-4 ± 6.09e-5 | 4.98e-5 ± 1.55e-6 |
| **param_notrained** | 3.39e-4 ± 5.74e-5 | 4.97e-5 ± 1.56e-6 |
| *Paper OrthoInit* | *1.93e-4 ± 1.88e-5* | *4.62e-5 ± 1.79e-6* |
| **ortho_init** | 3.49e-4 ± 6.90e-5 | 4.98e-5 ± 1.63e-6 |
| trained_fp32loss_normalized (÷E²) | 3.19e-5 ± 3.50e-5 | 1.68e-6 ± 8.02e-8 |
| trained_fp32loss constant LR | 2.29e-4 ± 2.41e-5 | 5.15e-5 ± 2.31e-6 |
| trained from default Linear init, bf16 loss | 6.67e-1 ± 4.09e-3 | 2.03e-2 ± 4.10e-5 |
## Verdict
**Verified, with one stated interpretation.** Under the reading that the trained arm stores the matrix
in bf16 but computes the loss's Gram matmul in fp32, the claim's ordering reproduces decisively:
trained (3.4e-5 / 1.7e-6) ≪ Param (3.5e-4 / 5.0e-5) ≈ OrthoInit (3.5e-4 / 5.0e-5) — ~10× lower Max Dev,
~30× lower L1 Dist. The Param/OrthoInit L1 Dist means match the paper within ~4–8%; Max Dev is
~1.7–1.8× higher (a max-statistic sensitive to matmul accumulation details). The trained arm's median
Max Dev (1.97e-5) and L1 Dist (1.66e-6) are the same order as the paper's, ~2× higher; 7/100 trials
stall above 1e-4 and inflate the mean.
**Findings on underspecified details:**
1. The loss computed literally in bf16 arithmetic (verbatim Fig. 6 on a bf16 matrix) makes
orthonormality *worse* than no training (5.2e-4 vs 3.5e-4 Max Dev) — the paper's Trained numbers
are only reachable if the Gram matmul upcasts to fp32.
2. The cosine LR schedule is essential: constant 1e-4 leaves the matrix at cast-noise level
(2.29e-4 / 5.15e-5).
3. The trained arm cannot start from a default Linear init (does not converge in 100 steps, Max Dev
0.67); it must start from an orthogonal-like state. Loss normalization (÷E²) changes nothing,
consistent with Adam's scale invariance.
4. Param with and without 100 training steps give identical post-cast error — the parametrization
reading of the "Param" arm is immaterial to the claim.
Total compute: ~2 GPU-minutes on one A10G (sandbox).
<div style="display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 2em"><a href="https://hf.co/chat?mode=ml-intern"><img src="https://hf.co/datasets/huggingface/badges/resolve/main/built-with-ml-intern-lg.svg" alt="Built with ML Intern" style="margin:0"></a><a href="https://hf.co/chat?mode=ml-intern&prompt=Run%20the%20Table%202%20reproduction%20at%20a%20different%20router%20shape" style="display:inline-flex;align-items:center;gap:5px;padding:4px 12px;border:1.5px solid #eee;border-radius:16px;background:#f9fbfc;color:#c2410c;font-weight:600;font-size:14px;text-decoration:none">Try another router shape ›</a></div>