diff --git a/CLAIMS.md b/CLAIMS.md index 16f5d945..5991fc09 100644 --- a/CLAIMS.md +++ b/CLAIMS.md @@ -87,3 +87,4 @@ tracked file, which both scripts resolve (they check that it exists, not what it | `inkling-layer0-mlp-fidelity-228` | Inkling 2 Mini layer-0 routed MLP under main's integer rules, real NVFP4 weights, open loop vs float64: FAIL vs prereg on both bars. Layer 0's top-8 sigmoid-routed MoE block of thinkingmachines/Inkling-2-Mini (ed40e7da) computed with main's integer rules (12-bit cells, 13-bit per-tensor weights, docs/model.md router and sigmoid table, two new 2^-8-step tables for the soft-capped SwiGLU, a rounded-division routing weight at 2^13) against our own numpy float64 version of the same block, on the 10 frozen prompt texts of 20261109-8 (2,426 tokens), exact float64 input, open loop. B1 (Qwen A2 shape, per prompt): rel_y median 0.0218, max 0.0304 vs median <= 0.01, max <= 0.05: FAIL. B2: the top-8 expert set differs on 91 of 2,426 tokens (3.75%) vs <= 1%: FAIL; each flip changes exactly one expert. B3 range: IN-BOUND, 0 events at every site. With the float set and float weights the integer expert arithmetic alone gives pooled rel_y 0.0079 (descriptive). Deterministic, two processes bit-identical. Measured, unreplicated. Float reference is our reading of open transformers PR 51050 (6173a2f6), not checked against the publisher's runtime. One block, no logits, no proof | negative, unreplicated | unreplicated | [experiments/20261121-228-inkling-layer0-fidelity/RESULTS.md](experiments/20261121-228-inkling-layer0-fidelity/RESULTS.md) | #230 | | `qwen-silu-step-vs-clip-221` | Qwen3.8-27B abliterated layers 31 to 63: SiLU table step vs domain clip, one change at a time (M31-C clip removed, M31-T step removed), issue #221: Registered diagnostic, valid (G1 REF top-1 = PR 173: True; G2 M31-C#2 bit-equal: True; G3 no guard error: True). From PR 167's layer-30 REF residual, abliterated layers 31 to 63, 1461 positions of 10 frozen prompts, float64 heads/attention/norms/lm_head; one change at a time to PR 138's SiLU lookup. M31-C: top-1 1459 of 1461 (99.86%), KL median 2.06e-06, max 0.00215 nats; M31-T: top-1 1424 of 1461 (97.47%), KL median 0.00146, max 1.93 nats. H-C (removing only the clip halves PR 202's M31 KL median 1.466e-3): ratio 0.001408, HOLDS. H-T (removing only the step halves it): ratio 0.9948, DOES NOT HOLD. Registered outcome: H-C only: the clip carries the token error; the step alone does not halve it. Diagnostic arms, not operators; chooses no repair. No proof | measured, unreplicated | unreplicated | [experiments/20261118-221-silu-step-clip/RESULTS.md](experiments/20261118-221-silu-step-clip/RESULTS.md), [experiments/20261118-221-silu-step-clip/runs/summary.json](experiments/20261118-221-silu-step-clip/runs/summary.json), [experiments/20261118-221-silu-step-clip/runs/e2e-abl.json](experiments/20261118-221-silu-step-clip/runs/e2e-abl.json), [experiments/20261118-221-silu-step-clip/ENV.json](experiments/20261118-221-silu-step-clip/ENV.json), [experiments/20261118-221-silu-step-clip/PREREG.md](experiments/20261118-221-silu-step-clip/PREREG.md) | #224 | | `qwen-weight-cell-classes-239` | Qwen3.8-27B weight-cell classes (DESIGN 6.2) on all 48 DeltaNet layers: conv taps, gains, cA, dt_bias, honest conversion, both checkpoints (issue #239): PASS vs prereg. Every honestly converted conv tap, gain x sqrt(128), cA and dt_bias integer (DESIGN 5.0, merged exponent_of, one exponent per tensor per layer) on all 48 DeltaNet layers lies in its DESIGN 6.2 class: 0 out of class of 1,976,832 integers per checkpoint; every exponent in 1..24 (e_conv 12-13, e_gain 7-8, e_A 4-13). For taps, gains and cA (1,974,528 of the 1,976,832 integers per checkpoint) being in class follows from the exponent rule, so an honest conversion cannot fail there; what could have failed is the exponent admission (144 exponents per checkpoint, 288 over both, each in 1..24) and the dt_bias class (2,304 values per checkpoint). The four tensors have equal SHA-256 per tensor in the stock and abliterated checkpoints (192 of 192, byte-identical), so one answer covers both. Descriptive: dt_bias alone puts the softplus input outside v1's [-8, 8) on 17 of 2,304 heads (16 at or above 8: 15 on layer 0, 1 on layer 58; 1 below -8 on layer 1); offset range -8.94 to 19.25. cA keeps as few as 2 significant bits (357 of 2,304 heads at 5 bits or fewer; the smallest head of a layer keeps fewer than 5 bits on 18 of 48 layers, 2 bits on layers 12, 28 and 44). Integer counts only, no proof, no matrix weights, no activations | measured, unreplicated | unreplicated | [experiments/20261129-239-qwen-weight-cell-classes/RESULTS.md](experiments/20261129-239-qwen-weight-cell-classes/RESULTS.md), [experiments/20261129-239-qwen-weight-cell-classes/PREREG.md](experiments/20261129-239-qwen-weight-cell-classes/PREREG.md), [experiments/20261129-239-qwen-weight-cell-classes/ENV.json](experiments/20261129-239-qwen-weight-cell-classes/ENV.json), [experiments/20261129-239-qwen-weight-cell-classes/runs/summary.json](experiments/20261129-239-qwen-weight-cell-classes/runs/summary.json), [experiments/20261129-239-qwen-weight-cell-classes/runs/ckpt-compare.json](experiments/20261129-239-qwen-weight-cell-classes/runs/ckpt-compare.json) | #243 | +| `qwen-m3a1-inproj` | Qwen M3a-1 in_proj: one DeltaNet head's 514 in_proj outputs for one token as a linear claim on the committed weight table, public normed input (issue #229 sub-step c): Measured, unreplicated, CPU research harness, research setting (no security level). First proved computation in which committed Qwen matrix weights take part: for V head 0, layer 0 of the pinned stock Qwen3.8-27B and ONE token, with the layer's normed input a public (5,120 integers, \|a\| <= 2,047, a float64 norm of one embedding row rounded at 2^5), 1,028 committed cells x_r, rem_r for all 514 in_proj rows are in exact classes by bits and satisfy sum_j a_j M[r][j] + 2^(s_r - 1) = 2^(s_r) x_r + rem_r IN THE FIELD against the committed table of PR #231. No sumcheck over columns and no change to an existing source file: LIN already sends W = g^T M, and the input is applied by one caller's linear claim on W, with row weights eq(rho, .) drawn after the cells are committed. 5 of 5 honest proofs verified; all 9 registered negative tests rejected (output off by one two ways, a weight changed two ways, the public input changed two ways, x and rem out of class with the linear claim true, the input out of class); 2 of 2 completeness cases accepted (x at both class edges). One more negative test added by amendment after these results were known (the prover fits W so the caller's claim is true) was also rejected; it is not part of the registered threshold. NOT established: the matrix weights' range (no Qwen layout of the WF range proof), so the equation is the integer rounding only for a table of small integers; any soundness level (trace at target 10 bits; LIN on hand-made unpriced plans, one of them written here because the library's priced planner fixes the number of claims in a request's own test); any head computation after in_proj; more than one token, head or layer; accuracy; hiding; that the table is the advertised checkpoint | measured, unreplicated | unreplicated | [experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md](experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md), [experiments/20261129-229-qwen-m3a1-inproj/PREREG.md](experiments/20261129-229-qwen-m3a1-inproj/PREREG.md), [experiments/20261129-229-qwen-m3a1-inproj/ENV.json](experiments/20261129-229-qwen-m3a1-inproj/ENV.json), [experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json](experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json), [experiments/20261129-229-qwen-m3a1-inproj/runs/summary-a2.json](experiments/20261129-229-qwen-m3a1-inproj/runs/summary-a2.json), [experiments/20261129-229-qwen-m3a1-inproj/runs/inputs-head0.json](experiments/20261129-229-qwen-m3a1-inproj/runs/inputs-head0.json), [research/operators/qwen_m3a1c/README.md](research/operators/qwen_m3a1c/README.md) | #242 | diff --git a/README.md b/README.md index 1d7affcc..b421e48c 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ Every number below comes from a file on `main` (the one exception, a reviewer fi | Inkling 2 Mini layer-0 routed MLP under main's integer rules, real NVFP4 weights, open loop vs float64 | negative, unreplicated | FAIL vs prereg on both bars. Layer 0's top-8 sigmoid-routed MoE block of thinkingmachines/Inkling-2-Mini (ed40e7da) computed with main's integer rules (12-bit cells, 13-bit per-tensor weights, docs/model.md router and sigmoid table, two new 2^-8-step tables for the soft-capped SwiGLU, a rounded-division routing weight at 2^13) against our own numpy float64 version of the same block, on the 10 frozen prompt texts of 20261109-8 (2,426 tokens), exact float64 input, open loop. B1 (Qwen A2 shape, per prompt): rel_y median 0.0218, max 0.0304 vs median <= 0.01, max <= 0.05: FAIL. B2: the top-8 expert set differs on 91 of 2,426 tokens (3.75%) vs <= 1%: FAIL; each flip changes exactly one expert. B3 range: IN-BOUND, 0 events at every site. With the float set and float weights the integer expert arithmetic alone gives pooled rel_y 0.0079 (descriptive). Deterministic, two processes bit-identical. Measured, unreplicated. Float reference is our reading of open transformers PR 51050 (6173a2f6), not checked against the publisher's runtime. One block, no logits, no proof | CPU only, numpy and tokenizers only (no torch, no transformers); weights by HTTP range reads of layer 0 and 317 embedding rows (630 MB of 19.5 GB); NVFP4 decode per the PR's dequantise op, checked D1-D4 (max \|w\| / amax = 1.000 every expert); gate/up order from the PR's Interleave + chunk; input exponent fitted in-sample (Em = 6); attention sub-block float64 only; one layer, open loop; shared loaded host | [experiments/20261121-228-inkling-layer0-fidelity/RESULTS.md](experiments/20261121-228-inkling-layer0-fidelity/RESULTS.md) | | Qwen3.8-27B abliterated layers 31 to 63: SiLU table step vs domain clip, one change at a time (M31-C clip removed, M31-T step removed), issue #221 | measured, unreplicated | Registered diagnostic, valid (G1 REF top-1 = PR 173: True; G2 M31-C#2 bit-equal: True; G3 no guard error: True). From PR 167's layer-30 REF residual, abliterated layers 31 to 63, 1461 positions of 10 frozen prompts, float64 heads/attention/norms/lm_head; one change at a time to PR 138's SiLU lookup. M31-C: top-1 1459 of 1461 (99.86%), KL median 2.06e-06, max 0.00215 nats; M31-T: top-1 1424 of 1461 (97.47%), KL median 0.00146, max 1.93 nats. H-C (removing only the clip halves PR 202's M31 KL median 1.466e-3): ratio 0.001408, HOLDS. H-T (removing only the step halves it): ratio 0.9948, DOES NOT HOLD. Registered outcome: H-C only: the clip carries the token error; the step alone does not halve it. Diagnostic arms, not operators; chooses no repair. No proof | Preregistered (experiments/20261118-221-silu-step-clip/PREREG.md); start state PR 167's ckpt.npz sha256 22dff8b92107511838e50e4b26d6e91a2b55d09064711c638042c4c18fb80009, next_layer 31, checked before registration and re-hashed in the job, REF entries only, layers 0 to 30 not regenerated; abliterated layers 31 to 63, final norm, lm_head; PR 124's frozen prompts teacher-forced; PR 202 harness, PR 138 mlp_int stages, PR 124 logits_metrics, PR 88 forward reused; M31 and M31-S not rerun (PR 202 values cited); CPU, taskset 8 to 13, one deterministic run with an in-run duplicate path; shared loaded host; no GPU, no serving route, no proof | [experiments/20261118-221-silu-step-clip/RESULTS.md](experiments/20261118-221-silu-step-clip/RESULTS.md) | | Qwen3.8-27B weight-cell classes (DESIGN 6.2) on all 48 DeltaNet layers: conv taps, gains, cA, dt_bias, honest conversion, both checkpoints (issue #239) | measured, unreplicated | PASS vs prereg. Every honestly converted conv tap, gain x sqrt(128), cA and dt_bias integer (DESIGN 5.0, merged exponent_of, one exponent per tensor per layer) on all 48 DeltaNet layers lies in its DESIGN 6.2 class: 0 out of class of 1,976,832 integers per checkpoint; every exponent in 1..24 (e_conv 12-13, e_gain 7-8, e_A 4-13). For taps, gains and cA (1,974,528 of the 1,976,832 integers per checkpoint) being in class follows from the exponent rule, so an honest conversion cannot fail there; what could have failed is the exponent admission (144 exponents per checkpoint, 288 over both, each in 1..24) and the dt_bias class (2,304 values per checkpoint). The four tensors have equal SHA-256 per tensor in the stock and abliterated checkpoints (192 of 192, byte-identical), so one answer covers both. Descriptive: dt_bias alone puts the softplus input outside v1's [-8, 8) on 17 of 2,304 heads (16 at or above 8: 15 on layer 0, 1 on layer 58; 1 below -8 on layer 1); offset range -8.94 to 19.25. cA keeps as few as 2 significant bits (357 of 2,304 heads at 5 bits or fewer; the smallest head of a layer keeps fewer than 5 bits on 18 of 48 layers, 2 bits on layers 12, 28 and 44). Integer counts only, no proof, no matrix weights, no activations | Preregistered (experiments/20261129-239-qwen-weight-cell-classes/PREREG.md, amendments A1, A2 before the runs they cover by commit order; A3 corrects the times typed into them); 192 tensors per checkpoint by HTTP range with the merged fetch code, each SHA-256 equal to the merged stream manifest; unit test of every class edge (31 cases, synthetic); five identical analysis runs (deterministic); CPU, cores 0-1 of a shared loaded host | [experiments/20261129-239-qwen-weight-cell-classes/RESULTS.md](experiments/20261129-239-qwen-weight-cell-classes/RESULTS.md) | +| Qwen M3a-1 in_proj: one DeltaNet head's 514 in_proj outputs for one token as a linear claim on the committed weight table, public normed input (issue #229 sub-step c) | measured, unreplicated | Measured, unreplicated, CPU research harness, research setting (no security level). First proved computation in which committed Qwen matrix weights take part: for V head 0, layer 0 of the pinned stock Qwen3.8-27B and ONE token, with the layer's normed input a public (5,120 integers, \|a\| <= 2,047, a float64 norm of one embedding row rounded at 2^5), 1,028 committed cells x_r, rem_r for all 514 in_proj rows are in exact classes by bits and satisfy sum_j a_j M[r][j] + 2^(s_r - 1) = 2^(s_r) x_r + rem_r IN THE FIELD against the committed table of PR #231. No sumcheck over columns and no change to an existing source file: LIN already sends W = g^T M, and the input is applied by one caller's linear claim on W, with row weights eq(rho, .) drawn after the cells are committed. 5 of 5 honest proofs verified; all 9 registered negative tests rejected (output off by one two ways, a weight changed two ways, the public input changed two ways, x and rem out of class with the linear claim true, the input out of class); 2 of 2 completeness cases accepted (x at both class edges). One more negative test added by amendment after these results were known (the prover fits W so the caller's claim is true) was also rejected; it is not part of the registered threshold. NOT established: the matrix weights' range (no Qwen layout of the WF range proof), so the equation is the integer rounding only for a table of small integers; any soundness level (trace at target 10 bits; LIN on hand-made unpriced plans, one of them written here because the library's priced planner fixes the number of claims in a request's own test); any head computation after in_proj; more than one token, head or layer; accuracy; hiding; that the table is the advertised checkpoint | CPU only, cores 8-13 of a shared loaded host, single-threaded runs, g++ 13.3.0 -O2; PREREG first and alone; amendment A1 (implementation choices) committed before the registered runs; amendment A2 (one added negative test) committed after the registered results and before its own run, with a rebuilt binary; debug only on a synthetic fixture (table numpy seed 9101, input seed 9102, prover seed 9); the table is committed afresh in each run (no stored key); research setting target 10 bits, query work 6; LIN plans hand-made | [experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md](experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md) | _Last regenerated from `research/results.yaml` on 2026-11-29 (UTC), against main `57460851`._ diff --git a/experiments/20261129-229-qwen-m3a1-inproj/ENV.json b/experiments/20261129-229-qwen-m3a1-inproj/ENV.json new file mode 100644 index 00000000..dcf3d179 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/ENV.json @@ -0,0 +1,55 @@ +{ + "experiment": "20261129-229-qwen-m3a1-inproj", + "commits": { + "base_main": "cdf78449d390a1f62dc77d28c5cf6cb8c0bb1b02", + "prereg": "8ce57884a351e3062ab397d5d6b12a34f13d2cde", + "code_and_amendment_A1_before_runs": "f89780a5d8ccacf09fdd7b56bff4dbd03d3048f4", + "registered_runs": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d", + "amendment_A2_and_its_code_before_its_run": "f0ac5e14d0fe211f320c8832cbea1e11f55ab070", + "A2_run": "7d7a26dbfeeb54b90df85752a6766221791babff" + }, + "weights": { + "repo": "Qwen/Qwen3.8-27B", + "rev": "37561816e66b5b9153b1b64c10968c18c1e6f4a0", + "table": "M.i32 of research/operators/qwen_m3a1/prepare.py real (head 0), SHA-256 equal to M_i32_sha256 of experiments/20261121-229-qwen-m3a1-weight-side/runs/weights-head0.json", + "tensors_sha256_checked_against": "experiments/20261121-229-qwen-m3a1-weight-side/runs/weights-head0.json (9 of 9 equal)", + "public_input": "token id 760; embedding row and layer 0 input_layernorm.weight fetched by HTTP range (10,240 bytes each), SHA-256 equal to experiments/20261109-8-qwen-real-weights/runs/fetch-stock.json", + "details": "runs/inputs-head0.json (hashes and counts, no values)" + }, + "toolchain": { + "cxx": "g++ 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04.1)", + "flags": "-std=c++17 -O2 -Wall -Wextra -fno-ipa-modref -DBLK_FIELD=2 -DBLK_HASH=1 -I blocks", + "python": "3.12.3", + "numpy": "2.4.3", + "binaries": { + "registered_16_runs": { + "sha256": "602d5ba929f306a300dafe09154bf91cca0206adc192da804e7029c0829d0438", + "built": "2026-11-29 about 02:28 UTC from the working tree; qm3a1c.cpp was not edited between that build and commit f89780a. Not rebuilt from the commit to confirm the hash" + }, + "A2_run": { + "sha256": "a1bf7afc8bb33725a29ba402c40a3cfc38cb31a9f95312b42d8873cd862cb27a", + "built": "2026-11-29 about 02:39 UTC from the working tree; qm3a1c.cpp was not edited between that build and commit f0ac5e1. Not rebuilt from the commit to confirm the hash" + }, + "note": "the binaries are not committed" + } + }, + "hardware": { + "kind": "cpu-epyc-rome-kvm-16", + "cores_used": "8-13 (taskset); each run is single-threaded", + "shared": "shared, loaded host (load average 6.5 on 16 cores right after the registered runs); other lanes ran beside this one. The 16 registered runs went through the host's heavy-job gate; the single A2 run (about 5 s, under 0.5 GB) did not" + }, + "seeds": { + "honest_prover_seeds": [1, 2, 3, 4, 5], + "case_prover_seed": 1, + "debug_fixture": {"table_numpy_seed": 9101, "input_numpy_seed": 9102, "prover_seed": 9}, + "note": "toy and test coin generators (ToyCoins, TestCoins), deterministic per seed; not for secrets" + }, + "setting": { + "trace": "setting_goldilocks, target 10 bits, query work 6 (harness research setting)", + "lin": "hand-made plans: first and shared chain of blocks/iop/tests/lin_world.h, second chain second_plan() of qm3a1c.cpp (6 batched claims); every round priced NOTHING; LinCase v 7, k_lo 6, rows 595, answers 1, columns 24, rate 1/4, ell 4096, rows high, 1 request, 12 draws" + }, + "run_times_utc": { + "registered_16_runs": "first start 2026-11-29T02:35:14Z, last start 02:36:31Z (each file carries its own start time)", + "A2_run": "2026-11-29T02:40:52Z" + } +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/PREREG.md b/experiments/20261129-229-qwen-m3a1-inproj/PREREG.md new file mode 100644 index 00000000..fba9fae7 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/PREREG.md @@ -0,0 +1,115 @@ +# PREREG: 20261129-229-qwen-m3a1-inproj + +Issue: #229, sub-step (c). Lane: inproj229. Date (UTC): 2026-11-29 02:14. Base commit: cdf78449d390a1f62dc77d28c5cf6cb8c0bb1b02. + +Research harness only, CPU only. Design followed: `experiments/20261109-32-qwen-m3-design/DESIGN.md` (r3) sections 3.2, 5.0, 5.1, 6. Builds on `experiments/20261121-229-qwen-m3a1-weight-side` (PR #231, merged), which committed the table and did not start (c). + +## What this step builds (decided from the source before any code) + +PR #231's RESULTS said (c) needs "a column sumcheck plus committed outputs and their tie". Its reviewer suggested checking first whether a caller's linear claim on LIN's own message W is possible (, nonblocking 5, a suggestion, not verified there). Read in the source at the base commit: + +- `blocks/iop/lin.h`: in its first part a request sends W = g^T M as an oracle message (one entry per column of M), and the block's claims (Fold) and (Dot) tie W to the table at a point psi* drawn after W is sent. The comment above `lin_first_prove_on_shape` says: "After this call the caller may add claims of its own to the group LinFirst::own; then it seals the chain." +- So a claim sum_j a_j W[j] = v with public a is one more linear claim on that group. No sumcheck over the column index is needed. +- One thing stands in the way and is solved without touching an existing file: BAT (`blocks/iop/bat.h`) ends the process unless the plan counts the rows it batches, and the plan of `blocks/iop/tests/lin_world.h` counts 5 for a request's own test. The new code lays its own second-chain plan with 6 rows, in the new directory. If this turns out to need a change to an existing file, the lane stops and reports the missing interface. + +The composition, for V head 0 of layer 0, ONE token: + +1. **Table.** As PR #231: the 595 x 8,192 integer matrix M of the head (3,288,706 weights) in one committed table (`blocks/iop/index_cpu.h`), same layout, same `LinCase` (2^7 table rows, 2^6 matrix columns per table row, rate at most 1/4, 24 drawn columns, one-time test). The in_proj rows are table rows 1..128 (q), 129..256 (k), 257..384 (v), 385..512 (z), 513 (a), 514 (b), 5,120 entries each, then zeros. +2. **Public input.** A vector a of 5,120 integers, class |a_j| <= 2,047 (DESIGN 3.2), checked by the verifier before anything else (admission, DESIGN 6). +3. **Output cells.** For each covered table row r with public shift s_r: two cells of the harness's product oracle (`research/operators/qwen_deltanet/product.h`), x_r and rem_r, meant as x_r = rq(u_r, s_r) and its remainder, u_r = sum_j a_j M[r][j], so u_r + 2^(s_r - 1) = 2^(s_r) x_r + rem_r (DESIGN 5.1; rq as docs/model.md: floor((u + 2^(s-1)) / 2^s)). Classes by exact bits (each bit a column (b, b, b) with two relations, as PR #231): x_r in [-2^23, 2^23) (24 bits), rem_r in [0, 2^(s_r)) (s_r bits). s_r is the row's tensor exponent (DESIGN 5.0, "s_T = e_T"), from the merged `runs/weights-head0.json`: 13 for q, k, v (in_proj_qkv), 14 for z and a, 16 for b. +4. **Tie.** On the trace chain, whose first query holds the relations, the table's name (root and record) and all 5,120 values of a: after the product oracle's root the verifier draws rho (10 elements of E, one per row bit) and a second point (13 elements, used only for LIN's own evaluation claim). The prover sends v. One linear claim on the product oracle: sum_r eq(rho, r) (2^(s_r) x_r + rem_r - 2^(s_r - 1)) = v. One LIN request on the table with row weights g[r] = eq(rho, r) for the covered rows and 0 elsewhere (written out by the verifier), so W = g^T M; and the caller's claim on W: sum over j < 5,120 of a_j W[j] = v. LIN's first chain has rho, the second point, v and a in its first query. Both sides are multilinear in rho, and the cells and the table are fixed before rho, so a covered row whose cells do not satisfy the field equation of item 3 against the committed row is caught except with probability at most 10 / |E| over rho in the idealised argument (not the error of the compiled proof). +5. LIN's interface also wants one evaluation claim "W at a point = t". It is given the second point and the prover's t. It is true for an honest prover and adds nothing to the statement. + +## Hypothesis + +On the CPU research harness, a proof that the 514 in_proj outputs of V head 0, layer 0 of the pinned stock Qwen3.8-27B for one token (committed cells x_r, rem_r in their classes) satisfy u_r + 2^(s_r - 1) = 2^(s_r) x_r + rem_r in the field against the committed weight table and a public input vector, built from LIN plus one caller claim on W with no change to any existing file, verifies for the honest prover in 5 of 5 runs and is rejected in every registered negative test below. + +## Statement (exactly) + +- **Public:** the run configuration (codes, plans, sizes; the trace at the harness's research setting, target 10 bits, query work 6), the layout (which table rows are covered, their shifts, the cell classes), the table's key (root and record), and the input vector a (all 5,120 values, in the first query of the trace chain and of LIN's first chain). +- **Committed, not shown:** the table (as PR #231); the 1,028 output cells and their bits. +- **Proved:** every x_r is in [-2^23, 2^23) and every rem_r in [0, 2^(s_r)); for every covered row r, sum_j a_j M[r][j] + 2^(s_r - 1) = 2^(s_r) x_r + rem_r **as an equation in the field**, M being the committed table; the table is close to a codeword (LIN's one-time test). +- **Rows covered: all 514 in_proj rows of the head** (q, k, v, z: 128 each; a, b: 1 each; table rows 1..514). Not a subset. +- **The verifier recomputes:** the admission check on a; the relations from the public layout; rho and the second point from its own transcript; the row weights g; the caller's claim (a and v); the constant sum_r eq(rho, r) 2^(s_r - 1). It reads no weight and no output cell. +- **What this does and does not mean.** Given the committed table and a, the pair (x_r, rem_r) is unique: 2^(s_r) x_r + rem_r ranges over fewer than 2^41 values, far below the field size. That x_r is the integer rounding of the integer product needs every weight of the row to be a small integer (|w| <= 4,096 gives |u_r| < 2^36). **The matrix weights' range is still NOT proved** (no Qwen layout of WF, none built here), so the equation is established in the field only. The test N4a below shows what that means: a table with two huge entries gives a "product" whose rounding is out of class, and the class is what refuses it. + +## Weights and the public input + +Weights: M.i32 of PR #231's data directory (head 0, real stock weights), copied to this lane's own directory outside the clone. Before use: every tensor file's SHA-256 is checked against the merged `experiments/20261121-229-qwen-m3a1-weight-side/runs/weights-head0.json`, and M.i32's SHA-256 must equal that file's `M_i32_sha256`. A mismatch stops the lane. Never committed. + +Public input, rule fixed now: token id 760, the first token of prompt p01 of the merged `experiments/20261109-8-qwen-real-weights/prompts.json`. x = that token's BF16 embedding row and w = layer 0's `input_layernorm.weight`, both of the pinned stock revision (`Qwen/Qwen3.8-27B` at 37561816e66b5b9153b1b64c10968c18c1e6f4a0), fetched by HTTP range with the merged `fetch.py` `get()` at the byte ranges of the merged `runs/fetch-stock.json`, each SHA-256 equal to that file's entry (the embedding row is 10,240 bytes and is not a layer-0 tensor; it is the only such fetch). h = x / sqrt(mean(x^2) + 1e-6) * (1 + w) in float64, the formula of the merged `real_head.py` `inproj()`. **a = RNE(2^5 h)** (numpy rint). Why 2^5: the merged `runs/real-stock.jsonl` reports max |h| at most 50.24 over the ten prompts, so 2^5 is the largest power of two that keeps |a| <= 2,047 on them. If any |a_j| > 2,047 for token 760, the lane stops and reports; the rule is not changed. Committed to the repository: the rule, the length, the SHA-256 of a (int32 little endian) and whether the class check passed. **The values of a are not committed to the repository** (they derive from weights). In the proof a is public, not committed: the verifier is handed all of it. + +Two things this rule is NOT: a is not the output of an integer norm (it is a float64 norm, rounded), and its scale 2^5 is not the design's stream scale F = 12 (at 2^12 the real normed input, up to 50.24, does not fit DESIGN 3.2's class 2,047). With s_r = e_T the outputs x_r are at a's scale, 2^5. This step proves a linear claim on committed weights; it does not settle the scale question and makes no accuracy claim. + +## Metric + +Verifier verdict (accept, or reject with its reason string) per run; product-oracle columns, relations, proof bytes (trace and LIN), table commit, prove and verify wall time, peak RSS (getrusage and /usr/bin/time). All labelled measured, unreplicated, one shared host. + +## Acceptance threshold + +PASS iff all four hold: +1. Honest proof accepted in 5 of 5 runs (prover seeds 1..5). +2. Every negative test N1a, N1b, N2a, N2b, N3a, N3b, N4a, N4b, N5 rejected. +3. Completeness cases C1, C2 accepted. +4. In every honest run the program's own integer computation of the 514 (x_r, rem_r) from M and a equals the values computed independently by the numpy preparation script (the program reads them from a file and stops if any differs). This check is written in the code and its outcome is in each run record. + +Negative tests (one complete proof each by a prover that knows the honest witness, unchanged verifier, prover seed 1). r1 = table row 1 (the first q row). j0, j1 = the first two columns with a_j0, a_j1 nonzero and coprime. +- **N1a output cell off by one, v from the trace:** x_r1 + 1 in the trace, bits honestly re-derived (in class), table honest, v computed from the trace cells. The trace is self-consistent; the claim on W is false. +- **N1b output cell off by one, v from the table:** the same cell change, v computed from the table, every trace claim's target replaced by its local value (the hostile prover of `qm3a1.cpp`). +- **N2a weight changed, other key:** M[r1][j0] + 1; proof made honestly over the changed table, with the outputs of the changed table; checked against the key of the unchanged table. +- **N2b weight changed, registered key:** the prover holds the unchanged table (so the transcript is the verifier's) but its output cells are those of the changed table; v from the trace. +- **N3a public input changed after the proof:** proof honest for a; the verifier holds a' = a with a_j0 changed by one (toward zero). +- **N3b proof bound to a', outputs for a:** the prover binds a' as the verifier does, its output cells are those for a; v from the trace. +- **N4a x out of class, linear claim true:** the table's entries (r1, j0) and (r1, j1) are changed (Bezout coefficients, two entries far outside any weight class) so that the field equation holds with x_r1 = 2^23 and the old rem_r1. Trace cell x_r1 = 2^23, bits from an honest decomposition (of another value), targets local. Verified against the changed table's key. Only the class can refuse it. +- **N4b rem out of class, linear claim true:** x_r1 - 1 and rem_r1 + 2^13 in the trace (the same value of 2^13 x + rem), table honest, bits from an honest decomposition, targets local. +- **N5 public input out of class:** a_j0 = 2,048, everything computed honestly for that vector; the verifier must refuse at admission. + +Completeness cases (must be ACCEPTED, prover seed 1): the table changed as in N4a so that x_r1 = 2^23 - 1 (C1) and x_r1 = -2^23 (C2), cells and bits honest for those values, verified against that table's key. + +If a registered negative test is ACCEPTED: stop, report it as a finding, fix nothing in this step. + +## Kill criterion + +Hard stop for the lane: 2026-11-29T04:50:02Z. Each registered run: 10 minutes elapsed from its start, else stopped and reported. Stop and report if: the composition needs a change to any existing file (report the missing interface exactly); the product oracle would exceed 2^23 columns or a run's process tree passes 12 GB; the admission check fails for the registered token; a tensor or M.i32 hash differs from the merged record; a negative test is accepted; no honest proof verifies by the hard stop. No widening or weakening of the statement after a failure: a registered item that cannot be built or run is reported as not built, not replaced. + +## Runs + +Honest: 5 runs, same inputs, prover coin seeds 1..5. What varies: the prover's private randomness (table tails and pads, so the table's root and record; masks; transcript challenges; proof bytes). The table is committed afresh in each run from the same M; there is no stored key file, so "the registered key" in a negative test is the key of the unchanged table in that run, and it is not a root from PR #231. Negative and completeness cases: 1 run each, prover seed 1. Each run's output goes to its own file under `runs/`, written once, with its UTC start time. No registered run before this registration and before its code's amendments are committed. + +Debug fixture (never a registered input): the synthetic table of PR #231's `prepare.py synthetic` (numpy seed 9101, "head 1", no real weights), a synthetic public input from numpy seed 9102 (uniform integers in [-2,047, 2,047]), prover seed 9. All development and every debug run of every case uses only these. + +Cores 8-13; single-threaded runs; builds and anything over 2 minutes of CPU or 4 GB through the heavy-job gate. The host is shared and loaded. + +## Prior art + +DESIGN.md (r3) 3.2 and 5.1 state that with a public input in_proj is "directly a linear claim" on the weight table; it is counted there, not built. PR #231 built the table and the tie of the 1,666 trace-read weights and left (c). LIN, FOLDEQ and the committed table are upstream blocks (lin.h cites Greyhound, ePrint 2024/1293, for the form of its row and column claims, with the column combination committed instead of given); they are used unchanged. zkML systems that commit weights (zkLLM, EZKL, Jolt-based provers, Expander-based GKR provers) prove a matmul against a weight commitment by a sumcheck over both indices followed by an opening; what is specific here is small: the input is public, so the column side needs no sumcheck, and the claim rides on a message LIN already sends. New here is only this composition in this fork's research harness and its negative tests. + +## Not in this step (M3a-1 parts left out) + +Everything of M3a-1 after in_proj: the convolution, the q/k norm, the gates (softplus, exp, sigmoid), the recurrence and its state, the gated norm, the out_proj product, the public output of the statement, and T = 16 (this is one token, and a head computation at one token would also need the conv history, which is not here). The tie of the 1,666 trace-read weights (PR #231) is not repeated in this proof. The matrix weights' range is not proved. There is no soundness level: the trace runs at the research setting (target 10 bits) and LIN on a hand-made plan whose rounds are all unpriced, compiled with the two test-only macros of `lin_world.h`. No hiding claim (v and t are sent in the clear; weights and a are public anyway). That the table is the advertised checkpoint is outside the proof (the manifest, #59). No accuracy claim: a's scale and the float norm are choices of this step, and F = 12 is known to miss the fidelity bar on layer 0. One head, one layer, one token, no replication. + +## Amendments + +### A1 (2026-11-29 02:36 UTC, after code and synthetic debug, BEFORE any registered run) + +Concrete choices the code makes that the registration did not fix. None changes the statement, a threshold, a case or a stop rule. + +- **Trace chain.** Transcript label 0x46504d43, run text `research-qwen-m3a1c-inproj-cells-v1`. rho (10 elements) and the second point (13 elements) are drawn in one round named JOIN (23 draws), after the product oracle's root and PSC; v is one scalar sent after it; one tie row. Columns: x_r at column r - 1, rem_r at column 513 + r, then the bits. Counted by the layout (the same for every input): 20,178 product columns, log length 15, 39,328 relations. +- **LIN.** `LinCase` as PR #231 (2^7 table rows, 2^6 matrix columns per table row, 1 record answer, 24 drawn columns, rate at most 1/4, message lengths 4,096, rows high, one request, 12 draws per stage). The row weights are one Tensor written out over the 2^10 row indices (eq(rho, r) at rows 1..514, 0 elsewhere). The (Eval) claim's target t is sent on LIN's first chain; the request's mask entry is joined with coefficient 0, so t and v are not masked. The caller's claim is added to `LinFirst::own` right after `lin_first_prove` / `lin_first_verify`, before the seal, on both sides. It reads W at the 5,120 public-input columns only, through `vector_lay` of W's shape; columns where a_j = 0 get no term. +- **The one plan of this lane's own.** The request's second chain is laid by `second_plan()` in the new file: `toy_plan_iopp` with 6 batched claims ((Eval), the caller's claim, (Dot), three sample claims) where `lin_world.h` has 5. It replaces `LinWorld::second` in this program's own object. No existing file is changed. Like the plans of `lin_world.h`, every round of it is unpriced. +- **j0, j1.** j0 is the first column with a_j0 nonzero; j1 the first later column with a_j1 nonzero and gcd(a_j0, a_j1) = 1. +- **Prover forms.** N1b, N4a, N4b set every trace claim's target to its local value on the tampered trace. N1a, N2b, N3b run the honest prover code on tampered inputs. N2a and N3a prove honestly and are checked under another key or another input. N5 proves honestly for the out-of-class vector. +- **Registered check 4.** The program computes the 514 (x_r, rem_r) in 128-bit integers and compares them with `ref.i64` from `prepare_input.py` (numpy int64) before it proves anything; a difference ends the process with exit 1 and no proof. An honest run's record says `outputs_match_reference: true` only after that comparison passed. Both are computations of the same formula from the same M and a by two programs; neither is a float reference. +- **Run limit.** `run_registered.py` stops a run at 600 s. Each record carries its UTC start time and is written once. +- **Inputs.** Prepared at 2026-11-29T02:31Z by `prepare_input.py real`: the 9 tensor files and M.i32 equal the merged `weights-head0.json`; the embedding row of token 760 (10,240 bytes) and `input_layernorm.weight` (10,240 bytes) were fetched and equal the merged `fetch-stock.json` hashes; the class check on a passed. The summary (hashes, counts, no values) is committed as `runs/inputs-head0.json`. +- **Debug.** The honest path and all 11 cases were run on the synthetic fixture only (table seed 9101, input seed 9102, prover seed 9). Outputs not kept as evidence. No proof has been made on the registered inputs before this amendment's commit. + +### A2 (2026-11-29 02:42 UTC, AFTER the 16 registered runs and their summary were seen and committed, BEFORE the run it adds) + +One negative test is added. It was not in the registration, and it is added with the results of the 16 registered runs known (all as registered). It is reported as its own item; the acceptance threshold above is judged on the 16 registered runs alone and is not changed by it. The 16 run files and `runs/summary.json` are not touched. + +Why: in the three registered tests that LIN refuses (N1a, N2b, N3b) the prover's message W is the honest g^T M and the caller's claim on W is the false one. None lets the prover choose W. The composition's new piece is a caller's claim on a message that the prover sends, so the test that matters most for it is a prover that picks W to make that claim true. + +- **N6 output cell off by one, W fitted:** x_r1 + 1 in the trace (bits honestly re-derived, in class), table honest, v computed from the trace cells, as N1a. On LIN's first chain the prover sends W' = g^T M plus a correction in column j0 so that sum_j a_j W'[j] = v holds exactly, and sends as (Eval) target the true value of W' at the second point. So the trace claims, the caller's claim and (Eval) are all true statements about what was sent; W' is not g^T M, and only LIN's (Dot), which ties W to the table at the shared point drawn after W' is fixed, can refuse. Prover seed 1, registered inputs, one run, file `runs/case-N6-output-off-by-one-W-fitted.json`. Must be REJECTED. If it is accepted: stop, report it as a finding, fix nothing. +- Code: one optional argument of `lin_prove()` (the column at which W is fitted) and the case's entry in `main()`; `run_registered.py ... a2` runs this case alone; `summarise.py summary-a2.json` writes a second summary over all 17 files. The honest path and the 11 earlier cases are unchanged in the source, but the binary is rebuilt; the 16 registered runs were made with the binary built from the previous commit (both binaries' SHA-256 go to ENV.json). +- Debug: N6 was run once on the synthetic fixture (prover seed 9), with N1a and C1 beside it as a check that the rebuilt binary behaves as before. On the fixture N6 was refused by LIN's test on the request's own group, so its outcome on the fixture was known when this was written. No run of N6 on the registered inputs before this amendment's commit. diff --git a/experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md b/experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md new file mode 100644 index 00000000..c6a8a322 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md @@ -0,0 +1,108 @@ +# RESULTS: 20261129-229-qwen-m3a1-inproj + +Issue #229, sub-step (c). PREREG: [PREREG.md](PREREG.md) (first commit 8ce57884, alone; amendment A1 committed before any registered run; amendment A2 added one negative test after the registered results were known and before its own run). Code: [`research/operators/qwen_m3a1c/`](../../research/operators/qwen_m3a1c/README.md). Environment: [ENV.json](ENV.json). + +**Verdict: PASS on all four registered conditions (16 registered runs). The one test added afterwards by amendment A2 (N6) was also rejected; it is reported separately and is not part of the registered threshold.** Every number below is measured, unreplicated, on one shared loaded CPU host, at the harness's research setting. None of it is a security level. + +## In plain words + +PR #231 put the 3,288,706 integer weights of one Gated DeltaNet head of the real Qwen3.8-27B (layer 0, V head 0) into a committed table and stopped before any computation used the matrix weights. This step is the first proved computation that does: for one token, with the layer's normed input public, a proof shows that 514 committed output values (the head's q, k, v, z, a and b projections) are the rounded products of that input with the committed in_proj rows, as an equation in the proof's field. It needed no new protocol block and no change to an existing source file (the coverage inventory and the results ledger get one row each): LIN already sends the combination of table rows it is asked about as a message, and the input is applied to that message by one extra linear claim. Five honest proofs verified. Every negative test was refused, and both edge cases that must pass did. + +What it does not show: that the matrix weights are small integers. That range proof still does not exist for a Qwen layout, so "rounded product" is exact integer arithmetic only for a table like the honest one, and is a field equation otherwise. + +## The statement (as built) + +- **Public:** the run configuration (codes, plans, setting), the layout (table rows 1..514, their shifts 13 / 14 / 16, the cell classes), the table's key (root and record), and the input a (5,120 integers, every |a_j| <= 2,047; in the first query of the trace chain and of LIN's first chain). +- **Committed:** the table (all 3,288,706 weights as field elements); 1,028 output cells x_r, rem_r and their bits. +- **Proved:** (1) every x_r in [-2^23, 2^23) and every rem_r in [0, 2^(s_r)), by exact bits; (2) on the trace, sum_r eq(rho, r) (2^(s_r) x_r + rem_r - 2^(s_r - 1)) = v, rho drawn after the trace root with the table's name and a already bound; (3) LIN's message W equals g^T M for g[r] = eq(rho, r) on rows 1..514 (LIN's own claims, under the table's one-time test); (4) the caller's claim sum over j < 5,120 of a_j W[j] = v. Together: for all 514 rows, sum_j a_j M[r][j] + 2^(s_r - 1) = 2^(s_r) x_r + rem_r in the field, except with probability at most 10 / |E| over rho in the idealised argument (cells and table fixed before rho). That bound is not the error of the compiled proof. +- **Rows covered:** all 514 in_proj rows of the head, as registered. No subset. +- **The verifier** checks the class of a first, builds every relation, the row weights and the caller's claim itself from public data and its own transcript. It reads no weight and no output cell. +- **The public input:** token id 760 (first token of prompt p01 of the merged real-weights experiment), a = RNE(2^5 h), h the float64 zero-centred RMS norm of its embedding row with layer 0's `input_layernorm.weight`. SHA-256 of a (int32 little endian): `8ff01091b52c3a184c4f882b89a6509dc17af9e7c8e3a6db4bf58393c9ad9a24`. 4,988 of 5,120 entries are nonzero. The class check passed. The values are not in the repository; in the proof they are public, not committed. + +## Registered items + +Refusal lines are quoted from the run files. Source lines are those of this PR's head; in the binary of the 16 registered runs (commit f89780a) the two `qm3a1c.cpp` lines were 120 and 331. + +| item | registered | result | verdict | +|---|---|---|---| +| honest proof | accepted 5 of 5 (seeds 1..5) | 5 of 5 accepted | PASS | +| N1a output cell +1, v from the trace | rejected | trace accepted; rejected by LIN: "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)" (`qm3a1c.cpp` line 342) | PASS | +| N1b output cell +1, v from the table | rejected | rejected on the trace chain: "BASE: the masked message in the proof does not satisfy the linear claim" (`blocks/iop/base_case.h` line 225) | PASS | +| N2a one in_proj weight +1, proof honest over the changed table, checked under the unchanged table's key | rejected | rejected on the trace chain: "a nonce does not give the proof of work that its round asks for" (`blocks/chain/rounds.h` line 516) | PASS | +| N2b the prover holds the unchanged table, its outputs are the changed table's | rejected | trace accepted; rejected by LIN, same line as N1a | PASS | +| N3a public input changed after the proof | rejected | rejected on the trace chain, nonce (`rounds.h` line 516) | PASS | +| N3b proof bound to the changed input, outputs for the old one | rejected | trace accepted; rejected by LIN, same line as N1a | PASS | +| N4a x = 2^23 (out of class), field equation true by a changed table | rejected | rejected on the trace chain, BASE (`base_case.h` line 225) | PASS | +| N4b rem out of class, same value of 2^13 x + rem | rejected | rejected on the trace chain, BASE (`base_case.h` line 225) | PASS | +| N5 public input value 2,048 | rejected | rejected before any proof is read: "admission: a public input value is outside [-2047, 2047]" (`qm3a1c.cpp` line 122) | PASS | +| C1 x = 2^23 - 1 | accepted | accepted | PASS | +| C2 x = -2^23 | accepted | accepted | PASS | +| check 4: the program's integer outputs equal the numpy script's | holds in every honest run | 5 of 5 (`outputs_match_reference: true`; the program stops before proving if they differ, `qm3a1c.cpp` line 458) | PASS | + +Added by amendment A2, after the 16 results were known (not part of the threshold): + +| item | registered in A2 | result | +|---|---|---| +| N6 output cell +1, W fitted so that the caller's claim on W is true | rejected | trace accepted; rejected by LIN, `qm3a1c.cpp` line 342 | + +What each refusal does and does not show: + +- **N1a, N2b, N3b** are refused where the composition says they must be: the trace is consistent with itself and in class, W is the honest g^T M, and the caller's claim (the input applied to W) is the false one. This is the new piece doing its work. +- **N6** is the complement: the caller's claim and LIN's (Eval) are true about the W that was sent, but that W is not g^T M. Only LIN's (Dot), which ties W to the table at a point drawn after W is fixed, can refuse it. It did. The refusal string is the same as N1a's because the request's own proximity test batches (Eval), the caller's claim and (Dot) into one check; the run does not say which of the three failed. That N6 fails on (Dot) is by construction of the case, not read from the output. +- **N2a and N3a** are refused at the first check that reads the verifier's own first query: the table's name and the input are bound there, so another key or another input changes the transcript and the recorded proof-of-work nonce no longer fits. As PR #231's H1: this tests transcript binding, not the weights. N2b and N3b are the versions in which the transcript matches and the claim itself has to refuse. +- **N1b, N4a, N4b** are refused on the trace: a hostile prover that replaces each claim's target by its local value fails the proximity test. N4a is the case that shows what the unproved weight range leaves open and what still holds: the table there has two entries far outside any weight class, chosen so that the field equation is true with x = 2^23. The table is accepted as it is (nothing bounds it); the class of x refuses the cell. +- **C1 and C2** use tables of the same kind to reach x's class edges and are accepted. They show the class does not refuse its own boundary values. They also show, on purpose, that a table with entries that are not weights is accepted by this proof. + +Raw outputs: `runs/honest-seed{1..5}.json`, `runs/case-*.json` (each written once, each with its UTC start time), `runs/summary.json` (the 16 registered runs), `runs/summary-a2.json` (the same plus N6), `runs/inputs-head0.json` (hashes of the weights and the input; no values). + +## Measured (unreplicated, shared loaded host, single-threaded runs on cores 8-13) + +| quantity | value | +|---|---| +| table | as PR #231: 595 x 8,192 matrix, 3,288,706 weights | +| rows covered / output cells / product columns / log length / relations | 514 / 1,028 / 20,178 / 15 / 39,328 | +| claims batched in the request's own test | 6 (the fixture of `lin_world.h` has 5) | +| commit of the table, s (n = 5) | median 3.607, sd 0.021, min 3.595, max 3.647 | +| prove (trace + LIN), s (n = 5) | median 1.009, sd 0.060, min 0.969, max 1.122 | +| verify (admission + trace + LIN), s (n = 5) | median 0.104, sd 0.003, min 0.103, max 0.110 | +| peak RSS, kB (n = 5) | median 488,424, min 485,648, max 488,552; N2a 853,560 (two tables in one process) | +| trace proof bytes (n = 5) | median 420,792, min 420,472, max 420,856 | +| LIN proof bytes (n = 5) | median 225,080, min 223,864, max 225,240 | + +What varies between the 5 honest runs: the prover's private randomness (seeds 1..5): table tails and pads, so the root and record, masks, the transcript's challenges, and the proof bytes. Verdicts did not vary. The table is committed afresh in each run. The caller's claim adds no prover message: W is sent by LIN anyway. The verifier's time includes building the row weights (514 values) and the caller's claim (4,988 terms). These numbers are not compared with PR #231's: other cores, other day, other load. + +## What bounds the matrix weights that now take part + +- **The in_proj rows (table rows 1..514, columns 0..5,119): 2,631,680 weights now take part in a proved equation.** They are bound in this sense: the committed table fixes them (up to its proximity test), and the 514 outputs are tied to them and to the public input by the equation above. A changed weight under the same key (N2b) or a changed output (N1a, N6) is refused. +- **Their RANGE is still not proved.** Nothing in this step, or on main, shows that a table entry is an integer in [-4,096, 4,095]. WF, the range proof on committed weights, exists for upstream's Maverick layout only; no Qwen layout was built here. So the equation is in the field. For the honest table (|w| <= 3,584 by the conversion, PR #231) it is the integer equation, and x_r is the rounded product; for an arbitrary table it is not, and N4a, C1 and C2 are three accepted-table examples of exactly that. +- What the classes add on their own: 2^(s_r) x_r + rem_r takes fewer than 2^41 values, so given the table and a the pair (x_r, rem_r) is unique. The outputs are therefore bounded integers whatever the table holds; it is their meaning as a product of small integers that needs the missing range proof. +- **Not read by this proof:** columns 5,120..8,191 of rows 1..514 (the caller's claim reads W at the 5,120 input columns only, so those entries may hold anything), row 0 and its tie (PR #231), and the out_proj rows 515..594. + +## Deviations and things a reviewer should know + +- **A2 is a test added after results were seen.** The 16 registered runs were complete and committed (be7f1ff) when N6 was written, and N6's outcome on the synthetic fixture was known before its registered run. It is evidence about the composition, not part of the registered threshold. +- **Two binaries.** The 16 registered runs used the binary built from the source of commit f89780a; N6 used a rebuild from f0ac5e1 (one optional argument and one case added). Neither binary was rebuilt from its commit to confirm its hash; the source file was not edited between each build and its commit. Hashes in ENV.json. +- **Input preparation before A1's commit.** `prepare_input.py real` ran at 02:31Z, before A1 was committed (02:34Z). It checks hashes, fetches two 10,240-byte ranges, derives a and computes the 514 reference outputs with numpy. It makes no proof. So the honest outputs' class check (all x_r in class) was known before the first registered run; the registered rule for a was not changed. +- **A fetch outside layer 0.** The embedding row of token 760 (10,240 bytes) is not a layer-0 tensor. It was fetched from the pinned stock revision with the merged fetch code and checked against the merged hash, as the PREREG says. +- **Check 4 is two programs, one formula.** The C++ and numpy computations agree on all 1,028 values. Both read the same M.i32 and a.i32. It is not a comparison with a float model. +- The single A2 run and the synthetic debug runs (each about 5 s, under 0.5 GB) did not go through the heavy-job gate; the builds and the 16 registered runs did. +- **Amendment headers carry times that are a little late.** A1's header says 02:36 UTC and it was committed at 02:34:57; A2's says 02:42 and it was committed at 02:40:32. Both were written with a guessed time. The order is as stated: A1 before the first registered run (02:35:14), A2 before its run (02:40:52). The headers are not edited. +- **How the two chains are joined.** LIN's first chain does not follow the trace chain's seal. Its first query holds rho, the second point, v, a and the table's name, and the verifier puts in the values its own trace verification produced. That is as registered, and the same join PR #231 used; a reviewer should weigh it. + +## NOT established + +- **Any soundness level.** The trace uses the research setting (target 10 bits). LIN runs on hand-made plans (two from `blocks/iop/tests/lin_world.h`, one written here with 6 batched claims), every round unpriced, built with the test-only macros `BLK_PLANS_BY_HAND_FOR_A_TEST` and `BLK_TESTED_TABLE_FOR_A_TEST`. The negative tests are one complete proof each, not an exhaustive adversary. The 10 / |E| argument for the tie is this lane's own, not reviewed, not in Lean. +- **Any bound on the matrix weights** (above). +- **Any head computation beyond in_proj:** no conv, q/k norm, gates, recurrence, gated norm, out_proj. The M3a-1 evidence gate of DESIGN section 9 (honest 10 of 10 at T = 16, the hostile cases that need the head computation, UBSan clean) is not met. +- **More than one token, one head, one layer.** +- **Accuracy.** a is a float64 norm rounded at 2^5, a choice of this step: not an integer norm and not the design's stream scale F = 12 (at 2^12 the real normed input does not fit DESIGN 3.2's class 2,047). The outputs are at a's scale. Nothing here says the integer outputs are close to the model's. +- **That the table is the advertised checkpoint.** The proof binds a root; the hash checks are outside it. Each run makes its own root. +- **Hiding.** v and t are sent in the clear. +- **Independent replication.** + +## Open risks and the next missing piece + +1. **A priced plan for this composition does not exist, and the library's planner does not allow it as it is.** Read, not run: `blocks/frame/lin_frame.h` line 255 plans "a request's own test" with exactly 2 + 3 x samples batched claims, and BAT ends the process if the count differs (`blocks/iop/bat.h` line 111). A caller's claim on `LinFirst::own` makes it one more. Here that was solved with a hand-made, unpriced plan in the new file. A version with a real error bound needs that count to be a parameter of the priced planner, or a priced planner of its own: a change to an existing file, out of this step's limits. +2. The use of LIN here (one request, row weights written out over 2^10 indices, the request's mask entry at coefficient 0, a caller's claim on W) is not a use the upstream tests exercise. `lin.h` allows a caller's claim on that group in a comment (above `lin_first_prove_on_shape`); a text search of `blocks/`, `research/`, `prover/`, `verifier/`, `toy/` and `tests/` at the base commit for `add_row` calls that name `own` finds only LIN's own three (`lin.h` lines 360, 620, 632). That is one pattern, not a reading of every caller. +3. LIN's interface forces an (Eval) claim that this statement does not need. It is given a second transcript point and the prover's value; a reviewer should confirm it cannot weaken the rest. +4. The scale of a and the norm before it are open (DESIGN section 11, item 5: fidelity and scaling); this step takes no position. diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-C1-x-at-class-maximum.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-C1-x-at-class-maximum.json new file mode 100644 index 00000000..c25a83d1 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-C1-x-at-class-maximum.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:36:26Z", + "args": [ + "case", + "C1-x-at-class-maximum", + "1" + ], + "exit": 0, + "wall_s": 4.856, + "stdout": [ + "{\"mode\":\"completeness\",\"case\":\"C1-x-at-class-maximum\",\"prover_seed\":1,\"accepted\":true,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":true,\"lin_why\":\"accepted\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420696,\"lin_proof_bytes\":224632,\"commit_s\":3.617,\"prove_s\":1.006,\"verify_s\":0.102,\"peak_rss_kb\":488424}" + ], + "max_rss_kb_time": 488424, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-C2-x-at-class-minimum.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-C2-x-at-class-minimum.json new file mode 100644 index 00000000..7d3f49d5 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-C2-x-at-class-minimum.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:36:31Z", + "args": [ + "case", + "C2-x-at-class-minimum", + "1" + ], + "exit": 0, + "wall_s": 4.783, + "stdout": [ + "{\"mode\":\"completeness\",\"case\":\"C2-x-at-class-minimum\",\"prover_seed\":1,\"accepted\":true,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":true,\"lin_why\":\"accepted\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420696,\"lin_proof_bytes\":224248,\"commit_s\":3.563,\"prove_s\":0.983,\"verify_s\":0.107,\"peak_rss_kb\":488552}" + ], + "max_rss_kb_time": 488552, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N1a-output-off-by-one-v-from-trace.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N1a-output-off-by-one-v-from-trace.json new file mode 100644 index 00000000..8c739b34 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N1a-output-off-by-one-v-from-trace.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:35:38Z", + "args": [ + "case", + "N1a-output-off-by-one-v-from-trace", + "1" + ], + "exit": 0, + "wall_s": 4.874, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N1a-output-off-by-one-v-from-trace\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":false,\"lin_why\":\"LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420856,\"lin_proof_bytes\":225080,\"commit_s\":3.613,\"prove_s\":1.037,\"verify_s\":0.118,\"peak_rss_kb\":488548}" + ], + "max_rss_kb_time": 488548, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N1b-output-off-by-one-v-from-table.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N1b-output-off-by-one-v-from-table.json new file mode 100644 index 00000000..a888aca3 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N1b-output-off-by-one-v-from-table.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:35:43Z", + "args": [ + "case", + "N1b-output-off-by-one-v-from-table", + "1" + ], + "exit": 0, + "wall_s": 4.836, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N1b-output-off-by-one-v-from-table\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":false,\"trace_why\":\"BASE: the masked message in the proof does not satisfy the linear claim\",\"lin_accepted\":false,\"lin_why\":\"not run: the trace chain was refused\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420760,\"lin_proof_bytes\":224568,\"commit_s\":3.607,\"prove_s\":1.031,\"verify_s\":0.087,\"peak_rss_kb\":488420}" + ], + "max_rss_kb_time": 488420, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N2a-weight-changed-other-key.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N2a-weight-changed-other-key.json new file mode 100644 index 00000000..25abc99c --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N2a-weight-changed-other-key.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:35:48Z", + "args": [ + "case", + "N2a-weight-changed-other-key", + "1" + ], + "exit": 0, + "wall_s": 8.458, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N2a-weight-changed-other-key\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":false,\"trace_why\":\"a nonce does not give the proof of work that its round asks for\",\"lin_accepted\":false,\"lin_why\":\"not run: the trace chain was refused\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420984,\"lin_proof_bytes\":224664,\"commit_s\":7.186,\"prove_s\":1.044,\"verify_s\":0.075,\"peak_rss_kb\":853560}" + ], + "max_rss_kb_time": 853560, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N2b-weight-changed-registered-key.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N2b-weight-changed-registered-key.json new file mode 100644 index 00000000..e2556a1f --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N2b-weight-changed-registered-key.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:35:57Z", + "args": [ + "case", + "N2b-weight-changed-registered-key", + "1" + ], + "exit": 0, + "wall_s": 4.914, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N2b-weight-changed-registered-key\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":false,\"lin_why\":\"LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420920,\"lin_proof_bytes\":224312,\"commit_s\":3.686,\"prove_s\":0.995,\"verify_s\":0.105,\"peak_rss_kb\":526636}" + ], + "max_rss_kb_time": 526636, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N3a-input-changed-after-the-proof.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N3a-input-changed-after-the-proof.json new file mode 100644 index 00000000..701e2bc2 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N3a-input-changed-after-the-proof.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:36:02Z", + "args": [ + "case", + "N3a-input-changed-after-the-proof", + "1" + ], + "exit": 0, + "wall_s": 5.121, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N3a-input-changed-after-the-proof\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":false,\"trace_why\":\"a nonce does not give the proof of work that its round asks for\",\"lin_accepted\":false,\"lin_why\":\"not run: the trace chain was refused\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420856,\"lin_proof_bytes\":225208,\"commit_s\":3.724,\"prove_s\":1.216,\"verify_s\":0.076,\"peak_rss_kb\":488420}" + ], + "max_rss_kb_time": 488420, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N3b-proof-bound-to-changed-input.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N3b-proof-bound-to-changed-input.json new file mode 100644 index 00000000..4e5b2b7e --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N3b-proof-bound-to-changed-input.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:36:07Z", + "args": [ + "case", + "N3b-proof-bound-to-changed-input", + "1" + ], + "exit": 0, + "wall_s": 4.845, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N3b-proof-bound-to-changed-input\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":false,\"lin_why\":\"LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":421048,\"lin_proof_bytes\":223960,\"commit_s\":3.638,\"prove_s\":0.994,\"verify_s\":0.100,\"peak_rss_kb\":488548}" + ], + "max_rss_kb_time": 488548, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N4a-x-out-of-class-claim-true.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N4a-x-out-of-class-claim-true.json new file mode 100644 index 00000000..ec6700a3 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N4a-x-out-of-class-claim-true.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:36:12Z", + "args": [ + "case", + "N4a-x-out-of-class-claim-true", + "1" + ], + "exit": 0, + "wall_s": 4.829, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N4a-x-out-of-class-claim-true\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":false,\"trace_why\":\"BASE: the masked message in the proof does not satisfy the linear claim\",\"lin_accepted\":false,\"lin_why\":\"not run: the trace chain was refused\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420920,\"lin_proof_bytes\":225304,\"commit_s\":3.599,\"prove_s\":1.011,\"verify_s\":0.090,\"peak_rss_kb\":488548}" + ], + "max_rss_kb_time": 488548, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N4b-rem-out-of-class-claim-true.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N4b-rem-out-of-class-claim-true.json new file mode 100644 index 00000000..f3ba8785 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N4b-rem-out-of-class-claim-true.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:36:16Z", + "args": [ + "case", + "N4b-rem-out-of-class-claim-true", + "1" + ], + "exit": 0, + "wall_s": 4.878, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N4b-rem-out-of-class-claim-true\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":false,\"trace_why\":\"BASE: the masked message in the proof does not satisfy the linear claim\",\"lin_accepted\":false,\"lin_why\":\"not run: the trace chain was refused\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420600,\"lin_proof_bytes\":223960,\"commit_s\":3.644,\"prove_s\":1.025,\"verify_s\":0.093,\"peak_rss_kb\":488424}" + ], + "max_rss_kb_time": 488424, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N5-input-out-of-class.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N5-input-out-of-class.json new file mode 100644 index 00000000..b73661a1 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N5-input-out-of-class.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:36:21Z", + "args": [ + "case", + "N5-input-out-of-class", + "1" + ], + "exit": 0, + "wall_s": 4.707, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N5-input-out-of-class\",\"prover_seed\":1,\"accepted\":false,\"admitted\":false,\"admit_why\":\"admission: a public input value is outside [-2047, 2047]\",\"trace_accepted\":false,\"trace_why\":\"not run: the public input was refused at admission\",\"lin_accepted\":false,\"lin_why\":\"not run: the public input was refused at admission\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420920,\"lin_proof_bytes\":223608,\"commit_s\":3.565,\"prove_s\":1.024,\"verify_s\":0.000,\"peak_rss_kb\":485652}" + ], + "max_rss_kb_time": 485652, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N6-output-off-by-one-W-fitted.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N6-output-off-by-one-W-fitted.json new file mode 100644 index 00000000..6df34f80 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/case-N6-output-off-by-one-W-fitted.json @@ -0,0 +1,15 @@ +{ + "start_utc": "2026-11-29T02:40:52Z", + "args": [ + "case", + "N6-output-off-by-one-W-fitted", + "1" + ], + "exit": 0, + "wall_s": 4.829, + "stdout": [ + "{\"mode\":\"negative\",\"case\":\"N6-output-off-by-one-W-fitted\",\"prover_seed\":1,\"accepted\":false,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":false,\"lin_why\":\"LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)\",\"outputs_match_reference\":null,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420856,\"lin_proof_bytes\":224632,\"commit_s\":3.616,\"prove_s\":1.011,\"verify_s\":0.105,\"peak_rss_kb\":488424}" + ], + "max_rss_kb_time": 488424, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed1.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed1.json new file mode 100644 index 00000000..c8e47b71 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed1.json @@ -0,0 +1,14 @@ +{ + "start_utc": "2026-11-29T02:35:14Z", + "args": [ + "honest", + "1" + ], + "exit": 0, + "wall_s": 4.83, + "stdout": [ + "{\"mode\":\"honest\",\"case\":\"honest\",\"prover_seed\":1,\"accepted\":true,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":true,\"lin_why\":\"accepted\",\"outputs_match_reference\":true,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420856,\"lin_proof_bytes\":225208,\"commit_s\":3.595,\"prove_s\":1.022,\"verify_s\":0.104,\"peak_rss_kb\":488424}" + ], + "max_rss_kb_time": 488424, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed2.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed2.json new file mode 100644 index 00000000..e749deef --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed2.json @@ -0,0 +1,14 @@ +{ + "start_utc": "2026-11-29T02:35:19Z", + "args": [ + "honest", + "2" + ], + "exit": 0, + "wall_s": 4.834, + "stdout": [ + "{\"mode\":\"honest\",\"case\":\"honest\",\"prover_seed\":2,\"accepted\":true,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":true,\"lin_why\":\"accepted\",\"outputs_match_reference\":true,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420792,\"lin_proof_bytes\":224568,\"commit_s\":3.612,\"prove_s\":1.009,\"verify_s\":0.103,\"peak_rss_kb\":485648}" + ], + "max_rss_kb_time": 485648, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed3.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed3.json new file mode 100644 index 00000000..793c8f64 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed3.json @@ -0,0 +1,14 @@ +{ + "start_utc": "2026-11-29T02:35:24Z", + "args": [ + "honest", + "3" + ], + "exit": 0, + "wall_s": 4.976, + "stdout": [ + "{\"mode\":\"honest\",\"case\":\"honest\",\"prover_seed\":3,\"accepted\":true,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":true,\"lin_why\":\"accepted\",\"outputs_match_reference\":true,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420792,\"lin_proof_bytes\":225240,\"commit_s\":3.647,\"prove_s\":1.122,\"verify_s\":0.104,\"peak_rss_kb\":488424}" + ], + "max_rss_kb_time": 488424, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed4.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed4.json new file mode 100644 index 00000000..a1bb8758 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed4.json @@ -0,0 +1,14 @@ +{ + "start_utc": "2026-11-29T02:35:29Z", + "args": [ + "honest", + "4" + ], + "exit": 0, + "wall_s": 4.784, + "stdout": [ + "{\"mode\":\"honest\",\"case\":\"honest\",\"prover_seed\":4,\"accepted\":true,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":true,\"lin_why\":\"accepted\",\"outputs_match_reference\":true,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420472,\"lin_proof_bytes\":223864,\"commit_s\":3.596,\"prove_s\":0.969,\"verify_s\":0.110,\"peak_rss_kb\":488552}" + ], + "max_rss_kb_time": 488552, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed5.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed5.json new file mode 100644 index 00000000..5140b6a7 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/honest-seed5.json @@ -0,0 +1,14 @@ +{ + "start_utc": "2026-11-29T02:35:34Z", + "args": [ + "honest", + "5" + ], + "exit": 0, + "wall_s": 4.806, + "stdout": [ + "{\"mode\":\"honest\",\"case\":\"honest\",\"prover_seed\":5,\"accepted\":true,\"admitted\":true,\"admit_why\":\"admitted\",\"trace_accepted\":true,\"trace_why\":\"accepted\",\"lin_accepted\":true,\"lin_why\":\"accepted\",\"outputs_match_reference\":true,\"rows_covered\":514,\"output_cells\":1028,\"product_columns_used\":20178,\"log_length\":15,\"relations\":39328,\"table_matrix\":[595,8192],\"input_length\":5120,\"lin_own_test_claims\":6,\"trace_proof_bytes\":420504,\"lin_proof_bytes\":225080,\"commit_s\":3.607,\"prove_s\":0.984,\"verify_s\":0.106,\"peak_rss_kb\":488548}" + ], + "max_rss_kb_time": 488548, + "stderr_tail": [] +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/inputs-head0.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/inputs-head0.json new file mode 100644 index 00000000..050ae7c9 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/inputs-head0.json @@ -0,0 +1,82 @@ +{ + "mode": "real", + "head": 0, + "M_i32_sha256": "ac11d7b74075bcd804bdacd8f5a6d871ac86a4f21d798483f755b3661d7c050d", + "M_equals_merged": true, + "tensors_checked": { + "model.language_model.layers.0.linear_attn.A_log": { + "sha256": "429d53cd15ec0ea1a2d638100c3bbdf8d53505e69110fb17ee09d055c1fdbd34", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.conv1d.weight": { + "sha256": "803a2591c4f5e7b1c2a7bdbbad78bbd0b68acdd0deab9552933ee7c337489dad", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.dt_bias": { + "sha256": "969ce6b2149d20f0c365373fd89613167e373905c15f0e1cf5af62adf52228de", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.in_proj_a.weight": { + "sha256": "ff9e6d0a05fc85c2a61e5f73200d6778c84d76df3df2ce6c80e1e9a4c99c0ce1", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.in_proj_b.weight": { + "sha256": "9694f11c0393c563dcbc8c1ba120c2eaebc36b200d6d19bf8761034acde4ac33", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.in_proj_qkv.weight": { + "sha256": "2417986b44e8f6cd23a1ae5230515a9d5d1ed074aaf573f2ee308c1d9d41c9e2", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.in_proj_z.weight": { + "sha256": "2b98edf85caa94f5bf81b46865b24202d4fc80117c406a3a814f83adbda56b53", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.norm.weight": { + "sha256": "70d11f294923a94aac97bedd27e596dbf496746c6b9e3b2b7c38798a0d2522cc", + "equals_merged": true + }, + "model.language_model.layers.0.linear_attn.out_proj.weight": { + "sha256": "87b442961543b1d794219563100c9728529f75bc513f01cbbbaeab6ca89b33fe", + "equals_merged": true + } + }, + "source": { + "repo": "Qwen/Qwen3.8-27B", + "rev": "37561816e66b5b9153b1b64c10968c18c1e6f4a0" + }, + "input": { + "rule": "a = RNE(2^5 h), h = x / sqrt(mean(x^2) + 1e-6) * (1 + w), float64; x = embedding row of the token, w = layer 0 input_layernorm.weight", + "token_id": 760, + "prompt": "p01-ordinary-short", + "position": 0, + "scale_bits": 5, + "embedding_row_sha256": "69f7c987fa3baa37a4e7586b5be51aa1e6b028d58e1c3a20a685da82364b716a", + "embedding_row_equals_merged": true, + "input_layernorm_sha256": "853b5989bfb677b1761540ee97c09bbf8d90fd825c9ae6ca74ef5853cba3c075", + "input_layernorm_equals_merged": true, + "length": 5120, + "a_i32_sha256": "8ff01091b52c3a184c4f882b89a6509dc17af9e7c8e3a6db4bf58393c9ad9a24", + "class_abs_max": 2047, + "class_check_passed": true, + "nonzero": 4988, + "values_committed_to_repository": false + }, + "matrix": { + "rows": 595, + "columns": 8192 + }, + "rows_covered": 514, + "first_row": 1, + "shifts": { + "rows_1_384": 13, + "rows_385_513": 14, + "row_514": 16 + }, + "reference": { + "ref_i64_sha256": "f95e57db064bde55aedf2a946b6ae076f11c767d83de89a97b6952984d3895c6", + "x_in_class": true, + "note": "514 x then 514 rem, int64 little endian; values not committed" + }, + "written_utc": "2026-11-29T02:31:19Z" +} \ No newline at end of file diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/summary-a2.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/summary-a2.json new file mode 100644 index 00000000..e51dd1e0 --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/summary-a2.json @@ -0,0 +1,201 @@ +{ + "label": "measured, unreplicated, one shared loaded host, cores 8-13, research setting (no security level)", + "honest": { + "accepted": 5, + "n": 5, + "outputs_match_reference": 5, + "prove_s": { + "n": 5, + "median": 1.009, + "sd": 0.06, + "min": 0.969, + "max": 1.122 + }, + "verify_s": { + "n": 5, + "median": 0.104, + "sd": 0.0028, + "min": 0.103, + "max": 0.11 + }, + "commit_s": { + "n": 5, + "median": 3.607, + "sd": 0.0212, + "min": 3.595, + "max": 3.647 + }, + "wall_s": { + "n": 5, + "median": 4.83, + "sd": 0.0754, + "min": 4.784, + "max": 4.976 + }, + "peak_rss_kb": { + "n": 5, + "median": 488424, + "sd": 1271.2023, + "min": 485648, + "max": 488552 + }, + "trace_proof_bytes": { + "n": 5, + "median": 420792, + "sd": 180.4528, + "min": 420472, + "max": 420856 + }, + "lin_proof_bytes": { + "n": 5, + "median": 225080, + "sd": 584.8213, + "min": 223864, + "max": 225240 + }, + "fixed": { + "rows_covered": 514, + "output_cells": 1028, + "product_columns_used": 20178, + "log_length": 15, + "relations": 39328, + "table_matrix": [ + 595, + 8192 + ], + "input_length": 5120, + "lin_own_test_claims": 6 + } + }, + "negative": { + "rejected": 10, + "n": 10 + }, + "completeness": { + "accepted": 2, + "n": 2 + }, + "cases": { + "C1-x-at-class-maximum": { + "accepted": true, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "accepted", + "expected_accepted": true, + "exit": 0, + "peak_rss_kb": 488424, + "start_utc": "2026-11-29T02:36:26Z" + }, + "C2-x-at-class-minimum": { + "accepted": true, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "accepted", + "expected_accepted": true, + "exit": 0, + "peak_rss_kb": 488552, + "start_utc": "2026-11-29T02:36:31Z" + }, + "N1a-output-off-by-one-v-from-trace": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488548, + "start_utc": "2026-11-29T02:35:38Z" + }, + "N1b-output-off-by-one-v-from-table": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "BASE: the masked message in the proof does not satisfy the linear claim", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488420, + "start_utc": "2026-11-29T02:35:43Z" + }, + "N2a-weight-changed-other-key": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "a nonce does not give the proof of work that its round asks for", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 853560, + "start_utc": "2026-11-29T02:35:48Z" + }, + "N2b-weight-changed-registered-key": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 526636, + "start_utc": "2026-11-29T02:35:57Z" + }, + "N3a-input-changed-after-the-proof": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "a nonce does not give the proof of work that its round asks for", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488420, + "start_utc": "2026-11-29T02:36:02Z" + }, + "N3b-proof-bound-to-changed-input": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488548, + "start_utc": "2026-11-29T02:36:07Z" + }, + "N4a-x-out-of-class-claim-true": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "BASE: the masked message in the proof does not satisfy the linear claim", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488548, + "start_utc": "2026-11-29T02:36:12Z" + }, + "N4b-rem-out-of-class-claim-true": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "BASE: the masked message in the proof does not satisfy the linear claim", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488424, + "start_utc": "2026-11-29T02:36:16Z" + }, + "N5-input-out-of-class": { + "accepted": false, + "admit_why": "admission: a public input value is outside [-2047, 2047]", + "trace_why": "not run: the public input was refused at admission", + "lin_why": "not run: the public input was refused at admission", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 485652, + "start_utc": "2026-11-29T02:36:21Z" + }, + "N6-output-off-by-one-W-fitted": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488424, + "start_utc": "2026-11-29T02:40:52Z" + } + }, + "all_cases_as_expected": true +} diff --git a/experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json b/experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json new file mode 100644 index 00000000..894abbeb --- /dev/null +++ b/experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json @@ -0,0 +1,191 @@ +{ + "label": "measured, unreplicated, one shared loaded host, cores 8-13, research setting (no security level)", + "honest": { + "accepted": 5, + "n": 5, + "outputs_match_reference": 5, + "prove_s": { + "n": 5, + "median": 1.009, + "sd": 0.06, + "min": 0.969, + "max": 1.122 + }, + "verify_s": { + "n": 5, + "median": 0.104, + "sd": 0.0028, + "min": 0.103, + "max": 0.11 + }, + "commit_s": { + "n": 5, + "median": 3.607, + "sd": 0.0212, + "min": 3.595, + "max": 3.647 + }, + "wall_s": { + "n": 5, + "median": 4.83, + "sd": 0.0754, + "min": 4.784, + "max": 4.976 + }, + "peak_rss_kb": { + "n": 5, + "median": 488424, + "sd": 1271.2023, + "min": 485648, + "max": 488552 + }, + "trace_proof_bytes": { + "n": 5, + "median": 420792, + "sd": 180.4528, + "min": 420472, + "max": 420856 + }, + "lin_proof_bytes": { + "n": 5, + "median": 225080, + "sd": 584.8213, + "min": 223864, + "max": 225240 + }, + "fixed": { + "rows_covered": 514, + "output_cells": 1028, + "product_columns_used": 20178, + "log_length": 15, + "relations": 39328, + "table_matrix": [ + 595, + 8192 + ], + "input_length": 5120, + "lin_own_test_claims": 6 + } + }, + "negative": { + "rejected": 9, + "n": 9 + }, + "completeness": { + "accepted": 2, + "n": 2 + }, + "cases": { + "C1-x-at-class-maximum": { + "accepted": true, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "accepted", + "expected_accepted": true, + "exit": 0, + "peak_rss_kb": 488424, + "start_utc": "2026-11-29T02:36:26Z" + }, + "C2-x-at-class-minimum": { + "accepted": true, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "accepted", + "expected_accepted": true, + "exit": 0, + "peak_rss_kb": 488552, + "start_utc": "2026-11-29T02:36:31Z" + }, + "N1a-output-off-by-one-v-from-trace": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488548, + "start_utc": "2026-11-29T02:35:38Z" + }, + "N1b-output-off-by-one-v-from-table": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "BASE: the masked message in the proof does not satisfy the linear claim", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488420, + "start_utc": "2026-11-29T02:35:43Z" + }, + "N2a-weight-changed-other-key": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "a nonce does not give the proof of work that its round asks for", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 853560, + "start_utc": "2026-11-29T02:35:48Z" + }, + "N2b-weight-changed-registered-key": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 526636, + "start_utc": "2026-11-29T02:35:57Z" + }, + "N3a-input-changed-after-the-proof": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "a nonce does not give the proof of work that its round asks for", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488420, + "start_utc": "2026-11-29T02:36:02Z" + }, + "N3b-proof-bound-to-changed-input": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "accepted", + "lin_why": "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488548, + "start_utc": "2026-11-29T02:36:07Z" + }, + "N4a-x-out-of-class-claim-true": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "BASE: the masked message in the proof does not satisfy the linear claim", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488548, + "start_utc": "2026-11-29T02:36:12Z" + }, + "N4b-rem-out-of-class-claim-true": { + "accepted": false, + "admit_why": "admitted", + "trace_why": "BASE: the masked message in the proof does not satisfy the linear claim", + "lin_why": "not run: the trace chain was refused", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 488424, + "start_utc": "2026-11-29T02:36:16Z" + }, + "N5-input-out-of-class": { + "accepted": false, + "admit_why": "admission: a public input value is outside [-2047, 2047]", + "trace_why": "not run: the public input was refused at admission", + "lin_why": "not run: the public input was refused at admission", + "expected_accepted": false, + "exit": 0, + "peak_rss_kb": 485652, + "start_utc": "2026-11-29T02:36:21Z" + } + }, + "all_cases_as_expected": true +} diff --git a/research/coverage/inventory.yaml b/research/coverage/inventory.yaml index a82546ef..a5715235 100644 --- a/research/coverage/inventory.yaml +++ b/research/coverage/inventory.yaml @@ -378,6 +378,17 @@ rows: - {file: research/operators/qwen_m3a1/qm3a1.cpp, symbol: 'static std::vector relations('} - {file: research/operators/qwen_m3a1/qm3a1.cpp, symbol: 'static bool lin_check('} note: "does not bound the 3,287,040 matrix weights (rows 1 to 594 of the table); research harness, no security level" + - id: OP-R21 + category: operator + scope: research + element: "Qwen M3a-1 in_proj (research/operators/qwen_m3a1c, issue #229 sub-step c): for one token and a public normed input a, the 514 in_proj outputs of one head as committed cells x_r, rem_r in exact classes, with sum_j a_j M[r][j] + 2^(s_r - 1) = 2^(s_r) x_r + rem_r in the field against the committed weight table" + relation: "experiments/20261129-229-qwen-m3a1-inproj; relations() builds the class relations (exact bits, b^2 = b), tie_row() the claim on the output cells at a transcript point rho, and input_row() the caller's claim sum_j a_j W[j] = v on LIN's message W = g^T M, checked in lin_check(); admit() is the verifier's class check on a" + enforcement: proof_constraint + sites: + - {file: research/operators/qwen_m3a1c/qm3a1c.cpp, symbol: 'static std::vector relations('} + - {file: research/operators/qwen_m3a1c/qm3a1c.cpp, symbol: 'static Row input_row('} + - {file: research/operators/qwen_m3a1c/qm3a1c.cpp, symbol: 'static bool lin_check('} + note: "an equation in the field only: it does not bound the matrix weights (no Qwen layout of the WF range proof), so it is the integer rounding only for a table of small integers; no head computation after in_proj; one token; LIN on hand-made unpriced plans, research harness, no security level" # ---------------------------------------------------------------- range and rounding rules - id: RR-01 category: range_rounding diff --git a/research/operators/qwen_m3a1c/README.md b/research/operators/qwen_m3a1c/README.md new file mode 100644 index 00000000..64e20fb0 --- /dev/null +++ b/research/operators/qwen_m3a1c/README.md @@ -0,0 +1,57 @@ +# Qwen M3a-1, in_proj: one head's in_proj outputs for one token as a linear claim on the committed weight table (issue #229 sub-step (c), research only) + +Registration and results: [`experiments/20261129-229-qwen-m3a1-inproj`](../../../experiments/20261129-229-qwen-m3a1-inproj/). CPU research harness, not a serving protocol. No existing source file is changed: the code includes `blocks/` and `research/operators/qwen_deltanet/product.h` as they are on main, and uses the table layout of [`../qwen_m3a1`](../qwen_m3a1/README.md) (PR #231). + +## What is proved + +For V head 0 of layer 0 of the pinned stock Qwen3.8-27B, ONE token, with the layer's normed input a (5,120 integers) public: + +1. **Committed output cells in their classes.** For each of the 514 in_proj rows of the head (table rows 1..514: q, k, v, z 128 each; a, b 1 each) two cells of the product oracle, x_r and rem_r, with exact classes by bits: x_r in [-2^23, 2^23), rem_r in [0, 2^(s_r)). s_r is the row's tensor exponent: 13 (q, k, v), 14 (z, a), 16 (b). 1,028 cells, 20,178 product columns, 39,328 relations, table length 2^15. +2. **The linear claim.** For every covered row, sum over j < 5,120 of a_j M[r][j] + 2^(s_r - 1) = 2^(s_r) x_r + rem_r **as an equation in the field**, M being the committed table. That is x_r = rq(u_r, s_r) of DESIGN 5.1 if the weights of the row are small integers. + +How (2) is proved without a sumcheck over the column index: LIN (`blocks/iop/lin.h`) already sends, for a request with row weights g, the oracle message W = g^T M (one entry per column) and ties it to the table at a point drawn afterwards. Its source says the caller may add claims of its own to the request's group before the chain is sealed. So: + +- on the trace chain, whose first query holds the relations, the table's name and all of a, the verifier draws rho (10 elements of E) after the product oracle's root, and the prover sends v; +- one claim on the trace: sum_r eq(rho, r) (2^(s_r) x_r + rem_r - 2^(s_r - 1)) = v; +- one LIN request with g[r] = eq(rho, r) on rows 1..514 and 0 elsewhere, and **one caller claim on W: sum_j a_j W[j] = v** (`input_row()` in `qm3a1c.cpp`). + +Cells and table are fixed before rho, and both sides are multilinear in rho, so a covered row whose cells do not satisfy the field equation is caught except with probability at most 10 / |E| over rho. That is the bound of the idealised argument, not the error of the compiled proof at the research setting. + +## What the verifier recomputes + +It checks the class of a (every |a_j| <= 2,047) before anything else, builds the relations from the public layout, sizes and plans the trace run itself, binds the table key and a into the trace chain's first query, draws rho and the second point from its own transcript, reads v, adds the tie row, checks the proximity test; then it builds LIN's claim (the row weights from rho) and the caller's claim (a and v) itself and checks LIN's three chains and the binding path with the same key. It reads no weight and no output cell. + +## What is not covered + +- **The matrix weights' range is not proved.** Table rows 1..594 are field elements under the root. No Qwen layout of the WF range proof exists, and none is built here. So (2) is an equation in the field: with a table whose entries are not small integers, "the product" is not an integer product. The registered tests N4a, C1 and C2 use such tables on purpose (two entries far outside any weight class) to push x to its class edge; they are accepted or refused by the class of x alone. +- No head computation after in_proj: no conv, q/k norm, gates, recurrence, gated norm, out_proj. One token, one head, one layer. The tie of the 1,666 trace-read weights (PR #231) is not repeated in this proof. +- No soundness level. The trace uses the harness's research setting (target 10 bits, query work 6). LIN's chains use the hand-made plans of `blocks/iop/tests/lin_world.h` and one hand-made plan of this file (`second_plan()`, 6 batched claims where the fixture has 5), every round priced NOTHING, compiled with `BLK_PLANS_BY_HAND_FOR_A_TEST` and `BLK_TESTED_TABLE_FOR_A_TEST`: the LIN part has no error bound at all. The negative tests are one complete proof each, not an exhaustive adversary. +- The public input is a float64 norm of one embedding row, rounded at 2^5, a choice of this step: not an integer norm, and not the design's stream scale F = 12. No accuracy claim. +- Not hiding: v and t are sent in the clear. +- That the committed table is the advertised checkpoint: the root is whatever the committer made (#59). The tensor hashes are checked before use; that check is outside the proof. Each run commits the table afresh; there is no stored key. + +## Files + +- `prepare_input.py`: checks the tensor files and M.i32 of `../qwen_m3a1/prepare.py real` against the merged `weights-head0.json`, fetches the embedding row of token 760 and layer 0's `input_layernorm.weight` (10,240 bytes each) with the merged `fetch.py` `get()` and checks them against the merged `fetch-stock.json`, derives a by the registered rule, and writes `a.i32`, `ref.i64` (the 514 x and 514 rem by numpy int64) and a summary of hashes to a data directory outside the repository. `synthetic` mode writes the debug fixture (table numpy seed 9101, input seed 9102). +- `qm3a1c.cpp`: trace, tie, LIN with the caller's claim, verifier, and the registered negative and completeness cases. It compares its own 128-bit integer outputs with `ref.i64` before proving and stops on a difference. Case N6 (a prover that fits W so that the caller's claim is true; only LIN's own tie of W to the table can refuse it) was added by amendment A2 after the 16 registered runs. +- `run_registered.py`: the registered runs, each to its own file with its UTC start time, never overwritten; with a fifth argument `a2`, the one case of amendment A2. `summarise.py`: `runs/summary.json` (or another name, given as a second argument). + +## Reproduce + +From the repository root (Python 3 with NumPy, g++ 13; pin cores on a shared host). `` is the data directory of `../qwen_m3a1/prepare.py real` (about 232 MB fetched there). + +```sh +python3 research/operators/qwen_m3a1/prepare.py real /summary.json +python3 research/operators/qwen_m3a1c/prepare_input.py real /inputs-head0.json +g++ -std=c++17 -O2 -Wall -Wextra -fno-ipa-modref -DBLK_FIELD=2 -DBLK_HASH=1 -I blocks research/operators/qwen_m3a1c/qm3a1c.cpp -o /qm3a1c.bin +python3 research/operators/qwen_m3a1c/run_registered.py /qm3a1c.bin +python3 research/operators/qwen_m3a1c/summarise.py +python3 research/operators/qwen_m3a1c/run_registered.py /qm3a1c.bin 8-13 a2 +python3 research/operators/qwen_m3a1c/summarise.py summary-a2.json +``` + +One run: `/qm3a1c.bin /M.i32 /a.i32 /ref.i64 honest ` or `... case `. The compile took under a minute of one core here; each run takes about 5 s and 0.5 GB (0.85 GB for the case that commits two tables). + +## What a priced version would need + +The request's own proximity test here batches 6 claims. The library's priced planner (`blocks/frame/lin_frame.h`, "a request's own test") fixes that count at 2 + 3 x samples, and BAT ends the process if the run's count differs from the plan's. So this composition runs only on a hand-made plan today. Giving it an error bound means making that count a parameter of the priced planner: a change to an existing file, not made here. diff --git a/research/operators/qwen_m3a1c/prepare_input.py b/research/operators/qwen_m3a1c/prepare_input.py new file mode 100644 index 00000000..b4dcfb9c --- /dev/null +++ b/research/operators/qwen_m3a1c/prepare_input.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +"""Inputs of the in_proj step (issue #229 sub-step (c)): the weight table M, the public input a, and a reference. + +Research only. Nothing this script writes goes into the repository except the summary (hashes, shapes, counts). + +real + - checks every layer-0 tensor file in (the data directory that + research/operators/qwen_m3a1/prepare.py real wrote) against the SHA-256 values of the merged + experiments/20261121-229-qwen-m3a1-weight-side/runs/weights-head0.json, and M.i32 against its M_i32_sha256; + copies M.i32 to . Any mismatch stops. + - the public input, by the rule registered in experiments/20261129-229-qwen-m3a1-inproj/PREREG.md: + token id 760 (first token of prompt p01 of the merged real-weights experiment); x = its BF16 embedding + row, w = layer 0's input_layernorm.weight, both of the pinned stock revision, fetched by HTTP range with + the merged fetch.py get() at the byte ranges of the merged runs/fetch-stock.json, each SHA-256 equal to + that file's entry; h = x / sqrt(mean(x^2) + 1e-6) * (1 + w) in float64 (real_head.py inproj()); + a = RNE(2^5 h). Stops if any |a_j| > 2,047. + - the reference outputs: u = M[1:515, :5120] @ a in int64, x = floor((u + 2^(s-1)) / 2^s), rem = the + remainder, s = 13 for rows 1..384, 14 for 385..513, 16 for 514. Written as ref.i64 (514 x, then 514 rem). + +synthetic + debug fixture only: the synthetic table of prepare.py synthetic (numpy seed 9101, "head 1"), a from numpy + seed 9102 (uniform integers in [-2047, 2047]). No real weights, no fetch. +""" +import hashlib, json, shutil, sys, time +from pathlib import Path + +import numpy as np + +ROOT = Path(__file__).resolve().parents[3] +RW = ROOT / "experiments" / "20261109-8-qwen-real-weights" +sys.path.insert(0, str(RW)) +import fetch as rw_fetch # noqa: E402 (merged get()) + +REPO, REV = rw_fetch.REPOS["stock"] +ROWS, COLS, DM, NOUT = 595, 8192, 5120, 514 +TOKEN, PROMPT, SCALE_BITS, A_MAX = 760, "p01-ordinary-short", 5, 2047 +SHIFTS = np.array([13] * 384 + [14] * 129 + [16], dtype=np.int64) +NORM = "model.language_model.layers.0.input_layernorm.weight" + + +def sha(b): + return hashlib.sha256(b).hexdigest() + + +def bf16(data): + u = np.frombuffer(data, dtype="> SHIFTS # arithmetic shift: floor + rem = t - (x << SHIFTS) + assert ((rem >= 0) & (rem < (np.int64(1) << SHIFTS))).all() + return x, rem + + +def write_inputs(M, a, own, summary, out): + assert M.shape == (ROWS, COLS) and a.shape == (DM,) + x, rem = reference(M, a) + a32 = a.astype("= -(1 << 23)) & (x < (1 << 23))).all()), + note="514 x then 514 rem, int64 little endian; values not committed"), + written_utc=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())) + json.dump(summary, open(out, "w"), indent=1) + print(json.dumps(dict(a_i32_sha256=summary["input"]["a_i32_sha256"], class_check_passed=summary["input"]["class_check_passed"], + x_in_class=summary["reference"]["x_in_class"], M_i32_sha256=summary["M_i32_sha256"]))) + + +def real(src, own, out): + merged = json.load(open(ROOT / "experiments/20261121-229-qwen-m3a1-weight-side/runs/weights-head0.json")) + checked = {} + for name, t in merged["source"]["tensors"].items(): + h = sha((src / (name + ".bin")).read_bytes()) + if h != t["sha256"]: + raise SystemExit(f"STOP: {name} sha256 {h} differs from the merged weights-head0.json") + checked[name] = dict(sha256=h, equals_merged=True) + raw = (src / "M.i32").read_bytes() + if sha(raw) != merged["M_i32_sha256"]: + raise SystemExit("STOP: M.i32 differs from the merged M_i32_sha256") + shutil.copyfile(src / "M.i32", own / "M.i32") + M = np.frombuffer(raw, dtype=" A_MAX: + raise SystemExit("STOP: the registered public input is outside the class |a| <= 2047; the rule is not changed") + summary = dict(mode="real", head=0, M_i32_sha256=sha(raw), M_equals_merged=True, tensors_checked=checked, + source=dict(repo=REPO, rev=REV), + input=dict(rule="a = RNE(2^5 h), h = x / sqrt(mean(x^2) + 1e-6) * (1 + w), float64; x = embedding row of the token, w = layer 0 input_layernorm.weight", + token_id=TOKEN, prompt=PROMPT, position=0, scale_bits=SCALE_BITS, + embedding_row_sha256=sha(row), embedding_row_equals_merged=True, + input_layernorm_sha256=sha(wn), input_layernorm_equals_merged=True)) + write_inputs(M, a, own, summary, out) + + +def synthetic(src, own, out): + raw = (src / "M.i32").read_bytes() + shutil.copyfile(src / "M.i32", own / "M.i32") + M = np.frombuffer(raw, dtype=" honest +// qm3a1c.bin case +// Case N6 (a prover that fits W to the caller's claim) was added by amendment A2, after the 16 runs +// registered first; those were made with the program as it stood one commit earlier. +// Prints one JSON line per proof. +#define BLK_PLANS_BY_HAND_FOR_A_TEST +#define BLK_TESTED_TABLE_FOR_A_TEST +#include +#include +#include +#include +#include +#include +#include +#include + +#include "iop/tests/lin_world.h" +#include "toy/toy_coins.h" +#include "../qwen_deltanet/product.h" + +using namespace blk; + +static void need(bool ok, const char *s) { if (!ok) { std::fprintf(stderr, "FAIL: %s\n", s); std::exit(1); } } +static F fi(i64 x) { return x >= 0 ? F{u64(x)} : F{P - u64(-x)}; } +static double secs(std::chrono::steady_clock::time_point a) { return std::chrono::duration(std::chrono::steady_clock::now() - a).count(); } +static long rss_kb() { rusage u; getrusage(RUSAGE_SELF, &u); return u.ru_maxrss; } + +// ---- public layout ---- +constexpr u64 ROWS = 595, COLS = 8192, DM = 5120, NOUT = 514, FIRST_ROW = 1; +constexpr unsigned KCOL = 13, KROW = 10, XBITS = 24; +constexpr i64 A_MAX = 2047, X_OFFSET = i64(1) << 23; +constexpr u64 TIE_LABEL = 0x46504d43ULL; // "FPMC": this lane's own transcript domain +// Output i is table row 1 + i. Shift = the row's tensor exponent (DESIGN 5.0): in_proj_qkv 13, in_proj_z 14, in_proj_a 14, in_proj_b 16. +static unsigned shift_of(u64 i) { return i < 384 ? 13 : i < 513 ? 14 : 16; } + +// Columns of the product oracle: x_i at column i, rem_i at column 514 + i, each (a, b, c) = (value, 0, 0); +// then the bits of every x, then of every rem, each column (b, b, b), so b * b = b once a = b and c = a hold. +struct Layout { std::vector xbit, rbit; u64 columns = 0; unsigned log_len = 0; }; +static Layout layout() { + Layout L; u64 c = 2 * NOUT; + for (u64 i = 0; i < NOUT; i++) L.xbit.push_back(c), c += XBITS; + for (u64 i = 0; i < NOUT; i++) L.rbit.push_back(c), c += shift_of(i); + L.columns = c; while ((u64(1) << L.log_len) < c) L.log_len++; + return L; +} +static std::vector relations(const Layout &L) { + std::vector r; + for (u64 i = 0; i < NOUT; i++) { + WideRelation a; // x_i - sum_k 2^k bit_k = -2^23, so x_i is in [-2^23, 2^23) + a.terms.push_back({0, i, F{1}}); + for (unsigned k = 0; k < XBITS; k++) a.terms.push_back({0, L.xbit[i] + k, fi(-(i64(1) << k))}); + a.target = fi(-X_OFFSET); + r.push_back(a); + } + for (u64 i = 0; i < NOUT; i++) { + WideRelation a; // rem_i - sum_k 2^k bit_k = 0, so rem_i is in [0, 2^s_i) + a.terms.push_back({0, NOUT + i, F{1}}); + for (unsigned k = 0; k < shift_of(i); k++) a.terms.push_back({0, L.rbit[i] + k, fi(-(i64(1) << k))}); + a.target = F{0}; + r.push_back(a); + } + for (u64 c = 2 * NOUT; c < L.columns; c++) { + r.push_back({{{0, c, F{1}}, {1, c, fi(-1)}}, F{0}}); + r.push_back({{{0, c, F{1}}, {2, c, fi(-1)}}, F{0}}); + } + return r; +} +struct Cells { std::vector x, rem; }; +// Honest decomposition of (value + offset) mod 2^bits: a value out of class gets bits of another +// value, so its class relation is false. +static Table trace_table(const Layout &L, const Cells &c) { + Table t(1, 3, u64(1) << L.log_len); + auto bits = [&](u64 first, u64 s, unsigned nb) { + for (unsigned k = 0; k < nb; k++) { const E b = E::from(F{(s >> k) & 1}); for (int r = 0; r < 3; r++) t.set(r, first + k, b); } + }; + for (u64 i = 0; i < NOUT; i++) { + t.set(0, i, E::from(fi(c.x[i]))); + bits(L.xbit[i], u64(c.x[i] + X_OFFSET) & ((u64(1) << XBITS) - 1), XBITS); + t.set(0, NOUT + i, E::from(fi(c.rem[i]))); + bits(L.rbit[i], u64(c.rem[i]) & ((u64(1) << shift_of(i)) - 1), shift_of(i)); + } + return t; +} +// The integer outputs: u_i = sum_j a_j M[1 + i][j]; x_i = floor((u_i + 2^(s-1)) / 2^s); rem_i the remainder. +static Cells outputs(const std::vector &M, const std::vector &a) { + Cells c; c.x.resize(NOUT), c.rem.resize(NOUT); + for (u64 i = 0; i < NOUT; i++) { + __int128 u = 0; + for (u64 j = 0; j < DM; j++) u += (__int128)a[j] * M[(FIRST_ROW + i) * COLS + j]; + const unsigned s = shift_of(i); + const __int128 t = u + (__int128(1) << (s - 1)), two_s = __int128(1) << s; + const __int128 x = t >= 0 ? t / two_s : -((-t + two_s - 1) / two_s); + c.x[i] = (i64)x, c.rem[i] = (i64)(t - x * two_s); + } + return c; +} +static std::vector to_field(const std::vector &a) { std::vector f; for (i64 x : a) f.push_back(fi(x)); return f; } +// Admission (DESIGN 6): the verifier's check on the public input, before any relation is built. +static const char *admit(const std::vector &a) { + if (a.size() != DM) return "admission: the public input has not 5,120 entries"; + for (i64 x : a) + if (x < -A_MAX || x > A_MAX) return "admission: a public input value is outside [-2047, 2047]"; + return nullptr; +} + +// ---- the trace chain ---- +struct TraceRun { ToyRun product; std::vector relations; IndexName table; std::vector input; explicit TraceRun(const Setting &s) : product(s) {} }; +struct TraceBound { ToyPublic product; Public> relations; Public table; Public> input; }; +struct TieOut { std::vector rho, psi2; E v = E::zero(); }; +static TraceBound trace_bind(Binder &b, const TraceRun &run) { + TraceBound x; x.product = toy_bind_run(b, run.product); + x.relations = b.statement("in_proj output cell class relations v1", run.relations); + x.table = b.statement("weight table", run.table); + x.input = b.statement("the layer's normed input, public", run.input); + return x; +} +// As trace_size() of research/operators/qwen_m3a1/qm3a1.cpp, with this step's relations, one tie +// row, the two points (10 + 13 draws) and the tie value (1 scalar) before the proximity test. +static TraceRun trace_size(const Setting &set, unsigned log_len, std::vector rel, const IndexName &table, std::vector input) { + TraceRun run(set); + const unsigned log_n = log_len + 1, mask_log_n = log_len + 1; + const std::vector further = {{1, 1, log_len, log_len}, {0, 0, log_len, log_len}}; + const u64 rows = toy_rows_batched(set) + rel.size() + 1; + run.product.shape.text = toy_text("research-qwen-m3a1c-inproj-cells-v1", set, {{"relations", rel.size()}, {"log-length", log_len}, {"log-n", log_n}, {"mask-log-n", mask_log_n}, {"outputs", NOUT}}, further); + Plan plan(set); + GroupSize g; g.name = "a, b, c"; g.k = 2, g.h = 0; + g.main.name = "rows", g.main.log_n = log_n, g.main.ell = u64(1) << log_len; + const u64 masks = 1 + 2 * u64(log_len) + 2 + 2; + g.mask.name = "mask row", g.mask.log_n = mask_log_n, g.mask.over_E = true; + g.mask.ell = pow2_at_least(std::max(masks + set.samples, 2 * g.k + 1 - g.h)); + u64 t = 0; + for (int turn = 0; turn < 16; turn++) { + g.main.r = g.mask.r = tail_for(set, t); + GroupLoad load; load.cube_bits = stage_cube_bits(g); load.batched_rows = rows; + g = size_group(set, plan.scope(), g, load); + if (analysis(set, g).bad()) { plan.refuse("no slack"); run.product.plan = plan.finish(); return run; } + const u64 more = plan_positions(plan, analysis(set, g).at.agree, Bound(Real::two_to(-(long)set.target - 30))); + if (more <= t) break; + t = more; + } + const std::vector stages = solve_stages(plan, g, t, further); + if (plan.refused()) { run.product.plan = plan.finish(); return run; } + run.product.stages = iopp_stages(stages, run.product.shape.codes); + if (const char *fault = iopp_sized_fault(run.product.shape.codes, run.product.stages, stages)) { plan.refuse(fault); run.product.plan = plan.finish(); return run; } + plan_chain_start(plan, "trace", true); + toy_plan_preamble(plan, run.product.shape, run.product.stages, {g}); + plan_join(plan, "in_proj tie points", KROW + KCOL); + plan_scalars(plan, "in_proj tie value", "in_proj tie", 1); + plan_iopp(plan, g.name, stages, tree_sizes(run.product.shape.codes, toy_first_message(OracleNotice{run.product.shape.oracle(), 0}, run.product.stages)), rows, 0, true); + run.product.plan = plan.finish(); + run.relations = std::move(rel); run.table = table; run.input = std::move(input); + return run; +} +// sum_i eq(rho, 1 + i) (2^s_i x_i + rem_i) = v + sum_i eq(rho, 1 + i) 2^(s_i - 1) +static Row tie_row(OracleId o, const std::vector &rho, const E &v) { + Row r; r.name = "in_proj outputs at the tie point"; + E c = E::zero(); + for (u64 i = 0; i < NOUT; i++) { + const E e = eq_index(FIRST_ROW + i, rho.data(), KROW); + const unsigned s = shift_of(i); + r.add_unit(o, Part::MAIN, 0 + 4 * i, e * F{u64(1) << s}); + r.add_unit(o, Part::MAIN, 0 + 4 * (NOUT + i), e); + c += e * F{u64(1) << (s - 1)}; + } + r.target = v + c; return r; +} +static E row_local(const Row &r, const Table &t) { // units only (wide rows and the tie row) + E x = E::zero(); for (const Unit &u : r.units) x += u.coeff * t.at(u.index % 4, u.index / 4); return x; +} +enum class VFrom { TRACE, TABLE }; +// u_field: the prover's table rows times its input, in the field (used for VFrom::TABLE). +static Writer trace_prove(const TraceRun &run, const Table &tab, const std::vector &u_field, VFrom vfrom, bool local, u64 seed, TieOut &out) { + EngineCpu engine; ToyCoins coins(1000 + seed); Writer proof; + Binder b(TIE_LABEL, run.product.plan); const TraceBound in = trace_bind(b, run); + ProverRounds ch(b, random_digest(coins), proof, [&](const ChainPrefix &p, unsigned bits) { return engine.search_nonce(p, bits); }); + ProverContext pr(in.product.codes, ch, engine, coins); FoldMask mask; + const GroupId g = toy_prove_preamble(pr, in.product, tab, mask); const OracleId o = pr.st.group(g).members[0]; + for (const auto &a : ch.get(in.relations)) { Row row = wide_row(o, a); if (local) row.target = row_local(row, tab); pr.st.add_row(g, std::move(row)); } + std::vector rho(KROW), psi2(KCOL); + { AlgebraicDraw from = ch.close_algebraic(R_JOIN); for (E &z : rho) z = from.draw(); for (E &z : psi2) z = from.draw(); } + E v = E::zero(); + if (vfrom == VFrom::TRACE) { const Row zero = tie_row(o, rho, E::zero()); v = row_local(zero, tab) - zero.target; } + else for (u64 i = 0; i < NOUT; i++) v += eq_index(FIRST_ROW + i, rho.data(), KROW) * u_field[i]; + ch.send(v); + Row tie = tie_row(o, rho, v); if (local) tie.target = row_local(tie, tab); pr.st.add_row(g, std::move(tie)); + iopp_prove(pr, g, in.product.stages, in.product.choice, std::move(mask)); ch.finish(); pr.st.require_all_tested(); + out.rho = rho, out.psi2 = psi2, out.v = v; + return proof; +} +static bool trace_decide(VerifierRounds &ch, const TraceBound &in, TieOut &out, Notes *notes) { + VerifierContext vf(in.product.codes, ch); vf.notes = notes; + GroupId g = 0; FoldMask mask; + if (!toy_verify_preamble(vf, in.product, g, mask)) return false; + const OracleId o = vf.st.group(g).members[0]; + wide_rows(vf.st, g, ch.get(in.relations)); + std::vector rho(KROW), psi2(KCOL); + { AlgebraicDraw from = ch.close_algebraic(R_JOIN); for (E &z : rho) z = from.draw(); for (E &z : psi2) z = from.draw(); } + E v; if (!ch.recv(v)) return false; + vf.st.add_row(g, tie_row(o, rho, v)); + if (!iopp_verify(vf, g, in.product.stages, in.product.choice, std::move(mask))) return false; + vf.st.require_all_tested(); + out.rho = rho, out.psi2 = psi2, out.v = v; return true; +} + +// ---- LIN on the table (chains as blocks/iop/tests/lin_world.h; own first-chain statement, own second plan) ---- +static const LinCase LCASE = {"qwen m3a1 head table", 7, 6, ROWS, 0, 1, 24, 1, 2, 4096, 4096, 4096, true, 1, 0, 12, false}; +// The request's second chain, as lin_world() lays it, but its own test batches 6 claims: +// (Eval), the caller's claim on W, (Dot), and one sample claim for each of the three members. +static Planned second_plan(const LinWorld &w) { + need(!w.S.own_split_needed(), "this plan is for W and Omega under one code"); + Plan second = toy_empty_plan(); + toy_plan_iopp(second, w.codes, w.S.test_own, LCASE.draws, w.S.choice, w.S.masks_ahead, 3 + 3); + return second; +} +struct FirstBound { LinPublic lin; Public input; Public binding; Public> rho, psi2; Public v; Public> a; }; +static FirstBound bind_first(Binder &b, const LinWorld &w, const IndexName &table, const TieOut &tie, const std::vector &a) { + FirstBound x; b.configuration(w.configuration); + lin_bind_parameters(b, w.codes, w.S, x.lin); + x.input = b.parameter("a request's mask message", w.input), x.binding = b.parameter("the binding tree", w.binding); + lin_bind_table(b, table, x.lin); + x.rho = b.statement("in_proj tie point", tie.rho), x.psi2 = b.statement("in_proj second point", tie.psi2); + x.v = b.statement("in_proj tie value", tie.v), x.a = b.statement("the layer's normed input, public", a); + return x; +} +// g[r] = eq(rho, r) for the covered rows 1..514, 0 for every other row; written out. +static std::vector row_weight_values(const std::vector &rho) { + std::vector g(size_t(1) << KROW, E::zero()); + for (u64 i = 0; i < NOUT; i++) g[FIRST_ROW + i] = eq_index(FIRST_ROW + i, rho.data(), KROW); + return g; +} +static Tensor row_weights(const LinShape &S, const std::vector &rho) { + need(S.k_row() == KROW, "the table's row bits"); + Tensor t; t.push_dense(KROW); + t.set_values(std::make_shared>(row_weight_values(rho)), 0); + return t; +} +// THE CALLER'S CLAIM: sum over j < 5,120 of a_j W[j] = v, on LIN's message W = g^T M. +static Row input_row(const Codes &codes, const LinShape &S, OracleId w, const std::vector &a, const E &v) { + Row r; r.name = "in_proj: the public input on W"; + const VectorLay lay = vector_lay(codes, S.w, S.w_rows_high); + for (u64 j = 0; j < a.size(); j++) + if (a[j].v != 0) r.add_unit(w, Part::MAIN, lay.index(j), E::from(a[j])); + r.target = v; return r; +} +// fit_w_at: COLS for the honest prover. Otherwise (amendment A2, case N6) a column j with a_j != 0: the prover +// adds to W[j] whatever makes the caller's claim sum_j a_j W[j] = v true for the v of its trace, so W is no +// longer g^T M. Its (Eval) target is then the true value of that W at the second point. Only (Dot) is false. +static LinView lin_prove(const LinWorld &w, IndexCpu &index, const std::vector &M, const std::vector &a, const TieOut &tie, u64 seed, u64 fit_w_at = COLS) { + const LinShape &S = w.S; TestCoins coins(5000 + seed); EngineCpu engine; LinView view; + const IndexName table{index.commitment(), index.record()}; + LinBinding binding(w.binding, w.configuration, coins); + std::unique_ptr begun; need(lin_begin(index, S, begun), "LIN: the table's tails cover a batch"); + Writer first_w, second_w, shared_w, path_w; + Binder b(1, w.first); const FirstBound x = bind_first(b, w, table, tie, a); + ProverRounds ch(b, toy_random_bytes(seed + 100), first_w); + ProverContext P(x.lin.codes, ch, engine, coins); + std::vector drafts; drafts.push_back(lin_draft(P, ch.get(x.input).shape, false, ch.get(x.input).leaf_class, {})); + const OracleId input = send_prove(P, std::move(drafts))[0]; + LinClaim claim; claim.g.push_back(row_weights(S, ch.get(x.rho))); claim.psi = ch.get(x.psi2); + const std::vector g = row_weight_values(ch.get(x.rho)); + std::vector wc(COLS, E::zero()); // W = g^T M, from the prover's own table + for (u64 i = 0; i < NOUT; i++) + for (u64 j = 0; j < COLS; j++) wc[j] += g[FIRST_ROW + i] * fi(M[(FIRST_ROW + i) * COLS + j]); + if (fit_w_at < COLS) { + need(fit_w_at < a.size() && a[fit_w_at].v != 0, "fit W at a column with a nonzero public input value"); + E gap = tie.v; + for (u64 j = 0; j < a.size(); j++) gap = gap - wc[j] * a[j]; + wc[fit_w_at] += gap * inv(a[fit_w_at]); + } + claim.target = mle_eval(wc.data(), wc.size(), claim.psi.data(), KCOL); // t: W at the second point + claim.add_mask(P.st.masks(input).take(), E::zero()); // joins the request's mask message to its group; no weight + ch.send(claim.target); + LinFirst lf = lin_first_prove(P, x.lin, std::move(claim), wc); + P.st.add_row(lf.own, input_row(P.st.codes(), S, lf.w, ch.get(x.a), ch.get(x.v))); + Sealed seal; need(ch.seal(R_SEAL, seal), "seal"); ch.finish(); + binding.put(0, seal.digest()); + Binder sb(LIN_LABEL_SHARED, w.shared); sb.configuration(w.configuration); + const LinPublic sx = lin_bind_shared(sb, w.codes, w.S, table, binding.root()); + ProverRounds sch(sb, Digest{}, shared_w); ProverContext SP(sx.codes, sch, engine, coins); + LinShared shared; lin_shared_prove(SP, sx, w.test, index, std::move(begun), shared); + lin_shared_tests_prove(SP, sx, shared); + Sealed shared_seal; need(sch.seal(R_SEAL, shared_seal), "shared seal"); sch.finish(); SP.st.require_all_tested(); + Binder b2(LIN_LABEL_SECOND, w.second); b2.configuration(w.configuration); lin_bind_second(b2, seal, shared_seal); + ProverRounds ch2(b2, toy_random_bytes(seed + 200), second_w); + ProverContext P2 = lin_go_on(std::move(P), ch2); + const LinSecond second = lin_second_prove(P2, x.lin, lf, SP, shared); + lin_second_tests_prove(P2, x.lin, lf, second); ch2.finish(); P2.st.require_all_tested(); + binding.write_path(path_w, 0); lin_release(SP, shared); + view.target = tie.v; view.first = first_w.bytes(), view.path = path_w.bytes(), view.shared = shared_w.bytes(), view.second = second_w.bytes(); + return view; +} +// The verifier's LIN side: rho, the second point and v as its own trace verification produced them, a as it holds it. +static bool lin_check(const LinWorld &w, const IndexKey &key, const TieOut &tie, const std::vector &a, const LinView &view, const char *&reason) { + const IndexName table{key.commitment(), key.rec}; + const TableRead read(key); // ONE_TIME: the committer's own test; any reader + Reader fb(view.first.data(), view.first.size()); + Binder b(1, w.first); const FirstBound x = bind_first(b, w, table, tie, a); + VerifierSession session; VerifierRounds ch(b, fb, session); VerifierContext V(x.lin.codes, ch); + std::vector ids; + if (!send_verify(V, std::vector{ch.get(x.input)}, ids)) return reason = "LIN first part: the input message", false; + LinClaim claim; claim.g.push_back(row_weights(w.S, ch.get(x.rho))); claim.psi = ch.get(x.psi2); + if (!ch.recv(claim.target)) return reason = "LIN first part: the target", false; + claim.add_mask(V.st.masks(ids[0]).take(), E::zero()); + LinFirst first; + if (!lin_first_verify(V, x.lin, std::move(claim), first)) return reason = "LIN first part", false; + V.st.add_row(first.own, input_row(V.st.codes(), w.S, first.w, ch.get(x.a), ch.get(x.v))); + Sealed seal; if (!ch.seal(R_SEAL, seal) || !ch.finish()) return reason = "LIN first part: its end", false; + Reader path(view.path.data(), view.path.size()); LinBindingRoot root; + if (!lin_binding_root(path, ch.get(x.binding), ch.configuration(), seal.digest(), root) || !path.at_end()) return reason = "LIN path", false; + Reader sbytes(view.shared.data(), view.shared.size()); + Binder sb(LIN_LABEL_SHARED, w.shared); sb.configuration(w.configuration); + const LinPublic sx = lin_bind_shared(sb, w.codes, w.S, table, root); + VerifierRounds sch(sb, sbytes, session); VerifierContext SV(sx.codes, sch); LinShared shared; + if (!lin_shared_verify(SV, sx, w.test, read, shared)) return reason = "LIN shared part", false; + if (!lin_shared_tests_verify(SV, sx, shared)) return reason = "LIN shared part: a proximity test", false; + Sealed shared_seal; if (!sch.seal(R_SEAL, shared_seal) || !sch.finish()) return reason = "LIN shared part: its end", false; + SV.st.require_all_tested(); + Reader b2bytes(view.second.data(), view.second.size()); + Binder b2(LIN_LABEL_SECOND, w.second); b2.configuration(w.configuration); lin_bind_second(b2, seal, shared_seal); + VerifierRounds ch2(b2, b2bytes, session); VerifierContext V2 = lin_go_on(std::move(V), ch2); LinSecond second; + if (!lin_second_verify(V2, x.lin, first, SV, shared, second)) return reason = "LIN second part", false; + if (!lin_second_tests_verify(V2, x.lin, first, second)) return reason = "LIN second part: the proximity test on the request's own group (Eval, the public input on W, Dot)", false; + if (!ch2.finish()) return reason = "LIN second part: its end", false; + V2.st.require_all_tested(); + if (!session.accepted()) return reason = "LIN: the session is not accepted", false; + reason = "accepted"; return true; +} + +// ---- one statement, end to end ---- +struct World { + Layout L; std::vector rel; LinWorld lw; Setting set; + World() : lw(lin_world(LCASE, TableTest::ONE_TIME)) { + L = layout(); rel = relations(L); + lw.second = second_plan(lw); + set = setting_goldilocks(); set.hash_block_bytes = HASH_BLOCK_BYTES; set.target = 10; set.set_work(ErrorKind::QUERY, Scope::REQUEST, 6); + need(!lin_fault(lw.codes, lw.S), "LIN shape"); + } +}; +static Table table_rows(const LinShape &S, const std::vector &M) { + LinMatrix lm{ROWS, COLS, {}}; lm.a.resize(ROWS * COLS); + for (u64 i = 0; i < ROWS * COLS; i++) lm.a[i] = fi(M[i]); + return lin_table_rows(S, lm); +} +struct Committed { std::unique_ptr index; IndexKey key; }; +static Committed commit(const World &W, const std::vector &M, u64 coin) { + Committed c; TestCoins coins(coin); + c.index.reset(new IndexCpu(W.lw.S.fold.index, table_rows(W.lw.S, M), coins)); + c.key = c.index->key(); + need(!index_key_fault(c.key), "an honest key is refused"); + return c; +} +struct Verdict { bool admitted = false, trace = false, lin = false; const char *admit_why = "admitted", *trace_why = nullptr, *lin_why = "not run"; }; +static void emit(const char *mode, const std::string &name, u64 seed, const Verdict &d, const char *ref, const World &W, size_t trace_bytes, size_t lin_bytes, double commit_s, double prove_s, double verify_s) { + std::printf("{\"mode\":\"%s\",\"case\":\"%s\",\"prover_seed\":%llu,\"accepted\":%s,\"admitted\":%s,\"admit_why\":\"%s\",\"trace_accepted\":%s,\"trace_why\":\"%s\",\"lin_accepted\":%s,\"lin_why\":\"%s\"," + "\"outputs_match_reference\":%s,\"rows_covered\":%llu,\"output_cells\":%llu,\"product_columns_used\":%llu,\"log_length\":%u,\"relations\":%zu,\"table_matrix\":[%llu,%llu]," + "\"input_length\":%llu,\"lin_own_test_claims\":6,\"trace_proof_bytes\":%zu,\"lin_proof_bytes\":%zu,\"commit_s\":%.3f,\"prove_s\":%.3f,\"verify_s\":%.3f,\"peak_rss_kb\":%ld}\n", + mode, name.c_str(), (unsigned long long)seed, d.admitted && d.trace && d.lin ? "true" : "false", d.admitted ? "true" : "false", d.admit_why, d.trace ? "true" : "false", + d.trace_why ? d.trace_why : (d.trace ? "accepted" : "not run"), d.lin ? "true" : "false", d.lin_why, ref, + (unsigned long long)NOUT, (unsigned long long)(2 * NOUT), (unsigned long long)W.L.columns, W.L.log_len, W.rel.size(), (unsigned long long)ROWS, (unsigned long long)COLS, + (unsigned long long)DM, trace_bytes, lin_bytes, commit_s, prove_s, verify_s, rss_kb()); + std::fflush(stdout); +} +// The prover: table pM, bound input pa, trace cells `cells`. The verifier: the key of vM (default: the +// prover's table's key) and the input va. +struct Case { + std::vector pM, pa; Cells cells; VFrom vfrom = VFrom::TRACE; bool local = false; + bool other_key = false; std::vector vM; u64 verify_coin = 0; std::vector va; + u64 fit_w_at = COLS; // see lin_prove() +}; +static void run_case(const World &W, const char *mode, const std::string &name, const Case &k, u64 seed, const char *ref) { + auto t0 = std::chrono::steady_clock::now(); + Committed c = commit(W, k.pM, 77 + seed); + Committed other; if (k.other_key) other = commit(W, k.vM, k.verify_coin); + const IndexKey &vkey = k.other_key ? other.key : c.key; + const double commit_s = secs(t0); + const Table tab = trace_table(W.L, k.cells); + std::vector u_field(NOUT, F{0}); + if (k.vfrom == VFrom::TABLE) + for (u64 i = 0; i < NOUT; i++) + for (u64 j = 0; j < DM; j++) u_field[i] += fi(k.pa[j]) * fi(k.pM[(FIRST_ROW + i) * COLS + j]); + auto tp = std::chrono::steady_clock::now(); + const IndexName pname{c.index->commitment(), c.index->record()}; + const std::vector pa = to_field(k.pa); + TraceRun run = trace_size(W.set, W.L.log_len, W.rel, pname, pa); + need(run.product.plan->holds(), "trace plan holds"); + TieOut tie; Writer tp_bytes = trace_prove(run, tab, u_field, k.vfrom, k.local, seed, tie); + LinView view = lin_prove(W.lw, *c.index, k.pM, pa, tie, seed, k.fit_w_at); + const double prove_s = secs(tp); + // The verifier: admission, then its own trace run bound to the key and the input it holds, then LIN. + auto tv = std::chrono::steady_clock::now(); + Verdict d; + if (const char *why = admit(k.va)) { + d.admit_why = why, d.trace_why = "not run: the public input was refused at admission", d.lin_why = "not run: the public input was refused at admission"; + } else { + d.admitted = true; + const std::vector va = to_field(k.va); + const IndexName vname{vkey.commitment(), vkey.rec}; + TraceRun vrun = trace_size(W.set, W.L.log_len, W.rel, vname, va); + TieOut vt; + d.trace = run_verifier(TIE_LABEL, vrun.product.plan, vrun, trace_bind, trace_decide, tp_bytes.data(), tp_bytes.size(), vt, &d.trace_why); + d.lin_why = "not run: the trace chain was refused"; + if (d.trace) d.lin = lin_check(W.lw, vkey, vt, va, view, d.lin_why); + } + const double verify_s = secs(tv); + const size_t lin_bytes = view.first.size() + view.path.size() + view.shared.size() + view.second.size(); + emit(mode, name, seed, d, ref, W, tp_bytes.size(), lin_bytes, commit_s, prove_s, verify_s); +} + +// p, q with a p + b q = gcd(a, b) +static i64 egcd(i64 a, i64 b, i64 &p, i64 &q) { + if (b == 0) { p = a >= 0 ? 1 : -1, q = 0; return a >= 0 ? a : -a; } + i64 p1, q1; const i64 g = egcd(b, a % b, p1, q1); + p = q1, q = p1 - (a / b) * q1; return g; +} +template static std::vector read_file(const char *path, size_t count, const char *what) { + std::ifstream f(path, std::ios::binary); need(bool(f), what); + std::vector raw(count); f.read((char *)raw.data(), raw.size() * sizeof(T)); need(f.gcount() == (std::streamsize)(raw.size() * sizeof(T)), what); + return raw; +} + +int main(int argc, char **argv) { + need(argc == 6 || argc == 7, "usage: qm3a1c.bin honest | case "); + const std::vector rawM = read_file(argv[1], ROWS * COLS, "M.i32"); + const std::vector rawa = read_file(argv[2], DM, "a.i32"); + const std::vector ref = read_file(argv[3], 2 * NOUT, "ref.i64"); + const std::vector M(rawM.begin(), rawM.end()), a(rawa.begin(), rawa.end()); + const std::string mode = argv[4]; + need((mode == "honest" && argc == 6) || (mode == "case" && argc == 7), "mode: honest | case "); + const std::string name = mode == "case" ? argv[5] : "honest"; + const u64 seed = std::strtoull(argv[argc - 1], nullptr, 10); + need(seed >= 1, "seed >= 1"); + World W; + need(W.L.columns <= (u64(1) << 23), "the product oracle has more than 2^23 columns"); + const Cells honest = outputs(M, a); + // Registered check 4: this program's integer outputs against the preparation script's (numpy). + bool same = true; + for (u64 i = 0; i < NOUT; i++) same = same && honest.x[i] == ref[i] && honest.rem[i] == ref[NOUT + i]; + need(same, "this program's in_proj outputs differ from the preparation script's reference"); + // The entries the negative tests touch: output 0 (table row 1), columns j0 < j1. + u64 j0 = DM, j1 = DM; i64 bp = 0, bq = 0; + for (u64 j = 0; j < DM && j0 == DM; j++) if (a[j] != 0) j0 = j; + need(j0 < DM, "the public input is all zero"); + for (u64 j = j0 + 1; j < DM && j1 == DM; j++) if (a[j] != 0 && egcd(a[j0], a[j], bp, bq) == 1) j1 = j; + need(j1 < DM && a[j0] * bp + a[j1] * bq == 1, "no coprime pair of public input values"); + const u64 r1 = FIRST_ROW; + Case k; k.pM = M, k.pa = a, k.va = a, k.cells = honest; + if (mode == "honest") { + run_case(W, "honest", "honest", k, seed, "true"); + return 0; + } + // A table changed in two entries of row 1 so that the INTEGER equation holds with x_0 = target. + auto forced = [&](i64 target) { + std::vector M2 = M; + const unsigned s = shift_of(0); + __int128 u = 0; for (u64 j = 0; j < DM; j++) u += (__int128)a[j] * M[r1 * COLS + j]; + const __int128 delta = (__int128)target * (__int128(1) << s) + honest.rem[0] - (__int128(1) << (s - 1)) - u; + M2[r1 * COLS + j0] += (i64)(delta * bp), M2[r1 * COLS + j1] += (i64)(delta * bq); + const Cells c2 = outputs(M2, a); + need(c2.x[0] == target && c2.rem[0] == honest.rem[0], "the changed table does not give the wanted output"); + return M2; + }; + if (name == "N1a-output-off-by-one-v-from-trace") { + k.cells.x[0] += 1; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N1b-output-off-by-one-v-from-table") { + k.cells.x[0] += 1, k.vfrom = VFrom::TABLE, k.local = true; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N2a-weight-changed-other-key") { + k.pM[r1 * COLS + j0] += 1, k.cells = outputs(k.pM, a); + k.other_key = true, k.vM = M, k.verify_coin = 991; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N2b-weight-changed-registered-key") { + std::vector M2 = M; M2[r1 * COLS + j0] += 1; + k.cells = outputs(M2, a); + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N3a-input-changed-after-the-proof") { + k.va[j0] += a[j0] > 0 ? -1 : 1; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N3b-proof-bound-to-changed-input") { + k.pa[j0] += a[j0] > 0 ? -1 : 1, k.va = k.pa; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N4a-x-out-of-class-claim-true") { + k.pM = forced(X_OFFSET), k.cells = outputs(k.pM, a), k.local = true; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N4b-rem-out-of-class-claim-true") { + k.cells.x[0] -= 1, k.cells.rem[0] += i64(1) << shift_of(0), k.local = true; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N5-input-out-of-class") { + k.pa[j0] = A_MAX + 1, k.va = k.pa, k.cells = outputs(M, k.pa); + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "N6-output-off-by-one-W-fitted") { + k.cells.x[0] += 1, k.fit_w_at = j0; + run_case(W, "negative", name, k, seed, "null"); + } else if (name == "C1-x-at-class-maximum") { + k.pM = forced(X_OFFSET - 1), k.cells = outputs(k.pM, a); + run_case(W, "completeness", name, k, seed, "null"); + } else if (name == "C2-x-at-class-minimum") { + k.pM = forced(-X_OFFSET), k.cells = outputs(k.pM, a); + run_case(W, "completeness", name, k, seed, "null"); + } else { + need(false, "unknown case"); + } + return 0; +} diff --git a/research/operators/qwen_m3a1c/run_registered.py b/research/operators/qwen_m3a1c/run_registered.py new file mode 100644 index 00000000..18f41233 --- /dev/null +++ b/research/operators/qwen_m3a1c/run_registered.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +"""Registered runs of experiments/20261129-229-qwen-m3a1-inproj (PREREG.md): 5 honest proofs (prover seeds 1..5), +the 9 negative tests and the 2 completeness cases (prover seed 1), on head 0's REAL table and the registered +public input, as prepare_input.py real wrote them. + +Each run's output goes to its own file under the runs directory, written once (refuses to overwrite), with its +UTC start time. A run is stopped after 600 s (the registered limit). +Usage: run_registered.py [cores, default 8-13] + run_registered.py a2 + only the case that amendment A2 added after the 16 runs above (N6), prover seed 1 +""" +import json, subprocess, sys, time +from pathlib import Path + +CASES = ["N1a-output-off-by-one-v-from-trace", "N1b-output-off-by-one-v-from-table", "N2a-weight-changed-other-key", + "N2b-weight-changed-registered-key", "N3a-input-changed-after-the-proof", "N3b-proof-bound-to-changed-input", + "N4a-x-out-of-class-claim-true", "N4b-rem-out-of-class-claim-true", "N5-input-out-of-class", + "C1-x-at-class-maximum", "C2-x-at-class-minimum"] +A2_CASES = ["N6-output-off-by-one-W-fitted"] + + +def one(binary, data, cores, args, out): + if out.exists(): + raise SystemExit(f"refusing to overwrite {out.name}") + start = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) + t0 = time.time() + cmd = ["taskset", "-c", cores, "/usr/bin/time", "-v", binary, str(data / "M.i32"), str(data / "a.i32"), str(data / "ref.i64")] + args + try: + r = subprocess.run(cmd, capture_output=True, text=True, timeout=600) + code, stdout, stderr = r.returncode, r.stdout, r.stderr + except subprocess.TimeoutExpired as e: + code, stdout, stderr = "stopped after 600 s", (e.stdout or b"").decode(), (e.stderr or b"").decode() + rss = [l for l in stderr.splitlines() if "Maximum resident set size" in l] + rec = dict(start_utc=start, args=args, exit=code, wall_s=round(time.time() - t0, 3), stdout=stdout.strip().splitlines(), + max_rss_kb_time=int(rss[0].split()[-1]) if rss else None, + stderr_tail=[l for l in stderr.splitlines() if "FAIL" in l or "rounds:" in l]) + out.write_text(json.dumps(rec, indent=1) + "\n") + last = json.loads(rec["stdout"][-1]) if rec["stdout"] else {} + print(out.name, "exit", code, "accepted", last.get("accepted"), "|", last.get("admit_why"), "|", last.get("trace_why"), "|", last.get("lin_why"), flush=True) + + +def main(): + binary, data, runs = sys.argv[1], Path(sys.argv[2]), Path(sys.argv[3]) + cores = sys.argv[4] if len(sys.argv) > 4 else "8-13" + runs.mkdir(parents=True, exist_ok=True) + if len(sys.argv) > 5: + if sys.argv[5] != "a2": + raise SystemExit("fifth argument: a2") + for c in A2_CASES: + one(binary, data, cores, ["case", c, "1"], runs / f"case-{c}.json") + return + for s in range(1, 6): + one(binary, data, cores, ["honest", str(s)], runs / f"honest-seed{s}.json") + for c in CASES: + one(binary, data, cores, ["case", c, "1"], runs / f"case-{c}.json") + + +if __name__ == "__main__": + main() diff --git a/research/operators/qwen_m3a1c/summarise.py b/research/operators/qwen_m3a1c/summarise.py new file mode 100644 index 00000000..9af33784 --- /dev/null +++ b/research/operators/qwen_m3a1c/summarise.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Summary of the registered runs (runs/honest-*.json, runs/case-*.json, each written once by run_registered.py) +into runs/summary.json, or into runs/ if a name is given. Refuses to overwrite. +Usage: summarise.py [name, default summary.json]""" +import json, statistics, sys +from pathlib import Path + +EXPECT = {"N": False, "C": True} + + +def main(): + runs = Path(sys.argv[1]) + out_path = runs / (sys.argv[2] if len(sys.argv) > 2 else "summary.json") + if out_path.exists(): + raise SystemExit(f"refusing to overwrite {out_path.name}") + honest, cases = [], {} + for p in sorted(runs.glob("*.json")): + if not (p.name.startswith("honest-") or p.name.startswith("case-")): + continue + rec = json.loads(p.read_text()) + last = json.loads(rec["stdout"][-1]) if rec["stdout"] else None + if p.name.startswith("honest"): + honest.append(dict(last or {}, wall_s=rec["wall_s"], max_rss_kb_time=rec["max_rss_kb_time"], exit=rec["exit"], start_utc=rec["start_utc"])) + else: + name = p.name[len("case-"):-len(".json")] + cases[name] = dict(accepted=last["accepted"] if last else None, admit_why=last["admit_why"] if last else None, + trace_why=last["trace_why"] if last else None, lin_why=last["lin_why"] if last else None, + expected_accepted=EXPECT[name[0]], exit=rec["exit"], peak_rss_kb=last["peak_rss_kb"] if last else None, + start_utc=rec["start_utc"]) + + def stat(k): + v = [h[k] for h in honest] + return dict(n=len(v), median=statistics.median(v), sd=round(statistics.stdev(v), 4) if len(v) > 1 else 0, min=min(v), max=max(v)) + neg = {k: v for k, v in cases.items() if k[0] == "N"} + comp = {k: v for k, v in cases.items() if k[0] == "C"} + out = dict( + label="measured, unreplicated, one shared loaded host, cores 8-13, research setting (no security level)", + honest=dict(accepted=sum(bool(h.get("accepted")) for h in honest), n=len(honest), + outputs_match_reference=sum(bool(h.get("outputs_match_reference")) for h in honest), + prove_s=stat("prove_s"), verify_s=stat("verify_s"), commit_s=stat("commit_s"), wall_s=stat("wall_s"), + peak_rss_kb=stat("peak_rss_kb"), trace_proof_bytes=stat("trace_proof_bytes"), lin_proof_bytes=stat("lin_proof_bytes"), + fixed=dict((k, honest[0][k]) for k in ("rows_covered", "output_cells", "product_columns_used", "log_length", "relations", + "table_matrix", "input_length", "lin_own_test_claims"))), + negative=dict(rejected=sum(v["accepted"] is False and v["exit"] == 0 for v in neg.values()), n=len(neg)), + completeness=dict(accepted=sum(v["accepted"] is True and v["exit"] == 0 for v in comp.values()), n=len(comp)), + cases=cases, + all_cases_as_expected=all(c["accepted"] == c["expected_accepted"] and c["exit"] == 0 for c in cases.values()), + ) + out_path.write_text(json.dumps(out, indent=1) + "\n") + print(json.dumps(dict(honest_accepted=out["honest"]["accepted"], negative=out["negative"], completeness=out["completeness"], + all_cases_as_expected=out["all_cases_as_expected"], prove_s=out["honest"]["prove_s"], verify_s=out["honest"]["verify_s"], + peak_rss_kb=out["honest"]["peak_rss_kb"]))) + + +if __name__ == "__main__": + main() diff --git a/research/results.yaml b/research/results.yaml index 29912a2c..62984378 100644 --- a/research/results.yaml +++ b/research/results.yaml @@ -2090,3 +2090,21 @@ results: - {"name": "wcc_softplus_offset_heads_outside", "stat": "count", "value": 17, "total": 2304, "unit": "count", "n": 2304, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "ec2d02e63456e0ac19191414c6c25fde1c5778d7", "source": "experiments/20261129-239-qwen-weight-cell-classes/runs/summary.json", "note": "Measured, unreplicated, descriptive (no bar); heads whose dt_bias alone (dt_int / 4,096) lies outside softplus v1's [-8, 8): 16 at or above 8 (layer 0: 15, layer 58: 1), 1 below -8 (layer 1); bias only, not activations (PR #146)"} - {"name": "wcc_cA_min_sig_bits", "stat": "single", "value": 2, "unit": "int", "n": 2304, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "ec2d02e63456e0ac19191414c6c25fde1c5778d7", "source": "experiments/20261129-239-qwen-weight-cell-classes/runs/summary.json", "note": "Measured, unreplicated, descriptive; smallest bit length of a head's cA_int over 2,304 heads (layers 12, 28, 44); 357 heads at 5 bits or fewer, 0 at zero; one cA exponent per layer"} - {"name": "wcc_tensors_identical_stock_abl", "stat": "count", "value": 192, "total": 192, "unit": "count", "n": 192, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "acd0e4b1fbb1f5a74f764d50c09f51ebea992bbb", "source": "experiments/20261129-239-qwen-weight-cell-classes/runs/ckpt-compare.json", "note": "Measured; conv1d, norm, A_log, dt_bias of 48 layers with equal SHA-256 in both pinned checkpoints"} + + - id: qwen-m3a1-inproj + title: "Qwen M3a-1 in_proj: one DeltaNet head's 514 in_proj outputs for one token as a linear claim on the committed weight table, public normed input (issue #229 sub-step c)" + status: "measured" + replication: "unreplicated" + pr: 242 + summary: "Measured, unreplicated, CPU research harness, research setting (no security level). First proved computation in which committed Qwen matrix weights take part: for V head 0, layer 0 of the pinned stock Qwen3.8-27B and ONE token, with the layer's normed input a public (5,120 integers, |a| <= 2,047, a float64 norm of one embedding row rounded at 2^5), 1,028 committed cells x_r, rem_r for all 514 in_proj rows are in exact classes by bits and satisfy sum_j a_j M[r][j] + 2^(s_r - 1) = 2^(s_r) x_r + rem_r IN THE FIELD against the committed table of PR #231. No sumcheck over columns and no change to an existing source file: LIN already sends W = g^T M, and the input is applied by one caller's linear claim on W, with row weights eq(rho, .) drawn after the cells are committed. 5 of 5 honest proofs verified; all 9 registered negative tests rejected (output off by one two ways, a weight changed two ways, the public input changed two ways, x and rem out of class with the linear claim true, the input out of class); 2 of 2 completeness cases accepted (x at both class edges). One more negative test added by amendment after these results were known (the prover fits W so the caller's claim is true) was also rejected; it is not part of the registered threshold. NOT established: the matrix weights' range (no Qwen layout of the WF range proof), so the equation is the integer rounding only for a table of small integers; any soundness level (trace at target 10 bits; LIN on hand-made unpriced plans, one of them written here because the library's priced planner fixes the number of claims in a request's own test); any head computation after in_proj; more than one token, head or layer; accuracy; hiding; that the table is the advertised checkpoint" + conditions: "CPU only, cores 8-13 of a shared loaded host, single-threaded runs, g++ 13.3.0 -O2; PREREG first and alone; amendment A1 (implementation choices) committed before the registered runs; amendment A2 (one added negative test) committed after the registered results and before its own run, with a rebuilt binary; debug only on a synthetic fixture (table numpy seed 9101, input seed 9102, prover seed 9); the table is committed afresh in each run (no stored key); research setting target 10 bits, query work 6; LIN plans hand-made" + evidence: ["experiments/20261129-229-qwen-m3a1-inproj/RESULTS.md", "experiments/20261129-229-qwen-m3a1-inproj/PREREG.md", "experiments/20261129-229-qwen-m3a1-inproj/ENV.json", "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "experiments/20261129-229-qwen-m3a1-inproj/runs/summary-a2.json", "experiments/20261129-229-qwen-m3a1-inproj/runs/inputs-head0.json", "research/operators/qwen_m3a1c/README.md"] + metrics: + - {"name": "qm3a1c_honest_accepted", "stat": "count", "value": 5, "total": 5, "unit": "count", "n": 5, "spread": null, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "note": "Measured, unreplicated; honest proofs (admission + trace + LIN with the caller's claim on W) accepted, prover seeds 1..5; verdict did not vary; in each the program's integer outputs equal the numpy script's", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d"} + - {"name": "qm3a1c_negative_rejected", "stat": "count", "value": 9, "total": 9, "unit": "count", "n": 1, "spread": null, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "note": "Measured, unreplicated; registered negative tests N1a, N1b, N2a, N2b, N3a, N3b, N4a, N4b, N5 rejected, one complete proof each, seed 1; N2a and N3a are refused by transcript binding (a nonce), not by the claim", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d"} + - {"name": "qm3a1c_completeness_accepted", "stat": "count", "value": 2, "total": 2, "unit": "count", "n": 1, "spread": null, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "note": "Measured, unreplicated; x at 2^23 - 1 and at -2^23 accepted, seed 1; both use a table with two entries outside any weight class, which this proof does not refuse", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d"} + - {"name": "qm3a1c_negative_rejected_with_added_case", "stat": "count", "value": 10, "total": 10, "unit": "count", "n": 1, "spread": null, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary-a2.json", "note": "Measured, unreplicated; the 9 registered negative tests plus N6 (W fitted to the caller's claim), which amendment A2 added AFTER the registered results were known; not part of the registered threshold", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "7d7a26dbfeeb54b90df85752a6766221791babff"} + - {"name": "qm3a1c_prove_s_median", "stat": "median", "value": 1.009, "unit": "s", "n": 5, "spread": {"sd": 0.06, "min": 0.969, "max": 1.122}, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "note": "Measured, unreplicated; trace + LIN prove wall time, table commit (median 3.607 s) not included", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d"} + - {"name": "qm3a1c_verify_s_median", "stat": "median", "value": 0.104, "unit": "s", "n": 5, "spread": {"sd": 0.0028, "min": 0.103, "max": 0.11}, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "note": "Measured, unreplicated; admission + trace + LIN verify wall time", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d"} + - {"name": "qm3a1c_peak_rss_kib_median", "stat": "median", "value": 488424, "unit": "KiB", "n": 5, "spread": {"sd": 1271.2, "min": 485648, "max": 488552}, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "note": "Measured, unreplicated; getrusage max RSS of the whole process (commit, prove, verify), ru_maxrss in KiB", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d"} + - {"name": "qm3a1c_product_columns", "stat": "single", "value": 20178, "unit": "count", "n": 5, "spread": null, "source": "experiments/20261129-229-qwen-m3a1-inproj/runs/summary.json", "note": "Measured; product-oracle columns used for the 1,028 output cells and their class bits; log length 15; 39,328 relations; 514 table rows covered; deterministic", "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "be7f1ff7dd029db3686a0172ac1ac0b7d9b1e58d"}