Skip to content

feat(gpu): headwise Muon, Sinkhorn-balanced update, DeepSeek measurement probes - #210

Merged
ronaldtse merged 2 commits into
mainfrom
deepseek-tooling
Sep 11, 2026
Merged

ronaldtse merged 2 commits into
mainfrom
deepseek-tooling

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

The ml-models side of the DeepSeek-V4.1-Flash learnings pass (rababa TODO.impl/03, /06, and the two measurement probes).

Headwise Muon (muon.py): per-head Newton-Schulz for Q/K projections - externally validated by DeepSeek-V4.1-Flash sec 2.5, GLM-5 and Kimi-K3. New add_headwise_group (converts an existing Muon group in place or adds one), qk_named selector, shared _momentum_direction helper. Config-gated by the headwise_muon spec flag in the distill loop, off by default - off-state routing is bit-identical.

Sinkhorn-balanced update (sinkhorn_update.py): the report's Algorithm 1 as an optimizer for embedding/head matrices - Nesterov momentum, alternating row/column L2 normalization (odd K, ends rows), near-zero row masking at tau=1e-3, sqrt(hidden-dim) RMS conversion, gamma=0.18 lr correction, no weight decay. eps=1e-20 guards per the mHC log-domain lesson.

Probes: scripts/probe_speculative.py (draft/verify acceptance between the shipped layerdrop-int4 and small-2.1-int8 artifacts over golden-v1 rows; measured acceptance 0.97-1.00 at ~8.9 tokens per verifier pass, K=8; output-preserving greedy verification verified exact against the plain-path reference) and src/gpu/modal_teacher_sadeed.py (teacher-only SadeedDiac-25 predictions under the windowed protocol - produced the r6 per-domain slice behind the negative routing verdict).

Spec: ara-diac-small-lite2 - the lite rung's one untested variable: layer-drop init from the trained 2.1 student instead of generic byt5-small, recipe otherwise identical to run-009 (launched separately).

Tests: test_muon_headwise.py (5) and test_sinkhorn_update.py (6), all real tensors - per-slice equivalence, heads=1 identity, hand-computed balance case, manual algorithm match, no-weight-decay contract.

Ronald Tse added 2 commits September 11, 2026 21:24
TODO.impl/03, /06 and the two measurement probes from the
DeepSeek-V4.1-Flash learnings pass:

- muon: headwise group (per-head Newton-Schulz for Q/K, config-gated
  by the headwise_muon spec flag, off by default), qk_named selector,
  shared momentum helper. Off-state routing bit-identical.
- sinkhorn_update: Algorithm 1 as an optimizer for embedding/head
  matrices (Nesterov momentum, alternating row/col L2, near-zero row
  mask, sqrt(hidden) RMS conversion, gamma=0.18 lr correction, no
  weight decay, eps=1e-20 guards).
- probe_speculative: draft/verify acceptance measurement over
  golden-v1 rows between the shipped layerdrop-int4 and small-2.1-int8
  artifacts (early rows: acceptance 0.97-1.00, ~8.9 tokens/verify).
- modal_teacher_sadeed: teacher-only SadeedDiac-25 predictions under
  the windowed protocol (used for the r6 per-domain slice, negative
  verdict recorded in rababa TODO.impl/02).
- distill_specs: ara-diac-small-lite2 - the lite rung's untested
  variable, layer-drop init from the trained 2.1 student.
@ronaldtse
ronaldtse merged commit 1fab970 into main Sep 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant