feat(spec): GF-T SGD weight update w'=w-eta*g — training loop closed (Refs #1764) - #1807
Merged
Merged
Conversation
gft_sgd_step.t27 (GftSgdStep): a GF-T SGD weight update, the final brick of an on-device training step. eta positive learning rate, g the signed gradient, w the signed weight. Composes a signed multiply smul (sign = XOR of signs, magnitude = the verified RNE magnitude mul) with subtract (sadd + neg). Bit-exact to the integer oracle 500/500 (iverilog); accuracy to GF-T16 precision (<=1 ULP). Spot: w=1,g=0.5,eta=0.5 -> 0.75 exact; g=0 -> w unchanged; w=1,g=-1,eta=1 -> 2.0. The full on-device training loop is now expressible spec-first on GF-T: logits -> softmax -> prob -> NLL loss (forward) -> gradient p-y (backward) -> w' = w - eta*g (update). Every stage iverilog-verified bit-exact. Fresh seal for GftSgdStep (seal --verify MATCH). No compiler change. Refs #1764 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1806. Base retargets to
masteras the stack merges.gft_sgd_step.t27— GF-T SGD weight updatew' = w − η·gThe final brick of an on-device training step.
η= positive learning rate,g= signed gradient (from #1806),w= signed weight. Composes a signed multiplysmul(sign = XOR of the signs, magnitude = the verified RNE magnitude multiply) with subtract (sadd+neg).w=1, g=0.5, η=0.5 → 0.75exact;g=0 → wunchanged;w=1, g=−1, η=1 → 2.0(ascent) exact.The full on-device training loop is now expressible spec-first on GF-T:
Every stage iverilog-verified bit-exact. Combined with the BitNet×GF-T layers/MLP/classifier, GF-T now spans a complete train + infer stack in synthesizable spec-first hardware.
Fresh seal (
seal --verify→ MATCH). No compiler change.Refs #1764
🤖 Generated with Claude Code