Calc Consulting (@CalcCon) header
Calc Consulting (@CalcCon) profile picture

Calculation Consulting is a boutique consultancy that specializes in machine learning, AI, and data science

San Francisco
Joined January 2013
Replying to @iScienceLuvr
IMHO, the challenge is to develop a baseline measure that requires no tuning. Let me propose the weightwatcher spectral renormalization group view of learning.
48
𝗱𝗼𝗲𝘀 𝗪𝗲𝗶𝗴𝗵𝘁𝗪𝗮𝘁𝗰𝗵𝗲𝗿 𝘄𝗼𝗿𝗸 𝗳𝗼𝗿 𝗟𝗟𝗠𝘀? Yes! We trained a character-level GPT on Shakespeare using SGD with momentum (SGDM). ChatGPT ran this, using 5 seeds, tracking every 500 updates. Below I plot the test loss vs average alpha ⟨α⟩ , and how often it predicted the next character correctly on held-out text The average alpha here is a confidence-weighted, tail-size-adjusted average. Notice that even though the test accuracy keeps increasing, the the test loss is a minimum: ⟨α⟩ ≈ 2
𝗛𝗼𝘄 𝘄𝗲𝗹𝗹 𝗱𝗼𝗲𝘀 𝗪𝗲𝗶𝗴𝗵𝘁𝗪𝗮𝘁𝗰𝗵𝗲𝗿 𝘄𝗼𝗿𝗸 𝗳𝗼𝗿 𝗟𝗟𝗠𝘀? One question I get when we try to publish our WeightWatcher work is whether you can really tell how well a language model is learning just by looking at its weights. The classic Shakespeare GPT experiment is small enough to try for yourself. We trained a character-level GPT on Shakespeare using SGD with momentum. Every 500 updates, we measured how often it predicted the next character correctly on held-out text. We also ran WeightWatcher on the model’s weights. Each dot is an average across five training runs. 𝗙𝗼𝗹𝗹𝗼𝘄 𝘁𝗵𝗲 𝗰𝘂𝗿𝘃𝗲 𝗳𝗿𝗼𝗺 𝘁𝗵𝗲 𝗹𝗼𝘄𝗲𝗿 𝗿𝗶𝗴𝗵𝘁. • 𝟱𝟬𝟬 𝘂𝗽𝗱𝗮𝘁𝗲𝘀 — Average α ~= 3.0. The model gets the next character right 29% of the time. • 𝟴,𝟬𝟬𝟬 𝘂𝗽𝗱𝗮𝘁𝗲𝘀 — Average α ~= 2 as accuracy climbs to 50%. That’s the marginal value our renormalization group theory predicts. • 𝟮𝟬,𝟬𝟬𝟬 𝘂𝗽𝗱𝗮𝘁𝗲𝘀 — Accuracy reaches 54.21%, while average α drifts back up to about 2.21. 𝗪𝗵𝗮𝘁 𝗴𝗼𝗲𝘀 𝗶𝗻𝘁𝗼 𝘁𝗵𝗮𝘁 𝗮𝘃𝗲𝗿𝗮𝗴𝗲? For each layer, WeightWatcher fits a power law to the largest eigenvalues in its weight spectrum. The exponent of that fit is α. Layers differ in size, and some have only a few eigenvalues in the fitted tail. We give a layer more weight when more eigenvalues support the fit and when the fitted power law follows the observed tail more closely. 𝗜𝗻𝗱𝗶𝘃𝗶𝗱𝘂𝗮𝗹 𝗹𝗮𝘆𝗲𝗿𝘀 𝘃𝗮𝗿𝘆 𝗾𝘂𝗶𝘁𝗲 𝗮 𝗯𝗶𝘁. Theiweighted average α ~= 2 as accuracy improves through the first several thousand updates. After 8-10,000 updates, the model gains another four percentage points while the average α >~ 2.2, a slight drift upward. Of course, no one really trains LLMs for crazy long periods of time. Still, one can ask 𝗪𝗵𝘆 𝘁𝗵𝗲 𝗹𝗮𝘁𝗲-𝘀𝘁𝗮𝗴𝗲 𝗱𝗿𝗶𝗳𝘁 ? • Is that drift sensitive to how we take the weighted average? • Or does the most accurate checkpoint genuinely sit a little away from marginality? These are interesting questions to be sorted out. You can run this yourself, or ask ChatGPT to help. Train Shakespeare GPT, run WeightWatcher every 500 updates, and plot accuracy against your own weighted average α.
2
5
294
𝗛𝗼𝘄 𝘄𝗲𝗹𝗹 𝗱𝗼𝗲𝘀 𝗪𝗲𝗶𝗴𝗵𝘁𝗪𝗮𝘁𝗰𝗵𝗲𝗿 𝘄𝗼𝗿𝗸 𝗳𝗼𝗿 𝗟𝗟𝗠𝘀? One question I get when we try to publish our WeightWatcher work is whether you can really tell how well a language model is learning just by looking at its weights. The classic Shakespeare GPT experiment is small enough to try for yourself. We trained a character-level GPT on Shakespeare using SGD with momentum. Every 500 updates, we measured how often it predicted the next character correctly on held-out text. We also ran WeightWatcher on the model’s weights. Each dot is an average across five training runs. 𝗙𝗼𝗹𝗹𝗼𝘄 𝘁𝗵𝗲 𝗰𝘂𝗿𝘃𝗲 𝗳𝗿𝗼𝗺 𝘁𝗵𝗲 𝗹𝗼𝘄𝗲𝗿 𝗿𝗶𝗴𝗵𝘁. • 𝟱𝟬𝟬 𝘂𝗽𝗱𝗮𝘁𝗲𝘀 — Average α ~= 3.0. The model gets the next character right 29% of the time. • 𝟴,𝟬𝟬𝟬 𝘂𝗽𝗱𝗮𝘁𝗲𝘀 — Average α ~= 2 as accuracy climbs to 50%. That’s the marginal value our renormalization group theory predicts. • 𝟮𝟬,𝟬𝟬𝟬 𝘂𝗽𝗱𝗮𝘁𝗲𝘀 — Accuracy reaches 54.21%, while average α drifts back up to about 2.21. 𝗪𝗵𝗮𝘁 𝗴𝗼𝗲𝘀 𝗶𝗻𝘁𝗼 𝘁𝗵𝗮𝘁 𝗮𝘃𝗲𝗿𝗮𝗴𝗲? For each layer, WeightWatcher fits a power law to the largest eigenvalues in its weight spectrum. The exponent of that fit is α. Layers differ in size, and some have only a few eigenvalues in the fitted tail. We give a layer more weight when more eigenvalues support the fit and when the fitted power law follows the observed tail more closely. 𝗜𝗻𝗱𝗶𝘃𝗶𝗱𝘂𝗮𝗹 𝗹𝗮𝘆𝗲𝗿𝘀 𝘃𝗮𝗿𝘆 𝗾𝘂𝗶𝘁𝗲 𝗮 𝗯𝗶𝘁. Theiweighted average α ~= 2 as accuracy improves through the first several thousand updates. After 8-10,000 updates, the model gains another four percentage points while the average α >~ 2.2, a slight drift upward. Of course, no one really trains LLMs for crazy long periods of time. Still, one can ask 𝗪𝗵𝘆 𝘁𝗵𝗲 𝗹𝗮𝘁𝗲-𝘀𝘁𝗮𝗴𝗲 𝗱𝗿𝗶𝗳𝘁 ? • Is that drift sensitive to how we take the weighted average? • Or does the most accurate checkpoint genuinely sit a little away from marginality? These are interesting questions to be sorted out. You can run this yourself, or ask ChatGPT to help. Train Shakespeare GPT, run WeightWatcher every 500 updates, and plot accuracy against your own weighted average α.
1
1
4
614
and the result is even cleaner if when taking the average, we also count for the size of the power law tail
60
𝗖𝗮𝗻 𝘄𝗲 𝗳𝗶𝘅 𝗔𝗱𝗮𝗺𝗪’𝘀 𝗶𝗺𝗽𝗹𝗶𝗰𝗶𝘁 𝘀𝗽𝗲𝗰𝘁𝗿𝗮𝗹 𝗯𝗶𝗮𝘀 𝘂𝘀𝗶𝗻𝗴 𝗥𝗲𝗻𝗼𝗿𝗺𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻 𝗚𝗿𝗼𝘂𝗽 𝘁𝗵𝗲𝗼𝗿𝘆? We’ve been testing a prediction from our new Renormalization Group (RG) theory of neural-network weight spectra, building on WeightWatcher, HTSR, and SETOL. Our theory identifies 𝗮𝗹𝗽𝗵𝗮 = 𝟮 as a marginal spectral regime. We expect the theory to work most naturally with scale-covariant optimizers such as SGD with momentum. But AdamW introduces an interesting complication. 𝗔𝗱𝗮𝗺𝗪 𝗯𝗿𝗲𝗮𝗸𝘀 𝘁𝗵𝗲 𝘀𝗰𝗮𝗹𝗲 𝘀𝘆𝗺𝗺𝗲𝘁𝗿𝘆. AdamW’s adaptive update rule does not transform under weight rescaling in the same way as SGD with momentum. We hypothesize that this symmetry breaking introduces an implicit spectral bias. During training, AdamW can produce layer exponents below α = 2, while prolonged training may drive them above 2 without necessarily improving generalization. 𝗖𝗮𝗻 𝘄𝗲 𝗰𝗼𝗿𝗿𝗲𝗰𝘁 𝘁𝗵𝗶𝘀 𝗯𝗶𝗮𝘀? We modified AdamW by replacing its matrix-update magnitudes with SGDM-matched magnitudes, while retaining AdamW’s adaptive directions and moment history. The goal is to restore the spectral behavior predicted by our RG framework without abandoning adaptive optimization. 𝗧𝗵𝗲 𝗽𝗿𝗲𝗹𝗶𝗺𝗶𝗻𝗮𝗿𝘆 𝗿𝗲𝘀𝘂𝗹𝘁𝘀 𝗮𝗿𝗲 𝗲𝗻𝗰𝗼𝘂𝗿𝗮𝗴𝗶𝗻𝗴! We ran controlled experiments on MNIST and Fashion-MNIST, comparing native AdamW, modified AdamW, and SGD with momentum. The accompanying figure shows 40 Fashion-MNIST runs for each AdamW variant. The best modified AdamW model achieved: • 𝟵𝟬.𝟮𝟲% 𝘁𝗲𝘀𝘁 𝗮𝗰𝗰𝘂𝗿𝗮𝗰𝘆 • 𝗞𝗦-𝗰𝗼𝗻𝗳𝗶𝗱𝗲𝗻𝗰𝗲-𝘄𝗲𝗶𝗴𝗵𝘁𝗲𝗱 𝗮𝘃𝗲𝗿𝗮𝗴𝗲 α ≈ 𝟮.𝟬𝟴 • Higher accuracy than every native AdamW model in this experiment. The best native AdamW model reached 89.73%. Importantly, 𝘄𝗲 𝗮𝗿𝗲 𝗻𝗼𝘁 𝗰𝗹𝗮𝗶𝗺𝗶𝗻𝗴 𝘁𝗵𝗮𝘁 𝗲𝘃𝗲𝗿𝘆 𝗹𝗮𝘆𝗲𝗿 𝗰𝗼𝗻𝘃𝗲𝗿𝗴𝗲𝘀 𝘁𝗼 α = 𝟮. The prediction concerns a collective spectral observable: the confidence-weighted average across FC1, FC2, and FC3. We compute this using the quality of each layer’s power-law fit, measured by its Kolmogorov–Smirnov distance: α̂_KS = [Σₗ α̂ₗ/(D_KS,ₗ + 0.02)] / [Σₗ 1/(D_KS,ₗ + 0.02)] This weighting reduces the influence of poorly fitted spectra. 𝗪𝗵𝗮𝘁 𝗱𝗼𝗲𝘀 𝘁𝗵𝗶𝘀 𝘀𝘂𝗴𝗴𝗲𝘀𝘁? The results are consistent with our hypothesis that optimizer-induced scale-symmetry breaking affects spectral marginality. Correcting the update magnitudes appears to produce models with improved accuracy and a collective spectral exponent close to the predicted marginal value. These are preliminary results, not yet a demonstration of universal convergence or causality. The experiments, checkpoint verification, and analysis were conducted using 𝗖𝗵𝗮𝘁𝗚𝗣𝗧 𝗪𝗼𝗿𝗸, which acted as an autonomous research assistant. We’ll be extending this investigation to transformer models and preparing a more detailed write-up. 𝗧𝗵𝗲 𝗲𝗺𝗲𝗿𝗴𝗶𝗻𝗴 𝗽𝗶𝗰𝘁𝘂𝗿𝗲: 𝗼𝗽𝘁𝗶𝗺𝗶𝘇𝗲𝗿 𝗱𝘆𝗻𝗮𝗺𝗶𝗰𝘀 𝗺𝗮𝘁𝘁𝗲𝗿 𝗳𝗼𝗿 𝘀𝗽𝗲𝗰𝘁𝗿𝗮𝗹 𝘂𝗻𝗶𝘃𝗲𝗿𝘀𝗮𝗹𝗶𝘁𝘆.
1
4
23
842
🌴 𝗩𝗮𝗰𝗮𝘁𝗶𝗼𝗻 𝗿𝗲𝘀𝗲𝗮𝗿𝗰𝗵: 𝗔𝗱𝗮𝗺𝗪 𝗮𝗻𝗱 𝗮𝗹𝗽𝗵𝗮 ChatGPT and I have been digging into why AdamW often pushes layer α below 2. 𝗧𝗵𝗲 𝗰𝗹𝘂𝗲: Adam’s normalization divides out the gradient’s scale. Under a scale-invariant loss, SGDM needs η → b²η; Adam needs η → bη. That breaks the SGDM scaling law used in our RG mapping. 𝗧𝗵𝗲 𝘁𝗲𝘀𝘁: Keep Adam’s direction. Replace its step magnitude with the momentum-SGD rule. • Test accuracy: 𝟵𝟳.𝟲𝟵% → 𝟵𝟴.𝟰𝟰% • 𝟯𝟯% 𝗳𝗲𝘄𝗲𝗿 𝘁𝗲𝘀𝘁 𝗲𝗿𝗿𝗼𝗿𝘀, three fresh seeds • FC1 α: 1.74 → 2.09; FC2 α: 1.86 → 1.94 • FC3 remained above 2 These MNIST results support a clearer explanation of AdamW’s implicit bias. We’re working out the corrections to our theory. For now, I recommend 𝗦𝗚𝗗 𝘄𝗶𝘁𝗵 𝗺𝗼𝗺𝗲𝗻𝘁𝘂𝗺 as the reference for applying our WeightWatcher/RG framework.
1
1
8
404
A great example from the weightwatcher community discord channel testing out the ww-pgd optimizer on nano GPT
4
387
and one more subsection, I will add to the paper before I leave for vacation this week Here I will describe two ideas 1. Why the average layer alpha is a good metric, even when the individual layer alphas are off 2. The difference between mode seeking and geometry, seeking and how we can gauge layers this way.
2
13
703
In finalizing the RG paper, I realize that I can connect the spectral flow directly to a a dilation beta function for each individual layer arising directly in BackProp Once I’m sure this is correct. I’ll add it to the paper and submit an updated version. Comments welcome
2
26
996