Download docs/ARCHITECTURE.md from Snapkitty/sovereign-reduction-algebra: direct link, hf CLI and curl.
- Browser
- Download file 4.49 kB
-
https://huggingface.co/Snapkitty/sovereign-reduction-algebra/resolve/main/docs/ARCHITECTURE.md
- Command line
-
hf download hf://Snapkitty/sovereign-reduction-algebra/docs/ARCHITECTURE.md
-
curl -L -o ARCHITECTURE.md https://huggingface.co/Snapkitty/sovereign-reduction-algebra/resolve/main/docs/ARCHITECTURE.md
Architecture
Sovereign Reduction Algebra is an array reduction algebra for an experimental
SUBLEQ attention / bi-encoder. Production numeric work runs in J 9.7 and R 4.5
with gmp bigz. Python launches those processes and compares the integers they
print. It does not multiply, reduce modulo the Goldilocks prime, or hash.
This is not a trained softmax transformer. Tower weights are a fixed permutation. The late interaction is subtract β compare β predicate β select β route β reduce. The unmasked head must equal exact matrix multiplication. The routed tensor is a separate sparse approximation and is not required to match that product.
Components
| Layer | Path | Role |
|---|---|---|
| J arithmetic | j/biencoder.ijs |
Extended-integer matmul (+/ .*), SUBLEQ routing, field residues |
| J seal | j/sha512.ijs |
FIPS 180-4 SHA-512; 64-bit words as two uint32 halves |
| J benches | j/bench.ijs |
6!:2 timings written through the Python recorder |
| R arithmetic | r/biencoder.R |
gmp bigz matmul; never double, never base %*% on numeric |
| R seal | r/sha512.R |
SHA-512 with uint16 limbs (high-bit uint32 is NA_integer_ in R) |
| R benches | r/bench.R |
system.time timings |
| Launcher | scripts/run_biencoder.py |
Starts J and R; compares printed decimals and hex seals |
| Bench recorder | scripts/run_benchmarks.py |
Records timer output only; does not invent seconds |
| Results | results/*.json |
Measured artifacts |
| TinyAPL | tinyapl/, vendor/tinyapl |
Legacy demo. Complex Double cannot hold Goldilocks p. |
| Astra | astra/*.apl |
GNU-APL style agent registry, routing, and mixture sources (included, not claimed executed here) |
ββββββββββββββββββββββββββββ
β Python process launcher β
β compare printed ints β
ββββββββββββββ¬ββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββ
βΌ βΌ
ββββββββββββββββββ ββββββββββββββββββ
β J 9.7 β β R 4.5 + gmp β
β +/ .* β β bigz %*% β
β SHA-512 DAG β β SHA-512 DAG β
βββββββββ¬βββββββββ βββββββββ¬βββββββββ
β β
ββββββββββββββββ¬βββββββββββββββββββββββ
βΌ
exact_head Β· predicted Β· weights Β· prime
β
βΌ
parent SHA-512 seal
See also docs/images/architecture.svg.
Field
Goldilocks prime p = 18446744069414584321 = 2^64 β 2^32 + 1 is held as an
extended integer in both engines. Seeded small products agree with the field
product when they do not wrap. A fixed large residue case is reduced in both
languages and must agree.
Pipeline
ARRAY β SUBTRACT β COMPARE β PREDICATE β SELECT β ROUTE β REDUCE β STATE
Two towers apply one fixed permutation (Wq +/ .* |: Wk = I in J; the same
product in R). One integer training step does not move Wq or Wk. It adds
the routed residual to an integer projection, then adds that projection
elementwise to the routed prediction. The unmasked head must still
equal A times B.
Verification rules
- Unmasked head equals exact
A Γ Bin both engines. - J and R agree on the seeded 4Γ4 case (shapes, tensors, seals).
- SHA-512 DAG seals agree;
verifypasses; a one-entry mutation fails verify. - Routed max absolute error is reported and does not gate exit status.
- Benchmark seconds come only from J
6!:2or Rsystem.time.
Legacy
TinyAPL remains for the earlier reduction-algebra demos. Its scalars are
Complex Double; ulp at 2^64 is 4096, so p is not an exact distinct scalar.
The older Python Goldilocks reference and SHA-256 JSON stub are not the
production bi-encoder seal.