feat: GF-T exp2 primitive + 4-neuron layer + AX7203 classifier synth runbook (Refs #1764) - #1803
Closed
gHashTag wants to merge 3 commits into
Closed
feat: GF-T exp2 primitive + 4-neuron layer + AX7203 classifier synth runbook (Refs #1764)#1803gHashTag wants to merge 3 commits into
gHashTag wants to merge 3 commits into
Conversation
Three parallel deliverables ("все три"):
A2 - specs/ternary/gft_exp2.t27 (GftExp2): a GF-T exp2 primitive, 2^x for a
signed GF-T16 -> positive GF-T16. The missing building block for a GF-T softmax
(softmax = 2^logit / sum 2^logit). |x|->Q16.16 (positive shifts only),
sign-aware floor into k+f, 2^x = 2^k * 2^f; 2^k is an exact GF-T offset, 2^f
mantissa via a Q16 quartic with rounded Horner shifts (coeffs 354,123,29,6).
Prototyped + fitted in Python vs the exact mantissa (<=1 ULP over all 2^16
fractions) and vs true round_to_GFT(2^x) (<=1 ULP) before transcribing. Bit-exact
to the committed oracle 606/606 (iverilog).
B - specs/ternary/gft_layer4.t27 (GftLayer4): extends gft_layer3 to 4 neurons
(M->N=4), 4 trits packed 2 bits each. Doubly-grounded oracle, iverilog 500/500.
C - docs/synth/CLASSIFIER_AX7203.md: owner-gated flow to take gft_classifier4
spec -> yosys -> nextpnr-xilinx -> openFPGALoader on ALINX AX7203 (XC7A200T).
Final JTAG flash needs the user at the board; everything up to the bitstream is
scripted. On-silicon done = replay the conformance vectors, bit-exact on-air.
Fresh seals for GftExp2 + GftLayer4 (seal --verify MATCH). No compiler change.
Refs #1764
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gft_recip.t27 (GftRecip): 1/x for a signed GF-T16 -- the last missing softmax
primitive. Closed form (no polynomial): 512+m' = round(524288/(512+m)),
off' = 79-o (+renorm). One rounded integer divide -> EXACT (0 ULP) vs true 1/x.
iverilog 506/506 bit-exact.
gft_softmax4.t27 (GftSoftmax4): the complete GF-T softmax over 4 signed GF-T16
logits, base-2, max-stabilized: p_i = 2^(l_i-M) / sum 2^(l_j-M), returns p_sel.
Composes the verified primitives -- max (gt), subtract (sadd+neg), exp2 (<=1 ULP),
sum (sadd), reciprocal (exact), multiply (RNE). Bit-exact to the integer oracle
2000/2000 (iverilog); accuracy <=0.0017 abs probability vs true float softmax
(sum-of-probs in [0.9982,1.0018]; uniform -> 0.25 exact).
Completes the GF-T classifier head: activations -> MLP -> logits ->
{argmax -> class} or {softmax -> calibrated probabilities}.
Fresh seals for GftRecip + GftSoftmax4 (seal --verify MATCH). No compiler change.
Refs #1764
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat(spec): GF-T reciprocal + complete GF-T softmax (Refs #1764)
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
This was referenced Aug 6, 2026
Contributor
Contributor
PR DashboardGenerated at: 2026-08-06 22:22:01 UTC
Summary
Seal Status
|
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Owner
Author
|
Superseded: this branch's content (gft_layer4.t27 + docs/synth/CLASSIFIER_AX7203.md) already landed in master via the integration merge #1809, together with the full GF-T train+infer stack. Closing as redundant. |
auto-merge was automatically disabled
August 6, 2026 23:06
Pull request was closed
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.
"все три параллельно" — three deliverables in one PR (batched to avoid
docs/NOW.mdconflict churn during the ongoing GitHub Actions incident that still blocks merging #1801 + #1802).A² —
gft_exp2.t27: a GF-T exp2 primitive (the softmax building block)2^xfor a signed GF-T16 input → positive GF-T16. Softmax in base 2 is2^logit / Σ 2^logit, so exp2 is the missing primitive.Method (all integer, hardware-shaped):
|x|→Q16.16(positive shifts only, no signed-shift ambiguity) → sign-aware floor into integerk+ fractionf→2^x = 2^k·2^f;2^kis an exact GF-T offset, the2^fmantissa comes from a Q16 quartic with rounded Horner shifts (coeffs354,123,29,6).Prototype-first (debugging doctrine): the poly was fitted + local-searched in Python against the exact mantissa — ≤1 ULP over all 2¹⁶ fractions — and the whole pipeline against true
round_to_GFT(2^x)— ≤1 ULP over the logit sweep — before transcribing to.t27. Bit-exact to the committed integer oracle 606/606 (iverilog). Spot-checks exact: 2⁰=1, 2¹=2, 2⁻¹=0.5, 2²=4.B —
gft_layer4.t27: 4-neuron BitNet×GF-T layerExtends
gft_layer3to 4 neurons (M→N=4): 4 shared GF-T16 activations → 4 trits packed 2 bits each. Doubly-grounded oracle (int-vs-float), iverilog 500/500 bit-exact.C —
docs/synth/CLASSIFIER_AX7203.md: owner-gated flash runbookCopy-paste flow:
gft_classifier4spec → yosys (synth_xilinx -family xc7) → nextpnr-xilinx →openFPGALoaderon ALINX AX7203 (XC7A200T). The final JTAG flash is owner-gated (needs the user at the board). On-silicon "done" = replaygft_classifier4_vectors.txt, class index bit-exact 1500/1500 on-air (mirrors thegft_dot2#185 proof).Fresh seals for
GftExp2+GftLayer4(seal --verify→ MATCH). No compiler change.Refs #1764
🤖 Generated with Claude Code