Repository navigation
Description
This issue records the maintainers' review of #26 by @henry-y (ResearchBoost-Agent), the measurements behind the decision, and the rules --speedups follows once merged. CONTRIBUTING asks for an issue before a change to shared code; this one documents the agreement.
Decision
Merge #26 together with the maintainer changes listed below.
--speedupsis off by default: without the flag, training is the currentmain, bit for bit.- Users may opt in with
--speedups exact,--speedups allor a comma list of components. - Formal runs accept only
exact(or a selection of its parts), which reproduces the default path bit for bit.all,cudnnandmergechange rounding and stay in research mode. - Published results, audits and cost proofs are unaffected. Merging changes
native_source_sha256, so a formal run in progress continues on its own commit.
The submission
#26 was opened on 2026-11-06 by @henry-y and prepared with Claude Code. Three commits:
4933b29removes a host synchronization per micro batch from the default path (same value).99a69bfadds--speedups: run-time patches of 13 shared functions with Triton kernels undernexttransformer/runtime/speedups/;nexttransformer/models/andnanochat/are untouched.c1c6be8addspython -m nexttransformer.checks.speedups(GPU tests, timing, bit identity, resume, numerics).
Reported on the submitter's GPUs: dense_full on 8 GPUs 1375 → 851 ms/update with exact (1.62×) and 690 ms with all (1.99×), peak memory 75.0 → 60.9 GiB, bit identity on 1 and 4 GPUs.
What we checked
CPU (the CI suite). The fast tests pass, checks.golden finds every method bitwise identical, every cost proof matches, checks.changes lists no published method, and the public check is clean. FLOPs are charged from the cost proofs, so the kernels cannot change the compute ledger.
GPU. One node of eight 80 GB Ampere-generation GPUs, torch 2.9.1, SDPA flash (no FlashAttention-3), bounded research runs on the real data:
- The 45 GPU tests of the PR pass.
- Bit identity (
checks.speedups bits, 8 GPUs, deterministic attention),exactagainstmain:dense_full(30 updates) andgdn,moba_hybrid,deeploop,mhc,ouro,mla_nope,residual_standard,attnres(6 updates each). Parameters, optimizer state, data cursor, logged losses andtheory_flopsare identical. This includes the default-path change of4933b29. - Resume: 6 + 6 updates equal 12 continuous updates, for
exactand forall.
Speed, dense_full, 8 GPUs, micro batch 16, reference and optimized runs alternating:
| ms/update | speedup | peak memory | |
|---|---|---|---|
| default | 4384 | 1.00× | 75.0 GiB |
exact |
3183 | 1.38× | 63.1 GiB |
exact,merge |
3128 | 1.40× | |
exact,cudnn |
3300 | 1.33× | |
all |
3244 | 1.35× | 60.9 GiB |
On these GPUs cuDNN attention is slower than SDPA flash, so all is slower than exact. On one GPU with micro batch 8, all gave 1.12× (mhc) to 1.46× (ouro) across eight methods (dense_full 1.29×, moba_hybrid 1.25×, attnres 1.19×, gdn_hybrid 1.16×, mla_nope 1.15×, nsa 1.14×) and lowered peak memory by 6–17 GiB.
Numerics of all (no deterministic attention, so two identical runs differ too):
| final val BPB | mean loss, last updates | mean |Δloss| | |
|---|---|---|---|
dense_full, 300 updates: exact ×2 |
0.99846, 1.00011 | 3.27658, 3.27504 | exact–exact 0.0043 |
dense_full, 300 updates: all ×2 |
0.99905, 0.99645 | 3.27565, 3.27650 | exact–all 0.0045, 0.0055 |
ouro, 120 updates: exact ×2 |
1.27788, 1.28279 | 4.13349, 4.13043 | exact–exact 0.0051 |
ouro, 120 updates: all ×1 |
1.27736 | 4.13578 | exact–all 0.0069 |
Found in review and fixed before merging
Maintainer commits on #26:
--formalaccepted--speedups all, and the exported result did not record the selection. Formal runs now accept only selections insideexact, the audit rejects formal segments with anything else, andexport_runwritesproof.speedups(records of runs without speedups are unchanged).- Resume compared the selection in one direction only: a run started with speedups could continue without them. It is now compared both ways.
- A model class that overrides
_token_loss, as a plugin may, received the uncapped logits of the fused readout. In a probe its loss went from 18.50 to 27.13 without an error. Such a class now keeps the original readout; a GPU test covers it. checks.speedups bitscountedsoftware/git_commitas a difference between two checkouts. It is now ignored.- A change to one of the 13 patched functions no longer needs to touch the speedups: the fast tests warn, and
--speedupsrefuses to start until its patch is reviewed.
Documentation: the protocol overview (English and Chinese) states the formal rule, the changing-shared-code guide mentions the patched functions, and the package README lists the measurements above.
Re-checked after these changes: CPU suite 540 passed; GPU tests 48 passed; --formal --speedups all is refused at parse time; --formal --speedups exact runs and records exact; resuming an exact run without the flag is refused; dense_full remains bitwise identical to main.
Limits
- Gains depend on the GPU. We did not measure GPUs with FlashAttention-3, where
cudnnhas no effect. allwas measured over at most 300 updates. Onouroits loss deviation exceeded the run-to-run noise in a single 120-update run, so it stays research only.- The kernels pin torch 2.9.1's reduction order. A torch upgrade or a change to a patched function disables
--speedupsuntil the patches are reviewed. @henry-y is the point of contact for the kernels.
Activity
Merge pull request #26 from henry-y/speedups/shared-components
Selen-Suyue commentedon Nov 6, 2026
Done: #26 merged in 5943c54 with the maintainer changes above, and ResearchBoost-Agent added to the community projects in #28.