Skip to content

Commit 815de22

Browse files
authored
Merge pull request #73 from cybertronai/feat/muon-review-prompt
docs: Add agent prompt system + Task 9 (Muon optimizer review)
2 parents 141cb57 + f084062 commit 815de22

4 files changed

Lines changed: 136 additions & 1 deletion

File tree

docs/agent-prompts/muon-review.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Muon Optimizer Literature Review
2+
3+
You are contributing to the **Sutro Group**, a research lab studying energy-efficient AI training. Your task is a literature review of the **Muon optimizer**.
4+
5+
## Project context
6+
7+
Read these files first:
8+
- `DISCOVERIES.md` — what's already known
9+
- `LAB.md` — lab rules (important: do NOT modify measurement code, tracker.py, cache_tracker.py, data.py, config.py, harness.py)
10+
- `findings/_template.md` — reference for expected report format
11+
12+
- We optimize for **energy efficiency**, not just accuracy or speed
13+
- Our benchmark: **sparse parity** (n=20 bits, k=3 secret, 17 noise)
14+
- Our metric: **ByteDMD** (https://github.com/cybertronai/ByteDMD) — successor to DMC. Tracks memory at **byte level** (not per-element), using integer arithmetic. Reference implementation has been hardened against escape hatches (agents were bypassing TrackedArray via np.asarray() → Python ints). See also: https://github.com/cybertronai/ByteDMD-examples for test cases.
15+
- **Baseline SGD**: ~0.12s wall-clock, high DMD (exact ByteDMD score unmeasured — you'd need to run the ByteDMD tracer)
16+
- **Best known**: GF(2) Gaussian Elimination (~509us, low byte-level access count), KM-min (~1ms)
17+
18+
## Task: Research the Muon optimizer
19+
20+
### 1. Read the Muon paper
21+
22+
Primary source: https://kellerjordan.github.io/posts/muon/
23+
24+
Key facts to extract:
25+
- The algorithm: Newton-Schulz iteration on SGD momentum updates to orthogonalize gradients
26+
- How it replaces Adam's element-wise adaptation with matrix orthogonalization
27+
- Performance claims (CIFAR-10, NanoGPT, 1.5B parameter models)
28+
- Computational overhead (<1% FLOP overhead claimed)
29+
- Scope: only for 2D hidden-layer weights, paired with AdamW for embeddings/biases
30+
31+
### 2. Analyze relevance to energy efficiency
32+
33+
Study the ByteDMD metric: https://github.com/cybertronai/ByteDMD
34+
35+
Investigate:
36+
- Does Newton-Schulz iteration **reduce byte-level data movement** compared to Adam's moment tracking (first + second moment buffers)?
37+
- What's the **FLOP/memory tradeoff**? Does it reduce byte accesses at the cost of more compute?
38+
- Does orthogonalization change **reuse distance patterns** compared to Adam or SGD?
39+
- Would Muon help on **small networks** (hidden=200, our sparse parity setup) or only large LLMs?
40+
41+
### 3. Write findings
42+
43+
Create `findings/exp_muon_review.md` following this structure:
44+
45+
```markdown
46+
# Muon Optimizer — Literature Review
47+
48+
## Hypothesis
49+
[What we expect Muon to help with (or not) for energy efficiency]
50+
51+
## Key Facts from Paper
52+
- [5-10 bullets on algorithm, results, limitations]
53+
54+
## Relevance to Sutro Group
55+
[Would Muon improve energy efficiency on sparse parity? Why/why not?]
56+
57+
## Comparison to Our Methods
58+
[How Muon relates to our best methods: SGD, GF(2), KM-min]
59+
60+
## Open Questions
61+
[What we'd need to test experimentally to know for sure]
62+
63+
## References
64+
- [Links to paper, code, follow-ups]
65+
```
66+
67+
## Rules
68+
69+
- **DO NOT** modify any experiment/run code (tracker.py, cache_tracker.py, data.py, config.py, harness.py, fast.py, src/)
70+
- **DO NOT** run experiments — this is a literature review only
71+
- Write findings to `findings/exp_muon_review.md`
72+
- Check `DISCOVERIES.md` first to avoid repeating known results
73+
- Do NOT change LAB.md, DISCOVERIES.md, CLAUDE.md, CODEX.md, or any other project configuration

docs/findings/exp_muon_review.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Muon Optimizer — Literature Review
2+
3+
## Hypothesis
4+
If we substitute standard optimizers with Muon's Newton-Schulz matrix orthogonalization for the sparse parity task, we expect it to *worsen* energy efficiency (increase ByteDMD) compared to SGD. Newton-Schulz iterations require multiple heavy matrix multiplications per step, generating high byte-level data movement through intermediate matrices. Furthermore, its overhead scales inversely with batch size, making it extremely inefficient for our single-sample or small-batch regimes.
5+
6+
## Key Facts from Paper
7+
- **Algorithm:** Muon orthogonalizes the update matrix from SGD-momentum using a Newton-Schulz (NS) iteration, replacing the update with the nearest semi-orthogonal matrix ($UV^\top$ from SVD).
8+
- **Scope:** It applies only to 2D hidden layer parameters (e.g., $W_1$). Embedding, bias, and output parameters must still be optimized by AdamW/standard methods.
9+
- **Memory footprint:** Muon uses SGD-momentum (one buffer), substituting Adam's second moment accumulator with NS iteration matrix temporaries ($A, B, X$) computed in bfloat16.
10+
- **Computational overhead:** The overhead is bounded by $Tm/B$ where $T \approx 5$ is NS steps, $m$ is model dimension, and $B$ is batch size in tokens. For large transformers ($B > 500,000$), FLOP overhead is < 1%.
11+
- **Performance:** Set speedrun records for training NanoGPT and CIFAR-10. It reduced the training time of a 1.5B parameter transformer on HellaSwag from 13.3 to 10 hours.
12+
- **Limitations:** Muon has a slower per-step wallclock time than standard optimizers; its success hinges on reducing the overall number of training steps (epochs) significantly.
13+
14+
## Relevance to Sutro Group
15+
- **Energy efficiency (ByteDMD):** Muon is highly detrimental to ByteDMD. The 5-step NS iteration performs operations like $A = XX^\top$ and $B = bA + cA^2$, aggressively reading and writing matrices. Each matmul natively incurs a massive ByteDMD cost (as intermediate values flush the LRU stack), ruining the cache locality that makes single-sample SGD efficient.
16+
- **Small batch scaling:** Our sparse parity setups use small networks ($m=200$ to $1000$) with tiny batch sizes ($B=1$ to $32$). The FLOP overhead $Tm/B$ becomes astronomical, e.g., $5 \times 1000 / 32 \approx 156\times$ the baseline FLOPs.
17+
- **Problem structure:** Sparse parity's difficulty is primarily searching for exactly $k$ secret bits (a combinatorial feature extraction problem), not resolving a poorly conditioned loss landscape in hidden layer activations, which is what orthogonalization fixes.
18+
19+
## Comparison to Our Methods
20+
- **SGD:** Single-sample SGD has excellent L1-cache locality yielding low ByteDMD/ARD. Muon would require accumulating a batch update and running an $O(m^3)$ matrix orthogonalization, destroying our $100\%$ L1 hit rates and resulting in a much higher DMC.
21+
- **EGD (Egalitarian Gradient Descent):** Existing experiments (`exp_egd`) show that gradient SVD-normalization cuts epochs by ~2x but its per-step SVD overhead makes wall time 12% worse. Muon's NS iteration is an approximation to SVD, meaning it would run into the same exact bottleneck for this task: optimizing the step count at the expense of per-step computational & data movement overhead.
22+
- **GF(2) & KM-min:** These perform extremely well on parity (DMC ~3500-8600, ~1ms wall-clock). Muon, as a gradient-based iterative optimizer, fundamentally has no path to beating $O(n)$ or deterministic matrix algebra solvers on purely logical tasks.
23+
24+
## Open Questions
25+
- Does Newton-Schulz iteration yield *any* net epoch reduction for 20-bit sparse parity, or does orthogonalizing the gradient matrices corrupt the needle-in-a-haystack subsets of weights that are actually learning?
26+
- Can the Newton-Schulz step be computed iteratively in a block-tiled manner to fit completely within the L1 cache, thereby bounding its otherwise catastrophic ByteDMD cost?
27+
- What is the empirical ByteDMD cost of running 1 step of Muon vs. 1 step of SGD on a $1000 \times 20$ matrix using `bytedmd`'s tracker?
28+
29+
## References
30+
- Primary Source: [Muon Blog Post](https://kellerjordan.github.io/posts/muon/)
31+
- Code: [KellerJordan/Muon GitHub](https://github.com/KellerJordan/Muon)
32+
- Metric: [ByteDMD Metric Definition](https://github.com/cybertronai/ByteDMD)
33+
- Internal Context: `DISCOVERIES.md` (`exp_egd` and scaling properties)

docs/tasks/009-muon-review.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Task 9: Muon Optimizer Literature Review
2+
3+
**Priority**: MEDIUM
4+
**Status**: DONE
5+
**Agent**: Antigravity
6+
**Source**: Yaroslav's Information Bottleneck podcast interview (April 1), search_space.yaml (listed but untested)
7+
8+
## Context
9+
10+
Yaroslav mentioned Muon in the Information Bottleneck podcast as an example. The lab's learning-guide.md notes: "Muon (first optimizer to beat Adam in 10 years) was discovered on 2-second CIFAR runs."
11+
12+
Muon appears in `research/search_space.yaml` but was never tested. The question: does an optimizer that orthogonalizes gradients (Newton-Schulz iteration) reduce memory access patterns compared to Adam's moment tracking? Relevant to our ByteDMD metric.
13+
14+
## Tasks
15+
16+
- [x] Read the Muon paper (https://kellerjordan.github.io/posts/muon/)
17+
- [x] Study ByteDMD metric (https://github.com/cybertronai/ByteDMD)
18+
- [x] Analyze whether Newton-Schulz iteration reduces byte-level data movement vs Adam
19+
- [x] Assess whether Muon helps on small networks (hidden=200) or only large LLMs
20+
- [x] Write findings to `docs/findings/exp_muon_review.md` using the agent prompt scaffold
21+
22+
## References
23+
24+
- Agent prompt: [docs/agent-prompts/muon-review.md](../agent-prompts/muon-review.md)
25+
- Muon paper: https://kellerjordan.github.io/posts/muon/
26+
- ByteDMD: https://github.com/cybertronai/ByteDMD
27+
- ByteDMD test cases: https://github.com/cybertronai/ByteDMD-examples
28+
- Learning guide mention: [docs/learning-guide.md](../learning-guide.md)
29+
- Search space: [research/search_space.yaml](../../research/search_space.yaml)

docs/tasks/INDEX.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ Feedback from Meetings #8-11, Telegram, and Google Docs. Updated 2026-04-19.
1212
| 6 | Prep homework for next Monday (present results/process) | HIGH | SUPERSEDED | [006-homework-monday.md](006-homework-monday.md) |
1313
| 7 | Homework for Meeting #10: DMC baseline + optimization | HIGH | DONE | [007-homework-meeting10.md](007-homework-meeting10.md) |
1414
| 8 | Pre-experiment plan: DMC comparison, RL env, license | MEDIUM | IN PROGRESS | [008-pre-experiment-plan.md](008-pre-experiment-plan.md) |
15-
| 9 | Muon optimizer review (ByteDMD-aware agent prompt) | MEDIUM | OPEN (PR #73) | docs/agent-prompts/muon-review.md |
15+
| 9 | Muon optimizer literature review (ByteDMD-aware) | MEDIUM | DONE | [009-muon-review.md](009-muon-review.md) |
1616
| 10 | ASI-Evolve paper review — autonomous loop lessons | HIGH | IN PROGRESS | [010-asi-evolve-integration.md](010-asi-evolve-integration.md) |

0 commit comments

Comments
 (0)