4 comments

  • ekelsen53 minutes ago
    From the guidelines: &quot;Please don&#x27;t use HN primarily for promotion. It&#x27;s ok to post your own stuff part of the time, but the primary use of the site should be for curiosity.&quot;<p>Every link submitted by the author seems to be self promotion...
    • martincsweiss25 minutes ago
      I wrote this essay out of curiosity for finetuning, and as part of my Postdoc. I thought folks here who are finetuning models might find it interesting.<p>And thanks for your feedback, I&#x27;ll try to post more of what I&#x27;m reading, too.
  • martincsweiss2 days ago
    If you fine-tune a model with weights stored in bf16 and let torch.optim.AdamW write to them directly, you get interesting behaviour. bf16 can only represent changes to weights if the change is at least ~1&#x2F;512 of the weight itself, so at small learning rates only the smallest weights can update.<p>As a result, you have a sparse fine-tuner that trains the small-magnitude weights and freezes the rest, with the cutoff set by your learning rate. This is a thing - I found half a dozen peer-reviewed papers (with thousands of citations) that fine-tune this way, but none of them reference this behaviour.<p>I dug into one called Quiet-STaR, because (a) it&#x27;s a cool paper, (b) they released their weights, and (c) their code works! So I diffed their base model and saw that indeed the small-magnitude weights were the only ones updated during their training. Then I reran its recipe with an optimizer that applies every update, and watched it diverge. A higher-precision optimizer needs a 3 to 10 times smaller learning rate to get the same result, and I couldn&#x27;t achieve a better result.<p>This started with Barron, Gnanapragasam &amp; Tschannen&#x27;s &quot;A Fix for Softmax and Cross-Entropy&quot; (Oct 2026). They show that the standard way of computing cross-entropy rounds the correct answer&#x27;s gradient to exactly zero once the model is confident enough (past a margin of about 5.5 in bf16, which they call the precision cliff), and that this, interacting with Adam, is what produces the &quot;slingshot&quot; loss spikes seen during grokking. Fix the rounding and the spikes go away: something people had studied as training dynamics was rounding.<p>That made me wonder what else out there is weird like this. This is one, and it runs the other way: their rounding bug adds instability to training; this one hides it.<p>The code, logs and evaluation results are in mweiss17&#x2F;quietstar-bf16-adamw, in case you want to check the receipts.
  • electroglyph1 hour ago
    semi-related: <a href="https:&#x2F;&#x2F;unsloth.ai&#x2F;docs&#x2F;get-started&#x2F;reinforcement-learning-rl-guide&#x2F;advanced-rl-documentation&#x2F;fp16-vs-bf16-for-rl">https:&#x2F;&#x2F;unsloth.ai&#x2F;docs&#x2F;get-started&#x2F;reinforcement-learning-r...</a><p>i personally do finetuning in FP16 because then the LoRA merge at the end has less rounding error.<p>for most models it&#x27;s lossless as well (when coming from a BF16 source), it&#x27;s very quick to scan the weights and make sure they&#x27;re all in range if you&#x27;re concerned.
    • martincsweiss27 minutes ago
      Yea that&#x27;s pretty related. In this case, I&#x27;m looking at full finetunes (although we don&#x27;t end up actually finetuning the whole model, just the small weights!)
  • ekelsen1 hour ago
    There&#x27;s a reason we keep around an fp32 copy of the weights?<p>This issue was recognized a decade ago when we first started training with fp16.
    • martincsweiss22 minutes ago
      But there are many, many papers (amassing thousands of citations) that actually don&#x27;t keep fp32 copies around.<p>Also fp16 is much more precise, so this is far less of an issue, and as far as I was able to tell nobody had identified the actual effect (that finetuning in bf16 is NanoAdam with the masking amount &#x2F; size of weights targetted determined by learning rate).<p>I figured that was an interesting inductive bias, to target small weights.