Spaces:
Paused
Paused
Correct README to the verified claims
Browse filesWas: Gemma-4-12B ternary, 48 layers, 'no matmul'.
Is: Llama-3.2-3B int8 per-column, 28 layers, and it performs matmuls --
the wave form is an equivalence proof about the arithmetic, not a
replacement for it. Adds the measured numbers, the ternary result on both
model families, and the DAG/bandwidth analysis.
README.md
CHANGED
|
@@ -5,15 +5,79 @@ colorFrom: gray
|
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
pinned: false
|
| 8 |
-
short_description:
|
| 9 |
---
|
| 10 |
# Phox — Wave-Rider Inference Engine
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
pinned: false
|
| 8 |
+
short_description: Transformer forward pass as one equilibrium, int8-resident on CPU
|
| 9 |
---
|
| 10 |
# Phox — Wave-Rider Inference Engine
|
| 11 |
|
| 12 |
+
A transformer forward pass expressed as a **single equilibrium** rather than a
|
| 13 |
+
stack of layers, running int8-resident on a CPU. Every operation has a wave
|
| 14 |
+
form, and each one is measured against the reference rather than asserted.
|
| 15 |
|
| 16 |
+
**Model:** Llama-3.2-3B (Hermes-3-Llama-3.2-3B-abliterated) — 28 layers,
|
| 17 |
+
D=3072, 3.21B parameters. Weights quantised to int8 with per-output-column
|
| 18 |
+
scales: **2.82 GB, fully resident**, widened to f32 inside AVX2 registers so the
|
| 19 |
+
padding is never written to memory.
|
| 20 |
|
| 21 |
+
## Verified
|
| 22 |
+
|
| 23 |
+
| claim | measurement |
|
| 24 |
+
|---|---|
|
| 25 |
+
| Full forward in wave form | **5/5 identical token IDs** vs reference, 28 layers |
|
| 26 |
+
| The forward pass is ONE fixed point | Jacobi (unsequenced) and Gauss-Seidel reach identical logits — **error 0.000e+00** at the critical path |
|
| 27 |
+
| RMSNorm == saturable gain medium | direction cosine **1.000000000000** — an identity, not a fit |
|
| 28 |
+
| softmax == amplification + power pool | **1.3e-07** rel-err |
|
| 29 |
+
| RoPE == free-running oscillator phase | **2.6e-08** rel-err |
|
| 30 |
+
| Amplitude coupling reproduces `W·x` | **3.2e-08**; phase-only Kuramoto **9.75e-01** — the encoding is load-bearing |
|
| 31 |
+
| int8 per-column fidelity | y cosine **0.999949**; tokens unchanged through all 28 layers |
|
| 32 |
+
| Per-token latency | 68 s → **~0.7 s**, same hardware |
|
| 33 |
+
|
| 34 |
+
## Honest limitations
|
| 35 |
+
|
| 36 |
+
- **It performs matmuls.** The wave form is an *equivalence proof* about the
|
| 37 |
+
arithmetic, not a substitute for it: relaxation converges to `W·x`, which is a
|
| 38 |
+
value you have already computed. There is no speedup from the physics and none
|
| 39 |
+
is claimed. The speedup is ordinary systems work — OpenBLAS, int8 residency,
|
| 40 |
+
KV cache, batched prefill, and not materialising bf16's sixteen zero bits.
|
| 41 |
+
- **Ternary does not work.** Measured engine-free against real weights on both
|
| 42 |
+
Llama-3.2-3B and Gemma-4-12B: y cosine **0.877** against int8's **0.99995**.
|
| 43 |
+
Per-column scaling rescues int2 relative to a global scale (0.52 vs 0.036) but
|
| 44 |
+
neither is usable. Quantisation fidelity turns out to be a property of the bit
|
| 45 |
+
width rather than the model — the two families agree to three decimals at
|
| 46 |
+
every width tested.
|
| 47 |
+
- **Scale is unproven.** Verified on 3B. The 12B needs int4 (5.45 GB) and does
|
| 48 |
+
not fit in this machine's free RAM.
|
| 49 |
+
- **This Space ships no weights.** The dashboard renders and the visualisation is
|
| 50 |
+
wired, but the engine cannot start without a local model. Build the cache with
|
| 51 |
+
`bqsm_int8.py --build` on a machine that has one.
|
| 52 |
+
- **The tokenizer is whitespace-split, not BPE**, so punctuation and rare words
|
| 53 |
+
are spelled character by character. `bqsm_tokenizer.py` implements real
|
| 54 |
+
byte-level BPE but is not yet wired in.
|
| 55 |
+
- **The SRP popcount readout was removed.** Once the bf16 kernel did the dense
|
| 56 |
+
vocabulary scan in ~60 ms, SRP was both slower (82–159 ms) and approximate —
|
| 57 |
+
512-bit Hamming distances tie heavily, and a true argmax with 884 tokens
|
| 58 |
+
strictly closer had 1,135 tied-or-closer, falling outside k=1024.
|
| 59 |
+
- Training, backprop, cross-request batching, and sampling above greedy argmax
|
| 60 |
+
are not addressed.
|
| 61 |
+
|
| 62 |
+
## Architecture notes
|
| 63 |
+
|
| 64 |
+
The forward pass is a DAG of **311 blocks with a critical path of 227** — so the
|
| 65 |
+
available parallelism is **1.37×**, and 171 of those depth levels are strictly
|
| 66 |
+
serial. Depth is irreducible: 757 data-dependent nonlinearities (RMSNorm, the
|
| 67 |
+
saturating gate, softmax) break matrix associativity at every stage. Remove them
|
| 68 |
+
and all 28 layers collapse into a single 128256×3072 matrix that computes
|
| 69 |
+
nothing interesting.
|
| 70 |
+
|
| 71 |
+
At one token the arithmetic intensity is **1.78 FLOP/byte** — memory-bound by
|
| 72 |
+
roughly 6×. Fusing 197 matrix-vector products down to 113 moves zero bytes.
|
| 73 |
+
Only fewer bytes per weight, or more work per byte (batching), change the time.
|
| 74 |
+
|
| 75 |
+
## Running locally
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
python3 bqsm_assist/bqsm_int8.py --build # quantise once, ~2.82 GB
|
| 79 |
+
python3 bqsm_assist/bqsm_int8.py --n 5 --verify # check against golden tokens
|
| 80 |
+
python3 phoenix_dashboard.py # dashboard on :8765
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
Code: [github.com/compunerd/basin-quotient-machine](https://github.com/compunerd/basin-quotient-machine)
|