37.1 Ternion-Field Transformer (TFT): Purely Rational Rotor Dynamics, Non-Abelian Holonomy Attention, and Lie-Triple Curvature Gates on Parallel Concept-Field Bundles
“Reconstructing the Transformer out of ternions () means dismantling flat vector space along with its dense matrix multiplications (GEMM),
RMSNorm, two-dimensional AbelianRoPE,Softmaxexponential normalization, and -expanded feed-forward layers—rewriting the entire network as a purely rational spherical rotor dynamical system evolving on a parallel bundle of three-dimensional concept fields .”
Having liberated the minimal circular-arc ternion from Cartesian linearity into five lossless three-DOF nonlinear representations in Chapter 32 §32.4 and established active self-halting discretion in Chapter 36 §36.10, we arrive at the engineering synthesis of Chapter 37: recasting modern neural sequence modeling from the ground up as the Ternion-Field Transformer (TFT) (the neural architecture design and adaptive early-exit heuristic are marked MODEL; regarding arithmetic scope, under the rational retraction the entire forward rotor-block state-update core invoked in our opening epigraph—, 3D-NAPE, bilateral and butterfly projections, Born–Heap attention, and Lie-triple curvature gates—uses purely rational four-operation arithmetic +, -, ×, ÷, whereas the optional Gibbs retraction and the Euclidean-norm halting readout in §37.1.2 Item 5 evaluate algebraic square roots; dual-denominator polynomial identities, the seam-invariant sine vector, conformal metric bounds, Jacobian pullbacks, and reference tensor checks are manual derivation / NUM; deep-learning baselines are Literature; and large-scale perplexity and hardware throughput benchmarks are demarcated as OPEN in Open problem 37.4).
Nearly every structural pathology of the standard flat Transformer stems from forcing curved relational inference onto homogeneous Euclidean space : unconstrained dense GEMM layers let hidden norms drift exponentially, forcing repeated RMSNorm projections and severe activation outlier channels; 2D Rotary Position Embedding (RoPE) applies mutually commuting planar rotations, preventing position operators themselves from encoding path-ordered syntactic nesting; Softmax exponentials force weights to sum to even when no historical token matches, encouraging autoregressive heads under causal-mask asymmetry to park unmatched probability mass on initial tokens as empirically observed attention sinks; and flat linear layers lack intrinsic curvature interaction, forcing feed-forward blocks to spend nearly of model parameters on channel expansion (classical two-matrix FFNs expand to , while modern three-matrix gated SwiGLU uses hidden width for weights—or weights at full width). Restoring hidden states to a parallel bundle of three-dimensional ternion concept fields (echoing the 3D concept-field cap of §32.1) dissolves all five patches under a single rational circular-arc operator.
37.1.1 State Representation, the Dual-Denominator Arithmetic Core, and the Seam-Invariant Sine Vector
In TFT, the hidden state of token is not a monolithic vector , but a bundle of mutually orthogonal three-dimensional ternion concept fields on the projective adjoint quotient ():
each stored in the dual-chart Shadow-MRP coordinate of §32.4.2 using strictly real numbers and no scalar axis (on this adjoint quotient, and share , while antipodal boundary points on represent the same half-turn ; if spinor sheet resolution on is desired, one adjoins the sheet bit of §32.4.2).
-
Dual-Denominator Singularity-Free Ternion Multiplication () and Two Exact Polynomial Identities: For any , define the shared numerator , primary denominator , and shadow denominator (
manual derivation):Direct polynomial expansion establishes two identities valid identically across all of (
manual derivation):Four exact properties follow immediately: first, the selected denominator satisfies the global floor , so a single division never encounters a zero-denominator pole while calling only (zero transcendentals ); second, , locking every output inside the unit ball without
RMSNorm; third, is the exact two-sided identity on and is the exact global inverse (); fourth, is associative everywhere on and selects the shortest geodesic arc (with literal coordinate equality whenever the final product avoids the measure-zero half-turn seam , even if an intermediate product lands on the seam). -
Seam-Invariant Rational Sine Vector and Bounded Conformal Storage: Because antipodal boundary representatives on represent the same rotation, raw cross products in would flip sign across the seam. We therefore introduce the seam-invariant rational sine vector (matching the Cayley antisymmetric axis vector for ,
manual derivation):It is invariant under shadow inversion and vanishes smoothly on the half-turn seam , rendering all cross-field bridges and curvature gates single-valued on ! Simultaneously, differentiating yields a strictly conformally flat induced metric on with pointwise isotropic condition number (
manual derivation):From center () to equator (), the linear conformal length scale stays strictly within (max/min scale ratio ; metric scalar ; rotation-angle scale ). Every inter-layer state and
KV-Cacheentry is strictly bounded inside , eliminating unbounded norm outliers for scale-free fixed-pointINT8/INT4state storage (empirical quantization sensitivity across antipodal seam flips on is tracked in Open problem 37.4).
Dual denominators and the seam card: primary and shadow enforce the global floor , keeping every rotor product inside the unit ball without RMSNorm while verifying the seam-invariant sine vector (polynomial checks NUM, architecture MODEL, seam training and quantization benchmarks OPEN).
37.1.2 Geometric Reconstruction of the Five Core Transformer Modules
Built atop and , all five Transformer sub-blocks become native geometric operators on (MODEL + manual derivation):
-
Sequence Position Encoding: 3D Non-Abelian Path Holonomy (
3D-NAPEReplacing 2D AbelianRoPE): Whereas 2DRoPE(Su et al. 2021/2024) applies mutually commuting rotations whose position operators encode only scalar offset without path-ordered curvature,3D-NAPEaccumulates non-coplanar circular-arc rotors along each concept field:- Constant-step regime (recovering
RoPE): With constant step , right recurrence () paired with left inverse calibration and yields , depending strictly on relative offset ; - Token-gated regime (SSM fusion and syntactic spherical excess): For content-dependent steps deflecting across three orthogonal axes, pairing left recurrence with left calibration and cancels prefixes to isolate the reverse-ordered product , whereas pairing right recurrence with right calibration and isolates the forward-ordered product (mixing right recurrence with left calibration conjugates into ). Swapping two non-commuting step rotors
A → Bvs.B → A(ruling out coaxial steps as well as perpendicular half-turns in ) yields distinct composite rotors separable on suitable Bloch probe axes (while around any fixed pairwise non-antipodal triple vs. , reversing loop orientation flips , conjugates the return phase everywhere, and negates principal Girard spherical excess on non-great-circle triangles —or modulo in the collinear degenerate limit—anchored byshortest_gate_triangle_holonomyin Theorem 37.2, Item 5)!
- Constant-step regime (recovering
Non-Abelian holonomy: a swap card: swapping two orthogonal position steps A → B versus B → A separates by , whereas 2D commuting RoPE steps collapse together (shortest_gate_triangle_holonomy LEAN ✓, RoPE baseline ARGUED, rotor coordinates NUM).
- Role Projections (): Intra-Field Bilateral Rotors Sparse Butterfly Schur Bridges:
Eliminating dense matrices and their spurious cross-concept rotations (§32.1–§33.9), each projection combines:
- Intra-field bilateral rotors ( parameters): , exhausting all isometric degrees of freedom of per field;
- Logarithmic butterfly Schur bridges ( parameters): for across butterfly stages of pairs (padding to or using mixed-radix stages for general ), each pair carries a three-parameter coupling vector applying seam-invariant Lie-triple torque (and symmetrically on ), compressing per-layer projection cost from to (see Remark 37.3, Item 2, and bridge/Schur anchors in Theorem 37.2, Items 6–7).
Bilateral rotors and butterfly bridges card: intra-field bilateral rotors () paired with logarithmic butterfly Schur bridges ( single-layer parameters at against dense parameters), anchored to QMaxFlow_le_QMinCut and schur_quadratic_is_least (LEAN ✓, parameter counts NUM, TFT projection MODEL).
- Attention and Residual Update: Shadow-Invariant Rational Born Kernel Heap
[Q, K, V]Transport: Partitioning fields into heads ( fields per head) removes bothSoftmaxexponentials and flat residual sums:-
Purely rational Born round-trip kernel and blind-zone reserve : The squared operator overlap ( in , anchored in
rank_one_born_pairing_weight) simplifies to the rational fraction (manual derivation):Because shadow inversion merely flips the sign of , squaring makes invariant under chart switches and identically at half-turn orthogonality ! Integer power sharpening for (§36.10, requiring zero fractional-power transcendentals) paired with blind-zone vacuum reserve ,
lets nearly orthogonal unmatched queries (, down to ) drive smoothly instead of forcing unit-sum
Softmaxsink dumping in the unmatched regime! -
Origin-free heap transport
[Q, K, V]and local chordal aggregation: Applying the Prüfer–Baer heap operator of §32.4.4 transports the value-to-key relational arc onto the query:Upon an exact key match (), heap cancellation holds unconditionally in ; in coordinates, left-parenthesized holds on all , and cache-friendly right-parenthesized likewise recovers with zero error on the entire open ball (returning only on the measure-zero boundary when ). Setting , because raw Euclidean averaging of would flip sign across antipodal boundary representatives , we aggregate via the seam-invariant relative sine vector (which equals half the Riemannian gradient of on , matches to first order, and vanishes smoothly on the antipodal cut locus ), rendering the entire attention update representative-independent on (smoothly damped by and ):
-
Born–Heap attention and the reserve card: an exact single-slot hit advances by the rational fraction , whereas in the unmatched regime total attention weight decays smoothly toward zero instead of forcing unit-sum Softmax dumping (rank_one_born_pairing_weight LEAN ✓, attention-sink literature ARGUED, fractions NUM).
-
Feed-Forward Network: Fano-Inspired Cyclic Lie-Triple Curvature Gate (Replacing -Gated
SwiGLUand FFNs) and Two Retractions: Motivated by the cyclic difference set of the Fano plane (§32.3.2), we wire concept fields into triples (either disjoint Fano heptads when as at or , or cyclic shifts at general such as ) and apply the Lie triple curvature bracket to the seam-invariant sine vectors and :Because is invariant under shadow inversion, is globally smooth and single-valued on , with acting natively as a scalar-gated bilinear modulator without - or -expanded matrices or
SiLUexponentials! Two exact retractions are available (manual derivation):- Purely rational retraction : uses only (zero square roots, zero transcendentals, with origin derivative ), mapping into with maximum single-step rotation ;
- Exact Gibbs half-angle retraction : uses one algebraic square root (still zero transcendentals, with origin derivative ) to map bijectively.
-
Self-Halting Precision () and Lie-Algebra Pullback Backpropagation:
-
Token-wise adaptive halting (
MODELheuristic): Motivated by self-referential halting (§36.10) and linear Krylov subspace stabilization (observable_krylov_once_stable_permanently), monitoring triggers token-level early layer skipping (MODELheuristic across untied nonlinear layers; note that this Euclidean-norm readout evaluates per-field algebraic square roots outside the purely rational forward state update—monitoring the mean squared step instead would define a distinct root-free rational halting statistic); -
Exact tangent-pullback gradient: For inside a smooth chart, because in the unsigned tangent argument both retractions expand as and (sharing origin derivative with respect to , hence first-order equivalent while separating at finite step size starting at fifth order ), substituting the signed descent step gives both unit--generator-normalized right-multiplicative updates and the identical chain-rule derivative with respect to at (reducing at to ; feeding unhalved gives and pulls back to ). With (), the transpose pullback onto unit- spin generators reads (
manual derivation):(switching to for left updates ). Each bilateral rotor is an exact Riemannian isometry (intrinsic singular values ), compatible with product-manifold Riemannian Adam (Bécigneul & Ganea 2019).
-
The Fano Lie-triple gate and halting card: the seam-invariant Lie-triple bracket modulates bilinear curvature without channel expansion and triggers adaptive early exit once (observable_krylov_once_stable_permanently LEAN ✓, untied-layer halting heuristic MODEL, readouts NUM).
37.1.3 Formal Anchor Theorem, Parameter Reckoning, and Open Empirical Benchmarks
We formalize the TFT architecture, its eight frozen Lean 4 reference anchors, literature attributions, and open empirical frontiers below:
Given field count , head count , blind-zone reserve , integer sharpening power , and halting threshold , define a single Ternion-Field Transformer block (MODEL) as the rational/algebraic rotor map on (purely rational across the forward rotor state-update pipeline under , with algebraic square roots entering only when selecting or evaluating the Euclidean-norm halting readout ) chaining broadcast-aligned ternion_mul bilateral and seam-invariant butterfly projections, 3D-NAPE calibration, shadow-invariant Born scoring, heap [Q, K, V] transport with seam-invariant residual aggregation, seam-invariant Lie-triple curvature gating, and geodesic halting residual readout.
In the pinned trureturing frozen declaration set, the following eight mathematical theorems hold simultaneously:
- Rank-one Born modulus-squared pairing weight and unread decomposition (
rank_one_born_pairing_weight): For a record measurement , normalized PSD state , and rank-one projector , pure input yields exact readout weight , and ; - Exact slot addressing and self-slot walk on recursive self-mapped page tables (
recursive_page_table_walk): For fixed addressesroot, leaf, data : Addressobeyinglookup root selfSlot = root,lookup root i = leaf, andlookup leaf j = data,[i, j]returnsdata,[selfSlot, i]returnsleaf, andreplicate depth selfSlotreturnsrootfor everydepth; - Spectrum-bottom program-cost upper bound for lookup compilers (
lookup_program_upper_bound): Equippingrecordwith aLookupCompilerbounds its minimum consistent program cost via ; - Permanent stability of finite-dimensional observable Krylov subspaces (
observable_krylov_once_stable_permanently): Over (RCLike K) and finite-dimensional -inner-product spaces , linear maps and satisfying satisfy for all ; - Spherical-triangle holonomy of three (generally non-commuting) canonical shortest rotor gates (
shortest_gate_triangle_holonomy): Three pairwise non-antipodal unit directions satisfy , assigning normalized initial eigenstates return phase ; - Width-three bridge tensor-network quantum max-flow min-cut bound (
QMaxFlow_le_QMinCut): Maximum rank flow across the bridge graph never exceedsQMinCut; - Hermitian block Schur-complement variational minimum (
schur_quadratic_is_least): For fixed Hermitian block , rectangular block , positive-definite interior block , and boundary vector , minimizing the block quadratic form over the interior vector attains ; - 3D signed cross-product classification on 4D spin factors (
complete_consequences): UnderP2 DandPB D, there exists an orientation locking together withConsequences DandMatrixInterfaces.
Item 1 expands and sums weighted conditional states to recover unreadState. Items 2–3 follow by induction over the three page-slot patterns and exhibiting the compiled lookup program of cost (Chapter 36). Item 4 uses the adjoint recurrence on finite-dimensional inner-product spaces: equality of at stages and implies -invariance, which inducts across all (§36.10). Items 5 and 8 match Theorem 32.17 Items 4 and 1; Item 6 matches Theorem 32.13 Item 7; and Item 7 completes the Hermitian square on block vectors (§38.11 Theorem 38.34, Item 1). Note: the frozen declarations certify these linear/quantum-information and geometric primitives, whereas , seam-invariant , seam lookup, and full TFT block identities are established by the explicit derivations and numerical audits of this section. The full proof is checked by the Lean kernel.
Deep-learning and geometric-optimization sources. Key baselines referenced in this section include:
- Modern Transformer primitives and attention sinks:
RMSNorm(B. Zhang & R. Sennrich, NeurIPS, 2019, arXiv:1910.07467);SwiGLU(N. Shazeer, 2020, arXiv:2002.05202);RoPE(J. Su et al., Neurocomputing 568, 127063, 2024, DOI 10.1016/j.neucom.2023.127063); andSoftmax-driven attention sinks (G. Xiao et al.,StreamingLLM, ICLR, 2024, arXiv:2309.17453); - Butterfly transforms, adaptive halting, Clifford networks, and Riemannian Adam: Butterfly / Kaleidoscope / Monarch factorizations (T. Dao et al., ICML 2019, ICLR 2020, ICML 2022); Adaptive Computation Time and early exit (A. Graves, 2016; M. Elbayad et al., ICLR 2020; T. Schuster et al.,
CALM, NeurIPS 2022); Quaternion and Clifford equivariant networks (T. Parcollet et al., ICLR 2019; D. Ruhe, J. Brandstetter & P. Forré, NeurIPS 2023; J. Brehmer et al.,GATr, NeurIPS 2023); and product-manifold Riemannian Adam (G. Bécigneul & O.-E. Ganea, ICLR 2019, arXiv:1810.00760).
How lower sagitta improves the intermediate answer in two-step relation tracing with fixed endpoints (manual derivation). In an integer fact base, define for . Given a starting item and the pair , two lookups give the correct answers and . For a displacement state , read the answer as and the rotation as conjugation by , with a fixed unit imaginary quaternion,
The readouts are fixed before the evaluation labels are supplied. The first step proposes either displacement , and the second enforces total displacement from the input relation pair. The candidates and have identical signed rotor endpoints and each takes two steps. Their principal rotation angles are and , since . Set the context potentials to zero and charge each step , where is its principal angle. The triple-angle formula gives
At each step of the Choi trial, prepare the normalized Choi state of the preceding candidate rotor and measure the rank-one projector onto the next candidate state. Denote projector acceptance at steps and by . Run step first and proceed to step only on acceptance, and record a joint success only when both projectors accept. For rotors , the normalized maximally entangled state gives Choi overlap . At relative angle , its squared modulus is . The joint success probability is for the lower-sagitta path and for the higher-sagitta path. Under the deterministic two-lookup criterion, both paths give the correct final answer, and only the lower-sagitta path gives the intermediate answer . Their intermediate factual accuracies are and , respectively, on each task and hence under any distribution over tasks. Large-scale natural-language perplexity, seam training dynamics, and hardware throughput still require empirical tests (Open problem 37.4).
Three empirical and systems questions remain open (OPEN):
- Compute-matched language-modeling perplexity and long-context retrieval: At multi-billion-token pretraining scale and matched FLOP budgets, how does TFT (
3D-NAPE, Born–Heap attention, and Lie-triple curvature gates) compare with a width-matched modern ungrouped Transformer baseline on held-out perplexity, non-commutative tree reasoning, and long-context retrieval? - Equatorial chart-seam switching frequency and deep gradient conditioning: Across deep stacks and long contexts, how frequently do branch switches occur during training, and how do piecewise coordinate flips and unconstrained tangent-generator quantization affect gradient norms and convergence?
- Fused rational kernels vs. dense Tensor-Core throughput: With fused custom GPU/ASIC kernels (or linear-attention approximations to the pairwise evaluation), what prefill latency, decode throughput, scale-free
INT8/INT4KV-Cachefidelity, and silicon energy efficiency does TFT achieve relative to optimized Tensor-CoreGEMM?
We verify all TFT operator identities, single-slot damped lookup, reverse-mode gradients, and parameter budgets in the four-part audit below:
We audit TFT’s algebraic and numerical properties in four steps (manual derivation / NUM):
-
Part I: Exact rational zero-residual check and 85-digit decimal audit across deterministic triples for , , Born invariance, and heap lookup (
manual derivation/NUM): On the explicit RNG-free deterministic rational sequence given by , , and (all strictly inside , paired with cube inputs ): in exact rational arithmetic (Fractionover ), all six algebraic residuals across all samples—(i) , (ii) , (iii) Born shadow invariance , (iv) sine-vector seam invariance , (v) associativity ( outer seam ties across all outer products), and (vi) interior right-parenthesized lookup —equal exact zero0identically! Re-evaluated in PythonDecimal(prec = 85)floating-point arithmetic on the identical sequence, the six maximum rounding residuals are , , , (evaluating the common scalar prefactor of before multiplying , or if dividing each coordinate last), , and (and at exact seam-touching where lands on the equator, the outer product still recovers identically). -
Part II: Closed-form single-slot damped step and complex-step reverse-mode VJP verification (
manual derivation/NUM): For a single-slot exact match (, , , zero FFN weights, ), , , , and seam-invariant relative sine step gives , yielding exact rational output or exact algebraic output . Executing an explicit RNG-free seam-invariant reference block at —with input state ( for across ) except placed on the exact unit-norm seam , and deterministic parameters across three bilateral rotors , constant3D-NAPE, causal Born–Heap attention (), and cyclic modulo- Lie-triple gating given by , , , , , , , , and —all outputs satisfy and , flipping the seam slot to its antipodal representative leaves the readout invariant to maximum entrywise discrepancy (), and differentiating the scalar mean objective with respect to via complex-step differentiation (§30.3, yielding ) matches fourth-order central differences at step to (); moreover, on the explicit RNG-free deterministic sequence (, with , , yielding shadow-branch evaluations and consecutive branch transitions with ), dual-branch analytic reverse-mode VJP evaluated on coordinate basis cotangents matches complex-step differentiation across all Jacobian entries down to IEEE-754 double-precision rounding (, measuring across summation orders)! -
Part III: Non-Abelian
3D-NAPEword-order separation check (manual derivation): Setting and composing orthogonal position steps and gives and numerator coefficient (with cross-product coefficient ), cancelling identically towhose relative rotor spans , whereas 2D Abelian
RoPEposition rotations satisfy and cannot distinguish step order through position products alone! -
Part IV: Single-layer parameter reckoning at width (,
NUM): A standard modern ungrouped Transformer layer holds attention weights plus three gatedSwiGLUmatrices at hidden width (, matching classical two-matrix FFNs;SwiGLUwould reach ), totaling parameters; a full TFT layer ( with cyclic difference-set triples, or for disjoint Fano heptads with padded or mixed-radix butterfly bridges) uses bilateral rotor parameters, ten-stage () three-parameter pair () butterfly Schur-bridge parameters, and Lie-triple gate parameters, totaling parameters with constant-step3D-NAPE(), or parameters with token-gated bilateral3D-NAPE()—a three-order-of-magnitude reduction!
We summarize the five-module comparison between the standard flat Transformer and TFT below:
| Core Module | Standard Flat Transformer | Ternion-Field Transformer (TFT) | Per-Layer Scaling & Arithmetic | Flat Pathology Dissolved |
|---|---|---|---|---|
| 1. State & Normalization | Unbounded RMSNorm | Shadow-MRP ball quotient | state slots, zero norm layers | Norm drift & unbounded activation outliers |
| 2. Position Encoding | 2D complex Abelian RoPE | 3D non-Abelian holonomy 3D-NAPE | recursive arc rotors | Commuting-operator blindness & nesting loss |
| 3. Role Projections | dense GEMM matrices | Bilateral rotors butterfly Schur bridges | Cross-concept spurious mixing & memory wall | |
| 4. Attention & Residual | Softmax flat vector sum | Seam-invariant Born kernel heap [Q,K,V] | Zero exp; attn denom (rotor denom ) | Exponential overflow & unmatched unit-sum dumping |
| 5. Feed-Forward Block | -gated SwiGLU (or FFN) | Seam-invariant Lie-triple gate | intrinsic curvature gate | Channel-expansion bloat & SiLU lookup tables |
Now that the forward rotor core of artificial intelligence stands formulated as purely rational operator dynamics (paired with algebraic norm-halting readouts) on parallel ternion fields, an overarching question uniting fundamental physics and intelligence beckons: if both the physical cosmos and artificial intelligence evolve as least-action information systems on parallel ternion fields, what is the geometric identity of least action itself—and what is the geodesic that keeps physical motion dissipation-free and intelligent reasoning free of step-skipping hallucinations? Let us enter §37.2 Least-Action Isomorphism Between Artificial Intelligence and the Cosmos: Ternion-Field Sagitta Action, Born Surprisal, Heap-Autoparallel Geodesics, and Hallucination-Free Chains of Thought.
Full laboratory: toggle between the Rotor-Geometry and Transformer-Engineering lenses, drag the amber handle along the violet diameter to vary , and adjust field count , vacuum reserve , halting threshold , and retraction mode to inspect dual denominators, 3D-NAPE word-order holonomy, bilateral rotors with butterfly Schur bridges, Softmax-free Born–Heap attention, and the Fano Lie-triple gate. Eight frozen statements, rational checks, literature baselines, and open empirical questions are labeled separately in the evidence panel and theory drawer.