# BitState / HSDR PoC Experiment Matrix — v0.5 Purpose: make the experiment falsifiable, separate state-count correctness from numerical representation error, and test the new dependency-breaking pure-LNS path against the dyadic reference path. ## A. Correctness layers | ID | Test | Input | Reference | Candidate output | Required result | |---|---|---|---|---|---| | C0 | LNS8 decode | all codes 0..127, both signs | FP64 formula | decoded value | exact within FP rounding | | C1 | phase/band decomposition | all non-zero codes | direct formula | `phase=k&7`, `band=k>>3` | exact | | C2 | direct 8-phase accumulation | K=128 vectors | direct LNS8->FP64 sum | `A[L3] += ±(1<FP64 sum | shift/add reference | equivalent within FP rounding | | C4 | population folding | `n=1..128` identical states | FP64 `n*x` | `k + 8*log2(n)` | exact in real math; quantify LUT rounding | | C5 | fractional LNS same-sign add | exhaustive/sampled state pairs | FP64 add then log | `kappa+` path | quantify internal-code error | | C6 | fractional LNS subtract | opposite signs incl. equality | FP64 subtraction | `kappa-` + zero handling | exact zero for equal magnitude; quantify others | | C7 | balanced pure-LNS tree | random/adversarial K=128 | direct FP64 ternary dot | tree result | error vs internal fractional precision | | C8 | shared scale in log domain | random positive scales | direct `d*sum` | log-offset scale | quantify scale-offset error | | C9 | Q9.6 boundary | relevant output range | FP64 / wide fixed | Q9.6 | quantify rounding/saturation; not assumed lossless | ## B. State-distribution sweep | Distribution | Why | |---|---| | one repeated state | best case for population folding | | 8 phases, one band | isolates phase reduction | | one phase, 16 bands | tests intra-phase balanced LNS reduction | | octave/band sweep | tests exact +8-code relative positioning | | uniform random codes | high-cardinality stress case | | Gaussian-like encoded values | generic realistic distribution | | captured post-Hadamard Bonsai 2 activations | primary real workload | For each 64/128-element tile record unique-state count `U`, non-zero signed bucket count `B`, and active phase count `P`. ## C. Weight-distribution sweep | Pattern | Purpose | |---|---| | all +1 | sign-free reference | | alternating +/- | exact cancellation stress | | {-1,0,+1} uniform | generic ternary | | measured Bonsai 2 trit distribution | real workload | | high zero fraction | tests skip / nonzero mask benefit | ## D. Reuse / amortization sweep Build activation state representation once and reuse it for `N` output rows. ```text N = 1, 8, 32, 128, 512, 2048 ``` Report separately: ```text T_encode = activation LNS8 encoding T_stateset = reusable state-set construction T_intersect = one row's weight-mask intersection + POPCOUNT T_reduce_dyad = dyadic reference reduction T_reduce_lns = pure fractional-LNS reduction T_scale = scale application / log-offset handling T_total_ref(N) = T_encode + T_stateset + N*(T_intersect + T_reduce_dyad + T_scale) T_total_lns(N) = T_encode + T_stateset + N*(T_intersect + T_reduce_lns + T_scale) ``` ## E. Kernel variants | ID | Variant | Purpose | |---|---|---| | B0 | current fork ternary dot | baseline | | B1 | scalar direct decode | simple reference | | D0 | scalar direct 8-phase accumulator | correctness baseline for `A[L3] += ±(1< 8-phase 8->4->2->1 tree sparse global balanced tree ``` Report both operation count and **dependent critical-path stages**. This is a first-class metric, not a secondary implementation detail. ## I. CPU metrics - ns / 128-weight group - cycles / output row - cycles / weight - instructions / weight - uops / IPC - product-state ADD cost - phase-mask / selector build cost - direct K→8 weighted reduction cost - state-set build cost for histogram variants - unique states / non-zero signed buckets - POPCNT count and throughput - fractional-LNS LUT loads - dependent LNS-add/sub stages - L1/L2 misses - actual memory bandwidth - crossover reuse count vs baseline ## J. End-to-end metrics - TG128 - PP512 as secondary context - model load / memory footprint unchanged unless explicitly testing metadata - quality/perplexity or task check vs existing fork - LNS8 saturation / underflow rate - pure-LNS vs dyadic end-to-end delta ## K. Reporting rule Always report at least these components separately: ```text 1. activation / product-state encoding 2. phase-mask / selector construction 3. direct K→8 weighted reduction 4. state-set construction + POPCOUNT (histogram variants) 5. eight-phase dyadic finalization 6. pure-LNS reduction cost 7. dependent critical-path depth 8. end-to-end integrated result ``` This prevents a fast microkernel from hiding conversion costs and prevents a slow first implementation from hiding the benefit of reusable state sets or a shallower reduction dependency graph. ## L. Reference artifact for direct 8-phase correctness Use `LNS8_base74_8step_zone8_popcount_demo_JA_v0.8_bitslice128_validation.xlsx` as the visual reference for the direct path: - `Inputs_128` -> two Tile64 blocks; - `S1|E4|L3` decomposition; - phase masks as intermediate routing selectors; - `±(1<