From 94bd7df66fc7af2b14fd0e821dc8b08f5e0e9b3d Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:33:27 +0000 Subject: [PATCH 01/12] prereg: one rescue scale rule for Qwen integer attention at dh = 256 (#241) --- .../PREREG.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md new file mode 100644 index 00000000..032d8018 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md @@ -0,0 +1,84 @@ +# PREREG: 20261129-241-qwen-attn-rescue-rule + +Issue: #241 (part of #8, informs #35 and #32). Lane: attnrule (desk plus small CPU scripts; no model run, no weights, no proof, no verifier change). Date (UTC): 2026-11-29T02:33Z (the commit time is the record). Base commit: 02d62eb63760fcaf68f47099c70f42aba04a7707 (main). + +This file is the first commit of the experiment, alone, before any experiment code. Review class B: everything this step adds lives in this directory, plus the generated ledger files. + +## What was read before this file (disclosed, because it limits what "chosen from in-sample evidence" can mean) + +All on main at the base commit: issue #241; `experiments/20261113-176-qwen-int-attn/` PREREG.md and RESULTS.md (PR #178, in sample); `experiments/20261114-204-int-attn-heldout/RESULTS.md` (PR #206, held out); `research/operators/qwen_ops/DH256-ROTARY.md` sections 1 and 2 (PR #180); `verifier/src/vf_attention_shape.h`; the lines of `verifier/src/cp_verify.cpp` and `verifier/src/vf_layers_check.inc` that use `CLAMP` and `CLAMPED_CELL_BOUND`; the no-overflow table of `docs/format/11-3-attention-segment.md`. + +One script was run before this file: a schema peek that printed the file names under PR #178's and PR #206's `runs/` and the first record of PR #178's `layers.jsonl`, `cells.jsonl`, `prompt-rows.jsonl` and `attn-timing.jsonl`. No statistic was computed from any record. + +Consequences, stated now: +- The per-layer tables in both RESULTS files were read, held-out ones included (issue #241 quotes them too). So the author already knows which layers fail in both runs, that the failing layers have E_v = 5, and where PR #206's five clamped entries sit. The direction of the answer (the value side) is anticipated from the printed in-sample table. What this registration fixes is the decision procedure, the prediction formula, the margin rule and the thresholds, before any of them is computed. +- PR #206's files are used below only for the five clamp locations PR #206's RESULTS section 2 already reports. They are used to CHECK the chosen rule, never to choose or adjust it. Because they were seen, the range axis of any later run on the same eight held-out prompts is not a blind test of the margin at those five locations. + +## Where the issue text was checked against main (so far; more goes in RESULTS) + +- "evaluate on PR #204's 8 held-out prompts": #204 is the issue; the pull request is #206 and the directory is `experiments/20261114-204-int-attn-heldout/`. +- "a q/k-only clamp of 1,665 is the narrow fallback": correct for DH256-ROTARY.md section 2a. But PR #178's and PR #206's C1665 arm lowered v to 1,665 as well (one clamp for q, k and v). The fallback's own operation (q and k at 1,665, v at 2,047) has no fidelity run on main. +- The other figures quoted in the issue (layers 31, 35, 39; medians within 0.0003; 1 and 4 clamped entries; "any rescue" not tried in both section 7 lists) match the two RESULTS files as read. + +## Hypothesis + +H (desk): the decision procedure below, applied to PR #178's committed in-sample records only, selects ONE primary scale rule for which (i) every implemented attention no-overflow and policy condition holds at dh = 256 in exact integer arithmetic under the score layout the rule names, and (ii) the registered in-sample prediction puts the median rel_y of layers 31, 35 and 39, and of every other attention layer, at or under 0.01. H is false if no candidate satisfies (i), or if the prediction for the selected rule exceeds 0.01 on any of the 16 layers. + +Nothing here measures the rule. (ii) is a prediction carried over from other layers; a PASS of this step means "worth one registered run", not "fixed". + +## Definitions (fixed now) + +Records: PR #178's `runs/layers.jsonl` (per arm and layer: mx_q, mx_k, mx_v, Eq, Ek, Ev, sh, maxima, medians), `runs/cells.jsonl` (per arm, layer, prompt, head: rel_y), `runs/prompt-rows.jsonl` (per arm, layer, prompt: q_maxw, k_maxw, v_maxw). Query head h reads key-value head floor(h / 6). + +**D1, description.** Per layer at C2047: for each tensor t in {q, k, v}, the occupancy maxw_t / 2,047 (how much of the cell the largest entry uses) and the exponent E_t; the median rel_y per key-value head group (6 query heads x 10 prompts = 60 cells each) and per prompt; the count of cells over 0.01 per group. + +**D2, one-bit ratios from the paired arms.** For each (layer, prompt, head) cell, r = rel_y(C1665) / rel_y(C2047). A layer is "t-only" if exactly one of E_q, E_k, E_v differs between the arms, by exactly one bit, and that one is E_t. rho_t(layer) = the median of r over the layer's 240 cells. rho_t_min, rho_t_max = the smallest and largest rho_t(layer) over the t-only layers. Layers where two exponents differ are reported and not used. This is a natural experiment between two registered arms, not an arm designed to isolate a tensor; it says what one bit of E_t cost on those layers. + +**D3, leave-one-prompt-out overshoot.** For each layer, tensor t and prompt p (C2047 rows): the exact fraction maxw_t(p) / max over p' != p of maxw_t(p'). r_t = the largest such fraction over the 16 layers and 10 prompts. The integers are RNE values at the fitted scale, so each fraction carries a rounding error of at most about 1 part in 800; that is stated, not corrected. + +**Candidates (the issue's four).** V13: one extra bit on the value cell (value clamp 4,095, q and k unchanged). PKV: one value exponent per key-value head, 12-bit value cell. HQ: one query exponent per query head. M: a headroom margin (a policy every candidate carries; alone it can only cost bits). + +**Decision procedure.** +1. Bottleneck tensor = the t with the largest rho_t_min among the classes that have at least one t-only layer. +2. If the bottleneck is v: primary = V13, alternative = PKV. If it is q: primary = HQ, alternative = V13. If it is k: none of the issue's four candidates addresses k; report the issue's negative for this candidate list. +3. Margin: for each tensor class t, m_t = the smallest element of the grid {1, 9/8, 5/4, 3/2, 2} with m_t >= r_t. If r_t > 2, the margin rule is reported as not available from this evidence. The fitted exponent is the largest integer E with m_t x mx_t x 2^E <= CL_t, computed with exact rationals from the committed mx_t; the softmax shift follows PR #176's registered rule (sh = E_q + E_k - 8, adjusted into 4..12). +4. Score layout: the primary rule is stated under DH256-ROTARY.md's narrow fallback (q and k clamp 1,665, legacy 32-bit score digit, kFD = 16), because that is the layout with no unbuilt lookup dependency. The same arithmetic is also reported under wide33 (q and k clamp 2,047, 33-bit digit, kFD = 17) as a second table, not as a second rule. +5. The rule is NOT adjusted after the check against PR #206's five clamp locations. If the in-sample margin does not cover one of them, that is reported as a known miss. + +**Prediction (registered formula, a heuristic, not a measurement).** For a layer with C2047 exponents E and rule exponents E': pred = median rel_y(C2047) x rho_q_max^max(0, E_q - E'_q) x rho_k_max^max(0, E_k - E'_k) x F_v, with F_v = rho_v_min^-(E'_v - E_v) if the rule gains value bits and rho_v_max^(E_v - E'_v) if it loses them. Gains on q or k are given no credit. Assumptions, stated: the error factors multiply; one bit costs the same on every layer as on the t-only layers; the 10 prompts' medians carry over. Layers 31, 35 and 39 have identical exponents in both arms, so the paired arms contain NO direct evidence about them: for those layers the prediction is an extrapolation from layers that do pass. For V13 to bring layer 39 (0.01294) under 0.01 one extra value bit must cut its median by a factor of at least 1.294. + +## Metric + +- A (arithmetic, exact integers, no floats): for a parameter set (dh, q/k clamp, value clamp, Ty, lt, S, rx, u0, sh, kFD, score digit width), the left side, bound and verdict of every implemented condition of `AFork::shape()`: af-policy-kF (both halves), af-policy-sh, af-policy-C, N1, N2, N3, N4, N5, N6, N9; the largest q/k clamp admitted by N4 at every admitted C; the largest value clamp admitted by N6; and the layer-side sites of `cp_verify.cpp` whose bound uses the value clamp. u0 is derived with exact rational bounds on ln 2, not with floating point. +- D1, D2, D3 and the prediction as defined above, from the committed records. +- The rule's frozen exponent table (16 layers) computed from the committed mx values. + +## Acceptance threshold + +PASS iff all of: +- A1: the arithmetic script's unit tests pass, and they include exact reproduction of the constants already on main: PR #176 PREREG's N4 numbers (4,291,757,568; 4,296,873,984; 4,294,213,632; 4,299,351,552; 6,436,161,024), DH256-ROTARY.md section 2a's table, its section 2c table (eight rows) and its section 2d table (nHD and row intervals). A constant on main that the script does not reproduce is reported as a finding, not edited. +- A2: the primary rule passes every condition of Metric A at dh = 256, for every sh in 4..12, at lt = 10 and S = 12, rx = 8, under the narrow fallback layout, and every (lt, S) pair with lt in 2..16, S in 1..14 and lt + S + 1 <= 24 at the largest admitted C. +- B: the decision procedure selects a primary rule and the registered prediction is <= 0.01 on all 16 layers. +- C: the rule's integer definition, its admission consequences and the future run's PREREG text are committed as files. + +FAIL (the issue's negative) if A2 fails for every candidate: then the note says which arithmetic would have to change. If A passes and B fails, the verdict is "arithmetic admits the rule, in-sample evidence does not predict a pass", reported as such. + +## Kill criterion + +Lane deadline 2026-11-29T04:50Z. Stop and report exactly where if: the work needs a change to any existing file; a script needs more than 5 minutes of CPU or 2 GB; the committed records do not contain what a definition above needs (then the definition is reported as not computable, not replaced). + +## Runs + +Deterministic scripts on committed files and on constants; one run each, no seeds, no variance (a repeat is bit-identical). Standard 3 (at least 5 runs) does not apply to exact arithmetic; stated as a deviation. Run files are written once, each with its UTC start time. The description script is debugged only on synthetic records with made-up values (in its tests); its first run on the committed records is the registered run. The arithmetic script has no registered data; its tests are its run. + +## Prior art + +In this repo: `verifier/src/vf_attention_shape.h` (N1 to N9, CLAMP shared by q, k, v); `research/operators/qwen_ops/DH256-ROTARY.md` (PR #180: N4 alternatives at dh = 256, wide33 and the 1,665 q/k-only fallback, recomputed there with a desk script that is not committed as a tested module); `DQ-NE-D.md`; PR #178 and PR #206 (the two integer-attention runs; "any rescue" listed as not tried in both); `scales/README.md` (the fit rule). Outside: mixed-precision and per-channel quantisation of transformer activations (Q8BERT; LLM.int8() keeps outlier features in higher precision; SageAttention smooths K before INT8), integer-only softmax attention (I-BERT, Softermax), calibration with headroom or percentile clipping in post-training quantisation (Banner et al. 2019, analytical clipping; Nagel et al. 2021, white paper), lookup-proved softmax in zkML (zkLLM tlookup; EZKL). None gives a value-cell rule for a max-subtracted table softmax under a fixed score-digit budget at head size 256. New here: the choice of one rule from committed in-sample records by a registered procedure, with its admission arithmetic redone exactly and a tested script for it. + +## What is NOT in this step + +The rule is not run on any model: no fidelity number for it exists after this step, in sample or held out. No bar is relaxed. Integer projections, q/k norm, rotary, gate and o_proj are not touched. No verifier, prover or parameter-file change is made or designed in detail; "what changes for admission" is a list of obligations, not an implementation and not a soundness argument. Passing N4 or N6 is not admission of Qwen's attention, which is still refused elsewhere (dq != d, partial rotary, theta0, dh > 128). No public headline. + +## Amendments + +(empty at registration) From 9d083cda470e603d5ab5df8531ae8a713c14bc5b Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:51:03 +0000 Subject: [PATCH 02/12] attnrule: exact N4/N6 arithmetic script, description script, tests; PREREG amendment A1 (before any registered run) --- .../PREREG.md | 10 + .../describe.py | 262 +++++++++++++++ .../n4_arith.py | 298 ++++++++++++++++++ .../test_describe.py | 243 ++++++++++++++ .../test_n4_arith.py | 274 ++++++++++++++++ 5 files changed, 1087 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/describe.py create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/n4_arith.py create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/test_describe.py create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/test_n4_arith.py diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md index 032d8018..ab80bd08 100644 --- a/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md +++ b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md @@ -82,3 +82,13 @@ The rule is not run on any model: no fidelity number for it exists after this st ## Amendments (empty at registration) + +### A1, 2026-11-29T02:52Z, before the registered run of `describe.py` on the committed records and before `n4_arith.py report` (implementation choices; no threshold, formula or procedure changes) + +Written after the code and its tests exist and before either script has touched a committed record. Nothing below was chosen with a result in view: `describe.py` has run only on the synthetic records of `test_describe.py`. + +- **Which layout B is judged on.** Decision procedure step 4 states the primary rule under the narrow fallback and reports wide33 as a second table. Criterion B's verdict is therefore the narrow-fallback table's (q and k clamp 1,665, value clamp 4,095). The wide33 table's prediction is reported next to it and does not enter the verdict. +- **Prediction baseline.** The formula's E are arm C2047's exponents and its median is arm C2047's, for both layouts. Under the narrow layout a layer whose q or k exponent is lower than C2047's is charged rho_q_max or rho_k_max per lost bit, as registered. If a needed one-bit ratio does not exist (no t-only layer for that tensor), the layer's prediction is reported as not available and counts as over the bar. +- **The check against PR #206's five clamp locations.** The committed record is the integer RNE(x 2^E) at the arm's exponent, not x. So the entry's size at the rule's exponent is known only to within half a unit of the arm's grid, scaled. The check reports `fits` only if the whole interval is inside the rule's clamp and `undecided` if the clamp falls inside the interval. It is a check; step 5 stands (no adjustment). +- **Where the value clamp enters outside `shape()`.** Metric A's "layer-side sites" is implemented as the site "o" of `cp_verify.cpp` (`q9`: A = dq x BC x BWw, where BC bounds a cell of o), evaluated for BC = 2,048 and 4,096 at every shift the KL range test admits, for each digit form and for 4 and 5 residual-stream limbs, with dq = 6,144. The clamp table's row size (FC shape with a 13-bit output) is reported as a number, not as a condition of the verifier. +- **Run files.** `runs/describe.json` (the registered run), `runs/n4-report.json`, `runs/unit-tests-n4.json`, `runs/unit-tests-describe.json`. Each is written once; the scripts refuse to overwrite. diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/describe.py b/experiments/20261129-241-qwen-attn-rescue-rule/describe.py new file mode 100644 index 00000000..ff8c0226 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/describe.py @@ -0,0 +1,262 @@ +#!/usr/bin/env python3 +"""Issue #241: describe the failing attention layers from PR #178's committed in-sample records, apply the +registered decision procedure, and compute the chosen rule's exponent table and the registered prediction. + +Reads only committed files. Runs no model. Definitions D1, D2, D3, the decision procedure, the margin rule and the +prediction formula are in PREREG.md and are implemented here as written there. + + describe.py run the registered run (writes once) +""" +import json +import statistics +import sys +import time +from fractions import Fraction +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import n4_arith as A # noqa: E402 + +ARMS = {"C2047": 2047, "C1665": 1665} +ATT_LAYERS = tuple(range(3, 64, 4)) +NH, NKV = 24, 4 +GRID = (Fraction(1), Fraction(9, 8), Fraction(5, 4), Fraction(3, 2), Fraction(2)) +BAR = 0.01 +TENSORS = ("q", "k", "v") +# name: (q/k clamp, value clamp). The score digit and kFD of each layout are in n4_arith.LAYOUTS. +RULE_LAYOUTS = {"narrow-1665": (1665, 4095), "wide33": (2047, 4095)} + + +class RecordError(Exception): + pass + + +def read_jsonl(path): + return [json.loads(x) for x in Path(path).read_text().splitlines() if x.strip()] + + +def load(runs, layers=ATT_LAYERS, n_prompts=10, nh=NH): + """Load and validate layers.jsonl, cells.jsonl, prompt-rows.jsonl. Refuses anything but the full product.""" + runs = Path(runs) + L, C, P = {}, {}, {} + for r in read_jsonl(runs / "layers.jsonl"): + key = (r["arm"], r["layer"]) + if key[0] not in ARMS or key[1] not in layers or key in L: + raise RecordError("unexpected or duplicate layer record %r" % (key,)) + if r["clamp"] != ARMS[key[0]]: + raise RecordError("clamp mismatch in %r" % (key,)) + L[key] = r + if set(L) != {(a, l) for a in ARMS for l in layers}: + raise RecordError("layer records are not the full product") + for r in read_jsonl(runs / "prompt-rows.jsonl"): + key = (r["arm"], r["layer"], r["prompt"]) + if key[:2] not in L or key in P: + raise RecordError("unexpected or duplicate prompt row %r" % (key,)) + P[key] = r + prompts = sorted({k[2] for k in P}) + if len(prompts) != n_prompts or set(P) != {(a, l, p) for a in ARMS for l in layers for p in prompts}: + raise RecordError("prompt rows are not the full product") + for r in read_jsonl(runs / "cells.jsonl"): + key = (r["arm"], r["layer"], r["prompt"], r["head"]) + if key[:3] not in P or not (0 <= r["head"] < nh) or key in C: + raise RecordError("unexpected or duplicate cell %r" % (key,)) + if not (r["rel_y"] > 0): + raise RecordError("rel_y not positive in %r" % (key,)) + C[key] = r["rel_y"] + if len(C) != len(P) * nh: + raise RecordError("cells are not the full product") + return L, C, P, prompts + + +def exps(rec): + return dict(q=rec["Eq"], k=rec["Ek"], v=rec["Ev"]) + + +def d1(L, C, P, prompts, layers=ATT_LAYERS, nh=NH, nkv=NKV): + """D1: occupancy and exponent per tensor, median rel_y per key-value group and per prompt (arm C2047).""" + out = {} + per = nh // nkv + for l in layers: + rec = L[("C2047", l)] + groups, counts = [], [] + for g in range(nkv): + xs = [C[("C2047", l, p, h)] for p in prompts for h in range(g * per, (g + 1) * per)] + groups.append(statistics.median(xs)) + counts.append(sum(x > BAR for x in xs)) + byp = {p: statistics.median([C[("C2047", l, p, h)] for h in range(nh)]) for p in prompts} + allx = [C[("C2047", l, p, h)] for p in prompts for h in range(nh)] + out[l] = dict( + E=exps(rec), sh=rec["sh"], + maxw={t: rec[t + "_maxw"] for t in TENSORS}, + occupancy={t: rec[t + "_maxw"] / 2047 for t in TENSORS}, + median=statistics.median(allx), over_bar=sum(x > BAR for x in allx), n=len(allx), + group_median=groups, group_over_bar=counts, group_n=per * len(prompts), + prompt_median=byp, prompt_median_min=min(byp.values()), prompt_median_max=max(byp.values()), + passes=statistics.median(allx) <= BAR) + return out + + +def d2(L, C, prompts, layers=ATT_LAYERS, nh=NH): + """D2: per layer, which exponents differ between the arms and the median per-cell ratio C1665 / C2047.""" + per_layer, cls = {}, {t: [] for t in TENSORS} + for l in layers: + a, b = exps(L[("C2047", l)]), exps(L[("C1665", l)]) + diff = {t: a[t] - b[t] for t in TENSORS} + nz = [t for t in TENSORS if diff[t] != 0] + if not nz: + kind = "same" + elif len(nz) == 1 and diff[nz[0]] == 1: + kind = nz[0] + "-only" + else: + kind = "mixed" + rs = [C[("C1665", l, p, h)] / C[("C2047", l, p, h)] for p in prompts for h in range(nh)] + rho = statistics.median(rs) + per_layer[l] = dict(diff=diff, kind=kind, rho=rho, ratio_min=min(rs), ratio_max=max(rs), n=len(rs), + sh_2047=L[("C2047", l)]["sh"], sh_1665=L[("C1665", l)]["sh"]) + if kind.endswith("-only"): + cls[kind[0]].append((l, rho)) + summary = {} + for t in TENSORS: + if cls[t]: + summary[t] = dict(layers=[l for l, _ in cls[t]], rho_min=min(r for _, r in cls[t]), + rho_max=max(r for _, r in cls[t])) + else: + summary[t] = None + return per_layer, summary + + +def d3(P, prompts, layers=ATT_LAYERS): + """D3: leave-one-prompt-out overshoot per tensor, exact fractions of the committed RNE maxima (arm C2047).""" + out = {} + for t in TENSORS: + best = None + for l in layers: + w = {p: P[("C2047", l, p)][t + "_maxw"] for p in prompts} + for p in prompts: + rest = max(w[x] for x in prompts if x != p) + f = Fraction(w[p], rest) + if best is None or f > best[0]: + best = (f, l, p, w[p], rest) + f, l, p, num, den = best + out[t] = dict(r=[f.numerator, f.denominator], r_float=float(f), layer=l, prompt=p, maxw=num, rest_max=den) + return out + + +def margin_of(r: Fraction): + """The smallest grid element >= r, or None if r > 2 (margin rule not available).""" + for m in GRID: + if m >= r: + return m + return None + + +def decide(summary): + """Decision procedure steps 1 and 2.""" + have = {t: s["rho_min"] for t, s in summary.items() if s} + if not have: + return dict(bottleneck=None, primary=None, alternative=None, note="no t-only layer in any class") + bott = max(have, key=lambda t: have[t]) + if bott == "v": + return dict(bottleneck="v", primary="V13", alternative="PKV", rho_min=have) + if bott == "q": + return dict(bottleneck="q", primary="HQ", alternative="V13", rho_min=have) + return dict(bottleneck="k", primary=None, alternative=None, rho_min=have, + note="none of the issue's four candidates addresses k") + + +def rule_table(L, margins, cl_qk, cl_v, layers=ATT_LAYERS): + """The rule's exponents per layer: largest E with m_t * mx_t * 2^E <= CL_t (exact rationals from the committed + mx), then PR #176's sh rule.""" + out = {} + for l in layers: + rec = L[("C2047", l)] + Eq = A.fit_exponent(Fraction(rec["mx_q"]), cl_qk, margins["q"]) + Ek = A.fit_exponent(Fraction(rec["mx_k"]), cl_qk, margins["k"]) + Ev = A.fit_exponent(Fraction(rec["mx_v"]), cl_v, margins["v"]) + Eq2, sh, adj = A.sh_rule(Eq, Ek) + out[l] = dict(Eq=Eq2, Ek=Ek, Ev=Ev, sh=sh, Eq_fit=Eq, adjust=adj) + return out + + +def predict(d1row, rule, summary): + """The registered prediction for one layer. None if a needed one-bit ratio does not exist.""" + E = d1row["E"] + f = d1row["median"] + for t, key in (("q", "Eq"), ("k", "Ek")): + lost = max(0, E[t] - rule[key]) + if lost: + if not summary[t]: + return None + f *= summary[t]["rho_max"] ** lost + gain = rule["Ev"] - E["v"] + if gain: + if not summary["v"]: + return None + f *= summary["v"]["rho_min"] ** (-gain) if gain > 0 else summary["v"]["rho_max"] ** (-gain) + return f + + +def check_206(locations_path, L, tables): + """The five clamp locations PR #206 reports, against each layout's rule exponents. A check, never a fit.""" + rows = [] + for e in json.loads(Path(locations_path).read_text())["clamped_entries"]: + t, l = e["tensor"], e["layer"] + E_arm = L[(e["arm"], l)]["E" + t] + row = dict(arm=e["arm"], layer=l, prompt=e["prompt"], tensor=t, head=e["head"], rne_at_arm=e["max_abs_rne"], + E_arm=E_arm, covered={}) + for name, tab in tables.items(): + E_rule = tab[l]["E" + t] + cl = RULE_LAYOUTS[name][1] if t == "v" else RULE_LAYOUTS[name][0] + # the committed integer is RNE(x 2^E_arm), so |x| 2^E_rule lies within 2^(E_rule - E_arm) / 2 of this + centre = Fraction(e["max_abs_rne"]) * Fraction(2) ** (E_rule - E_arm) + slack = Fraction(2) ** (E_rule - E_arm) / 2 + row["covered"][name] = dict(E_rule=E_rule, clamp=cl, value_at_rule=float(centre), slack=float(slack), + fits=bool(centre + slack <= cl), + undecided=bool(centre - slack <= cl < centre + slack)) + rows.append(row) + return rows + + +def run(runs, locations, layers=ATT_LAYERS): + L, C, P, prompts = load(runs, layers) + D1 = d1(L, C, P, prompts, layers) + D2, summary = d2(L, C, prompts, layers) + D3 = d3(P, prompts, layers) + dec = decide(summary) + margins = {t: margin_of(Fraction(*D3[t]["r"])) for t in TENSORS} + out = dict(t_start=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), + note="computed from PR #178's committed in-sample records; nothing here is a measurement of the rule", + prompts=prompts, D1=D1, D2=D2, D2_summary=summary, D3=D3, decision=dec, + margins={t: (None if m is None else [m.numerator, m.denominator]) for t, m in margins.items()}) + if dec["primary"] != "V13" or any(m is None for m in margins.values()): + out["rule"] = None + out["B"] = dict(verdict="NOT EVALUATED", reason="primary is not V13 or a margin is not available") + return out + tables, preds, B = {}, {}, {} + for name, (cl_qk, cl_v) in RULE_LAYOUTS.items(): + tab = rule_table(L, margins, cl_qk, cl_v, layers) + tables[name] = tab + pr = {l: predict(D1[l], tab[l], summary) for l in layers} + preds[name] = pr + shs = sorted({tab[l]["sh"] for l in layers}) + over = [l for l in layers if pr[l] is None or pr[l] > BAR] + B[name] = dict(layers_over_bar=over, largest=max((p for p in pr.values() if p is not None), default=None), + sh_values=shs, sh_adjusted=[l for l in layers if tab[l]["adjust"]], + verdict="PASS" if not over else "FAIL") + out["rule"] = dict(name="V13", clamps={k: dict(qk=v[0], v=v[1]) for k, v in RULE_LAYOUTS.items()}, exponents=tables) + out["prediction"] = preds + out["B"] = dict(primary_layout="narrow-1665", verdict=B["narrow-1665"]["verdict"], by_layout=B) + out["check_pr206_clamp_locations"] = check_206(locations, L, tables) + return out + + +if __name__ == "__main__": + if len(sys.argv) == 5 and sys.argv[1] == "run": + dst = Path(sys.argv[4]) + if dst.exists(): + sys.exit("REFUSED: %s exists (run files are written once)" % dst.name) + res = run(sys.argv[2], sys.argv[3]) + dst.write_text(json.dumps(res, indent=1) + "\n") + print("wrote", dst.name, "decision", res["decision"].get("primary"), "B", res["B"]["verdict"]) + else: + sys.exit(__doc__) diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/n4_arith.py b/experiments/20261129-241-qwen-attn-rescue-rule/n4_arith.py new file mode 100644 index 00000000..8aa617f9 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/n4_arith.py @@ -0,0 +1,298 @@ +#!/usr/bin/env python3 +"""Exact integer arithmetic for the attention sub-proof's no-overflow and policy conditions (issue #241). + +Transcribed from `verifier/src/vf_attention_shape.h` (`AFork::shape()`, `shd()`) and from the site "o" of +`verifier/src/cp_verify.cpp` (`q9`, `site()`), at main 02d62eb6. Python integers and `fractions` only: no float +enters any bound. With the legacy parameters (one clamp 2,047 for q, k and v, a 32-bit score digit, kFD <= 16) +`conditions()` evaluates exactly what `shape()` tests. Three things are generalised, and each is a PROPOSED +substitution, not implemented anywhere: + + bqk the clamp of q and k that enters Smax = dh * bqk^2 (legacy: CLAMP). + bv the clamp of v that enters N6's first term 2 TS bv (legacy: CLAMP). + digit the width of the score key's low digit: 32 (legacy) or 33 (DH256-ROTARY.md section 2c, "wide33"): + N4's limit is 2^digit, N3's flag is 2^digit and its weight digit 2^(digit+1), and kFD may be 17. + +This is arithmetic on constants. Passing every line is not admission of any model and not a soundness argument. + + n4_arith.py report write the tables used by RULE.md (once; refuses to overwrite) +""" +import json +import sys +import time +from fractions import Fraction +from math import isqrt +from pathlib import Path + +P2 = 1 << 60 # shape(): P2 +PBUDGET = (1 << 61) - 1 # shape(): p, the conservative budget (not the field modulus) +TY = 1 << 18 # the cell bound Ty that the range-check construction fixes +CMAX = (1 << 24) - 65536 # af-policy-C: C + 65536 <= 2^24 +CLAMP = 2047 # vf_attention_shape.h: CLAMP +WEIGHT_BOUND = 1 << 12 # vf_widths_and_bounds.h: WEIGHT_BOUND = 2^(13 - 1) +SH_MIN, SH_MAX = 4, 12 # af-policy-sh +QWEN = dict(dh=256, H=24, G=4, d=5120) # full-attention head shape of Qwen3.8-27B (dq = H dh = 6,144) + + +def ln2_interval(bits=256, terms=128): + """Integers (lo, hi, Q) with lo / Q <= ln 2 <= hi / Q, from ln 2 = 2 atanh(1/3) (as DH256-ROTARY.md section 7).""" + Q = 1 << bits + lo = 2 * sum(Q // ((2 * k + 1) * 3 ** (2 * k + 1)) for k in range(terms)) + hi = lo + 2 * terms + (3 * Q + 4 * 3 ** (2 * terms) - 1) // (4 * 3 ** (2 * terms)) + return lo, hi, Q + + +def u0_of(S, rx): + """The least u with rne(2^S exp(-u / 2^rx)) = 0, as a mathematical threshold. + + The weight rounds to 0 iff 2^S exp(-u / 2^rx) <= 1/2, that is u >= 2^rx (S + 1) ln 2, which is never an + integer. The verifier builds its table with binary64 exp and nearbyint; that the platform table agrees with + this threshold is the softmax-table test's job and is not established here. + """ + if not (1 <= S <= 14 and 1 <= rx <= 12): + raise ValueError("af-policy-softmax") + lo, hi, Q = ln2_interval() + a = (1 << rx) * (S + 1) + if a * lo // Q != a * hi // Q: + raise ArithmeticError("ln 2 interval too wide to place u0") + return a * lo // Q + 1 + + +def smax(dh, bqk): + return dh * bqk * bqk + + +def shd(Smax, u0, sh): + """AFork::shd(): C, rho, nHD, Om for one shift.""" + C = u0 << sh + rho = 65536 - (1 << sh) + nHD = (4 * Smax + 1 + rho - 1) // rho + return dict(C=C, rho=rho, nHD=nHD, Om=2 * Smax + C) + + +def low(dh, bqk, C): + """The left side of N4: 6 Smax + 2 C + 3 x 65,536.""" + return 6 * smax(dh, bqk) + 2 * C + 3 * 65536 + + +def max_qk_clamp_n4(dh, C, digit=32): + """The largest q/k clamp b with low(dh, b, C) < 2^digit (strict).""" + room = (1 << digit) - 1 - 2 * C - 3 * 65536 + if room < 0: + return None + b = isqrt(room // (6 * dh)) + assert low(dh, b, C) < (1 << digit) <= low(dh, b + 1, C) + return b + + +def n6_left(lt, S, bv, Ty=TY): + TS = (1 << lt) << S + return 2 * TS * bv + TS + 2 * TS * (257 * Ty) + 2 * TS + 1 + 65536 * (Ty + 128) + 65536 + + +def max_v_clamp_n6(lt, S, Ty=TY): + """The largest value clamp bv with N6 (strict). Only N6: the FC table's 16-bit input and the two-limb cell + are separate, tighter limits (see fc_row_max and RULE.md).""" + TS = (1 << lt) << S + rest = n6_left(lt, S, 0, Ty) + if rest >= P2: + return None + bv = (P2 - 1 - rest) // (2 * TS) + assert n6_left(lt, S, bv, Ty) < P2 <= n6_left(lt, S, bv + 1, Ty) + return bv + + +def kfd_choices(Smax, u0, sh, kmax=17): + """Every kFD in 8..kmax that satisfies af-policy-kF's occupancy rule for this shift.""" + d = shd(Smax, u0, sh) + return [k for k in range(8, kmax + 1) if u0 + d["nHD"] <= (1 << k) <= u0 + 2 * d["nHD"]] + + +def conditions(ldh, bqk, bv, lt, S, rx, shs, kFD, digit=32, Ty=TY, C_override=None, policy=True): + """Every test of AFork::shape() that depends on these numbers, in the source's order, as rows + (name, sh, left, relation, bound, ok). `C_override` replaces u0 << sh (the superset check at CMAX). + `policy=False` skips the three policy rows that need the real u0 (kF occupancy, C) for the superset check.""" + if digit not in (32, 33): + raise ValueError("digit must be 32 (legacy) or 33 (wide33)") + rows = [] + + def add(name, left, rel, bound, sh=None): + ok = left < bound if rel == "<" else left <= bound if rel == "<=" else left >= bound + rows.append(dict(name=name, sh=sh, left=left, rel=rel, bound=bound, ok=bool(ok))) + + dh = 1 << ldh + T = 1 << lt + add("af-shape-tiles lt>=2", lt, ">=", 2) + add("af-shape-tiles lt<=16", lt, "<=", 16) + add("af-policy-softmax S>=1", S, ">=", 1) + add("af-policy-softmax S<=14", S, "<=", 14) + add("af-policy-softmax rx>=1", rx, ">=", 1) + add("af-policy-softmax rx<=12", rx, "<=", 12) + add("af-policy-softmax lt+S+1<=24", lt + S + 1, "<=", 24) + u0 = u0_of(S, rx) + Smax = smax(dh, bqk) + Ty2, Ty4 = 257 * Ty, 16843009 * Ty + kcap = 16 if digit == 32 else 17 + if policy: + add("af-policy-kF kFD>=8", kFD, ">=", 8) + add("af-policy-kF kFD<=%d" % kcap, kFD, "<=", kcap) + for sh in sorted(set(shs)): + add("af-policy-sh sh>=4", sh, ">=", SH_MIN, sh) + add("af-policy-sh sh<=12", sh, "<=", SH_MAX, sh) + d = shd(Smax, u0, sh) + C = d["C"] if C_override is None else C_override + if policy: + rowsn = 1 << kFD + add("af-policy-kF rows>=u0+nHD", rowsn, ">=", u0 + d["nHD"], sh) + add("af-policy-kF rows<=u0+2nHD", rowsn, "<=", u0 + 2 * d["nHD"], sh) + add("af-policy-C", C + 65536, "<=", 1 << 24, sh) + add("af-no-wrap-N3", 6 * Smax + 2 * C + 3 * 65536 + (1 << digit) + (1 << (digit + 1)) * (Ty2 + 128 + (1 << S)), + "<", PBUDGET, sh) + add("af-no-wrap-N4", 6 * Smax + 2 * C + 3 * 65536, "<", 1 << digit, sh) + add("af-no-wrap-N1", Ty4 + Smax, "<", P2) + add("af-no-wrap-N2 first", (1 << 40) * Ty + (1 << 20) * (Ty + 128) + Ty + 128 + (1 << 41), "<", PBUDGET) + add("af-no-wrap-N2 radix", Ty + 128 + 256, "<", 1 << 20) + TS = T << S + add("af-no-wrap-N5", TS + Ty4, "<", P2) + add("af-no-wrap-N6", n6_left(lt, S, bv, Ty), "<", P2) + add("af-no-wrap-N9", (1 << (16 - lt)) * 2 * T if lt <= 16 else 0, "<", P2) + return rows + + +def all_ok(rows): + return all(r["ok"] for r in rows) + + +def failing(rows): + return [(r["name"], r["sh"]) for r in rows if not r["ok"]] + + +def softmax_shapes(): + """The (lt, S) pairs that af-shape-tiles and af-policy-softmax admit: lt 2..16, S 1..14, lt + S + 1 <= 24.""" + return [(lt, S) for lt in range(2, 17) for S in range(1, 15) if lt + S + 1 <= 24] + + +def superset_ok(ldh, bqk, bv, digit): + """N1 to N9 at C = CMAX for every admitted (lt, S): a superset bound check, not admitted parameter files.""" + bad = [] + for lt, S in softmax_shapes(): + rows = conditions(ldh, bqk, bv, lt, S, 8, [SH_MIN], 16, digit=digit, C_override=CMAX, policy=False) + if not all_ok(rows): + bad.append((lt, S, failing(rows))) + return bad + + +def site_o(k, form, dq, bc_o, limbs=4, Ty=TY): + """cp_verify.cpp q9 site("o", k, form, A = dq * BC * BWw, SP = 2^(lsg+2), Qb = 2^(lsg+1)): the two conditions + U-o and W-o for a rounding right shift by k. `bc_o` is the bound on a cell of o (legacy CLAMPED_CELL_BOUND = + 2,048; o is a rounded mean of values of v, so it keeps v's bound). Returns (U_left, U_bound, W_left, W_bound).""" + lsg = 39 if limbs == 5 else 30 + A = dq * bc_o * WEIGHT_BOUND + SP, Qb = 1 << (lsg + 2), 1 << (lsg + 1) + t = 16 - k if k < 16 else 0 + U_left = SP << (k if k > 16 else 16) + Ty2 = 257 * Ty + extra = (1 << 16) * (Ty + 128) if form == 1 else (1 << 16) * (Ty2 + 32896) if form == 2 else 0 + W_left = ((A + (1 << (k - 1)) + (Qb << k)) << t) + extra + return U_left, P2, W_left, P2 + + +def site_o_table(dq, bcs, limbs=4): + """For every digit form and every shift the KL range test admits (form 0: 1..16, 1: 1..24, 2: 1..32): + whether U-o and W-o hold, for each bound in bcs. Returns the shifts at which any verdict differs.""" + out = dict(differs=[], largest_ok_k={}) + for form, kmax in ((0, 16), (1, 24), (2, 32)): + for bc in bcs: + oks = [] + for k in range(1, kmax + 1): + ul, ub, wl, wb = site_o(k, form, dq, bc, limbs) + oks.append(ul <= ub and wl < wb) + out["largest_ok_k"]["form%d bc%d" % (form, bc)] = max([k for k, o in zip(range(1, kmax + 1), oks) if o], + default=None) + out.setdefault("_oks", {})[(form, bc)] = oks + for k in range(1, kmax + 1): + vs = {out["_oks"][(form, bc)][k - 1] for bc in bcs} + if len(vs) > 1: + out["differs"].append(dict(form=form, k=k)) + del out["_oks"] + return out + + +def fc_row_max(b, offset): + """The largest row of a clamp table shaped like FC: t + 2^28 (clamp_b(t - 32768) + offset), t < 65536.""" + return 65535 + ((b + offset) << 28) + + +def fit_exponent(mx: Fraction, cl: int, margin: Fraction = Fraction(1)): + """The largest integer E with margin * mx * 2^E <= cl, in exact rationals (mx > 0).""" + if mx <= 0 or cl <= 0 or margin < 1: + raise ValueError("fit_exponent needs mx > 0, cl > 0, margin >= 1") + target = Fraction(cl) / (margin * mx) + E = 0 + while Fraction(2) ** (E + 1) <= target: + E += 1 + while Fraction(2) ** E > target: + E -= 1 + return E + + +def sh_rule(Eq, Ek, rx=8): + """PR #176's registered softmax-shift rule: sh = E_q + E_k - rx, moved into 4..12 by changing E_q.""" + sh = Eq + Ek - rx + adj = None + if sh > SH_MAX: + sh, Eq, adj = SH_MAX, rx + SH_MAX - Ek, "sh>12: q coarser" + elif sh < SH_MIN: + sh, Eq, adj = SH_MIN, rx + SH_MIN - Ek, "sh<4: q finer, clamps possible" + return Eq, sh, adj + + +LAYOUTS = { + # name: (q/k clamp, score digit, kFD) + "legacy-2047": (2047, 32, 16), + "narrow-1665": (1665, 32, 16), + "wide33": (2047, 33, 17), +} + + +def layout_table(layout, bv, lt=10, S=12, rx=8): + bqk, digit, kFD = LAYOUTS[layout] + rows = conditions(8, bqk, bv, lt, S, rx, list(range(SH_MIN, SH_MAX + 1)), kFD, digit=digit) + return dict(layout=layout, bqk=bqk, bv=bv, digit=digit, kFD=kFD, lt=lt, S=S, rx=rx, u0=u0_of(S, rx), + Smax=smax(256, bqk), all_ok=all_ok(rows), failing=failing(rows), + superset_failures=len(superset_ok(8, bqk, bv, digit)), rows=rows) + + +def report(): + u0 = u0_of(12, 8) + out = dict( + t_start=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), + note="exact integer arithmetic on constants; nothing measured; not admission", + u0_S12_rx8=u0, CMAX=CMAX, softmax_shapes=len(softmax_shapes()), + max_qk_clamp_n4=dict(dh256_C0_digit32=max_qk_clamp_n4(256, 0), dh256_Cmax_digit32=max_qk_clamp_n4(256, CMAX), + dh256_Cmax_digit33=max_qk_clamp_n4(256, CMAX, 33), + dh256_Cstd_sh12_digit32=max_qk_clamp_n4(256, u0 << 12)), + max_v_clamp_n6=dict(lt10_S12=max_v_clamp_n6(10, 12), lt16_S7=max_v_clamp_n6(16, 7), + smallest_over_shapes=min(max_v_clamp_n6(lt, S) for lt, S in softmax_shapes())), + n6_left=dict(bv2047_lt10_S12=n6_left(10, 12, 2047), bv4095_lt10_S12=n6_left(10, 12, 4095)), + kfd_choices={"%s sh%d" % (name, sh): kfd_choices(smax(256, LAYOUTS[name][0]), u0, sh) + for name in LAYOUTS for sh in range(SH_MIN, SH_MAX + 1)}, + site_o=dict(dq=QWEN["H"] * QWEN["dh"], A_bc2048=QWEN["H"] * QWEN["dh"] * 2048 * WEIGHT_BOUND, + A_bc4096=QWEN["H"] * QWEN["dh"] * 4096 * WEIGHT_BOUND, + limbs4=site_o_table(QWEN["H"] * QWEN["dh"], (2048, 4096), 4), + limbs5=site_o_table(QWEN["H"] * QWEN["dh"], (2048, 4096), 5)), + fc_row_max=dict(fc_b2047_off2048=fc_row_max(2047, 2048), fcv_b4095_off4096=fc_row_max(4095, 4096), + fl_shape_13bit_off4096=fc_row_max(4095, 4096)), + layouts=[layout_table(name, bv) for name in ("legacy-2047", "narrow-1665", "wide33") for bv in (2047, 4095)], + ) + return out + + +if __name__ == "__main__": + if len(sys.argv) == 3 and sys.argv[1] == "report": + dst = Path(sys.argv[2]) + if dst.exists(): + sys.exit("REFUSED: %s exists (run files are written once)" % dst.name) + dst.write_text(json.dumps(report(), indent=1) + "\n") + print("wrote", dst.name) + else: + sys.exit(__doc__) diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/test_describe.py b/experiments/20261129-241-qwen-attn-rescue-rule/test_describe.py new file mode 100644 index 00000000..ac7cbba0 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/test_describe.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python3 +"""Unit tests for describe.py on synthetic records with made-up values only. No number of PR #178 or PR #206 is +used: the layer ids, prompt names, exponents and errors below are invented so that every expected answer can be +worked out by hand. + + test_describe.py run the tests + test_describe.py run them and write a receipt (once; refuses to overwrite) +""" +import json +import sys +import tempfile +import time +import unittest +from fractions import Fraction +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import describe as D # noqa: E402 + +LAYERS = (3, 7, 11, 15) +PROMPTS = ("s1", "s2", "s3") +NH = 24 + +# Synthetic design (hand-checkable): +# layer 3: v-only (E_v 8 -> 7), every cell's error exactly doubles -> rho_v = 2 +# layer 7: q-only (E_q 11 -> 10), every cell's error x 1.25 -> rho_q = 1.25 +# layer 11: same exponents, same errors -> kind "same", rho = 1 +# layer 15: mixed (q and v both drop) -> not used +E2047 = {3: (11, 7, 8), 7: (11, 7, 6), 11: (11, 6, 5), 15: (11, 6, 7)} +E1665 = {3: (11, 7, 7), 7: (10, 7, 6), 11: (11, 6, 5), 15: (10, 6, 6)} +BASE = {3: 0.004, 7: 0.006, 11: 0.012, 15: 0.008} +FACT = {3: 2.0, 7: 1.25, 11: 1.0, 15: 3.0} +MX = {3: (0.5, 10.0, 6.0), 7: (0.5, 10.0, 24.0), 11: (0.5, 20.0, 48.0), 15: (0.5, 20.0, 12.0)} +MAXW = {"s1": 1000, "s2": 1200, "s3": 1500} + + +def make(dirpath, mutate=None): + lay, cells, rows = [], [], [] + for arm, cl in D.ARMS.items(): + for l in LAYERS: + Eq, Ek, Ev = (E2047 if arm == "C2047" else E1665)[l] + lay.append(dict(arm=arm, layer=l, clamp=cl, mx_q=MX[l][0], mx_k=MX[l][1], mx_v=MX[l][2], Eq=Eq, Ek=Ek, + Ev=Ev, sh=Eq + Ek - 8, q_maxw=1500, k_maxw=1400, v_maxw=1300)) + for p in PROMPTS: + rows.append(dict(arm=arm, layer=l, prompt=p, q_maxw=MAXW[p], k_maxw=MAXW[p] - 100, + v_maxw=MAXW[p] + (300 if (l, p) == (7, "s3") else 0))) + for h in range(NH): + base = BASE[l] * (1 + 0.01 * h) + cells.append(dict(arm=arm, layer=l, prompt=p, head=h, + rel_y=base * (FACT[l] if arm == "C1665" else 1.0))) + if mutate: + mutate(lay, cells, rows) + d = Path(dirpath) + for name, recs in (("layers.jsonl", lay), ("cells.jsonl", cells), ("prompt-rows.jsonl", rows)): + (d / name).write_text("".join(json.dumps(r) + "\n" for r in recs)) + return d + + +class Synthetic(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.dir = make(self.tmp.name) + self.L, self.C, self.P, self.prompts = D.load(self.dir, LAYERS, len(PROMPTS), NH) + + def tearDown(self): + self.tmp.cleanup() + + def test_load_counts(self): + self.assertEqual((len(self.L), len(self.P), len(self.C)), (8, 24, 576)) + + def test_d2_kinds_and_ratios(self): + per, summ = D.d2(self.L, self.C, self.prompts, LAYERS, NH) + self.assertEqual([per[l]["kind"] for l in LAYERS], ["v-only", "q-only", "same", "mixed"]) + self.assertAlmostEqual(per[3]["rho"], 2.0, places=12) + self.assertAlmostEqual(per[7]["rho"], 1.25, places=12) + self.assertAlmostEqual(per[11]["rho"], 1.0, places=12) + self.assertEqual(summ["v"]["layers"], [3]) + self.assertEqual(summ["q"]["layers"], [7]) + self.assertIsNone(summ["k"]) + self.assertAlmostEqual(summ["v"]["rho_min"], 2.0, places=12) + + def test_d2_two_bit_drop_is_mixed(self): + tmp = tempfile.TemporaryDirectory() + + def mut(lay, cells, rows): + for r in lay: + if r["arm"] == "C1665" and r["layer"] == 3: + r["Ev"] = 6 # two bits on v only: not a one-bit natural experiment + L, C, P, pr = D.load(make(tmp.name, mut), LAYERS, len(PROMPTS), NH) + per, summ = D.d2(L, C, pr, LAYERS, NH) + self.assertEqual(per[3]["kind"], "mixed") + self.assertIsNone(summ["v"]) + tmp.cleanup() + + def test_decide(self): + _, summ = D.d2(self.L, self.C, self.prompts, LAYERS, NH) + dec = D.decide(summ) + self.assertEqual((dec["bottleneck"], dec["primary"], dec["alternative"]), ("v", "V13", "PKV")) + self.assertEqual(D.decide(dict(q=dict(rho_min=1.5), k=None, v=dict(rho_min=1.2)))["primary"], "HQ") + self.assertIsNone(D.decide(dict(q=dict(rho_min=1.1), k=dict(rho_min=1.9), v=dict(rho_min=1.2)))["primary"]) + self.assertIsNone(D.decide(dict(q=None, k=None, v=None))["primary"]) + + def test_d1(self): + d1 = D.d1(self.L, self.C, self.P, self.prompts, LAYERS, NH, 4) + self.assertEqual(d1[3]["E"], dict(q=11, k=7, v=8)) + self.assertAlmostEqual(d1[3]["occupancy"]["v"], 1300 / 2047) + # heads 0..23 at base (1 + 0.01 h): median over heads = base * 1.115 + self.assertAlmostEqual(d1[11]["median"], 0.012 * 1.115, places=12) + self.assertEqual(d1[11]["over_bar"], 72) + self.assertFalse(d1[11]["passes"]) + self.assertTrue(d1[3]["passes"]) + # kv group g holds heads 6g..6g+5: median = base * (1 + 0.01 (6g + 2.5)) + self.assertAlmostEqual(d1[3]["group_median"][2], 0.004 * 1.145, places=12) + self.assertEqual(d1[3]["group_n"], 18) + + def test_d3(self): + d3 = D.d3(self.P, self.prompts, LAYERS) + # q: s3 = 1500 against the rest's 1200 on every layer -> 5/4 + self.assertEqual(d3["q"]["r"], [5, 4]) + # k: 1400 / 1100 + self.assertEqual(d3["k"]["r"], [14, 11]) + # v: layer 7, s3 = 1800 against 1200 -> 3/2 + self.assertEqual(d3["v"]["r"], [3, 2]) + self.assertEqual((d3["v"]["layer"], d3["v"]["prompt"]), (7, "s3")) + + def test_margin_grid(self): + self.assertEqual(D.margin_of(Fraction(1)), 1) + self.assertEqual(D.margin_of(Fraction(5, 4)), Fraction(5, 4)) + self.assertEqual(D.margin_of(Fraction(14, 11)), Fraction(3, 2)) + self.assertEqual(D.margin_of(Fraction(9, 8) + Fraction(1, 10 ** 9)), Fraction(5, 4)) + self.assertEqual(D.margin_of(Fraction(2)), 2) + self.assertIsNone(D.margin_of(Fraction(2) + Fraction(1, 10 ** 9))) + self.assertEqual(D.margin_of(Fraction(1, 2)), 1) + + def test_rule_table_and_prediction(self): + _, summ = D.d2(self.L, self.C, self.prompts, LAYERS, NH) + d1 = D.d1(self.L, self.C, self.P, self.prompts, LAYERS, NH, 4) + m = dict(q=Fraction(1), k=Fraction(1), v=Fraction(1)) + tab = D.rule_table(self.L, m, 2047, 4095, LAYERS) + # mx_v 6 -> E_v 9 at 4,095 (6 * 512 = 3072; 6 * 1024 > 4095): one bit more than E 8 + self.assertEqual([tab[l]["Ev"] for l in LAYERS], [9, 7, 6, 8]) + self.assertEqual((tab[3]["Eq"], tab[3]["Ek"], tab[3]["sh"]), (11, 7, 10)) + # one value bit gained, no q/k bit lost: prediction = median / rho_v_min = median / 2 + self.assertAlmostEqual(D.predict(d1[11], tab[11], summ), d1[11]["median"] / 2.0, places=12) + # margin 2 on v takes the bit back: prediction = median + tab2 = D.rule_table(self.L, dict(q=Fraction(1), k=Fraction(1), v=Fraction(2)), 2047, 4095, LAYERS) + self.assertEqual(tab2[11]["Ev"], 5) + self.assertAlmostEqual(D.predict(d1[11], tab2[11], summ), d1[11]["median"], places=12) + # q clamp 1,665 with margin 3/2 loses one q bit (0.5 * 1.5 * 2^11 = 1536 fits; no loss); with margin 2: 2048 > 1665 + tab3 = D.rule_table(self.L, dict(q=Fraction(2), k=Fraction(1), v=Fraction(1)), 1665, 4095, LAYERS) + self.assertEqual(tab3[11]["Eq"], 10) + self.assertAlmostEqual(D.predict(d1[11], tab3[11], summ), d1[11]["median"] * 1.25 / 2.0, places=12) + # a lost k bit with no k-only layer: prediction not available + self.assertIsNone(D.predict(d1[11], dict(Eq=11, Ek=5, Ev=6), summ)) + # a lost v bit uses rho_v_max + self.assertAlmostEqual(D.predict(d1[11], dict(Eq=11, Ek=6, Ev=4), summ), d1[11]["median"] * 2.0, places=12) + + def test_check_206_arithmetic(self): + loc = Path(self.tmp.name) / "loc.json" + loc.write_text(json.dumps(dict(clamped_entries=[ + dict(arm="C2047", layer=3, prompt="x", tensor="v", head=1, max_abs_rne=2300), + dict(arm="C1665", layer=7, prompt="y", tensor="q", head=2, max_abs_rne=1700)]))) + tabs = {"narrow-1665": {3: dict(Eq=11, Ek=7, Ev=9), 7: dict(Eq=10, Ek=7, Ev=7)}, + "wide33": {3: dict(Eq=11, Ek=7, Ev=8), 7: dict(Eq=9, Ek=7, Ev=7)}} + rows = D.check_206(loc, self.L, tabs) + # v at E 8 -> 9: 4600 +- 1 against 4,095: does not fit. At E 8 -> 8: 2300 +- 0.5 against 4,095: fits. + self.assertFalse(rows[0]["covered"]["narrow-1665"]["fits"]) + self.assertTrue(rows[0]["covered"]["wide33"]["fits"]) + # q at C1665's E 10 -> 10: 1700 against 1,665 no; -> 9 at clamp 2,047: 850 fits + self.assertFalse(rows[1]["covered"]["narrow-1665"]["fits"]) + self.assertTrue(rows[1]["covered"]["wide33"]["fits"]) + + def test_run_refuses_partial_prompt_set(self): + loc = Path(self.tmp.name) / "loc.json" + loc.write_text(json.dumps(dict(clamped_entries=[]))) + # run() validates against the registered 10 prompts and 24 heads through load()'s defaults, so the + # synthetic 3-prompt set must be refused there: the registered run cannot silently take a partial set. + with self.assertRaises(D.RecordError): + D.run(self.dir, loc, LAYERS) + + +class Refusals(unittest.TestCase): + def _load(self, mut): + tmp = tempfile.TemporaryDirectory() + try: + return D.load(make(tmp.name, mut), LAYERS, len(PROMPTS), NH) + finally: + tmp.cleanup() + + def test_duplicate_cell(self): + with self.assertRaises(D.RecordError): + self._load(lambda lay, cells, rows: cells.append(dict(cells[0]))) + + def test_missing_cell(self): + with self.assertRaises(D.RecordError): + self._load(lambda lay, cells, rows: cells.pop()) + + def test_head_out_of_range(self): + def mut(lay, cells, rows): + cells[0]["head"] = 24 + with self.assertRaises(D.RecordError): + self._load(mut) + + def test_missing_layer(self): + with self.assertRaises(D.RecordError): + self._load(lambda lay, cells, rows: lay.pop()) + + def test_wrong_clamp(self): + def mut(lay, cells, rows): + lay[0]["clamp"] = 1665 + with self.assertRaises(D.RecordError): + self._load(mut) + + def test_missing_prompt_row(self): + with self.assertRaises(D.RecordError): + self._load(lambda lay, cells, rows: rows.pop()) + + def test_nonpositive_rel(self): + def mut(lay, cells, rows): + cells[5]["rel_y"] = 0.0 + with self.assertRaises(D.RecordError): + self._load(mut) + + def test_unexpected_arm(self): + def mut(lay, cells, rows): + lay[0]["arm"] = "C9999" + with self.assertRaises(D.RecordError): + self._load(mut) + + +if __name__ == "__main__": + receipt = sys.argv.pop(1) if len(sys.argv) > 1 and sys.argv[1].endswith(".json") else None + t0 = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) + suite = unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) + res = unittest.TextTestRunner(verbosity=1).run(suite) + if receipt: + dst = Path(receipt) + if dst.exists(): + sys.exit("REFUSED: %s exists (run files are written once)" % dst.name) + dst.write_text(json.dumps(dict(t_start=t0, suite="test_describe.py", tests=res.testsRun, + failures=len(res.failures), errors=len(res.errors), + ok=res.wasSuccessful()), indent=1) + "\n") + sys.exit(0 if res.wasSuccessful() else 1) diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/test_n4_arith.py b/experiments/20261129-241-qwen-attn-rescue-rule/test_n4_arith.py new file mode 100644 index 00000000..c675c639 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/test_n4_arith.py @@ -0,0 +1,274 @@ +#!/usr/bin/env python3 +"""Unit tests for n4_arith.py. Every expected constant is transcribed from a file on main (named in each test), +not from this lane's own output. + + test_n4_arith.py run the tests + test_n4_arith.py run them and write a receipt (once; refuses to overwrite) +""" +import json +import math +import sys +import time +import unittest +from fractions import Fraction +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import n4_arith as A # noqa: E402 + +CMAX = 16_711_680 + + +def row(rows, name, sh=None): + hit = [r for r in rows if r["name"] == name and r["sh"] == sh] + assert len(hit) == 1, (name, sh, len(hit)) + return hit[0] + + +class MainConstants(unittest.TestCase): + """Constants already on main.""" + + def test_cmax(self): + self.assertEqual(A.CMAX, CMAX) + + def test_pr176_prereg_n4(self): + # experiments/20261113-176-qwen-int-attn/PREREG.md, "The N4 clamp, recomputed" + self.assertEqual(6 * A.smax(256, 2047), 6_436_161_024) + self.assertGreater(6 * A.smax(256, 2047), 1 << 32) + self.assertEqual(6 * A.smax(256, 1665), 4_258_137_600) + self.assertEqual(A.low(256, 1665, CMAX), 4_291_757_568) + self.assertEqual(A.low(256, 1666, CMAX), 4_296_873_984) + self.assertEqual(A.low(256, 1672, 0), 4_294_213_632) + self.assertEqual(A.low(256, 1673, 0), 4_299_351_552) + self.assertEqual(A.max_qk_clamp_n4(256, CMAX), 1665) + self.assertEqual(A.max_qk_clamp_n4(256, 0), 1672) + self.assertEqual(A.u0_of(12, 8), 2307) + self.assertEqual(2307 << 12, 9_449_472) + + def test_dh256_rotary_2a(self): + # research/operators/qwen_ops/DH256-ROTARY.md section 2 and 2a + self.assertEqual(A.smax(256, 2047), 1_072_693_504) + self.assertEqual(A.low(256, 2047, CMAX), 6_469_780_992) + self.assertEqual(A.smax(128, 2047), 536_346_752) + self.assertEqual(A.low(128, 2047, CMAX), 3_251_700_480) + self.assertEqual((1 << 32) - A.low(256, 1672, 0), 753_664) + self.assertEqual((1 << 32) - A.low(256, 1665, CMAX), 3_209_728) + self.assertEqual(A.smax(256, 1665), 709_689_600) + self.assertEqual(4 * A.smax(256, 2047) + CMAX, 4_307_485_696) + + def test_dh256_rotary_2c_table(self): + # DH256-ROTARY.md section 2c: dh 256, b = b_v = 2047, Ty 2^18, Cmax, T 1024, S 12, 33/34 layout + rows = A.conditions(8, 2047, 2047, 10, 12, 8, [4], 17, digit=33, C_override=CMAX, policy=False) + want = { + "af-no-wrap-N1": (4_416_366_444_800, 1_152_921_504_606_846_976), + "af-no-wrap-N2 first": (288_232_850_187_354_240, 2_305_843_009_213_693_951), + "af-no-wrap-N2 radix": (262_528, 1_048_576), + "af-no-wrap-N5": (4_415_297_945_600, 1_152_921_504_606_846_976), + "af-no-wrap-N6": (565_183_349_063_681, 1_152_921_504_606_846_976), + "af-no-wrap-N9": (131_072, 1_152_921_504_606_846_976), + } + for name, (left, bound) in want.items(): + r = row(rows, name) + self.assertEqual((r["left"], r["bound"], r["ok"]), (left, bound, True), name) + r = row(rows, "af-no-wrap-N3", 4) + self.assertEqual((r["left"], r["bound"], r["ok"]), (1_157_497_687_061_366_272, 2_305_843_009_213_693_951, True)) + r = row(rows, "af-no-wrap-N4", 4) + self.assertEqual((r["left"], r["bound"], r["ok"]), (6_469_780_992, 8_589_934_592, True)) + + def test_dh256_rotary_2c_text(self): + rows = A.conditions(8, 2047, 2047, 10, 14, 8, [4], 17, digit=33, C_override=CMAX, policy=False) + self.assertEqual(row(rows, "af-no-wrap-N3", 4)["left"], 1_157_708_793_293_899_264) + self.assertEqual(len(A.softmax_shapes()), 182) + self.assertEqual(A.superset_ok(8, 1665, 2047, 32), []) + self.assertEqual(A.superset_ok(8, 2047, 2047, 33), []) + self.assertEqual(A.max_qk_clamp_n4(256, CMAX, 33), 2360) + self.assertEqual(A.low(256, 2360, CMAX), 8_588_525_568) + self.assertEqual(A.low(256, 2361, CMAX), 8_595_777_024) + + def test_dh256_rotary_2d_table(self): + u0 = A.u0_of(12, 8) + want = {(1665, 4): (43_327, 45_634, 88_961, [16]), (1665, 12): (46_204, 48_511, 94_715, [16]), + (2047, 4): (65_489, 67_796, 133_285, [17]), (2047, 12): (69_837, 72_144, 141_981, [17])} + for (b, sh), (nHD, lo, hi, ks) in want.items(): + d = A.shd(A.smax(256, b), u0, sh) + self.assertEqual((d["nHD"], u0 + d["nHD"], u0 + 2 * d["nHD"]), (nHD, lo, hi)) + self.assertEqual(A.kfd_choices(A.smax(256, b), u0, sh), ks) + for sh in range(4, 13): # "Every intermediate shift 4..12 ... gives the same respective choice" + self.assertEqual(A.kfd_choices(A.smax(256, 1665), u0, sh), [16]) + self.assertEqual(A.kfd_choices(A.smax(256, 2047), u0, sh), [17]) + self.assertEqual((u0 << 4, u0 << 12), (36_912, 9_449_472)) + + +class Legacy(unittest.TestCase): + """The legacy layout: shape()'s verdicts as the source gives them.""" + + def test_maverick_dh128_passes(self): + rows = A.conditions(7, 2047, 2047, 10, 12, 8, list(range(4, 13)), 16) + bad = [x for x in A.failing(rows) if not x[0].startswith("af-policy-kF rows")] + self.assertEqual(bad, []) + + def test_dh256_2047_refused_by_n4_and_kf(self): + rows = A.conditions(8, 2047, 2047, 10, 12, 8, list(range(4, 13)), 16) + names = {n for n, _ in A.failing(rows)} + self.assertEqual(names, {"af-no-wrap-N4", "af-policy-kF rows>=u0+nHD"}) + self.assertEqual(len([1 for n, _ in A.failing(rows) if n == "af-no-wrap-N4"]), 9) + + def test_dh256_1665_passes_every_shift(self): + rows = A.conditions(8, 1665, 2047, 10, 12, 8, list(range(4, 13)), 16) + self.assertTrue(A.all_ok(rows), A.failing(rows)) + + def test_n4_strict_boundary(self): + self.assertTrue(row(A.conditions(8, 1665, 2047, 10, 12, 8, [4], 16, C_override=CMAX, policy=False), + "af-no-wrap-N4", 4)["ok"]) + self.assertFalse(row(A.conditions(8, 1666, 2047, 10, 12, 8, [4], 16, C_override=CMAX, policy=False), + "af-no-wrap-N4", 4)["ok"]) + # strict "<": a left side equal to the bound must be refused + r = dict(left=1 << 32, bound=1 << 32) + self.assertFalse(r["left"] < r["bound"]) + + def test_digit_argument(self): + with self.assertRaises(ValueError): + A.conditions(8, 2047, 2047, 10, 12, 8, [4], 16, digit=34) + + def test_sh_out_of_policy(self): + self.assertFalse(A.all_ok(A.conditions(8, 1665, 2047, 10, 12, 8, [3], 16))) + self.assertFalse(A.all_ok(A.conditions(8, 1665, 2047, 10, 12, 8, [13], 16))) + + def test_softmax_policy(self): + self.assertFalse(A.all_ok(A.conditions(8, 1665, 2047, 12, 12, 8, [4], 16))) # lt + S + 1 = 25 + with self.assertRaises(ValueError): + A.u0_of(15, 8) + + def test_wide33_needs_kfd17(self): + self.assertTrue(A.all_ok(A.conditions(8, 2047, 2047, 10, 12, 8, list(range(4, 13)), 17, digit=33))) + self.assertFalse(A.all_ok(A.conditions(8, 2047, 2047, 10, 12, 8, list(range(4, 13)), 16, digit=33))) + + +class ValueCell(unittest.TestCase): + """The value clamp enters shape() only through N6's first term.""" + + def test_n6_reproduces_main_at_2047(self): + self.assertEqual(A.n6_left(10, 12, 2047), 565_183_349_063_681) # DH256-ROTARY.md 2c + + def test_n6_term(self): + TS = (1 << 10) << 12 + self.assertEqual(A.n6_left(10, 12, 4095) - A.n6_left(10, 12, 2047), 2 * TS * 2048) + self.assertEqual(A.n6_left(10, 12, 4095), 565_183_349_063_681 + 2 * TS * 2048) + + def test_only_n6_moves_with_bv(self): + a = A.conditions(8, 1665, 2047, 10, 12, 8, list(range(4, 13)), 16) + b = A.conditions(8, 1665, 4095, 10, 12, 8, list(range(4, 13)), 16) + diff = [x["name"] for x, y in zip(a, b) if x != y] + self.assertEqual(diff, ["af-no-wrap-N6"]) + self.assertTrue(A.all_ok(b)) + + def test_max_v_clamp_boundary(self): + for lt, S in ((10, 12), (16, 7), (2, 1), (9, 14)): + bv = A.max_v_clamp_n6(lt, S) + self.assertLess(A.n6_left(lt, S, bv), A.P2) + self.assertGreaterEqual(A.n6_left(lt, S, bv + 1), A.P2) + self.assertGreater(bv, 4095) + + def test_v13_superset(self): + self.assertEqual(A.superset_ok(8, 1665, 4095, 32), []) + self.assertEqual(A.superset_ok(8, 2047, 4095, 33), []) + + def test_fc_rows(self): + self.assertEqual(A.fc_row_max(2047, 2048), 65535 + (4095 << 28)) + self.assertLess(A.fc_row_max(4095, 4096), 1 << 41) + self.assertEqual((4096 << 28), 1 << 40) # the encoding offset of a 13-bit clamp output + self.assertEqual((2048 << 28), 1 << 39) # legacy: vf_layers_check.inc's 2^39 + + def test_site_o_formula(self): + # cp_verify.cpp site(): k = 16, form 0, four limbs: SP 2^32, Qb 2^31, t = 0 + dq = 6144 + ul, ub, wl, wb = A.site_o(16, 0, dq, 2048) + self.assertEqual(ul, (1 << 32) << 16) + self.assertEqual(wl, dq * 2048 * 4096 + (1 << 15) + ((1 << 31) << 16)) + self.assertEqual((ub, wb), (1 << 60, 1 << 60)) + ul, ub, wl, wb = A.site_o(8, 1, dq, 4096) # k < 16: everything shifted by t = 8, form 1 adds 2^16 (Ty + 128) + self.assertEqual(wl, ((dq * 4096 * 4096 + (1 << 7) + ((1 << 31) << 8)) << 8) + (1 << 16) * ((1 << 18) + 128)) + self.assertEqual(ul, (1 << 32) << 16) + + def test_site_o_no_verdict_change(self): + for limbs in (4, 5): + t = A.site_o_table(6144, (2048, 4096), limbs) + self.assertEqual(t["differs"], []) + + +class U0(unittest.TestCase): + def test_u0_matches_float_table_rule(self): + """Cross-check only (floats, this platform): the verifier's loop, nearbyint(2^S exp(-u / 2^rx)) == 0.""" + for S in range(1, 15): + for rx in (1, 4, 8, 12): + u = 0 + while round(math.ldexp(1.0, S) * math.exp(-u / math.ldexp(1.0, rx))) != 0: + u += 1 + self.assertEqual(A.u0_of(S, rx), u, (S, rx)) + + def test_ln2_interval(self): + lo, hi, Q = A.ln2_interval() + self.assertLess(lo, hi) + self.assertLess(Fraction(lo, Q), Fraction(6931471805599454, 10 ** 16)) + self.assertGreater(Fraction(hi, Q), Fraction(6931471805599453, 10 ** 16)) + self.assertLess(hi - lo, Q >> 200) + + +class Fit(unittest.TestCase): + def test_fit_exact_boundaries(self): + self.assertEqual(A.fit_exponent(Fraction(2047, 2048), 2047), 11) + self.assertEqual(A.fit_exponent(Fraction(2047, 2048) + Fraction(1, 2 ** 60), 2047), 10) + self.assertEqual(A.fit_exponent(Fraction(1), 2047), 10) + self.assertEqual(A.fit_exponent(Fraction(4096), 2047), -2) + self.assertEqual(A.fit_exponent(Fraction(1), 4095), 11) + + def test_fit_margin(self): + self.assertEqual(A.fit_exponent(Fraction(1), 2047, Fraction(1)), 10) + self.assertEqual(A.fit_exponent(Fraction(1), 2047, Fraction(2)), 9) + self.assertEqual(A.fit_exponent(Fraction(3, 2), 4095, Fraction(5, 4)), 11) # 1.875 * 2^11 = 3840 + self.assertEqual(A.fit_exponent(Fraction(3, 2), 4095, Fraction(3, 2)), 10) # 2.25 * 2^11 = 4608 + with self.assertRaises(ValueError): + A.fit_exponent(Fraction(1), 2047, Fraction(1, 2)) + with self.assertRaises(ValueError): + A.fit_exponent(Fraction(0), 2047) + + def test_fit_reproduces_pr178_table(self): + # experiments/20261113-176-qwen-int-attn/RESULTS.md sections 3 and 5: layer 15 max |v| 6.7523 has E_v 8 at + # 2,047 and 7 at 1,665; layer 23 max |v| 13.8457 has E_v 7 and 6. (4-decimal values as printed there.) + self.assertEqual(A.fit_exponent(Fraction(67523, 10000), 2047), 8) + self.assertEqual(A.fit_exponent(Fraction(67523, 10000), 1665), 7) + self.assertEqual(A.fit_exponent(Fraction(138457, 10000), 2047), 7) + self.assertEqual(A.fit_exponent(Fraction(138457, 10000), 1665), 6) + + def test_sh_rule(self): + self.assertEqual(A.sh_rule(11, 7), (11, 10, None)) + self.assertEqual(A.sh_rule(11, 6), (11, 9, None)) + self.assertEqual(A.sh_rule(13, 8)[:2], (12, 12)) + self.assertEqual(A.sh_rule(5, 5)[:2], (7, 4)) + + +class Report(unittest.TestCase): + def test_report_shape(self): + r = A.report() + self.assertEqual(r["u0_S12_rx8"], 2307) + by = {(x["layout"], x["bv"]): x for x in r["layouts"]} + self.assertFalse(by[("legacy-2047", 2047)]["all_ok"]) + self.assertFalse(by[("legacy-2047", 4095)]["all_ok"]) + for k in (("narrow-1665", 2047), ("narrow-1665", 4095), ("wide33", 2047), ("wide33", 4095)): + self.assertTrue(by[k]["all_ok"], k) + self.assertEqual(by[k]["superset_failures"], 0) + + +if __name__ == "__main__": + receipt = sys.argv.pop(1) if len(sys.argv) > 1 and sys.argv[1].endswith(".json") else None + t0 = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) + suite = unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) + res = unittest.TextTestRunner(verbosity=1).run(suite) + if receipt: + dst = Path(receipt) + if dst.exists(): + sys.exit("REFUSED: %s exists (run files are written once)" % dst.name) + dst.write_text(json.dumps(dict(t_start=t0, suite="test_n4_arith.py", tests=res.testsRun, + failures=len(res.failures), errors=len(res.errors), + ok=res.wasSuccessful()), indent=1) + "\n") + sys.exit(0 if res.wasSuccessful() else 1) From 411f4a50a2bb105606b91825c92cab2303728900 Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 02:57:59 +0000 Subject: [PATCH 03/12] attnrule: registered runs (describe.json, n4-report.json, unit-test receipts), written once --- .../runs/describe.json | 1592 +++++++ .../runs/n4-report.json | 4131 +++++++++++++++++ .../runs/unit-tests-describe.json | 8 + .../runs/unit-tests-n4.json | 8 + 4 files changed, 5739 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-describe.json create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-n4.json diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json b/experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json new file mode 100644 index 00000000..05c8974f --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json @@ -0,0 +1,1592 @@ +{ + "t_start": "2026-11-29T02:51:32Z", + "note": "computed from PR #178's committed in-sample records; nothing here is a measurement of the rule", + "prompts": [ + "p01-ordinary-short", + "p02-ordinary-paragraph", + "p03-repeat-word", + "p04-repeat-punct", + "p05-code", + "p06a-digits-256", + "p07-chat-ordinary", + "p08-chat-refusal", + "p09-multilingual", + "p11-chat-long" + ], + "D1": { + "3": { + "E": { + "q": 11, + "k": 7, + "v": 8 + }, + "sh": 10, + "maxw": { + "q": 1368, + "k": 1570, + "v": 1806 + }, + "occupancy": { + "q": 0.668295065950171, + "k": 0.7669760625305325, + "v": 0.882266731802638 + }, + "median": 0.003212224360676837, + "over_bar": 0, + "n": 240, + "group_median": [ + 0.00395315171469952, + 0.003522839786594633, + 0.003489190144253489, + 0.002495339445931764 + ], + "group_over_bar": [ + 0, + 0, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.0030157619045433474, + "p02-ordinary-paragraph": 0.0036976471609672717, + "p03-repeat-word": 0.0022742154660706443, + "p04-repeat-punct": 0.0023655139147794003, + "p05-code": 0.003712165116064341, + "p06a-digits-256": 0.003651875982253929, + "p07-chat-ordinary": 0.0035082990626241293, + "p08-chat-refusal": 0.003661148473666063, + "p09-multilingual": 0.0029961478988427977, + "p11-chat-long": 0.004088020560419739 + }, + "prompt_median_min": 0.0022742154660706443, + "prompt_median_max": 0.004088020560419739, + "passes": true + }, + "7": { + "E": { + "q": 11, + "k": 7, + "v": 7 + }, + "sh": 10, + "maxw": { + "q": 1356, + "k": 1824, + "v": 1083 + }, + "occupancy": { + "q": 0.6624328285295554, + "k": 0.8910600879335613, + "v": 0.529066927210552 + }, + "median": 0.005282664954450534, + "over_bar": 0, + "n": 240, + "group_median": [ + 0.005172167075080376, + 0.005113626134847262, + 0.004631916899799393, + 0.006865103460485911 + ], + "group_over_bar": [ + 0, + 0, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.004717207218523275, + "p02-ordinary-paragraph": 0.005593918946305936, + "p03-repeat-word": 0.004518382271037296, + "p04-repeat-punct": 0.004270872725332614, + "p05-code": 0.006264741268663818, + "p06a-digits-256": 0.005976260634416591, + "p07-chat-ordinary": 0.005361838512014116, + "p08-chat-refusal": 0.005208300273183468, + "p09-multilingual": 0.0046374034810076036, + "p11-chat-long": 0.0057141042808919375 + }, + "prompt_median_min": 0.004270872725332614, + "prompt_median_max": 0.006264741268663818, + "passes": true + }, + "11": { + "E": { + "q": 11, + "k": 7, + "v": 7 + }, + "sh": 10, + "maxw": { + "q": 1665, + "k": 1862, + "v": 1210 + }, + "occupancy": { + "q": 0.8133854421104054, + "k": 0.9096238397655105, + "v": 0.5911089399120665 + }, + "median": 0.005094095494634179, + "over_bar": 0, + "n": 240, + "group_median": [ + 0.00469328640068936, + 0.005170198422694221, + 0.004670750638733238, + 0.0056065217944813485 + ], + "group_over_bar": [ + 0, + 0, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.004727882276194174, + "p02-ordinary-paragraph": 0.005050962096698504, + "p03-repeat-word": 0.0053320765341105265, + "p04-repeat-punct": 0.004950237029221344, + "p05-code": 0.005787241001066352, + "p06a-digits-256": 0.005442335529903387, + "p07-chat-ordinary": 0.005028580051946913, + "p08-chat-refusal": 0.004926096258876514, + "p09-multilingual": 0.004432471773053757, + "p11-chat-long": 0.005351547230985895 + }, + "prompt_median_min": 0.004432471773053757, + "prompt_median_max": 0.005787241001066352, + "passes": true + }, + "15": { + "E": { + "q": 11, + "k": 6, + "v": 8 + }, + "sh": 9, + "maxw": { + "q": 1356, + "k": 1147, + "v": 1729 + }, + "occupancy": { + "q": 0.6624328285295554, + "k": 0.5603321934538349, + "v": 0.8446507083536883 + }, + "median": 0.0038018320160196307, + "over_bar": 0, + "n": 240, + "group_median": [ + 0.0036115465335239457, + 0.003571649978307543, + 0.004033451994413946, + 0.00387707951655097 + ], + "group_over_bar": [ + 0, + 0, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.0035015435239412213, + "p02-ordinary-paragraph": 0.003995113324040466, + "p03-repeat-word": 0.0023502803202916298, + "p04-repeat-punct": 0.0031364854409184958, + "p05-code": 0.004040188368474772, + "p06a-digits-256": 0.0037313969979203814, + "p07-chat-ordinary": 0.004307497909407621, + "p08-chat-refusal": 0.00379420536488908, + "p09-multilingual": 0.0037618042062434816, + "p11-chat-long": 0.004163228287187246 + }, + "prompt_median_min": 0.0023502803202916298, + "prompt_median_max": 0.004307497909407621, + "passes": true + }, + "19": { + "E": { + "q": 11, + "k": 6, + "v": 7 + }, + "sh": 9, + "maxw": { + "q": 1176, + "k": 1161, + "v": 1277 + }, + "occupancy": { + "q": 0.5744992672203224, + "k": 0.567171470444553, + "v": 0.6238397655105031 + }, + "median": 0.005306025489529257, + "over_bar": 0, + "n": 240, + "group_median": [ + 0.005342209808510584, + 0.005831622023879679, + 0.005701642655423104, + 0.004603282739960321 + ], + "group_over_bar": [ + 0, + 0, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.0049507102613125225, + "p02-ordinary-paragraph": 0.0053069525128389165, + "p03-repeat-word": 0.005312758608142472, + "p04-repeat-punct": 0.006241062775605984, + "p05-code": 0.00585533094871998, + "p06a-digits-256": 0.005953618273895624, + "p07-chat-ordinary": 0.005402901426781652, + "p08-chat-refusal": 0.005106666802263153, + "p09-multilingual": 0.004924374931694675, + "p11-chat-long": 0.005182397097551805 + }, + "prompt_median_min": 0.004924374931694675, + "prompt_median_max": 0.006241062775605984, + "passes": true + }, + "23": { + "E": { + "q": 11, + "k": 6, + "v": 7 + }, + "sh": 9, + "maxw": { + "q": 1714, + "k": 1296, + "v": 1772 + }, + "occupancy": { + "q": 0.8373229115779189, + "k": 0.6331216414264778, + "v": 0.865657059110894 + }, + "median": 0.004544770182288706, + "over_bar": 0, + "n": 240, + "group_median": [ + 0.004533100737973935, + 0.005880197487364573, + 0.0044245661400230535, + 0.003949029394346047 + ], + "group_over_bar": [ + 0, + 0, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.004416047149868926, + "p02-ordinary-paragraph": 0.004549871849588718, + "p03-repeat-word": 0.0046208998672675, + "p04-repeat-punct": 0.004732552200116893, + "p05-code": 0.004771095073656175, + "p06a-digits-256": 0.005354072150429117, + "p07-chat-ordinary": 0.004291349659664302, + "p08-chat-refusal": 0.004464452938896982, + "p09-multilingual": 0.004061974939082877, + "p11-chat-long": 0.004298142162581928 + }, + "prompt_median_min": 0.004061974939082877, + "prompt_median_max": 0.005354072150429117, + "passes": true + }, + "27": { + "E": { + "q": 11, + "k": 6, + "v": 6 + }, + "sh": 9, + "maxw": { + "q": 1406, + "k": 1386, + "v": 1773 + }, + "occupancy": { + "q": 0.6868588177821202, + "k": 0.6770884220810943, + "v": 0.8661455788959452 + }, + "median": 0.006481533470570167, + "over_bar": 0, + "n": 240, + "group_median": [ + 0.0067694424837409055, + 0.006728590769886647, + 0.00488299854108306, + 0.007214661777163105 + ], + "group_over_bar": [ + 0, + 0, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.005616381675031642, + "p02-ordinary-paragraph": 0.007171795776811056, + "p03-repeat-word": 0.006733573115347355, + "p04-repeat-punct": 0.006020980727231193, + "p05-code": 0.007019146570686254, + "p06a-digits-256": 0.007443248784610954, + "p07-chat-ordinary": 0.00601172632783443, + "p08-chat-refusal": 0.0062471081357392145, + "p09-multilingual": 0.0062393313759182625, + "p11-chat-long": 0.007084581628607751 + }, + "prompt_median_min": 0.005616381675031642, + "prompt_median_max": 0.007443248784610954, + "passes": true + }, + "31": { + "E": { + "q": 11, + "k": 6, + "v": 5 + }, + "sh": 9, + "maxw": { + "q": 1497, + "k": 1474, + "v": 1369 + }, + "occupancy": { + "q": 0.7313141182217879, + "k": 0.7200781631656082, + "v": 0.6687835857352222 + }, + "median": 0.010806214195654116, + "over_bar": 153, + "n": 240, + "group_median": [ + 0.01121224175921921, + 0.011720734529275856, + 0.010261601943425997, + 0.010439449026931362 + ], + "group_over_bar": [ + 40, + 46, + 32, + 35 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.008713842215270051, + "p02-ordinary-paragraph": 0.012790451873046513, + "p03-repeat-word": 0.011822820387705057, + "p04-repeat-punct": 0.009248227561661427, + "p05-code": 0.013248442597563359, + "p06a-digits-256": 0.012036171107852331, + "p07-chat-ordinary": 0.00917840192095537, + "p08-chat-refusal": 0.010135065944182, + "p09-multilingual": 0.009219629535596859, + "p11-chat-long": 0.012828485186619509 + }, + "prompt_median_min": 0.008713842215270051, + "prompt_median_max": 0.013248442597563359, + "passes": false + }, + "35": { + "E": { + "q": 11, + "k": 6, + "v": 5 + }, + "sh": 9, + "maxw": { + "q": 1510, + "k": 1265, + "v": 1226 + }, + "occupancy": { + "q": 0.7376648754274548, + "k": 0.6179775280898876, + "v": 0.5989252564728872 + }, + "median": 0.010724094294297057, + "over_bar": 151, + "n": 240, + "group_median": [ + 0.012557038150470727, + 0.010505587159280851, + 0.010652226549231892, + 0.009348018236352791 + ], + "group_over_bar": [ + 56, + 43, + 35, + 17 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.009755882084238736, + "p02-ordinary-paragraph": 0.012796536374813245, + "p03-repeat-word": 0.011510658748070474, + "p04-repeat-punct": 0.008912544585166065, + "p05-code": 0.012595369555436154, + "p06a-digits-256": 0.011967123926328142, + "p07-chat-ordinary": 0.009565143231379141, + "p08-chat-refusal": 0.010226823234369216, + "p09-multilingual": 0.009617302379837437, + "p11-chat-long": 0.012772324637915243 + }, + "prompt_median_min": 0.008912544585166065, + "prompt_median_max": 0.012796536374813245, + "passes": false + }, + "39": { + "E": { + "q": 11, + "k": 6, + "v": 5 + }, + "sh": 9, + "maxw": { + "q": 1629, + "k": 1334, + "v": 1029 + }, + "occupancy": { + "q": 0.7957987298485588, + "k": 0.651685393258427, + "v": 0.5026868588177821 + }, + "median": 0.01293869272415931, + "over_bar": 211, + "n": 240, + "group_median": [ + 0.015937594938174045, + 0.01408019824497872, + 0.011919561186323684, + 0.010270294034393553 + ], + "group_over_bar": [ + 60, + 60, + 55, + 36 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.011123331123032897, + "p02-ordinary-paragraph": 0.01353081453366874, + "p03-repeat-word": 0.014058241310401906, + "p04-repeat-punct": 0.011895329752257792, + "p05-code": 0.01278022821199408, + "p06a-digits-256": 0.013939379096400415, + "p07-chat-ordinary": 0.012151396434408209, + "p08-chat-refusal": 0.012486324097958492, + "p09-multilingual": 0.012953045184619193, + "p11-chat-long": 0.012427586599268337 + }, + "prompt_median_min": 0.011123331123032897, + "prompt_median_max": 0.014058241310401906, + "passes": false + }, + "43": { + "E": { + "q": 11, + "k": 6, + "v": 5 + }, + "sh": 9, + "maxw": { + "q": 1765, + "k": 1284, + "v": 1765 + }, + "occupancy": { + "q": 0.8622374206155349, + "k": 0.6272594040058622, + "v": 0.8622374206155349 + }, + "median": 0.009150521869797344, + "over_bar": 83, + "n": 240, + "group_median": [ + 0.009966811923840205, + 0.010116404725693565, + 0.007607374439875506, + 0.009325094236057947 + ], + "group_over_bar": [ + 30, + 31, + 0, + 22 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.007932988419709882, + "p02-ordinary-paragraph": 0.011074957569997908, + "p03-repeat-word": 0.00984797344346766, + "p04-repeat-punct": 0.008520357416707296, + "p05-code": 0.010423663265714088, + "p06a-digits-256": 0.009505270928886759, + "p07-chat-ordinary": 0.008052130657844735, + "p08-chat-refusal": 0.008850988113500137, + "p09-multilingual": 0.008677085588661652, + "p11-chat-long": 0.011465506869953804 + }, + "prompt_median_min": 0.007932988419709882, + "prompt_median_max": 0.011465506869953804, + "passes": true + }, + "47": { + "E": { + "q": 11, + "k": 6, + "v": 5 + }, + "sh": 9, + "maxw": { + "q": 1725, + "k": 1170, + "v": 1621 + }, + "occupancy": { + "q": 0.8426966292134831, + "k": 0.5715681485100147, + "v": 0.7918905715681485 + }, + "median": 0.008427093462494973, + "over_bar": 45, + "n": 240, + "group_median": [ + 0.009385452373039872, + 0.009099201086407913, + 0.007635260356814941, + 0.007568631229229935 + ], + "group_over_bar": [ + 21, + 20, + 1, + 3 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.007574029495255355, + "p02-ordinary-paragraph": 0.010081472349308625, + "p03-repeat-word": 0.008999281789349733, + "p04-repeat-punct": 0.007232367529107138, + "p05-code": 0.009701206222771472, + "p06a-digits-256": 0.009541399912480254, + "p07-chat-ordinary": 0.007078009318596714, + "p08-chat-refusal": 0.007480506989609661, + "p09-multilingual": 0.007813208613359298, + "p11-chat-long": 0.00951523281309051 + }, + "prompt_median_min": 0.007078009318596714, + "prompt_median_max": 0.010081472349308625, + "passes": true + }, + "51": { + "E": { + "q": 11, + "k": 6, + "v": 5 + }, + "sh": 9, + "maxw": { + "q": 1715, + "k": 1089, + "v": 1576 + }, + "occupancy": { + "q": 0.8378114313629702, + "k": 0.5319980459208598, + "v": 0.7699071812408402 + }, + "median": 0.0074731290770745015, + "over_bar": 21, + "n": 240, + "group_median": [ + 0.009060167263786011, + 0.00605476302775822, + 0.007061441750425366, + 0.0077331963509929755 + ], + "group_over_bar": [ + 15, + 0, + 6, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.007010003064713598, + "p02-ordinary-paragraph": 0.009041512949664338, + "p03-repeat-word": 0.007253837783014788, + "p04-repeat-punct": 0.005805286957115616, + "p05-code": 0.008507187512976973, + "p06a-digits-256": 0.006635089604209884, + "p07-chat-ordinary": 0.0066141132290814105, + "p08-chat-refusal": 0.007207203104832577, + "p09-multilingual": 0.0075469210891312725, + "p11-chat-long": 0.008044395929892268 + }, + "prompt_median_min": 0.005805286957115616, + "prompt_median_max": 0.009041512949664338, + "passes": true + }, + "55": { + "E": { + "q": 11, + "k": 7, + "v": 5 + }, + "sh": 10, + "maxw": { + "q": 1854, + "k": 1938, + "v": 1117 + }, + "occupancy": { + "q": 0.9057156814851002, + "k": 0.9467513434294089, + "v": 0.545676599902296 + }, + "median": 0.007697855054171952, + "over_bar": 91, + "n": 240, + "group_median": [ + 0.012191299627809208, + 0.01739578575875539, + 0.007229074863060701, + 0.006777228708960553 + ], + "group_over_bar": [ + 44, + 47, + 0, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.00876199466513642, + "p02-ordinary-paragraph": 0.009610318896720043, + "p03-repeat-word": 0.008547115157718641, + "p04-repeat-punct": 0.005335393211404953, + "p05-code": 0.008233585382255593, + "p06a-digits-256": 0.007532871259260873, + "p07-chat-ordinary": 0.010149618592672799, + "p08-chat-refusal": 0.00981911890977976, + "p09-multilingual": 0.008571968158156699, + "p11-chat-long": 0.009265094021849368 + }, + "prompt_median_min": 0.005335393211404953, + "prompt_median_max": 0.010149618592672799, + "passes": true + }, + "59": { + "E": { + "q": 11, + "k": 7, + "v": 4 + }, + "sh": 10, + "maxw": { + "q": 1947, + "k": 1872, + "v": 1512 + }, + "occupancy": { + "q": 0.9511480214948705, + "k": 0.9145090376160234, + "v": 0.7386419149975574 + }, + "median": 0.009508808713675324, + "over_bar": 103, + "n": 240, + "group_median": [ + 0.010548455499062206, + 0.004871852075838347, + 0.012590497015056719, + 0.009116595356148637 + ], + "group_over_bar": [ + 40, + 0, + 53, + 10 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.01059746910917704, + "p02-ordinary-paragraph": 0.010011067822962589, + "p03-repeat-word": 0.00831782623356388, + "p04-repeat-punct": 0.005403214707456232, + "p05-code": 0.009197944766587744, + "p06a-digits-256": 0.009121160350197235, + "p07-chat-ordinary": 0.010461795772924647, + "p08-chat-refusal": 0.01041109905979352, + "p09-multilingual": 0.01026389770272824, + "p11-chat-long": 0.010191767676598244 + }, + "prompt_median_min": 0.005403214707456232, + "prompt_median_max": 0.01059746910917704, + "passes": true + }, + "63": { + "E": { + "q": 11, + "k": 7, + "v": 3 + }, + "sh": 10, + "maxw": { + "q": 1820, + "k": 1608, + "v": 1067 + }, + "occupancy": { + "q": 0.8891060087933561, + "k": 0.7855398143624817, + "v": 0.5212506106497313 + }, + "median": 0.00740581964666181, + "over_bar": 4, + "n": 240, + "group_median": [ + 0.007451635181794797, + 0.005935855671453681, + 0.008976966180199521, + 0.00738383436636403 + ], + "group_over_bar": [ + 0, + 0, + 4, + 0 + ], + "group_n": 60, + "prompt_median": { + "p01-ordinary-short": 0.007621166090860528, + "p02-ordinary-paragraph": 0.007522370477476418, + "p03-repeat-word": 0.006912917189516027, + "p04-repeat-punct": 0.006848048681665822, + "p05-code": 0.007034619650250746, + "p06a-digits-256": 0.007213915334029651, + "p07-chat-ordinary": 0.007624888899181939, + "p08-chat-refusal": 0.007550271832724013, + "p09-multilingual": 0.007490060613078933, + "p11-chat-long": 0.007433619992083735 + }, + "prompt_median_min": 0.006848048681665822, + "prompt_median_max": 0.007624888899181939, + "passes": true + } + }, + "D2": { + "3": { + "diff": { + "q": 0, + "k": 0, + "v": 1 + }, + "kind": "v-only", + "rho": 1.9153004696945475, + "ratio_min": 1.7021334541232005, + "ratio_max": 2.0300551877710777, + "n": 240, + "sh_2047": 10, + "sh_1665": 10 + }, + "7": { + "diff": { + "q": 0, + "k": 1, + "v": 0 + }, + "kind": "k-only", + "rho": 1.0322681130122873, + "ratio_min": 0.9862178890309702, + "ratio_max": 1.262599413853686, + "n": 240, + "sh_2047": 10, + "sh_1665": 9 + }, + "11": { + "diff": { + "q": 0, + "k": 1, + "v": 0 + }, + "kind": "k-only", + "rho": 1.0331502253824913, + "ratio_min": 0.9462476867122561, + "ratio_max": 1.2563346226639547, + "n": 240, + "sh_2047": 10, + "sh_1665": 9 + }, + "15": { + "diff": { + "q": 0, + "k": 0, + "v": 1 + }, + "kind": "v-only", + "rho": 1.7565742217225875, + "ratio_min": 1.380433830606028, + "ratio_max": 2.0112462888374245, + "n": 240, + "sh_2047": 9, + "sh_1665": 9 + }, + "19": { + "diff": { + "q": 0, + "k": 0, + "v": 0 + }, + "kind": "same", + "rho": 1.0, + "ratio_min": 1.0, + "ratio_max": 1.0, + "n": 240, + "sh_2047": 9, + "sh_1665": 9 + }, + "23": { + "diff": { + "q": 1, + "k": 0, + "v": 1 + }, + "kind": "mixed", + "rho": 1.8736275808698433, + "ratio_min": 1.6269830166618153, + "ratio_max": 2.0229572857145133, + "n": 240, + "sh_2047": 9, + "sh_1665": 8 + }, + "27": { + "diff": { + "q": 0, + "k": 0, + "v": 1 + }, + "kind": "v-only", + "rho": 1.9013495565846825, + "ratio_min": 1.575097774975807, + "ratio_max": 2.000648685777114, + "n": 240, + "sh_2047": 9, + "sh_1665": 9 + }, + "31": { + "diff": { + "q": 0, + "k": 0, + "v": 0 + }, + "kind": "same", + "rho": 1.0, + "ratio_min": 1.0, + "ratio_max": 1.0, + "n": 240, + "sh_2047": 9, + "sh_1665": 9 + }, + "35": { + "diff": { + "q": 0, + "k": 0, + "v": 0 + }, + "kind": "same", + "rho": 1.0, + "ratio_min": 1.0, + "ratio_max": 1.0, + "n": 240, + "sh_2047": 9, + "sh_1665": 9 + }, + "39": { + "diff": { + "q": 0, + "k": 0, + "v": 0 + }, + "kind": "same", + "rho": 1.0, + "ratio_min": 1.0, + "ratio_max": 1.0, + "n": 240, + "sh_2047": 9, + "sh_1665": 9 + }, + "43": { + "diff": { + "q": 1, + "k": 0, + "v": 1 + }, + "kind": "mixed", + "rho": 1.9680216391455962, + "ratio_min": 1.716137631793596, + "ratio_max": 2.039291794736536, + "n": 240, + "sh_2047": 9, + "sh_1665": 8 + }, + "47": { + "diff": { + "q": 1, + "k": 0, + "v": 0 + }, + "kind": "q-only", + "rho": 1.0264708817255608, + "ratio_min": 0.9351775378318727, + "ratio_max": 1.1588707206572517, + "n": 240, + "sh_2047": 9, + "sh_1665": 8 + }, + "51": { + "diff": { + "q": 1, + "k": 0, + "v": 0 + }, + "kind": "q-only", + "rho": 1.02415037592028, + "ratio_min": 0.9411284635010144, + "ratio_max": 1.1513585340734014, + "n": 240, + "sh_2047": 9, + "sh_1665": 8 + }, + "55": { + "diff": { + "q": 1, + "k": 1, + "v": 0 + }, + "kind": "mixed", + "rho": 1.031241898523107, + "ratio_min": 0.9874815861187262, + "ratio_max": 1.14699667603251, + "n": 240, + "sh_2047": 10, + "sh_1665": 8 + }, + "59": { + "diff": { + "q": 1, + "k": 1, + "v": 0 + }, + "kind": "mixed", + "rho": 1.0102193065095455, + "ratio_min": 0.9943247584181253, + "ratio_max": 1.05786189219194, + "n": 240, + "sh_2047": 10, + "sh_1665": 8 + }, + "63": { + "diff": { + "q": 1, + "k": 0, + "v": 0 + }, + "kind": "q-only", + "rho": 1.001666145878901, + "ratio_min": 0.9946480760657349, + "ratio_max": 1.0222751789268802, + "n": 240, + "sh_2047": 10, + "sh_1665": 9 + } + }, + "D2_summary": { + "q": { + "layers": [ + 47, + 51, + 63 + ], + "rho_min": 1.001666145878901, + "rho_max": 1.0264708817255608 + }, + "k": { + "layers": [ + 7, + 11 + ], + "rho_min": 1.0322681130122873, + "rho_max": 1.0331502253824913 + }, + "v": { + "layers": [ + 3, + 15, + 27 + ], + "rho_min": 1.7565742217225875, + "rho_max": 1.9153004696945475 + } + }, + "D3": { + "q": { + "r": [ + 1725, + 1553 + ], + "r_float": 1.1107533805537668, + "layer": 47, + "prompt": "p03-repeat-word", + "maxw": 1725, + "rest_max": 1553 + }, + "k": { + "r": [ + 785, + 737 + ], + "r_float": 1.0651289009497964, + "layer": 3, + "prompt": "p03-repeat-word", + "maxw": 1570, + "rest_max": 1474 + }, + "v": { + "r": [ + 1277, + 1059 + ], + "r_float": 1.2058545797922569, + "layer": 19, + "prompt": "p03-repeat-word", + "maxw": 1277, + "rest_max": 1059 + } + }, + "decision": { + "bottleneck": "v", + "primary": "V13", + "alternative": "PKV", + "rho_min": { + "q": 1.001666145878901, + "k": 1.0322681130122873, + "v": 1.7565742217225875 + } + }, + "margins": { + "q": [ + 9, + 8 + ], + "k": [ + 9, + 8 + ], + "v": [ + 5, + 4 + ] + }, + "rule": { + "name": "V13", + "clamps": { + "narrow-1665": { + "qk": 1665, + "v": 4095 + }, + "wide33": { + "qk": 2047, + "v": 4095 + } + }, + "exponents": { + "narrow-1665": { + "3": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "7": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "11": { + "Eq": 10, + "Ek": 6, + "Ev": 8, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "15": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "19": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "23": { + "Eq": 10, + "Ek": 6, + "Ev": 7, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "27": { + "Eq": 11, + "Ek": 6, + "Ev": 6, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "31": { + "Eq": 10, + "Ek": 6, + "Ev": 6, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "35": { + "Eq": 10, + "Ek": 6, + "Ev": 6, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "39": { + "Eq": 10, + "Ek": 6, + "Ev": 6, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "43": { + "Eq": 10, + "Ek": 6, + "Ev": 5, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "47": { + "Eq": 10, + "Ek": 6, + "Ev": 6, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "51": { + "Eq": 10, + "Ek": 6, + "Ev": 6, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "55": { + "Eq": 10, + "Ek": 6, + "Ev": 6, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "59": { + "Eq": 10, + "Ek": 6, + "Ev": 5, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "63": { + "Eq": 10, + "Ek": 6, + "Ev": 4, + "sh": 8, + "Eq_fit": 10, + "adjust": null + } + }, + "wide33": { + "3": { + "Eq": 11, + "Ek": 7, + "Ev": 8, + "sh": 10, + "Eq_fit": 11, + "adjust": null + }, + "7": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "11": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "15": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "19": { + "Eq": 11, + "Ek": 6, + "Ev": 8, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "23": { + "Eq": 11, + "Ek": 6, + "Ev": 7, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "27": { + "Eq": 11, + "Ek": 6, + "Ev": 6, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "31": { + "Eq": 11, + "Ek": 6, + "Ev": 6, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "35": { + "Eq": 11, + "Ek": 6, + "Ev": 6, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "39": { + "Eq": 11, + "Ek": 6, + "Ev": 6, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "43": { + "Eq": 11, + "Ek": 6, + "Ev": 5, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "47": { + "Eq": 11, + "Ek": 6, + "Ev": 6, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "51": { + "Eq": 11, + "Ek": 6, + "Ev": 6, + "sh": 9, + "Eq_fit": 11, + "adjust": null + }, + "55": { + "Eq": 10, + "Ek": 6, + "Ev": 6, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "59": { + "Eq": 10, + "Ek": 6, + "Ev": 5, + "sh": 8, + "Eq_fit": 10, + "adjust": null + }, + "63": { + "Eq": 10, + "Ek": 7, + "Ev": 4, + "sh": 9, + "Eq_fit": 10, + "adjust": null + } + } + } + }, + "prediction": { + "narrow-1665": { + "3": 0.0033187103222124033, + "7": 0.0031070628390291247, + "11": 0.0030754642699870817, + "15": 0.0038018320160196307, + "19": 0.0030206668320145874, + "23": 0.004665074256253925, + "27": 0.006481533470570167, + "31": 0.006314714218366877, + "35": 0.006266726671634844, + "39": 0.0075608483630823665, + "43": 0.009392744251939906, + "47": 0.004924452351548303, + "51": 0.004366994174303128, + "55": 0.00464743509413646, + "59": 0.005740764278929242, + "63": 0.004471124213762385 + }, + "wide33": { + "3": 0.003212224360676837, + "7": 0.0031070628390291247, + "11": 0.0029961534464738415, + "15": 0.0038018320160196307, + "19": 0.0030206668320145874, + "23": 0.004544770182288706, + "27": 0.006481533470570167, + "31": 0.006151868826275377, + "35": 0.006105118794115319, + "39": 0.007365867359405378, + "43": 0.009150521869797344, + "47": 0.00479745937193074, + "51": 0.004254377062271793, + "55": 0.00464743509413646, + "59": 0.005740764278929242, + "63": 0.004327661267369992 + } + }, + "B": { + "primary_layout": "narrow-1665", + "verdict": "PASS", + "by_layout": { + "narrow-1665": { + "layers_over_bar": [], + "largest": 0.009392744251939906, + "sh_values": [ + 8, + 9 + ], + "sh_adjusted": [], + "verdict": "PASS" + }, + "wide33": { + "layers_over_bar": [], + "largest": 0.009150521869797344, + "sh_values": [ + 8, + 9, + 10 + ], + "sh_adjusted": [], + "verdict": "PASS" + } + } + }, + "check_pr206_clamp_locations": [ + { + "arm": "C1665", + "layer": 11, + "prompt": "h03-code-js", + "tensor": "q", + "head": 5, + "rne_at_arm": 1685, + "E_arm": 11, + "covered": { + "narrow-1665": { + "E_rule": 10, + "clamp": 1665, + "value_at_rule": 842.5, + "slack": 0.25, + "fits": true, + "undecided": false + }, + "wide33": { + "E_rule": 11, + "clamp": 2047, + "value_at_rule": 1685.0, + "slack": 0.5, + "fits": true, + "undecided": false + } + } + }, + { + "arm": "C2047", + "layer": 23, + "prompt": "h07-code-sql", + "tensor": "v", + "head": 2, + "rne_at_arm": 2317, + "E_arm": 7, + "covered": { + "narrow-1665": { + "E_rule": 7, + "clamp": 4095, + "value_at_rule": 2317.0, + "slack": 0.5, + "fits": true, + "undecided": false + }, + "wide33": { + "E_rule": 7, + "clamp": 4095, + "value_at_rule": 2317.0, + "slack": 0.5, + "fits": true, + "undecided": false + } + } + }, + { + "arm": "C1665", + "layer": 59, + "prompt": "h02-prose-paragraph", + "tensor": "v", + "head": 1, + "rne_at_arm": 1696, + "E_arm": 4, + "covered": { + "narrow-1665": { + "E_rule": 5, + "clamp": 4095, + "value_at_rule": 3392.0, + "slack": 1.0, + "fits": true, + "undecided": false + }, + "wide33": { + "E_rule": 5, + "clamp": 4095, + "value_at_rule": 3392.0, + "slack": 1.0, + "fits": true, + "undecided": false + } + } + }, + { + "arm": "C1665", + "layer": 59, + "prompt": "h07-code-sql", + "tensor": "v", + "head": 1, + "rne_at_arm": 1679, + "E_arm": 4, + "covered": { + "narrow-1665": { + "E_rule": 5, + "clamp": 4095, + "value_at_rule": 3358.0, + "slack": 1.0, + "fits": true, + "undecided": false + }, + "wide33": { + "E_rule": 5, + "clamp": 4095, + "value_at_rule": 3358.0, + "slack": 1.0, + "fits": true, + "undecided": false + } + } + }, + { + "arm": "C1665", + "layer": 63, + "prompt": "h03-code-js", + "tensor": "k", + "head": 3, + "rne_at_arm": 1667, + "E_arm": 7, + "covered": { + "narrow-1665": { + "E_rule": 6, + "clamp": 1665, + "value_at_rule": 833.5, + "slack": 0.25, + "fits": true, + "undecided": false + }, + "wide33": { + "E_rule": 7, + "clamp": 2047, + "value_at_rule": 1667.0, + "slack": 0.5, + "fits": true, + "undecided": false + } + } + } + ] +} diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json b/experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json new file mode 100644 index 00000000..b499be4d --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json @@ -0,0 +1,4131 @@ +{ + "t_start": "2026-11-29T02:53:56Z", + "note": "exact integer arithmetic on constants; nothing measured; not admission", + "u0_S12_rx8": 2307, + "CMAX": 16711680, + "softmax_shapes": 182, + "max_qk_clamp_n4": { + "dh256_C0_digit32": 1672, + "dh256_Cmax_digit32": 1665, + "dh256_Cmax_digit33": 2360, + "dh256_Cstd_sh12_digit32": 1668 + }, + "max_v_clamp_n6": { + "lt10_S12": 137371580413, + "lt16_S7": 68652104701, + "smallest_over_shapes": 68652104701 + }, + "n6_left": { + "bv2047_lt10_S12": 565183349063681, + "bv4095_lt10_S12": 565200528932865 + }, + "kfd_choices": { + "legacy-2047 sh4": [ + 17 + ], + "legacy-2047 sh5": [ + 17 + ], + "legacy-2047 sh6": [ + 17 + ], + "legacy-2047 sh7": [ + 17 + ], + "legacy-2047 sh8": [ + 17 + ], + "legacy-2047 sh9": [ + 17 + ], + "legacy-2047 sh10": [ + 17 + ], + "legacy-2047 sh11": [ + 17 + ], + "legacy-2047 sh12": [ + 17 + ], + "narrow-1665 sh4": [ + 16 + ], + "narrow-1665 sh5": [ + 16 + ], + "narrow-1665 sh6": [ + 16 + ], + "narrow-1665 sh7": [ + 16 + ], + "narrow-1665 sh8": [ + 16 + ], + "narrow-1665 sh9": [ + 16 + ], + "narrow-1665 sh10": [ + 16 + ], + "narrow-1665 sh11": [ + 16 + ], + "narrow-1665 sh12": [ + 16 + ], + "wide33 sh4": [ + 17 + ], + "wide33 sh5": [ + 17 + ], + "wide33 sh6": [ + 17 + ], + "wide33 sh7": [ + 17 + ], + "wide33 sh8": [ + 17 + ], + "wide33 sh9": [ + 17 + ], + "wide33 sh10": [ + 17 + ], + "wide33 sh11": [ + 17 + ], + "wide33 sh12": [ + 17 + ] + }, + "site_o": { + "dq": 6144, + "A_bc2048": 51539607552, + "A_bc4096": 103079215104, + "limbs4": { + "differs": [], + "largest_ok_k": { + "form0 bc2048": 16, + "form0 bc4096": 16, + "form1 bc2048": 24, + "form1 bc4096": 24, + "form2 bc2048": 28, + "form2 bc4096": 28 + } + }, + "limbs5": { + "differs": [], + "largest_ok_k": { + "form0 bc2048": 16, + "form0 bc4096": 16, + "form1 bc2048": 19, + "form1 bc4096": 19, + "form2 bc2048": 19, + "form2 bc4096": 19 + } + } + }, + "fc_row_max": { + "fc_b2047_off2048": 1099243257855, + "fcv_b4095_off4096": 2198754885631, + "fl_shape_13bit_off4096": 2198754885631 + }, + "layouts": [ + { + "layout": "legacy-2047", + "bqk": 2047, + "bv": 2047, + "digit": 32, + "kFD": 16, + "lt": 10, + "S": 12, + "rx": 8, + "u0": 2307, + "Smax": 1072693504, + "all_ok": false, + "failing": [ + [ + "af-policy-kF rows>=u0+nHD", + 4 + ], + [ + "af-no-wrap-N4", + 4 + ], + [ + "af-policy-kF rows>=u0+nHD", + 5 + ], + [ + "af-no-wrap-N4", + 5 + ], + [ + "af-policy-kF rows>=u0+nHD", + 6 + ], + [ + "af-no-wrap-N4", + 6 + ], + [ + "af-policy-kF rows>=u0+nHD", + 7 + ], + [ + "af-no-wrap-N4", + 7 + ], + [ + "af-policy-kF rows>=u0+nHD", + 8 + ], + [ + "af-no-wrap-N4", + 8 + ], + [ + "af-policy-kF rows>=u0+nHD", + 9 + ], + [ + "af-no-wrap-N4", + 9 + ], + [ + "af-policy-kF rows>=u0+nHD", + 10 + ], + [ + "af-no-wrap-N4", + 10 + ], + [ + "af-policy-kF rows>=u0+nHD", + 11 + ], + [ + "af-no-wrap-N4", + 11 + ], + [ + "af-policy-kF rows>=u0+nHD", + 12 + ], + [ + "af-no-wrap-N4", + 12 + ] + ], + "superset_failures": 182, + "rows": [ + { + "name": "af-shape-tiles lt>=2", + "sh": null, + "left": 10, + "rel": ">=", + "bound": 2, + "ok": true + }, + { + "name": "af-shape-tiles lt<=16", + "sh": null, + "left": 10, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-softmax S>=1", + "sh": null, + "left": 12, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax S<=14", + "sh": null, + "left": 12, + "rel": "<=", + "bound": 14, + "ok": true + }, + { + "name": "af-policy-softmax rx>=1", + "sh": null, + "left": 8, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax rx<=12", + "sh": null, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-softmax lt+S+1<=24", + "sh": null, + "left": 23, + "rel": "<=", + "bound": 24, + "ok": true + }, + { + "name": "af-policy-kF kFD>=8", + "sh": null, + "left": 16, + "rel": ">=", + "bound": 8, + "ok": true + }, + { + "name": "af-policy-kF kFD<=16", + "sh": null, + "left": 16, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 4, + "left": 4, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 4, + "left": 4, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 4, + "left": 65536, + "rel": ">=", + "bound": 67796, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 4, + "left": 65536, + "rel": "<=", + "bound": 133285, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 4, + "left": 102448, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 4, + "left": 578748846732224096, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 4, + "left": 6436431456, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 5, + "left": 5, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 5, + "left": 5, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 5, + "left": 65536, + "rel": ">=", + "bound": 67812, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 5, + "left": 65536, + "rel": "<=", + "bound": 133317, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 5, + "left": 139360, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 5, + "left": 578748846732297920, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 5, + "left": 6436505280, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 6, + "left": 6, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 6, + "left": 6, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 6, + "left": 65536, + "rel": ">=", + "bound": 67844, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 6, + "left": 65536, + "rel": "<=", + "bound": 133381, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 6, + "left": 213184, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 6, + "left": 578748846732445568, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 6, + "left": 6436652928, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 7, + "left": 7, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 7, + "left": 7, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 7, + "left": 65536, + "rel": ">=", + "bound": 67908, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 7, + "left": 65536, + "rel": "<=", + "bound": 133509, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 7, + "left": 360832, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 7, + "left": 578748846732740864, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 7, + "left": 6436948224, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 8, + "left": 8, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 8, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 8, + "left": 65536, + "rel": ">=", + "bound": 68036, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 8, + "left": 65536, + "rel": "<=", + "bound": 133765, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 8, + "left": 656128, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 8, + "left": 578748846733331456, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 8, + "left": 6437538816, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 9, + "left": 9, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 9, + "left": 9, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 9, + "left": 65536, + "rel": ">=", + "bound": 68295, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 9, + "left": 65536, + "rel": "<=", + "bound": 134283, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 9, + "left": 1246720, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 9, + "left": 578748846734512640, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 9, + "left": 6438720000, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 10, + "left": 10, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 10, + "left": 10, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 10, + "left": 65536, + "rel": ">=", + "bound": 68819, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 10, + "left": 65536, + "rel": "<=", + "bound": 135331, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 10, + "left": 2427904, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 10, + "left": 578748846736875008, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 10, + "left": 6441082368, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 11, + "left": 11, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 11, + "left": 11, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 11, + "left": 65536, + "rel": ">=", + "bound": 69892, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 11, + "left": 65536, + "rel": "<=", + "bound": 137477, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 11, + "left": 4790272, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 11, + "left": 578748846741599744, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 11, + "left": 6445807104, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 12, + "left": 12, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 12, + "left": 12, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 12, + "left": 65536, + "rel": ">=", + "bound": 72144, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 12, + "left": 65536, + "rel": "<=", + "bound": 141981, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 12, + "left": 9515008, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 12, + "left": 578748846751049216, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 12, + "left": 6455256576, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-no-wrap-N1", + "sh": null, + "left": 4416366444800, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N2 first", + "sh": null, + "left": 288232850187354240, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N2 radix", + "sh": null, + "left": 262528, + "rel": "<", + "bound": 1048576, + "ok": true + }, + { + "name": "af-no-wrap-N5", + "sh": null, + "left": 4415297945600, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N6", + "sh": null, + "left": 565183349063681, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N9", + "sh": null, + "left": 131072, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + } + ] + }, + { + "layout": "legacy-2047", + "bqk": 2047, + "bv": 4095, + "digit": 32, + "kFD": 16, + "lt": 10, + "S": 12, + "rx": 8, + "u0": 2307, + "Smax": 1072693504, + "all_ok": false, + "failing": [ + [ + "af-policy-kF rows>=u0+nHD", + 4 + ], + [ + "af-no-wrap-N4", + 4 + ], + [ + "af-policy-kF rows>=u0+nHD", + 5 + ], + [ + "af-no-wrap-N4", + 5 + ], + [ + "af-policy-kF rows>=u0+nHD", + 6 + ], + [ + "af-no-wrap-N4", + 6 + ], + [ + "af-policy-kF rows>=u0+nHD", + 7 + ], + [ + "af-no-wrap-N4", + 7 + ], + [ + "af-policy-kF rows>=u0+nHD", + 8 + ], + [ + "af-no-wrap-N4", + 8 + ], + [ + "af-policy-kF rows>=u0+nHD", + 9 + ], + [ + "af-no-wrap-N4", + 9 + ], + [ + "af-policy-kF rows>=u0+nHD", + 10 + ], + [ + "af-no-wrap-N4", + 10 + ], + [ + "af-policy-kF rows>=u0+nHD", + 11 + ], + [ + "af-no-wrap-N4", + 11 + ], + [ + "af-policy-kF rows>=u0+nHD", + 12 + ], + [ + "af-no-wrap-N4", + 12 + ] + ], + "superset_failures": 182, + "rows": [ + { + "name": "af-shape-tiles lt>=2", + "sh": null, + "left": 10, + "rel": ">=", + "bound": 2, + "ok": true + }, + { + "name": "af-shape-tiles lt<=16", + "sh": null, + "left": 10, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-softmax S>=1", + "sh": null, + "left": 12, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax S<=14", + "sh": null, + "left": 12, + "rel": "<=", + "bound": 14, + "ok": true + }, + { + "name": "af-policy-softmax rx>=1", + "sh": null, + "left": 8, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax rx<=12", + "sh": null, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-softmax lt+S+1<=24", + "sh": null, + "left": 23, + "rel": "<=", + "bound": 24, + "ok": true + }, + { + "name": "af-policy-kF kFD>=8", + "sh": null, + "left": 16, + "rel": ">=", + "bound": 8, + "ok": true + }, + { + "name": "af-policy-kF kFD<=16", + "sh": null, + "left": 16, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 4, + "left": 4, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 4, + "left": 4, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 4, + "left": 65536, + "rel": ">=", + "bound": 67796, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 4, + "left": 65536, + "rel": "<=", + "bound": 133285, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 4, + "left": 102448, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 4, + "left": 578748846732224096, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 4, + "left": 6436431456, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 5, + "left": 5, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 5, + "left": 5, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 5, + "left": 65536, + "rel": ">=", + "bound": 67812, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 5, + "left": 65536, + "rel": "<=", + "bound": 133317, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 5, + "left": 139360, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 5, + "left": 578748846732297920, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 5, + "left": 6436505280, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 6, + "left": 6, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 6, + "left": 6, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 6, + "left": 65536, + "rel": ">=", + "bound": 67844, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 6, + "left": 65536, + "rel": "<=", + "bound": 133381, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 6, + "left": 213184, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 6, + "left": 578748846732445568, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 6, + "left": 6436652928, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 7, + "left": 7, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 7, + "left": 7, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 7, + "left": 65536, + "rel": ">=", + "bound": 67908, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 7, + "left": 65536, + "rel": "<=", + "bound": 133509, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 7, + "left": 360832, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 7, + "left": 578748846732740864, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 7, + "left": 6436948224, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 8, + "left": 8, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 8, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 8, + "left": 65536, + "rel": ">=", + "bound": 68036, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 8, + "left": 65536, + "rel": "<=", + "bound": 133765, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 8, + "left": 656128, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 8, + "left": 578748846733331456, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 8, + "left": 6437538816, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 9, + "left": 9, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 9, + "left": 9, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 9, + "left": 65536, + "rel": ">=", + "bound": 68295, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 9, + "left": 65536, + "rel": "<=", + "bound": 134283, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 9, + "left": 1246720, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 9, + "left": 578748846734512640, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 9, + "left": 6438720000, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 10, + "left": 10, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 10, + "left": 10, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 10, + "left": 65536, + "rel": ">=", + "bound": 68819, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 10, + "left": 65536, + "rel": "<=", + "bound": 135331, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 10, + "left": 2427904, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 10, + "left": 578748846736875008, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 10, + "left": 6441082368, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 11, + "left": 11, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 11, + "left": 11, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 11, + "left": 65536, + "rel": ">=", + "bound": 69892, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 11, + "left": 65536, + "rel": "<=", + "bound": 137477, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 11, + "left": 4790272, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 11, + "left": 578748846741599744, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 11, + "left": 6445807104, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-policy-sh sh>=4", + "sh": 12, + "left": 12, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 12, + "left": 12, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 12, + "left": 65536, + "rel": ">=", + "bound": 72144, + "ok": false + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 12, + "left": 65536, + "rel": "<=", + "bound": 141981, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 12, + "left": 9515008, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 12, + "left": 578748846751049216, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 12, + "left": 6455256576, + "rel": "<", + "bound": 4294967296, + "ok": false + }, + { + "name": "af-no-wrap-N1", + "sh": null, + "left": 4416366444800, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N2 first", + "sh": null, + "left": 288232850187354240, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N2 radix", + "sh": null, + "left": 262528, + "rel": "<", + "bound": 1048576, + "ok": true + }, + { + "name": "af-no-wrap-N5", + "sh": null, + "left": 4415297945600, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N6", + "sh": null, + "left": 565200528932865, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N9", + "sh": null, + "left": 131072, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + } + ] + }, + { + "layout": "narrow-1665", + "bqk": 1665, + "bv": 2047, + "digit": 32, + "kFD": 16, + "lt": 10, + "S": 12, + "rx": 8, + "u0": 2307, + "Smax": 709689600, + "all_ok": true, + "failing": [], + "superset_failures": 0, + "rows": [ + { + "name": "af-shape-tiles lt>=2", + "sh": null, + "left": 10, + "rel": ">=", + "bound": 2, + "ok": true + }, + { + "name": "af-shape-tiles lt<=16", + "sh": null, + "left": 10, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-softmax S>=1", + "sh": null, + "left": 12, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax S<=14", + "sh": null, + "left": 12, + "rel": "<=", + "bound": 14, + "ok": true + }, + { + "name": "af-policy-softmax rx>=1", + "sh": null, + "left": 8, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax rx<=12", + "sh": null, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-softmax lt+S+1<=24", + "sh": null, + "left": 23, + "rel": "<=", + "bound": 24, + "ok": true + }, + { + "name": "af-policy-kF kFD>=8", + "sh": null, + "left": 16, + "rel": ">=", + "bound": 8, + "ok": true + }, + { + "name": "af-policy-kF kFD<=16", + "sh": null, + "left": 16, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 4, + "left": 4, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 4, + "left": 4, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 4, + "left": 65536, + "rel": ">=", + "bound": 45634, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 4, + "left": 65536, + "rel": "<=", + "bound": 88961, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 4, + "left": 102448, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 4, + "left": 578748844554200672, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 4, + "left": 4258408032, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 5, + "left": 5, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 5, + "left": 5, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 5, + "left": 65536, + "rel": ">=", + "bound": 45645, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 5, + "left": 65536, + "rel": "<=", + "bound": 88983, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 5, + "left": 139360, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 5, + "left": 578748844554274496, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 5, + "left": 4258481856, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 6, + "left": 6, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 6, + "left": 6, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 6, + "left": 65536, + "rel": ">=", + "bound": 45666, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 6, + "left": 65536, + "rel": "<=", + "bound": 89025, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 6, + "left": 213184, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 6, + "left": 578748844554422144, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 6, + "left": 4258629504, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 7, + "left": 7, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 7, + "left": 7, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 7, + "left": 65536, + "rel": ">=", + "bound": 45708, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 7, + "left": 65536, + "rel": "<=", + "bound": 89109, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 7, + "left": 360832, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 7, + "left": 578748844554717440, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 7, + "left": 4258924800, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 8, + "left": 8, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 8, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 8, + "left": 65536, + "rel": ">=", + "bound": 45793, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 8, + "left": 65536, + "rel": "<=", + "bound": 89279, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 8, + "left": 656128, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 8, + "left": 578748844555308032, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 8, + "left": 4259515392, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 9, + "left": 9, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 9, + "left": 9, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 9, + "left": 65536, + "rel": ">=", + "bound": 45965, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 9, + "left": 65536, + "rel": "<=", + "bound": 89623, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 9, + "left": 1246720, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 9, + "left": 578748844556489216, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 9, + "left": 4260696576, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 10, + "left": 10, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 10, + "left": 10, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 10, + "left": 65536, + "rel": ">=", + "bound": 46311, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 10, + "left": 65536, + "rel": "<=", + "bound": 90315, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 10, + "left": 2427904, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 10, + "left": 578748844558851584, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 10, + "left": 4263058944, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 11, + "left": 11, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 11, + "left": 11, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 11, + "left": 65536, + "rel": ">=", + "bound": 47021, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 11, + "left": 65536, + "rel": "<=", + "bound": 91735, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 11, + "left": 4790272, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 11, + "left": 578748844563576320, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 11, + "left": 4267783680, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 12, + "left": 12, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 12, + "left": 12, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 12, + "left": 65536, + "rel": ">=", + "bound": 48511, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 12, + "left": 65536, + "rel": "<=", + "bound": 94715, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 12, + "left": 9515008, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 12, + "left": 578748844573025792, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 12, + "left": 4277233152, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-no-wrap-N1", + "sh": null, + "left": 4416003440896, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N2 first", + "sh": null, + "left": 288232850187354240, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N2 radix", + "sh": null, + "left": 262528, + "rel": "<", + "bound": 1048576, + "ok": true + }, + { + "name": "af-no-wrap-N5", + "sh": null, + "left": 4415297945600, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N6", + "sh": null, + "left": 565183349063681, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N9", + "sh": null, + "left": 131072, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + } + ] + }, + { + "layout": "narrow-1665", + "bqk": 1665, + "bv": 4095, + "digit": 32, + "kFD": 16, + "lt": 10, + "S": 12, + "rx": 8, + "u0": 2307, + "Smax": 709689600, + "all_ok": true, + "failing": [], + "superset_failures": 0, + "rows": [ + { + "name": "af-shape-tiles lt>=2", + "sh": null, + "left": 10, + "rel": ">=", + "bound": 2, + "ok": true + }, + { + "name": "af-shape-tiles lt<=16", + "sh": null, + "left": 10, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-softmax S>=1", + "sh": null, + "left": 12, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax S<=14", + "sh": null, + "left": 12, + "rel": "<=", + "bound": 14, + "ok": true + }, + { + "name": "af-policy-softmax rx>=1", + "sh": null, + "left": 8, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax rx<=12", + "sh": null, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-softmax lt+S+1<=24", + "sh": null, + "left": 23, + "rel": "<=", + "bound": 24, + "ok": true + }, + { + "name": "af-policy-kF kFD>=8", + "sh": null, + "left": 16, + "rel": ">=", + "bound": 8, + "ok": true + }, + { + "name": "af-policy-kF kFD<=16", + "sh": null, + "left": 16, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 4, + "left": 4, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 4, + "left": 4, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 4, + "left": 65536, + "rel": ">=", + "bound": 45634, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 4, + "left": 65536, + "rel": "<=", + "bound": 88961, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 4, + "left": 102448, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 4, + "left": 578748844554200672, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 4, + "left": 4258408032, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 5, + "left": 5, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 5, + "left": 5, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 5, + "left": 65536, + "rel": ">=", + "bound": 45645, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 5, + "left": 65536, + "rel": "<=", + "bound": 88983, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 5, + "left": 139360, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 5, + "left": 578748844554274496, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 5, + "left": 4258481856, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 6, + "left": 6, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 6, + "left": 6, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 6, + "left": 65536, + "rel": ">=", + "bound": 45666, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 6, + "left": 65536, + "rel": "<=", + "bound": 89025, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 6, + "left": 213184, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 6, + "left": 578748844554422144, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 6, + "left": 4258629504, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 7, + "left": 7, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 7, + "left": 7, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 7, + "left": 65536, + "rel": ">=", + "bound": 45708, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 7, + "left": 65536, + "rel": "<=", + "bound": 89109, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 7, + "left": 360832, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 7, + "left": 578748844554717440, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 7, + "left": 4258924800, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 8, + "left": 8, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 8, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 8, + "left": 65536, + "rel": ">=", + "bound": 45793, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 8, + "left": 65536, + "rel": "<=", + "bound": 89279, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 8, + "left": 656128, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 8, + "left": 578748844555308032, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 8, + "left": 4259515392, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 9, + "left": 9, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 9, + "left": 9, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 9, + "left": 65536, + "rel": ">=", + "bound": 45965, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 9, + "left": 65536, + "rel": "<=", + "bound": 89623, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 9, + "left": 1246720, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 9, + "left": 578748844556489216, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 9, + "left": 4260696576, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 10, + "left": 10, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 10, + "left": 10, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 10, + "left": 65536, + "rel": ">=", + "bound": 46311, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 10, + "left": 65536, + "rel": "<=", + "bound": 90315, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 10, + "left": 2427904, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 10, + "left": 578748844558851584, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 10, + "left": 4263058944, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 11, + "left": 11, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 11, + "left": 11, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 11, + "left": 65536, + "rel": ">=", + "bound": 47021, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 11, + "left": 65536, + "rel": "<=", + "bound": 91735, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 11, + "left": 4790272, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 11, + "left": 578748844563576320, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 11, + "left": 4267783680, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 12, + "left": 12, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 12, + "left": 12, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 12, + "left": 65536, + "rel": ">=", + "bound": 48511, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 12, + "left": 65536, + "rel": "<=", + "bound": 94715, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 12, + "left": 9515008, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 12, + "left": 578748844573025792, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 12, + "left": 4277233152, + "rel": "<", + "bound": 4294967296, + "ok": true + }, + { + "name": "af-no-wrap-N1", + "sh": null, + "left": 4416003440896, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N2 first", + "sh": null, + "left": 288232850187354240, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N2 radix", + "sh": null, + "left": 262528, + "rel": "<", + "bound": 1048576, + "ok": true + }, + { + "name": "af-no-wrap-N5", + "sh": null, + "left": 4415297945600, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N6", + "sh": null, + "left": 565200528932865, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N9", + "sh": null, + "left": 131072, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + } + ] + }, + { + "layout": "wide33", + "bqk": 2047, + "bv": 2047, + "digit": 33, + "kFD": 17, + "lt": 10, + "S": 12, + "rx": 8, + "u0": 2307, + "Smax": 1072693504, + "all_ok": true, + "failing": [], + "superset_failures": 0, + "rows": [ + { + "name": "af-shape-tiles lt>=2", + "sh": null, + "left": 10, + "rel": ">=", + "bound": 2, + "ok": true + }, + { + "name": "af-shape-tiles lt<=16", + "sh": null, + "left": 10, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-softmax S>=1", + "sh": null, + "left": 12, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax S<=14", + "sh": null, + "left": 12, + "rel": "<=", + "bound": 14, + "ok": true + }, + { + "name": "af-policy-softmax rx>=1", + "sh": null, + "left": 8, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax rx<=12", + "sh": null, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-softmax lt+S+1<=24", + "sh": null, + "left": 23, + "rel": "<=", + "bound": 24, + "ok": true + }, + { + "name": "af-policy-kF kFD>=8", + "sh": null, + "left": 17, + "rel": ">=", + "bound": 8, + "ok": true + }, + { + "name": "af-policy-kF kFD<=17", + "sh": null, + "left": 17, + "rel": "<=", + "bound": 17, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 4, + "left": 4, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 4, + "left": 4, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 4, + "left": 131072, + "rel": ">=", + "bound": 67796, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 4, + "left": 131072, + "rel": "<=", + "bound": 133285, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 4, + "left": 102448, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 4, + "left": 1157497687028016736, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 4, + "left": 6436431456, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 5, + "left": 5, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 5, + "left": 5, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 5, + "left": 131072, + "rel": ">=", + "bound": 67812, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 5, + "left": 131072, + "rel": "<=", + "bound": 133317, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 5, + "left": 139360, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 5, + "left": 1157497687028090560, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 5, + "left": 6436505280, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 6, + "left": 6, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 6, + "left": 6, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 6, + "left": 131072, + "rel": ">=", + "bound": 67844, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 6, + "left": 131072, + "rel": "<=", + "bound": 133381, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 6, + "left": 213184, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 6, + "left": 1157497687028238208, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 6, + "left": 6436652928, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 7, + "left": 7, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 7, + "left": 7, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 7, + "left": 131072, + "rel": ">=", + "bound": 67908, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 7, + "left": 131072, + "rel": "<=", + "bound": 133509, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 7, + "left": 360832, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 7, + "left": 1157497687028533504, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 7, + "left": 6436948224, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 8, + "left": 8, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 8, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 8, + "left": 131072, + "rel": ">=", + "bound": 68036, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 8, + "left": 131072, + "rel": "<=", + "bound": 133765, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 8, + "left": 656128, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 8, + "left": 1157497687029124096, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 8, + "left": 6437538816, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 9, + "left": 9, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 9, + "left": 9, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 9, + "left": 131072, + "rel": ">=", + "bound": 68295, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 9, + "left": 131072, + "rel": "<=", + "bound": 134283, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 9, + "left": 1246720, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 9, + "left": 1157497687030305280, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 9, + "left": 6438720000, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 10, + "left": 10, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 10, + "left": 10, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 10, + "left": 131072, + "rel": ">=", + "bound": 68819, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 10, + "left": 131072, + "rel": "<=", + "bound": 135331, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 10, + "left": 2427904, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 10, + "left": 1157497687032667648, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 10, + "left": 6441082368, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 11, + "left": 11, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 11, + "left": 11, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 11, + "left": 131072, + "rel": ">=", + "bound": 69892, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 11, + "left": 131072, + "rel": "<=", + "bound": 137477, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 11, + "left": 4790272, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 11, + "left": 1157497687037392384, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 11, + "left": 6445807104, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 12, + "left": 12, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 12, + "left": 12, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 12, + "left": 131072, + "rel": ">=", + "bound": 72144, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 12, + "left": 131072, + "rel": "<=", + "bound": 141981, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 12, + "left": 9515008, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 12, + "left": 1157497687046841856, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 12, + "left": 6455256576, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-no-wrap-N1", + "sh": null, + "left": 4416366444800, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N2 first", + "sh": null, + "left": 288232850187354240, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N2 radix", + "sh": null, + "left": 262528, + "rel": "<", + "bound": 1048576, + "ok": true + }, + { + "name": "af-no-wrap-N5", + "sh": null, + "left": 4415297945600, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N6", + "sh": null, + "left": 565183349063681, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N9", + "sh": null, + "left": 131072, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + } + ] + }, + { + "layout": "wide33", + "bqk": 2047, + "bv": 4095, + "digit": 33, + "kFD": 17, + "lt": 10, + "S": 12, + "rx": 8, + "u0": 2307, + "Smax": 1072693504, + "all_ok": true, + "failing": [], + "superset_failures": 0, + "rows": [ + { + "name": "af-shape-tiles lt>=2", + "sh": null, + "left": 10, + "rel": ">=", + "bound": 2, + "ok": true + }, + { + "name": "af-shape-tiles lt<=16", + "sh": null, + "left": 10, + "rel": "<=", + "bound": 16, + "ok": true + }, + { + "name": "af-policy-softmax S>=1", + "sh": null, + "left": 12, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax S<=14", + "sh": null, + "left": 12, + "rel": "<=", + "bound": 14, + "ok": true + }, + { + "name": "af-policy-softmax rx>=1", + "sh": null, + "left": 8, + "rel": ">=", + "bound": 1, + "ok": true + }, + { + "name": "af-policy-softmax rx<=12", + "sh": null, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-softmax lt+S+1<=24", + "sh": null, + "left": 23, + "rel": "<=", + "bound": 24, + "ok": true + }, + { + "name": "af-policy-kF kFD>=8", + "sh": null, + "left": 17, + "rel": ">=", + "bound": 8, + "ok": true + }, + { + "name": "af-policy-kF kFD<=17", + "sh": null, + "left": 17, + "rel": "<=", + "bound": 17, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 4, + "left": 4, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 4, + "left": 4, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 4, + "left": 131072, + "rel": ">=", + "bound": 67796, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 4, + "left": 131072, + "rel": "<=", + "bound": 133285, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 4, + "left": 102448, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 4, + "left": 1157497687028016736, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 4, + "left": 6436431456, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 5, + "left": 5, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 5, + "left": 5, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 5, + "left": 131072, + "rel": ">=", + "bound": 67812, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 5, + "left": 131072, + "rel": "<=", + "bound": 133317, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 5, + "left": 139360, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 5, + "left": 1157497687028090560, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 5, + "left": 6436505280, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 6, + "left": 6, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 6, + "left": 6, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 6, + "left": 131072, + "rel": ">=", + "bound": 67844, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 6, + "left": 131072, + "rel": "<=", + "bound": 133381, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 6, + "left": 213184, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 6, + "left": 1157497687028238208, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 6, + "left": 6436652928, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 7, + "left": 7, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 7, + "left": 7, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 7, + "left": 131072, + "rel": ">=", + "bound": 67908, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 7, + "left": 131072, + "rel": "<=", + "bound": 133509, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 7, + "left": 360832, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 7, + "left": 1157497687028533504, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 7, + "left": 6436948224, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 8, + "left": 8, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 8, + "left": 8, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 8, + "left": 131072, + "rel": ">=", + "bound": 68036, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 8, + "left": 131072, + "rel": "<=", + "bound": 133765, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 8, + "left": 656128, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 8, + "left": 1157497687029124096, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 8, + "left": 6437538816, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 9, + "left": 9, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 9, + "left": 9, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 9, + "left": 131072, + "rel": ">=", + "bound": 68295, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 9, + "left": 131072, + "rel": "<=", + "bound": 134283, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 9, + "left": 1246720, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 9, + "left": 1157497687030305280, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 9, + "left": 6438720000, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 10, + "left": 10, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 10, + "left": 10, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 10, + "left": 131072, + "rel": ">=", + "bound": 68819, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 10, + "left": 131072, + "rel": "<=", + "bound": 135331, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 10, + "left": 2427904, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 10, + "left": 1157497687032667648, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 10, + "left": 6441082368, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 11, + "left": 11, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 11, + "left": 11, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 11, + "left": 131072, + "rel": ">=", + "bound": 69892, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 11, + "left": 131072, + "rel": "<=", + "bound": 137477, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 11, + "left": 4790272, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 11, + "left": 1157497687037392384, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 11, + "left": 6445807104, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-policy-sh sh>=4", + "sh": 12, + "left": 12, + "rel": ">=", + "bound": 4, + "ok": true + }, + { + "name": "af-policy-sh sh<=12", + "sh": 12, + "left": 12, + "rel": "<=", + "bound": 12, + "ok": true + }, + { + "name": "af-policy-kF rows>=u0+nHD", + "sh": 12, + "left": 131072, + "rel": ">=", + "bound": 72144, + "ok": true + }, + { + "name": "af-policy-kF rows<=u0+2nHD", + "sh": 12, + "left": 131072, + "rel": "<=", + "bound": 141981, + "ok": true + }, + { + "name": "af-policy-C", + "sh": 12, + "left": 9515008, + "rel": "<=", + "bound": 16777216, + "ok": true + }, + { + "name": "af-no-wrap-N3", + "sh": 12, + "left": 1157497687046841856, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N4", + "sh": 12, + "left": 6455256576, + "rel": "<", + "bound": 8589934592, + "ok": true + }, + { + "name": "af-no-wrap-N1", + "sh": null, + "left": 4416366444800, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N2 first", + "sh": null, + "left": 288232850187354240, + "rel": "<", + "bound": 2305843009213693951, + "ok": true + }, + { + "name": "af-no-wrap-N2 radix", + "sh": null, + "left": 262528, + "rel": "<", + "bound": 1048576, + "ok": true + }, + { + "name": "af-no-wrap-N5", + "sh": null, + "left": 4415297945600, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N6", + "sh": null, + "left": 565200528932865, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + }, + { + "name": "af-no-wrap-N9", + "sh": null, + "left": 131072, + "rel": "<", + "bound": 1152921504606846976, + "ok": true + } + ] + } + ] +} diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-describe.json b/experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-describe.json new file mode 100644 index 00000000..4df17fda --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-describe.json @@ -0,0 +1,8 @@ +{ + "t_start": "2026-11-29T02:53:56Z", + "suite": "test_describe.py", + "tests": 18, + "failures": 0, + "errors": 0, + "ok": true +} diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-n4.json b/experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-n4.json new file mode 100644 index 00000000..8fbbce81 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-n4.json @@ -0,0 +1,8 @@ +{ + "t_start": "2026-11-29T02:53:56Z", + "suite": "test_n4_arith.py", + "tests": 29, + "failures": 0, + "errors": 0, + "ok": true +} From 0013feab3b882b19d4aba92be6f15b9a8e2639c6 Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:00:36 +0000 Subject: [PATCH 04/12] attnrule: PREREG amendment A2 (post hoc headroom description, rule unchanged) and headroom.py, before its run --- .../PREREG.md | 7 ++ .../headroom.py | 77 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/headroom.py diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md index ab80bd08..8a7e148f 100644 --- a/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md +++ b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md @@ -92,3 +92,10 @@ Written after the code and its tests exist and before either script has touched - **The check against PR #206's five clamp locations.** The committed record is the integer RNE(x 2^E) at the arm's exponent, not x. So the entry's size at the rule's exponent is known only to within half a unit of the arm's grid, scaled. The check reports `fits` only if the whole interval is inside the rule's clamp and `undecided` if the clamp falls inside the interval. It is a check; step 5 stands (no adjustment). - **Where the value clamp enters outside `shape()`.** Metric A's "layer-side sites" is implemented as the site "o" of `cp_verify.cpp` (`q9`: A = dq x BC x BWw, where BC bounds a cell of o), evaluated for BC = 2,048 and 4,096 at every shift the KL range test admits, for each digit form and for 4 and 5 residual-stream limbs, with dq = 6,144. The clamp table's row size (FC shape with a 13-bit output) is reported as a number, not as a condition of the verifier. - **Run files.** `runs/describe.json` (the registered run), `runs/n4-report.json`, `runs/unit-tests-n4.json`, `runs/unit-tests-describe.json`. Each is written once; the scripts refuse to overwrite. + +### A2, 2026-11-29T03:00Z, AFTER the registered run and after its numbers were read (one post hoc descriptive script; no verdict depends on it; the rule is not changed) + +- **What was noticed.** `runs/describe.json` reports that all five of PR #206's clamp locations fit the rule. Reading it against PR #178's table showed something the registered check does not say: at layer 23 the held-out value entry (RNE 2,317 at C2047's exponent) is 2,317 / 1,772 = 1.3076 times the in-sample maximum at the same exponent, which is MORE than the registered value margin 5/4. The entry fits under the rule only because a power-of-two exponent leaves more headroom than the margin asks for at that layer, not because the margin covers it. +- **What is added.** `headroom.py`: per layer and tensor, the rule's actual headroom CL_t / (mx_t 2^E_t) as an exact fraction of committed numbers, the layers where it is below the largest overshoot ratio among PR #206's five reported locations, and which layers gain a value bit over C2047. Output `runs/headroom.json`, written once. It uses PR #206 only for those five locations (already seen, already disclosed). +- **What does not change.** Decision procedure step 5 stands: the margin grid, the margins and the rule are not adjusted. Criteria A1, A2, B and C are judged as registered. The script's output goes in RESULTS as a post hoc description and as a stated weakness of the margin rule. +- **Not debugged on registered data.** The script has no test of its own; its one function is a three-term exact fraction. Its first run on the committed records is the run that is committed. diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/headroom.py b/experiments/20261129-241-qwen-attn-rescue-rule/headroom.py new file mode 100644 index 00000000..c9a740e0 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/headroom.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Post hoc, descriptive (PREREG Amendment A2): the headroom the chosen rule actually leaves per layer and tensor. + +The registered margin m_t only sets a floor. Because exponents are powers of two, the real headroom of a layer is +CL_t / (mx_t 2^E_t), anywhere from m_t up to just under 2 m_t. This script computes it exactly from PR #178's +committed mx values and the exponents in runs/describe.json, and compares it with the overshoot ratios at the +five clamp locations PR #206 reports (held-out RNE maximum over PR #178's in-sample RNE maximum of the same arm, +layer and tensor). Reads committed files only. No verdict depends on it. + + headroom.py (writes once) +""" +import json +import sys +import time +from fractions import Fraction +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import describe as D # noqa: E402 + + +def headroom(mx, E, cl): + """CL / (mx 2^E) as an exact fraction: how far above the in-sample maximum an entry may go before it clamps + (up to the half-unit of rounding).""" + return Fraction(cl) / (Fraction(mx) * Fraction(2) ** E) + + +def run(runs, locations, describe_json): + L, C, P, prompts = D.load(runs) + desc = json.loads(Path(describe_json).read_text()) + over = [] + for e in json.loads(Path(locations).read_text())["clamped_entries"]: + ins = L[(e["arm"], e["layer"])][e["tensor"] + "_maxw"] + over.append(dict(arm=e["arm"], layer=e["layer"], tensor=e["tensor"], prompt=e["prompt"], + heldout_rne=e["max_abs_rne"], insample_rne=ins, ratio=e["max_abs_rne"] / ins, + ratio_exact=[e["max_abs_rne"], ins])) + worst = {t: max([Fraction(*o["ratio_exact"]) for o in over if o["tensor"] == t], default=None) for t in D.TENSORS} + margins = {t: Fraction(*desc["margins"][t]) for t in D.TENSORS} + out = dict(t_start=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), + note="post hoc, descriptive; PR #206's five reported clamp locations were seen before registration", + seen_overshoots=over, + worst_seen_overshoot={t: (None if w is None else float(w)) for t, w in worst.items()}, + margin={t: float(m) for t, m in margins.items()}, + margin_covers_worst_seen={t: (None if worst[t] is None else bool(margins[t] >= worst[t])) + for t in D.TENSORS}, + layouts={}) + for name, (cl_qk, cl_v) in D.RULE_LAYOUTS.items(): + tab = desc["rule"]["exponents"][name] + rows, below = {}, {t: [] for t in D.TENSORS} + for l in D.ATT_LAYERS: + rec, r = L[("C2047", l)], tab[str(l)] + h = dict(q=headroom(rec["mx_q"], r["Eq"], cl_qk), k=headroom(rec["mx_k"], r["Ek"], cl_qk), + v=headroom(rec["mx_v"], r["Ev"], cl_v)) + rows[l] = dict(headroom={t: float(h[t]) for t in D.TENSORS}, + v_bits_gained_vs_C2047=r["Ev"] - rec["Ev"], + q_bits_lost_vs_C2047=rec["Eq"] - r["Eq"], k_bits_lost_vs_C2047=rec["Ek"] - r["Ek"]) + for t in D.TENSORS: + if h[t] < margins[t]: + raise AssertionError("headroom under the registered margin: layer %d %s" % (l, t)) + if worst[t] is not None and h[t] < worst[t]: + below[t].append(l) + out["layouts"][name] = dict( + per_layer=rows, layers_with_headroom_below_worst_seen=below, + v_bits_gained_layers=[l for l in D.ATT_LAYERS if rows[l]["v_bits_gained_vs_C2047"] > 0], + v_bits_not_gained_layers=[l for l in D.ATT_LAYERS if rows[l]["v_bits_gained_vs_C2047"] <= 0], + min_headroom={t: min(rows[l]["headroom"][t] for l in D.ATT_LAYERS) for t in D.TENSORS}) + return out + + +if __name__ == "__main__": + if len(sys.argv) != 5: + sys.exit(__doc__) + dst = Path(sys.argv[4]) + if dst.exists(): + sys.exit("REFUSED: %s exists (run files are written once)" % dst.name) + dst.write_text(json.dumps(run(sys.argv[1], sys.argv[2], sys.argv[3]), indent=1) + "\n") + print("wrote", dst.name) From 686e058644adfa4419d01487bb4f222295fcf963 Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:03:19 +0000 Subject: [PATCH 05/12] attnrule: post hoc headroom run (runs/headroom.json), written once --- .../runs/headroom.json | 482 ++++++++++++++++++ 1 file changed, 482 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json b/experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json new file mode 100644 index 00000000..08902dc7 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json @@ -0,0 +1,482 @@ +{ + "t_start": "2026-11-29T03:01:09Z", + "note": "post hoc, descriptive; PR #206's five reported clamp locations were seen before registration", + "seen_overshoots": [ + { + "arm": "C1665", + "layer": 11, + "tensor": "q", + "prompt": "h03-code-js", + "heldout_rne": 1685, + "insample_rne": 1665, + "ratio": 1.012012012012012, + "ratio_exact": [ + 1685, + 1665 + ] + }, + { + "arm": "C2047", + "layer": 23, + "tensor": "v", + "prompt": "h07-code-sql", + "heldout_rne": 2317, + "insample_rne": 1772, + "ratio": 1.3075620767494356, + "ratio_exact": [ + 2317, + 1772 + ] + }, + { + "arm": "C1665", + "layer": 59, + "tensor": "v", + "prompt": "h02-prose-paragraph", + "heldout_rne": 1696, + "insample_rne": 1512, + "ratio": 1.1216931216931216, + "ratio_exact": [ + 1696, + 1512 + ] + }, + { + "arm": "C1665", + "layer": 59, + "tensor": "v", + "prompt": "h07-code-sql", + "heldout_rne": 1679, + "insample_rne": 1512, + "ratio": 1.1104497354497354, + "ratio_exact": [ + 1679, + 1512 + ] + }, + { + "arm": "C1665", + "layer": 63, + "tensor": "k", + "prompt": "h03-code-js", + "heldout_rne": 1667, + "insample_rne": 1608, + "ratio": 1.0366915422885572, + "ratio_exact": [ + 1667, + 1608 + ] + } + ], + "worst_seen_overshoot": { + "q": 1.012012012012012, + "k": 1.0366915422885572, + "v": 1.3075620767494356 + }, + "margin": { + "q": 1.125, + "k": 1.125, + "v": 1.25 + }, + "margin_covers_worst_seen": { + "q": true, + "k": true, + "v": false + }, + "layouts": { + "narrow-1665": { + "per_layer": { + "3": { + "headroom": { + "q": 1.2169771170343457, + "k": 2.1210791383922145, + "v": 2.2673309156654597 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 1 + }, + "7": { + "headroom": { + "q": 1.2275873637403034, + "k": 1.8254706800561482, + "v": 1.8910676282125825 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 1 + }, + "11": { + "headroom": { + "q": 2.0004810532081945, + "k": 1.7879787320207459, + "v": 1.692650572338795 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 1 + }, + "15": { + "headroom": { + "q": 1.2279924382924188, + "k": 1.452093879545849, + "v": 2.368984561082654 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "19": { + "headroom": { + "q": 1.4152943218589449, + "k": 1.4344395481019123, + "v": 1.6034536464878557 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "23": { + "headroom": { + "q": 1.9422780817589356, + "k": 1.2845245317744132, + "v": 2.310628860876736 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + }, + "27": { + "headroom": { + "q": 1.1843393738249905, + "k": 1.201041635835013, + "v": 2.3099578026240684 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "31": { + "headroom": { + "q": 2.2248756746011136, + "k": 1.1292720729580965, + "v": 1.4951003120709367 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + }, + "35": { + "headroom": { + "q": 2.2053558289010304, + "k": 1.3157398630512664, + "v": 1.6705741829427356 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + }, + "39": { + "headroom": { + "q": 2.044336343004841, + "k": 1.2481667043447222, + "v": 1.9888990221523708 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + }, + "43": { + "headroom": { + "q": 1.886390028540137, + "k": 1.29623104540693, + "v": 2.319950721032939 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + }, + "47": { + "headroom": { + "q": 1.9307820062140393, + "k": 1.423483199406649, + "v": 1.2630807532246056 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + }, + "51": { + "headroom": { + "q": 1.9411299709619116, + "k": 1.5293200613647053, + "v": 1.2994932557921346 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + }, + "55": { + "headroom": { + "q": 1.7961476453969316, + "k": 1.7181338438906109, + "v": 1.8336001141384415 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 1 + }, + "59": { + "headroom": { + "q": 1.7101066525101742, + "k": 1.7788815289642157, + "v": 1.3539812168047247 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 1 + }, + "63": { + "headroom": { + "q": 1.8292335603285736, + "k": 2.070633565636181, + "v": 1.9188046913717278 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 1 + } + }, + "layers_with_headroom_below_worst_seen": { + "q": [], + "k": [], + "v": [ + 47, + 51 + ] + }, + "v_bits_gained_layers": [ + 7, + 11, + 19, + 31, + 35, + 39, + 47, + 51, + 55, + 59, + 63 + ], + "v_bits_not_gained_layers": [ + 3, + 15, + 23, + 27, + 43 + ], + "min_headroom": { + "q": 1.1843393738249905, + "k": 1.1292720729580965, + "v": 1.2630807532246056 + } + }, + "wide33": { + "per_layer": { + "3": { + "headroom": { + "q": 1.4961874826242076, + "k": 1.303858557444103, + "v": 2.2673309156654597 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "7": { + "headroom": { + "q": 1.5092320321780188, + "k": 2.2442873766215827, + "v": 1.8910676282125825 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 1 + }, + "11": { + "headroom": { + "q": 1.2297251399150673, + "k": 2.1981936723402202, + "v": 1.692650572338795 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 1 + }, + "15": { + "headroom": { + "q": 1.5097300427535023, + "k": 1.7852469498080197, + "v": 2.368984561082654 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "19": { + "headroom": { + "q": 1.7400044905977536, + "k": 1.7635421951739427, + "v": 1.6034536464878557 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "23": { + "headroom": { + "q": 1.1939469169250874, + "k": 1.5792322621875217, + "v": 2.310628860876736 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "27": { + "headroom": { + "q": 1.456061680612466, + "k": 1.4765959330656286, + "v": 2.3099578026240684 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "31": { + "headroom": { + "q": 1.367663815588132, + "k": 1.3883603203274617, + "v": 1.4951003120709367 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "35": { + "headroom": { + "q": 1.3556646792073301, + "k": 1.6176093091086743, + "v": 1.6705741829427356 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "39": { + "headroom": { + "q": 1.256683631871144, + "k": 1.5345328791553432, + "v": 1.9888990221523708 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "43": { + "headroom": { + "q": 1.159591708234733, + "k": 1.5936245945633547, + "v": 2.319950721032939 + }, + "v_bits_gained_vs_C2047": 0, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "47": { + "headroom": { + "q": 1.1868801101261677, + "k": 1.7500721376488952, + "v": 1.2630807532246056 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "51": { + "headroom": { + "q": 1.193241156324034, + "k": 1.8801910904585897, + "v": 1.2994932557921346 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 0, + "k_bits_lost_vs_C2047": 0 + }, + "55": { + "headroom": { + "q": 2.208236774851363, + "k": 2.112324311377826, + "v": 1.8336001141384415 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 1 + }, + "59": { + "headroom": { + "q": 2.102455446059055, + "k": 2.187009303177027, + "v": 1.3539812168047247 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 1 + }, + "63": { + "headroom": { + "q": 2.248913572367922, + "k": 1.2728489215787573, + "v": 1.9188046913717278 + }, + "v_bits_gained_vs_C2047": 1, + "q_bits_lost_vs_C2047": 1, + "k_bits_lost_vs_C2047": 0 + } + }, + "layers_with_headroom_below_worst_seen": { + "q": [], + "k": [], + "v": [ + 47, + 51 + ] + }, + "v_bits_gained_layers": [ + 7, + 11, + 19, + 31, + 35, + 39, + 47, + 51, + 55, + 59, + 63 + ], + "v_bits_not_gained_layers": [ + 3, + 15, + 23, + 27, + 43 + ], + "min_headroom": { + "q": 1.159591708234733, + "k": 1.2728489215787573, + "v": 1.2630807532246056 + } + } + } +} From 685ac9a88ca7d25f8d94bb180d04f9918899309b Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:45:14 +0000 Subject: [PATCH 06/12] attnrule: PREREG amendment A3 (post hoc: is the rule's clamp count on the held-out prompts already implied; rule unchanged) and implied_clamps.py, before its run --- .../PREREG.md | 10 +++ .../implied_clamps.py | 89 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/implied_clamps.py diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md index 8a7e148f..56db1d7b 100644 --- a/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md +++ b/experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md @@ -99,3 +99,13 @@ Written after the code and its tests exist and before either script has touched - **What is added.** `headroom.py`: per layer and tensor, the rule's actual headroom CL_t / (mx_t 2^E_t) as an exact fraction of committed numbers, the layers where it is below the largest overshoot ratio among PR #206's five reported locations, and which layers gain a value bit over C2047. Output `runs/headroom.json`, written once. It uses PR #206 only for those five locations (already seen, already disclosed). - **What does not change.** Decision procedure step 5 stands: the margin grid, the margins and the rule are not adjusted. Criteria A1, A2, B and C are judged as registered. The script's output goes in RESULTS as a post hoc description and as a stated weakness of the margin rule. - **Not debugged on registered data.** The script has no test of its own; its one function is a three-term exact fraction. Its first run on the committed records is the run that is committed. + +### A3, 2026-11-29T03:45Z, AFTER all earlier runs were read (one more post hoc descriptive script; no verdict depends on it; the rule is not changed) + +Written by a continuation instance of this lane (the first instance reached its run-time limit after committing `runs/headroom.json`). + +- **What was noticed, while drafting the future run's registration text.** Under the narrow layout the rule's exponents look, layer by layer, no finer than PR #178's C1665 arm for q and k, and exactly one bit finer for v with a clamp of 4,095 instead of 1,665. If that holds on all 16 layers, every entry that would clamp under the rule also clamped in PR #206's C1665 arm on the same inputs. PR #206 reports four clamped entries in that arm and `runs/describe.json` says all four fit under the rule. The rule's clamp count on PR #206's eight prompts would then be implied (zero) by numbers already committed, and a later run on those prompts could not test the margin at all. +- **How it was noticed, disclosed.** Two read-only helper scripts outside the repository compared the exponent tables and printed PR #206's clamp list; one of them also summed the per-layer clamp counts in PR #206's `runs/layers.jsonl` (totals 1 and 4, the figures PR #206's RESULTS already reports). That sum is a use of a PR #206 file other than the location list; it gave nothing beyond the reported totals, and the committed script does not read that file. +- **What is added.** `implied_clamps.py`: for each layout and each PR #178 arm, the layers and tensors where the rule's clamp threshold in real units, `(CL + 1/2) / 2^E` as an exact fraction, is below the arm's; and, where it is nowhere below, the implied clamp count. Output `runs/implied-clamps.json`, written once. From PR #206 it takes only the five reported clamp locations. It relies on two of PR #206's own statements without re-deriving them: that its clamp list is complete and that it used PR #178's exponents unchanged. +- **What does not change.** The rule, the margins and criteria A1, A2, B and C. The output goes in RESULTS as a post hoc description and in `FUTURE-PREREG.md` as a disclosure. +- **Not debugged on registered data.** The script has no test of its own. Its first run on the committed records is the run that is committed. The helper comparison described above did see the answer first; that is why this is labelled post hoc. diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/implied_clamps.py b/experiments/20261129-241-qwen-attn-rescue-rule/implied_clamps.py new file mode 100644 index 00000000..0cc758b1 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/implied_clamps.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +"""Post hoc, descriptive (PREREG Amendment A3): is the rule's clamp count on PR #206's eight held-out prompts +already implied by committed numbers? + +An entry x of a tensor clamps under (clamp CL, exponent E) iff |RNE(x 2^E)| > CL. For an odd CL a tie at CL + 1/2 +rounds to the even CL + 1, so this is |x| >= (CL + 1/2) / 2^E: a threshold in real units, compared here as an exact +fraction. If the rule's threshold is at or above the threshold of an arm that PR #206 ran with frozen scales, then +every entry that would clamp under the rule also clamped in that arm, on the same inputs. + +What is taken from PR #206, and only this: the clamped entries it reports (runs/locations.json, `clamped_entries`, +the five locations already seen and disclosed). That the list is complete (1 entry in arm C2047, 4 in arm C1665, +over all 16 layers and 8 prompts) and that PR #206 used PR #178's exponents unchanged (its validity check V3) are +PR #206's own statements (its RESULTS.md section 2); they are relied on here, not re-derived. + +Reads committed files only. Runs no model. No verdict depends on it. + + implied_clamps.py (writes once) +""" +import json +import sys +import time +from fractions import Fraction +from pathlib import Path + +ARMS = {"C2047": 2047, "C1665": 1665} +PR206_REPORTED = {"C2047": 1, "C1665": 4} # experiments/20261114-204-int-attn-heldout/RESULTS.md section 2 +ATT_LAYERS = tuple(range(3, 64, 4)) +TENSORS = ("q", "k", "v") + + +def threshold(cl, E): + """The smallest |x| that clamps under (cl, E), as an exact fraction. cl must be odd (see the docstring).""" + if cl % 2 != 1: + raise ValueError("threshold() is written for an odd clamp") + return (Fraction(cl) + Fraction(1, 2)) / Fraction(2) ** E + + +def run(runs178, locations, describe_json): + L = {} + for line in (Path(runs178) / "layers.jsonl").read_text().splitlines(): + if line.strip(): + r = json.loads(line) + L[(r["arm"], r["layer"])] = r + desc = json.loads(Path(describe_json).read_text()) + entries = json.loads(Path(locations).read_text())["clamped_entries"] + listed = {a: sum(e["count"] for e in entries if e["arm"] == a) for a in ARMS} + if listed != PR206_REPORTED: + raise AssertionError("location list %s differs from PR #206's reported totals %s" % (listed, PR206_REPORTED)) + fits = {(c["arm"], c["layer"], c["prompt"], c["tensor"], c["head"]): c["covered"] + for c in desc["check_pr206_clamp_locations"]} + out = dict(t_start=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), + note="post hoc, descriptive; exact fractions of committed numbers; nothing measured; holds for the " + "same inputs only (the same eight prompts through the same reference forward); relies on PR " + "#206's statements that its clamp list is complete and its exponents were PR #178's", + pr206_clamped_entries_listed=listed, layouts={}) + for name, cl in desc["rule"]["clamps"].items(): + tab = desc["rule"]["exponents"][name] + res = {} + for arm, acl in ARMS.items(): + below = {t: [] for t in TENSORS} + for l in ATT_LAYERS: + r, a = tab[str(l)], L[(arm, l)] + for t, rcl in (("q", cl["qk"]), ("k", cl["qk"]), ("v", cl["v"])): + if not threshold(rcl, r["E" + t]) >= threshold(acl, a["E" + t]): + below[t].append(l) + dominated = not any(below.values()) + ent = [] + for e in entries: + if e["arm"] == arm: + cov = fits[(e["arm"], e["layer"], e["prompt"], e["tensor"], e["head"])][name] + ent.append(dict(layer=e["layer"], prompt=e["prompt"], tensor=e["tensor"], head=e["head"], + count=e["count"], fits_rule=cov["fits"], undecided=cov["undecided"])) + all_fit = all(x["fits_rule"] and x["count"] == 1 for x in ent) + res[arm] = dict(layers_where_rule_threshold_is_below_arm=below, + rule_clamp_implies_arm_clamp_on_every_layer_and_tensor=dominated, + arm_clamped_entries=ent, + implied_rule_clamp_count_on_pr206_prompts=(0 if dominated and all_fit else None)) + out["layouts"][name] = res + return out + + +if __name__ == "__main__": + if len(sys.argv) != 5: + sys.exit(__doc__) + dst = Path(sys.argv[4]) + if dst.exists(): + sys.exit("REFUSED: %s exists (run files are written once)" % dst.name) + dst.write_text(json.dumps(run(sys.argv[1], sys.argv[2], sys.argv[3]), indent=1) + "\n") + print("wrote", dst.name) From 3fd5f0e9250b703f43d426031e5e096c299418e1 Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:46:11 +0000 Subject: [PATCH 07/12] attnrule: post hoc implied-clamps run (runs/implied-clamps.json), written once --- .../runs/implied-clamps.json | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json b/experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json new file mode 100644 index 00000000..d68794a0 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json @@ -0,0 +1,170 @@ +{ + "t_start": "2026-11-29T03:45:35Z", + "note": "post hoc, descriptive; exact fractions of committed numbers; nothing measured; holds for the same inputs only (the same eight prompts through the same reference forward); relies on PR #206's statements that its clamp list is complete and its exponents were PR #178's", + "pr206_clamped_entries_listed": { + "C2047": 1, + "C1665": 4 + }, + "layouts": { + "narrow-1665": { + "C2047": { + "layers_where_rule_threshold_is_below_arm": { + "q": [ + 3, + 7, + 15, + 19, + 27 + ], + "k": [ + 15, + 19, + 23, + 27, + 31, + 35, + 39, + 43, + 47, + 51 + ], + "v": [] + }, + "rule_clamp_implies_arm_clamp_on_every_layer_and_tensor": false, + "arm_clamped_entries": [ + { + "layer": 23, + "prompt": "h07-code-sql", + "tensor": "v", + "head": 2, + "count": 1, + "fits_rule": true, + "undecided": false + } + ], + "implied_rule_clamp_count_on_pr206_prompts": null + }, + "C1665": { + "layers_where_rule_threshold_is_below_arm": { + "q": [], + "k": [], + "v": [] + }, + "rule_clamp_implies_arm_clamp_on_every_layer_and_tensor": true, + "arm_clamped_entries": [ + { + "layer": 11, + "prompt": "h03-code-js", + "tensor": "q", + "head": 5, + "count": 1, + "fits_rule": true, + "undecided": false + }, + { + "layer": 59, + "prompt": "h02-prose-paragraph", + "tensor": "v", + "head": 1, + "count": 1, + "fits_rule": true, + "undecided": false + }, + { + "layer": 59, + "prompt": "h07-code-sql", + "tensor": "v", + "head": 1, + "count": 1, + "fits_rule": true, + "undecided": false + }, + { + "layer": 63, + "prompt": "h03-code-js", + "tensor": "k", + "head": 3, + "count": 1, + "fits_rule": true, + "undecided": false + } + ], + "implied_rule_clamp_count_on_pr206_prompts": 0 + } + }, + "wide33": { + "C2047": { + "layers_where_rule_threshold_is_below_arm": { + "q": [], + "k": [], + "v": [] + }, + "rule_clamp_implies_arm_clamp_on_every_layer_and_tensor": true, + "arm_clamped_entries": [ + { + "layer": 23, + "prompt": "h07-code-sql", + "tensor": "v", + "head": 2, + "count": 1, + "fits_rule": true, + "undecided": false + } + ], + "implied_rule_clamp_count_on_pr206_prompts": 0 + }, + "C1665": { + "layers_where_rule_threshold_is_below_arm": { + "q": [ + 23, + 43, + 47, + 51 + ], + "k": [], + "v": [] + }, + "rule_clamp_implies_arm_clamp_on_every_layer_and_tensor": false, + "arm_clamped_entries": [ + { + "layer": 11, + "prompt": "h03-code-js", + "tensor": "q", + "head": 5, + "count": 1, + "fits_rule": true, + "undecided": false + }, + { + "layer": 59, + "prompt": "h02-prose-paragraph", + "tensor": "v", + "head": 1, + "count": 1, + "fits_rule": true, + "undecided": false + }, + { + "layer": 59, + "prompt": "h07-code-sql", + "tensor": "v", + "head": 1, + "count": 1, + "fits_rule": true, + "undecided": false + }, + { + "layer": 63, + "prompt": "h03-code-js", + "tensor": "k", + "head": 3, + "count": 1, + "fits_rule": true, + "undecided": false + } + ], + "implied_rule_clamp_count_on_pr206_prompts": null + } + } + } +} From da5e748919a788486ecc5811c487309be2484f11 Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:55:20 +0000 Subject: [PATCH 08/12] attnrule: RULE.md, FUTURE-PREREG.md, RESULTS.md, README.md, ENV.json (rule on paper, not run; headroom and implied-clamp findings reported as they stand) --- .../ENV.json | 48 +++++ .../FUTURE-PREREG.md | 111 +++++++++++ .../README.md | 57 ++++++ .../RESULTS.md | 181 ++++++++++++++++++ .../RULE.md | 155 +++++++++++++++ 5 files changed, 552 insertions(+) create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/ENV.json create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/README.md create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md create mode 100644 experiments/20261129-241-qwen-attn-rescue-rule/RULE.md diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/ENV.json b/experiments/20261129-241-qwen-attn-rescue-rule/ENV.json new file mode 100644 index 00000000..53334511 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/ENV.json @@ -0,0 +1,48 @@ +{ + "experiment": "20261129-241-qwen-attn-rescue-rule", + "kind": "desk work plus deterministic CPU scripts on committed files and on constants; no model run, no weights fetched, no proof built; the rule written down here has not been run", + "status": "complete: registered items A1, A2, B, C judged; two post hoc descriptive scripts (PREREG amendments A2, A3)", + "commits": { + "base": "02d62eb63760fcaf68f47099c70f42aba04a7707 (main)", + "prereg": "94bd7df66fc7af2b14fd0e821dc8b08f5e0e9b3d (first commit, alone)", + "code_and_amendment_A1": "9d083cda470e603d5ab5df8531ae8a713c14bc5b (n4_arith.py, describe.py, both test files; before any registered run)", + "registered_runs": "411f4a50a2bb105606b91825c92cab2303728900 (runs/describe.json, runs/n4-report.json, two test receipts)", + "amendment_A2_and_headroom_py": "0013feab3b882b19d4aba92be6f15b9a8e2639c6 (before its run)", + "headroom_run": "686e058644adfa4419d01487bb4f222295fcf963", + "amendment_A3_and_implied_clamps_py": "685ac9a88ca7d25f8d94bb180d04f9918899309b (before its run)", + "implied_clamps_run": "3fd5f0e9250b703f43d426031e5e096c299418e1" + }, + "inputs_read": { + "pr178_layers_jsonl": "experiments/20261113-176-qwen-int-attn/runs/layers.jsonl sha256 73404d471b069f1944d4a518e7ea8544d4a2c53a17bd3d554ca0f2a677713aee", + "pr178_cells_and_prompt_rows": "experiments/20261113-176-qwen-int-attn/runs/cells.jsonl and runs/prompt-rows.jsonl (as on main at the base commit; hashes not recorded here)", + "pr206_locations_json": "experiments/20261114-204-int-attn-heldout/runs/locations.json sha256 a11ece9dffcda8f93ee7a25d6189188acf12bd80ca09a476df08cb08f574bcd1 (only its clamped_entries list)", + "source_transcribed": "verifier/src/vf_attention_shape.h (AFork::shape, shd) and the site o of verifier/src/cp_verify.cpp, read at the base commit, not modified" + }, + "outputs": { + "runs/describe.json": "sha256 968e5d305f65a694f04b71a333c1a7eda0dd29b4dc58433021fc4a774f4d95a7", + "runs/n4-report.json": "sha256 708229f81c27b28569a1e5e3cc00f94d53a1b53d8933d30d31f5edefd0a15022", + "runs/headroom.json": "sha256 2800f02c0d11791fc3937d084b4bad855009a0d3b7767e4bd225141d3219cee4" + }, + "toolchain": { + "python": "3.12.3, standard library only (json, fractions, math, statistics, unittest); no numpy, no compiled code", + "arithmetic": "Python integers and fractions.Fraction for every bound and every exponent fit; floats appear only in reported ratios and medians of committed float records" + }, + "hardware": { + "cpu": "AMD EPYC-Rome, 16 vCPU KVM VM (results.yaml key cpu-epyc-rome-kvm-16), shared with other lanes and services, loaded", + "os": "Linux x86_64", + "gpu": "none", + "pinning": "the lane was assigned cores 2 to 5; the continuation instance's one run (implied_clamps.py) used taskset -c 2-5; the exact command lines of the first instance's runs were not recorded in its log", + "cost": "not timed or profiled; small scripts on committed JSON (the lane log notes 0.3 s for the 29 arithmetic tests); no heavy-job slot used" + }, + "seeds": [ + "none: every script is deterministic", + "test_describe.py builds its synthetic records from fixed made-up values, no random generator" + ], + "repeats": "one run per script, no reruns for variance (deterministic; registered as a deviation from the five-run standard); a repeat differs only in t_start", + "process_notes": [ + "the lane was cut by its run-time limit after runs/headroom.json was committed and was finished by a second instance of the same lane", + "one push of the first instance (0013feab) went out before the host-path guard and the scrub had been run on its new files; both were run right after and were clean", + "tables in RULE.md, FUTURE-PREREG.md and RESULTS.md were generated from the committed run files by a helper script kept outside the repository" + ], + "data_on_disk": "none outside the repository; no weights, no activations" +} diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md b/experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md new file mode 100644 index 00000000..14964d2b --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md @@ -0,0 +1,111 @@ +# FUTURE-PREREG: text for the one run that would test rule V13 (issue #241, milestone item 3) + +This is a draft registration, committed as a file so that the run can be registered without a second look at any data. **It is not a registration and nothing here has been run.** The lane that runs it copies the sections below into the PREREG.md of its own experiment directory as that directory's first commit, alone, fills the three marked blanks (issue number, date, base commit), and changes nothing else. A change it needs goes under that file's Amendments, dated, before the run. + +The rule is `RULE.md` of this directory. Its exponents are frozen in `runs/describe.json` (`rule.exponents.narrow-1665`, 16 layers), sha256 `968e5d305f65a694f04b71a333c1a7eda0dd29b4dc58433021fc4a774f4d95a7`. + +--- + +# PREREG: --qwen-attn-v13-heldout + +Issue: # (part of #8). Lane: . Date (UTC): . Base commit:
. + +## What was seen before this registration (disclosed) + +- The rule was chosen from PR #178's in-sample records by the procedure registered in `experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md`. Its author had read both PR #178's and PR #206's per-layer tables before that registration. +- The five clamp locations PR #206 reports on these same eight held-out prompts were seen, and the rule was checked against them (all five fit; `runs/describe.json`, `check_pr206_clamp_locations`). So H_R below is NOT a blind test at those five locations. +- One of them is larger than the rule's value margin covers: layer 23, 2,317 against an in-sample 1,772, a ratio of 1.3076 against a margin of 5/4. The rule was not adjusted (`runs/headroom.json`). The rule's value headroom is below 1.3076 at layers 47 (1.2631) and 51 (1.2995). +- The held-out per-layer medians of PR #206 at the OLD scales were seen. No held-out number at the rule's scales exists. +- **The clamp count of this run on these eight prompts is already implied by committed numbers, so H_R below is not a test of the margin.** Under the narrow layout the rule's exponents are, on all 16 layers, at or below PR #178's C1665 exponents for q and for k, and exactly one above for v with a clamp of 4,095 against 1,665 (`RESULTS.md` section 6 of the rule's directory). So any entry that would clamp under the rule also clamped in PR #206's C1665 arm. That arm reports exactly four clamped entries over all layers and prompts, and all four fit under the rule. A correct evaluator must therefore count zero clamped entries on these prompts. Whether the margin transfers to prompts nobody has looked at is not something this run can show. + +## Hypothesis + +H_F: with the frozen exponents of rule V13 (q and k clamped at 1,665, v clamped at 4,095), upstream's integer attention meets the per-head bar on every one of the 16 full-attention layers of abliterated Qwen3.8-27B on the eight held-out prompts: median rel_y <= 0.01 and max rel_y <= 0.05 over the layer's 192 (prompt, head) cells. + +H_R: with the same frozen exponents, no q, k or v entry exceeds its clamp and no arithmetic guard fails, on every layer and prompt. On these prompts the clamp half is not an open question (see the disclosure above): committed numbers imply zero. Only the guard half is open. + +Each is judged on its own. H_F is falsifiable by one layer. + +## Metric + +- rel_y per (layer, prompt, query head): relative L2 of the integer head output against the float64 head output, as PR #178's `rel_heads` computes it (before reshape, gate and o_proj). 16 layers x 8 prompts x 24 heads = 3,072 cells. +- Clamped entries: the count of q, k and v entries whose RNE exceeds the tensor's own clamp (1,665 for q and k, 4,095 for v), with layer, prompt, tensor and head, as PR #206's `heldout.py` records them. Clamped entries are clamped and the cell is still computed and reported. +- Guard failures: the integer core's own assertions (exact integer scores and accumulators), as recorded by `heldout.py`. +- Descriptive, no bar: pooled median; per-layer max |RNE| / clamp per tensor; the post-gate, post-o_proj relative error per prompt; the same cells in sample (the fit prompts), as a check that the frozen table is the one this file names. + +## Acceptance threshold + +Unchanged from PR #204's registration; no bar is relaxed or added. + +- H_F PASS iff every layer has median rel_y <= 0.01 AND max rel_y <= 0.05 over its 192 cells. +- H_R PASS iff zero clamped entries and zero guard failures over all layers and prompts (all or nothing). +- Validity (both needed for either verdict): V1 the float path's output is bit-equal to PR #88's `q1_forward.attention` on every prompt and layer (as `heldout.py` checks); V2 the two determinism prompts give bit-identical integer outputs when computed twice; V3 the exponents used equal the frozen table on every prompt and layer, and the table's sha256 is the one above. + +Outcomes, all reportable with the same care: both PASS; H_F FAIL (the value bit did not fix the layers, or the narrower q and k cost more than predicted); H_R FAIL by a guard failure; H_R FAIL by a non-zero clamp count (reported as the FAIL it is, and also as a contradiction with committed numbers that the write-up must explain: an evaluator fault, a wrong table, or a wrong statement in PR #206); invalid by V1, V2 or V3. An H_R PASS here must not be reported as "the margin transferred". + +Registered expectation, stated so it can be wrong: the in-sample heuristic of `experiments/20261129-241-qwen-attn-rescue-rule` predicts in-sample medians of 0.00631, 0.00627 and 0.00756 on layers 31, 35 and 39 and 0.00939 on layer 43. That is a prediction for the fit prompts from other layers' one-bit ratios. It is not an acceptance threshold here. + +## Fit and evaluation + +- Fit: none in this run. The exponents were fitted on PR #124's 10 frozen prompts (the `mx_q`, `mx_k`, `mx_v` of PR #178's `runs/layers.jsonl`, sha256 `73404d471b069f1944d4a518e7ea8544d4a2c53a17bd3d554ca0f2a677713aee`) with margins 9/8, 9/8, 5/4, and are read from the frozen table. Nothing is fitted, refitted or adjusted on the evaluation prompts. +- Evaluation: PR #204's eight held-out prompts, `experiments/20261114-204-int-attn-heldout/prompts-heldout.json` (sha256 `5eb89d2366e7e15ad4a330c6b52eebad64b3789423a6e934364b11a8b404f117`), 541 tokens, teacher-forced through the float64 reference forward exactly as in PR #206. +- One arm: V13 under the narrow layout. The wide33 table of `RULE.md` is not run. + +## Code, and the one interface that is missing + +Issue #241 asks for the evaluation "with `heldout.py`". As it stands on main that file cannot run the rule unchanged, for two reasons read from its source: + +1. `heldout.py` and PR #178's `int_attn.arm_prompt` take ONE clamp per arm and apply it to q, k and v. The rule needs 1,665 for q and k and 4,095 for v. +2. `heldout.py` reads its exponents from PR #178's `runs/layers.jsonl` by a pinned hash and refuses any other table. + +So the run needs a new evaluator file in its own experiment directory. Existing files are imported, never edited. The evaluator: + +- imports PR #178's `int_attn.py` unchanged (sha256 `357feafac4f3d6a3786d5ab4f484cd1b69eb29a879a72bbfa48cb6bfa248d0a7`) and calls its `quant` three times with the per-tensor clamp, then its `int_core`, `attn_parts`, `float_o`, `finish`, `rel_heads`, `rel` unchanged; +- reuses by import whatever of PR #206's `heldout.py` can be used unchanged, and has its own versions of at least `load_table` (new path, new hash, per-tensor clamps), `eval_frozen` (three clamps) and the per-layer loop that calls them; how much of the rest can be imported as is was not worked out here; +- has unit tests, written and run before the registered run, on synthetic integer arrays only: that with all three clamps equal to 2,047 and PR #178's own table it reproduces `int_attn.arm_prompt` bit for bit; that an entry of 3,000 in v is not clamped at 4,095 and is clamped at 2,047; that a wrong table hash is refused. +- Debug only on the fixture PR #206 used ("The capital of Italy is", stock layers 0 to 3), which is in neither prompt set. No run of the registered suite, at any size, before the registered run. + +## Kill criterion + +One run. Budget: 60 minutes of elapsed time from the moment the heavy-job gate grants the slot, logged; one hard stop for the lane, fixed at registration. The 60 minutes are a cap, not an estimate. PR #206's run of two arms took 18 min 43 s of wall time with a peak process-tree RSS of 6.09 GB (decimal) on 6 cores of the shared host (its `ENV.json`); how the time splits between the float reference and the integer arms was not measured here. Stop and report exactly where if: a validity check fails; the process tree passes 10 GB RSS; the evaluator needs a change to an existing file. + +## Runs + +One deterministic run, no seeds. Spread is over (prompt, head) cells per layer. Determinism is checked inside the run (V2). Standard 3's five runs do not apply to a deterministic integer computation; stated as a deviation. Run files are written once. + +Resources: CPU only, 6 cores, through the heavy-job gate and the big-memory lock; weights read by HTTP range request one layer at a time and never written to disk, each tensor's SHA-256 checked against the merged manifests of PR #124, exactly as PR #206 did. Checkpoints: `Qwen/Qwen3.8-27B` at 37561816e66b5b9153b1b64c10968c18c1e6f4a0 and `huihui-ai/Huihui-Qwen3.8-27B-abliterated` at 739e3c5b89849f6c238ce1e5b70008612ae42cdd. + +## Prior art + +PR #178 (in sample, both clamps), PR #206 (held out, frozen scales, both axes FAIL), `research/operators/qwen_ops/DH256-ROTARY.md` (the score layouts), and `experiments/20261129-241-qwen-attn-rescue-rule` (the rule, its arithmetic, its stated weakness). Outside the repo: see that directory's PREREG "Prior art". + +## What is NOT in this run + +No proof, no verifier or prover change, no admission. A PASS says the integer arithmetic with these scales is close enough to float on eight prompts, open loop, one block at a time; it says nothing about end-to-end tokens, other prompts, or whether a verifier can admit the three clamps soundly. The alternative PKV is not run. The margin is not tuned and not tested: a test of range transfer needs prompts that were not seen when the rule was written, which is a separate registration and is not designed here. + +## Amendments + +(empty at registration) + +--- + +## The frozen table this text refers to (copied from `RULE.md`, for the reader; the run reads `runs/describe.json`) + +| layer | mx_q | mx_k | mx_v | C2047 fit E_q E_k E_v sh | rule (narrow) E_q E_k E_v sh | headroom q | k | v | wide33 E_q E_k E_v sh | +|---|---|---|---|---|---|---|---|---|---| +| 3 | 0.668039 | 12.2653 | 7.05503 | 11 7 8 10 | 11 6 8 9 | 1.2170 | 2.1211 | 2.2673 | 11 7 8 10 | +| 7 | 0.662265 | 14.2515 | 8.45876 | 11 7 7 10 | 11 6 8 9 | 1.2276 | 1.8255 | 1.8911 | 11 6 8 9 | +| 11 | 0.812793 | 14.5503 | 9.45032 | 11 7 7 10 | 10 6 8 8 | 2.0005 | 1.7880 | 1.6927 | 11 6 8 9 | +| 15 | 0.662047 | 17.9159 | 6.7523 | 11 6 8 9 | 11 6 8 9 | 1.2280 | 1.4521 | 2.3690 | 11 6 8 9 | +| 19 | 0.574431 | 18.1364 | 9.97603 | 11 6 7 9 | 11 6 8 9 | 1.4153 | 1.4344 | 1.6035 | 11 6 8 9 | +| 23 | 0.837149 | 20.2531 | 13.8457 | 11 6 7 9 | 10 6 7 8 | 1.9423 | 1.2845 | 2.3106 | 11 6 7 9 | +| 27 | 0.686449 | 21.6609 | 27.6994 | 11 6 6 9 | 11 6 6 9 | 1.1843 | 1.2010 | 2.3100 | 11 6 6 9 | +| 31 | 0.730817 | 23.0375 | 42.796 | 11 6 5 9 | 10 6 6 8 | 2.2249 | 1.1293 | 1.4951 | 11 6 6 9 | +| 35 | 0.737285 | 19.7726 | 38.3008 | 11 6 5 9 | 10 6 6 8 | 2.2054 | 1.3157 | 1.6706 | 11 6 6 9 | +| 39 | 0.795357 | 20.8431 | 32.1708 | 11 6 5 9 | 10 6 6 8 | 2.0443 | 1.2482 | 1.9889 | 11 6 6 9 | +| 43 | 0.861951 | 20.0702 | 55.1601 | 11 6 5 9 | 10 6 5 8 | 1.8864 | 1.2962 | 2.3200 | 11 6 5 9 | +| 47 | 0.842134 | 18.276 | 50.6574 | 11 6 5 9 | 10 6 6 8 | 1.9308 | 1.4235 | 1.2631 | 11 6 6 9 | +| 51 | 0.837644 | 17.0112 | 49.2379 | 11 6 5 9 | 10 6 6 8 | 1.9411 | 1.5293 | 1.2995 | 11 6 6 9 | +| 55 | 0.905258 | 15.1418 | 34.8955 | 11 7 5 10 | 10 6 6 8 | 1.7961 | 1.7181 | 1.8336 | 10 6 6 8 | +| 59 | 0.950804 | 14.6247 | 94.5129 | 11 7 4 10 | 10 6 5 8 | 1.7101 | 1.7789 | 1.3540 | 10 6 5 8 | +| 63 | 0.888884 | 12.5641 | 133.384 | 11 7 3 10 | 10 6 4 8 | 1.8292 | 2.0706 | 1.9188 | 10 7 4 9 | diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/README.md b/experiments/20261129-241-qwen-attn-rescue-rule/README.md new file mode 100644 index 00000000..6c1d4d91 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/README.md @@ -0,0 +1,57 @@ +# 20261129-241-qwen-attn-rescue-rule + +Issue #241: which single scale rule would fix the three attention layers (31, 35, 39) that miss the per-head fidelity bar under upstream's integer attention on Qwen3.8-27B, chosen only from in-sample evidence and written down with its exact admission arithmetic. + +## What this directory is, in plain language + +- **A rule on paper** (`RULE.md`): one extra bit on the value cell, q and k at the narrow 1,665 clamp, a headroom margin on every exponent. It was selected by a procedure registered before any number was computed (`PREREG.md`), from PR #178's committed in-sample records. +- **Exact arithmetic** (`n4_arith.py`, tested): every no-overflow and policy condition of the attention sub-proof, redone in Python integers at head size 256 for the rule's layout. +- **The text of the one run that would test it** (`FUTURE-PREREG.md`). +- **What it is not.** Nothing here proves anything, and the verifier recomputes nothing here: no proof, no verifier, prover or parameter-file change. **The rule has not been run on any model.** No fidelity number exists for it. Read `RESULTS.md` sections 5, 6 and 9 before quoting the PASS: the rule's headroom margin is thinner than a held-out overshoot already on main, and a run on PR #206's prompts cannot test that margin. + +## Files + +| file | what | +|---|---| +| `PREREG.md` | registration (first commit, alone) and amendments A1, A2, A3 | +| `RULE.md` | the rule: integer definition, frozen exponent table, admission arithmetic, what would change for the verifier, the alternative | +| `FUTURE-PREREG.md` | draft registration text for the one run that would test the rule | +| `RESULTS.md` | verdict per registered item, the description of the failing layers, the prediction, the headroom finding, what is not established | +| `ENV.json` | commits, toolchain, hardware, input hashes | +| `n4_arith.py`, `test_n4_arith.py` | exact integer arithmetic for the attention conditions (issue milestone item 4) and its 29 tests | +| `describe.py`, `test_describe.py` | D1, D2, D3, the decision procedure, the rule table, the prediction; 18 tests on synthetic records only | +| `headroom.py` | post hoc (A2): the headroom the rule really leaves per layer and tensor | +| `implied_clamps.py` | post hoc (A3): whether the rule's clamp count on PR #206's prompts is already implied | +| `runs/` | one output file per run, each written once with its UTC start time | + +## Reproduce every number + +From the repository root. Python 3 standard library only; small scripts on committed JSON (not timed). The scripts refuse to overwrite an existing output, so write to a new directory (here `OUT`, any empty directory outside the repository) and compare with `runs/`; only the `t_start` field differs. The exact command lines of the first three registered runs were not recorded when they were made; these are the commands the scripts' own usage text gives. + +``` +E=experiments/20261129-241-qwen-attn-rescue-rule +python3 $E/test_n4_arith.py $OUT/unit-tests-n4.json +python3 $E/test_describe.py $OUT/unit-tests-describe.json +python3 $E/n4_arith.py report $OUT/n4-report.json +python3 $E/describe.py run experiments/20261113-176-qwen-int-attn/runs experiments/20261114-204-int-attn-heldout/runs/locations.json $OUT/describe.json +python3 $E/headroom.py experiments/20261113-176-qwen-int-attn/runs experiments/20261114-204-int-attn-heldout/runs/locations.json $E/runs/describe.json $OUT/headroom.json +python3 $E/implied_clamps.py experiments/20261113-176-qwen-int-attn/runs experiments/20261114-204-int-attn-heldout/runs/locations.json $E/runs/describe.json $OUT/implied-clamps.json +``` + +Inputs read (all on main, none modified): PR #178's `runs/layers.jsonl`, `runs/cells.jsonl`, `runs/prompt-rows.jsonl`; PR #206's `runs/locations.json` (only its five reported clamp locations). + +## Where each number in the write-up lives + +| number | file and key | +|---|---| +| decision, one-bit ratios, margins | `runs/describe.json`: `decision`, `D2_summary`, `D3`, `margins` | +| per-layer description | `runs/describe.json`: `D1`, `D2` | +| rule exponents | `runs/describe.json`: `rule.exponents` (`narrow-1665` is the rule; `wide33` is a second table) | +| predictions and the verdict of B | `runs/describe.json`: `prediction`, `B` | +| condition tables, largest clamps | `runs/n4-report.json`: `layouts`, `max_qk_clamp_n4`, `max_v_clamp_n6`, `n6_left`, `site_o`, `fc_row_max` | +| headroom, seen overshoots | `runs/headroom.json` | +| implied clamp count | `runs/implied-clamps.json` | + +## Limits, stated once more + +Counted and predicted, not built and not measured. Passing the arithmetic is not admission: Qwen's attention is still refused elsewhere (dq != d, partial rotary, theta0, dh > 128). The prediction for layers 31, 35 and 39 is an extrapolation from other layers. The full list is `RESULTS.md` section 9. diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md b/experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md new file mode 100644 index 00000000..0c197899 --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md @@ -0,0 +1,181 @@ +# RESULTS: 20261129-241-qwen-attn-rescue-rule + +Issue #241 (part of #8). Desk work plus small CPU scripts on committed files. **No model was run, no weights were fetched, no proof was built, and the rule this step writes down has not been run.** Every number below is exact arithmetic on constants, or a statistic of PR #178's committed in-sample records, or a prediction computed from them by a registered formula. Predictions are labelled predicted. Nothing here is replicated. + +Base: main 02d62eb63760fcaf68f47099c70f42aba04a7707. Registration: `PREREG.md` (first commit, alone), amendments A1 (before the registered run), A2 and A3 (post hoc, after it). + +## 1. Plain summary + +- Layers 31, 35 and 39 miss the per-head median bar under upstream's integer attention. The registered procedure, applied to PR #178's in-sample records only, picks the value side as the bottleneck: on the layers where only the value exponent differs between PR #178's two arms, the arm with one value bit fewer has a per-cell error 1.76 to 1.92 times as large (median cell ratio per layer); for one query bit the ratio is 1.00 to 1.03, for one key bit 1.03. +- The rule it selects is **V13**: one extra bit on the value cell (clamp 4,095), q and k at the narrow fallback clamp 1,665 with the legacy 32-bit score digit, and a headroom margin of 9/8, 9/8, 5/4 on q, k, v. `RULE.md` has the integer definition and the frozen exponent table. The alternative is one value exponent per key-value head; it is defined but cannot be tabulated from the committed records. +- **Arithmetic: PASS.** Every implemented no-overflow and policy condition of the attention sub-proof holds at dh = 256 for the rule's layout, in exact integers, at every shift 4 to 12. The value clamp enters `shape()` only through N6, which is nowhere near binding. N4 limits q and k to 1,665 and does not see the value cell at all. +- **Prediction: PASS as registered, and it is only a prediction.** The registered heuristic puts every layer's in-sample median at or under 0.01 (largest 0.00939 at layer 43; layers 31, 35, 39 at 0.00631, 0.00627, 0.00756). For the three failing layers it is an extrapolation from other layers. +- **The margin is thinner than an overshoot already seen (post hoc).** One held-out value entry that PR #206 reports is 1.3076 times the in-sample maximum; the registered value margin is 1.25. That entry fits under the rule only because of power-of-two slack at its layer. The rule was not adjusted. Section 5 says what this does to the meaning of the PASS. +- **A later run on PR #206's eight prompts cannot test the margin (post hoc).** Committed numbers already imply that the rule clamps nothing on those prompts. Section 6. + +## 2. Verdict against the registration + +| item | registered criterion | verdict | evidence | +|---|---|---|---| +| A1 | the arithmetic script's unit tests pass and reproduce the constants already on main | **PASS** | `runs/unit-tests-n4.json`: 29 tests, 0 failures, 0 errors. `test_n4_arith.py` class `MainConstants`: PR #176 PREREG's N4 numbers, DH256-ROTARY.md sections 2a, 2c (eight rows), 2d. No constant on main failed to reproduce | +| A2 | the primary rule passes every condition of Metric A at dh = 256, sh 4 to 12, lt = 10, S = 12, rx = 8, narrow layout; and every (lt, S) pair at the largest admitted C | **PASS**, with the scope of Amendment A1 (see below) | `runs/n4-report.json`, `layouts`, entry narrow-1665 with value clamp 4,095: `all_ok` true, `superset_failures` 0 of 182 | +| B | the procedure selects a primary rule and the registered prediction is <= 0.01 on all 16 layers | **PASS** (predicted, not measured) | `runs/describe.json`: `decision` (bottleneck v, primary V13, alternative PKV), `B` (narrow-1665: no layer over the bar, largest 0.009393) | +| C | the rule's integer definition, its admission consequences and the future run's PREREG text are committed as files | **PASS** | `RULE.md`, `FUTURE-PREREG.md` | + +Hypothesis H (desk) is not falsified: a candidate satisfies (i) and the prediction for the selected rule does not exceed 0.01 on any layer. The issue's registered negative ("no candidate keeps N4 at dh = 256 with a cell wide enough") did not occur. + +Scope of A2, two limits. First, the check over the 182 (lt, S) pairs is `superset_ok`: it evaluates the no-overflow conditions N1 to N9 at the largest admitted C with rx = 8, and it does not evaluate the kFD occupancy policy or the C policy for those pairs (both depend on each pair's own u0). Those policy conditions were evaluated at lt = 10, S = 12, rx = 8 only. The criterion's words "every condition ... every (lt, S) pair" are therefore met for N1 to N9 and not shown for the policy rows. Second, Metric A names "the layer-side sites of `cp_verify.cpp` whose bound uses the value clamp". Amendment A1, written before the run, implemented that as the one site "o". For that site no verdict changes when its cell bound goes from 2,048 to 4,096, for any digit form, any shift the range test admits, and 4 or 5 residual-stream limbs (`runs/n4-report.json`, `site_o`, `differs` empty). That is "no verdict changes", not "the site passes for Qwen": which shift a Qwen parameter file would use there is not known. Reading the code for `RULE.md` showed other uses of the same constant `CLAMPED_CELL_BOUND` (`cp_verify.cpp` lines 1450, 1501, 1859) that this step did not evaluate. They are listed in `RULE.md` section 4 and in section 9 below. + +## 3. The failing layers, from PR #178's in-sample records (D1, D2, D3) + +Arm C2047, 10 prompts, 240 (prompt, head) cells per layer, 60 per key-value group. "occupancy" is the largest |RNE| over the clamp 2,047. "paired arms" says which exponents differ between PR #178's arms C2047 and C1665 at that layer; rho is the median over the layer's 240 cells of rel_y(C1665) / rel_y(C2047), with the smallest and largest cell ratio. + +| layer | E_q E_k E_v | occupancy q | k | v | median rel_y | cells > 0.01 (of 240) | kv group medians | group cells > 0.01 (of 60) | prompt median min..max | paired arms | rho (cell ratio min..max) | +|---|---|---|---|---|---|---|---|---|---|---|---| +| 3 | 11 7 8 | 0.668 | 0.767 | 0.882 | 0.00321 | 0 | 0.00395 0.00352 0.00349 0.00250 | 0 0 0 0 | 0.00227..0.00409 | v-only | 1.9153 (1.702..2.030) | +| 7 | 11 7 7 | 0.662 | 0.891 | 0.529 | 0.00528 | 0 | 0.00517 0.00511 0.00463 0.00687 | 0 0 0 0 | 0.00427..0.00626 | k-only | 1.0323 (0.986..1.263) | +| 11 | 11 7 7 | 0.813 | 0.910 | 0.591 | 0.00509 | 0 | 0.00469 0.00517 0.00467 0.00561 | 0 0 0 0 | 0.00443..0.00579 | k-only | 1.0332 (0.946..1.256) | +| 15 | 11 6 8 | 0.662 | 0.560 | 0.845 | 0.00380 | 0 | 0.00361 0.00357 0.00403 0.00388 | 0 0 0 0 | 0.00235..0.00431 | v-only | 1.7566 (1.380..2.011) | +| 19 | 11 6 7 | 0.574 | 0.567 | 0.624 | 0.00531 | 0 | 0.00534 0.00583 0.00570 0.00460 | 0 0 0 0 | 0.00492..0.00624 | same | 1.0000 (1.000..1.000) | +| 23 | 11 6 7 | 0.837 | 0.633 | 0.866 | 0.00454 | 0 | 0.00453 0.00588 0.00442 0.00395 | 0 0 0 0 | 0.00406..0.00535 | mixed | 1.8736 (1.627..2.023) | +| 27 | 11 6 6 | 0.687 | 0.677 | 0.866 | 0.00648 | 0 | 0.00677 0.00673 0.00488 0.00721 | 0 0 0 0 | 0.00562..0.00744 | v-only | 1.9013 (1.575..2.001) | +| 31 | 11 6 5 | 0.731 | 0.720 | 0.669 | 0.01081 | 153 | 0.01121 0.01172 0.01026 0.01044 | 40 46 32 35 | 0.00871..0.01325 | same | 1.0000 (1.000..1.000) | +| 35 | 11 6 5 | 0.738 | 0.618 | 0.599 | 0.01072 | 151 | 0.01256 0.01051 0.01065 0.00935 | 56 43 35 17 | 0.00891..0.01280 | same | 1.0000 (1.000..1.000) | +| 39 | 11 6 5 | 0.796 | 0.652 | 0.503 | 0.01294 | 211 | 0.01594 0.01408 0.01192 0.01027 | 60 60 55 36 | 0.01112..0.01406 | same | 1.0000 (1.000..1.000) | +| 43 | 11 6 5 | 0.862 | 0.627 | 0.862 | 0.00915 | 83 | 0.00997 0.01012 0.00761 0.00933 | 30 31 0 22 | 0.00793..0.01147 | mixed | 1.9680 (1.716..2.039) | +| 47 | 11 6 5 | 0.843 | 0.572 | 0.792 | 0.00843 | 45 | 0.00939 0.00910 0.00764 0.00757 | 21 20 1 3 | 0.00708..0.01008 | q-only | 1.0265 (0.935..1.159) | +| 51 | 11 6 5 | 0.838 | 0.532 | 0.770 | 0.00747 | 21 | 0.00906 0.00605 0.00706 0.00773 | 15 0 6 0 | 0.00581..0.00904 | q-only | 1.0242 (0.941..1.151) | +| 55 | 11 7 5 | 0.906 | 0.947 | 0.546 | 0.00770 | 91 | 0.01219 0.01740 0.00723 0.00678 | 44 47 0 0 | 0.00534..0.01015 | mixed | 1.0312 (0.987..1.147) | +| 59 | 11 7 4 | 0.951 | 0.915 | 0.739 | 0.00951 | 103 | 0.01055 0.00487 0.01259 0.00912 | 40 0 53 10 | 0.00540..0.01060 | mixed | 1.0102 (0.994..1.058) | +| 63 | 11 7 3 | 0.889 | 0.786 | 0.521 | 0.00741 | 4 | 0.00745 0.00594 0.00898 0.00738 | 0 0 4 0 | 0.00685..0.00762 | q-only | 1.0017 (0.995..1.022) | + +What it says: + +- **Which exponent is coarsest relative to its observed maximum.** On layers 31, 35 and 39 the value cell is the least used of the three: occupancy 0.669, 0.599 and 0.503 against 0.73 to 0.80 for q and 0.62 to 0.72 for k. At 0.503, layer 39's largest value entry uses barely more than half of the cell: it misses one more bit by under 1%. +- **Where the per-head error sits.** Not in one key-value group. On layers 31 and 39 all four groups have a median over 0.01; on layer 35 three of four. Counts of cells over 0.01 per group: 40, 46, 32, 35 (layer 31), 56, 43, 35, 17 (layer 35), 60, 60, 55, 36 (layer 39). Group 0 is worst and group 3 best on 35 and 39. The choice of V13 over the per-group exponent was fixed by the registered procedure (step 2) and did not use this spread. Whether a per-group exponent would help cannot be checked: the committed records hold no per-group maxima. +- **Not one prompt either.** The per-prompt medians of layer 39 run from 0.01112 to 0.01406: every prompt is over the bar. +- **One-bit ratios (D2).** v-only layers 3, 15, 27: rho 1.9153, 1.7566, 1.9013. q-only layers 47, 51, 63: 1.0265, 1.0242, 1.0017. k-only layers 7, 11: 1.0323, 1.0332. Layers 23, 43, 55, 59 are mixed and not used; layers 19, 31, 35, 39 have identical exponents in both arms. So the paired arms contain **no direct evidence about the three failing layers**. +- **Leave-one-prompt-out overshoot (D3).** r_q = 1,725 / 1,553 = 1.1108 (layer 47), r_k = 785 / 737 = 1.0651 (layer 3), r_v = 1,277 / 1,059 = 1.2059 (layer 19). All three come from the same prompt, `p03-repeat-word`. Margins on the registered grid: 9/8, 9/8, 5/4. + +Decision (registered procedure): bottleneck v (rho_v_min 1.7566 against rho_k_min 1.0323 and rho_q_min 1.0017); primary V13; alternative PKV. + +## 4. The rule's prediction (registered formula; predicted, not measured) + +Bits are against PR #178's C2047 fit. The verdict of B is the narrow column (Amendment A1); wide33 is reported next to it. + +| layer | C2047 in-sample median | value bits gained | q bits lost | k bits lost | predicted (narrow, judged) | predicted (wide33) | +|---|---|---|---|---|---|---| +| 3 | 0.00321 | 0 | 0 | 1 | 0.00332 | 0.00321 | +| 7 | 0.00528 | 1 | 0 | 1 | 0.00311 | 0.00311 | +| 11 | 0.00509 | 1 | 1 | 1 | 0.00308 | 0.00300 | +| 15 | 0.00380 | 0 | 0 | 0 | 0.00380 | 0.00380 | +| 19 | 0.00531 | 1 | 0 | 0 | 0.00302 | 0.00302 | +| 23 | 0.00454 | 0 | 1 | 0 | 0.00467 | 0.00454 | +| 27 | 0.00648 | 0 | 0 | 0 | 0.00648 | 0.00648 | +| 31 | 0.01081 | 1 | 1 | 0 | 0.00631 | 0.00615 | +| 35 | 0.01072 | 1 | 1 | 0 | 0.00627 | 0.00611 | +| 39 | 0.01294 | 1 | 1 | 0 | 0.00756 | 0.00737 | +| 43 | 0.00915 | 0 | 1 | 0 | 0.00939 | 0.00915 | +| 47 | 0.00843 | 1 | 1 | 0 | 0.00492 | 0.00480 | +| 51 | 0.00747 | 1 | 1 | 0 | 0.00437 | 0.00425 | +| 55 | 0.00770 | 1 | 1 | 1 | 0.00465 | 0.00465 | +| 59 | 0.00951 | 1 | 1 | 1 | 0.00574 | 0.00574 | +| 63 | 0.00741 | 1 | 1 | 1 | 0.00447 | 0.00433 | + +How to read it, and how not to: + +- Layers 31, 35 and 39 each gain one value bit and lose one query bit under the narrow layout. The formula charges the query bit at 1.0265 and credits the value bit at 1 / 1.7566. +- That credit is carried over from layers 3, 15 and 27, where 1.7566 to 1.9153 is what LOSING a value bit cost at E_v = 8, 8 and 6. It is applied as the gain of ADDING a bit at E_v = 5. Whether the gain is symmetric, and whether it holds at a coarser exponent, is an assumption of the formula. +- For layer 39 to pass, the extra value bit must cut its median by at least 0.012939 x 1.026471 / 0.01 = 1.328 (median and rho_q_max from `runs/describe.json`). The smallest single-cell ratio on any v-only layer is 1.380 (layer 15). That is the margin of the prediction for the worst layer. +- Layer 43 gains nothing on the value side (its 5/4 margin uses up the extra bit), loses a query bit, and is predicted at 0.00939. It would cross 0.01 if the query bit cost 0.01 / 0.009151 = 1.093 instead of the median 1.0265; single cells on the q-only layers show ratios up to 1.159. Layer 43 is the layer most likely to turn a pass into a fail. +- The formula predicts medians on the 10 fit prompts. It says nothing about the second half of the bar (max rel_y <= 0.05) and nothing about held-out prompts. +- The operation itself (q and k at 1,665, v at 4,095) has never been run. PR #178's C1665 arm narrowed v to 1,665 too. + +## 5. Headroom: what the PASS printed by the registered run does and does not mean (post hoc, Amendment A2) + +The registered run printed `decision V13 B PASS`, and its check against PR #206's five clamp locations reports that all five fit under the rule: + +| arm | layer | prompt | tensor | head | RNE at the arm's exponent | rule exponent (narrow) | value at the rule's exponent | clamp | fits | +|---|---|---|---|---|---|---|---|---|---| +| C1665 | 11 | h03-code-js | q | 5 | 1,685 | 10 | 842.5 +- 0.25 | 1,665 | yes | +| C2047 | 23 | h07-code-sql | v | 2 | 2,317 | 7 | 2,317.0 +- 0.5 | 4,095 | yes | +| C1665 | 59 | h02-prose-paragraph | v | 1 | 1,696 | 5 | 3,392.0 +- 1.0 | 4,095 | yes | +| C1665 | 59 | h07-code-sql | v | 1 | 1,679 | 5 | 3,358.0 +- 1.0 | 4,095 | yes | +| C1665 | 63 | h03-code-js | k | 3 | 1,667 | 6 | 833.5 +- 0.25 | 1,665 | yes | + +Both statements are true and stand as registered. Read against PR #178's table they hide one thing, which `headroom.py` (written after the run, Amendment A2; output `runs/headroom.json`) makes explicit: + +- At layer 23 the held-out value entry is 2,317 at an exponent where the in-sample maximum is 1,772. The ratio is **1.3076. The registered value margin is 5/4 = 1.25.** The margin does not cover this entry. +- It fits only because exponents are powers of two. The margin sets a floor for the headroom; the real headroom of a layer lies anywhere between the margin and just under twice the margin. Layer 23 happens to have a value headroom of 2.3106. +- The rule's value headroom is below 1.3076 on two layers: 47 (1.2631) and 51 (1.2995). A value overshoot of the size already seen once, landing on either, would be clamped. The smallest headrooms are 1.1843 (q, layer 27), 1.1293 (k, layer 31), 1.2631 (v, layer 47). +- The in-sample leave-one-prompt-out statistic that set the margin (r_v = 1.2059) underestimated the one held-out value overshoot on record (1.3076). For q and k the seen overshoots (1.0120 and 1.0367) are inside the margins. + +What this means for the PASS: + +1. **B PASS is a statement about the fidelity prediction only**: the procedure selected a rule and the heuristic predicts in-sample medians under the bar. It was never a statement that the rule's range policy is adequate, and it should not be read as one. +2. **The margin component of the rule is known, before any run, to be thinner than a held-out overshoot that was already on main.** PREREG decision step 5 says the rule is not adjusted after the check and that a location the margin does not cover is reported as a known miss. No location is literally missed (all five fit). The margin is nevertheless exceeded at one of them, and this is reported in that spirit: as a known weakness, with the rule unchanged. +3. **Nothing was tuned.** Raising the value margin to 3/2 would cover 1.3076 on paper. It would also be a choice made after seeing a held-out number, it would change the exponent table, and it could cost a value bit on some layers (not computed here). It was not done. It belongs to a new registration. +4. With one seen overshoot per tensor class as the only held-out evidence, no margin on this grid can be called validated. The honest reading of the whole step is: the arithmetic admits the rule, the in-sample records predict it would fix the three layers, and its headroom policy is unproven and already looks thin on the value side. + +## 6. The rule's clamp count on PR #206's eight prompts is already implied (post hoc, Amendment A3) + +`implied_clamps.py`, output `runs/implied-clamps.json`. An entry x clamps under (clamp CL, exponent E) iff |x| >= (CL + 1/2) / 2^E. Comparing that threshold as an exact fraction, layer by layer and tensor by tensor: + +- Under the narrow layout the rule's threshold is at or above PR #178's C1665 arm's on **all 16 layers for q, for k and for v** (`layers_where_rule_threshold_is_below_arm` empty for all three). In exponents: the rule's E_q and E_k are never above that arm's, and its E_v is exactly one above with a clamp of 4,095 against 1,665. +- So on the same inputs every entry that would clamp under the rule also clamped in PR #206's C1665 arm. PR #206 reports exactly four clamped entries in that arm, and all four fit under the rule (table above). +- **Implied clamp count of the rule on PR #206's eight prompts: 0.** (Against arm C2047 the rule is not dominated: its q threshold is lower on 5 layers and its k threshold on 10. The wide33 table is dominated by arm C2047 and is implied 0 as well.) + +This relies on two statements of PR #206 that were not re-derived: that its clamp list is complete, and that it ran with PR #178's exponents unchanged (its check V3). It holds for the same prompts through the same reference forward only. + +Consequence for the run the issue asks for: evaluated on PR #206's eight prompts, the range axis is a consistency check of the evaluator, not a test of the margin. `FUTURE-PREREG.md` says so and does not let an "H_R PASS" be reported as transfer. A real test of the margin needs prompts nobody had looked at when the rule was written. That is not designed here. + +## 7. Where the issue text was checked against main + +| issue text | on main | +|---|---| +| "PR #204's 8 held-out prompts" | #204 is the issue; the pull request is #206, directory `experiments/20261114-204-int-attn-heldout/` | +| "a q/k-only clamp of 1,665 is the narrow fallback" | correct for DH256-ROTARY.md section 2a. But the C1665 arm of PR #178 and PR #206 lowered v to 1,665 as well: the fallback's own operation has no fidelity run on main | +| "evaluate ... with `heldout.py`" | `heldout.py` cannot run the rule unchanged: it and PR #178's `int_attn.arm_prompt` apply one clamp to q, k and v, and `heldout.py` reads its exponents from PR #178's `runs/layers.jsonl` by a pinned hash. The future run needs a new evaluator file that imports both unchanged (`FUTURE-PREREG.md`) | +| negative result: "no candidate keeps N4 at dh = 256 with a cell wide enough" | N4 as implemented does not contain the value cell. It bounds q and k only (1,665 at a 32-bit digit). The value clamp enters `shape()` through N6 alone, which admits a clamp of 68,652,104,701 at its tightest. So for a value-side candidate N4 was never the condition at risk; the open questions are on the layer side and in the clamp tables | +| "Range transfer also failed by 1 and 4 clamped entries" | matches PR #206 RESULTS section 2 | +| layers 31, 35, 39; "medians within 0.0003"; "any rescue" listed as not tried in both section 7 lists | match the two RESULTS files as read | +| "about 20 to 30 minutes of heavy slot" | not checked beyond this: PR #206's run of two arms took 18 min 43 s of wall time (its `ENV.json`) | + +## 8. Deviations from the PREREG and from the standards + +- No variance runs: every script is deterministic arithmetic on committed files (registered as a deviation from the five-run standard). +- Two post hoc scripts after the registered run was read: `headroom.py` (A2) and `implied_clamps.py` (A3). Each was committed with its amendment before its one run. Neither has a unit test. No verdict depends on either. For A3 the answer had been seen first through read-only helper scripts outside the repository, one of which also summed the clamp counts in PR #206's `runs/layers.jsonl` (totals 1 and 4, the figures PR #206 reports): a use of a PR #206 file beyond the five locations, disclosed in A3. +- Reads of PR #206 beyond its five clamp locations, for the write-up only and with no statistic taken: its RESULTS.md, ENV.json and `heldout.py` source (to write `FUTURE-PREREG.md`), and the key names of the first record of its `runs/prompt-rows.jsonl`. +- Amendment A1 narrowed Metric A's "layer-side sites" to the site "o" before the run, and the 182-pair check covers N1 to N9 only (section 2). +- The unit-test receipts under `runs/` were written by a rerun of the two test suites after the registered describe run; the suites had passed before it on synthetic records (PREREG "Runs"). +- The lane was cut by its run-time limit after `runs/headroom.json` was committed and was finished by a second instance of the same lane. One push of the first instance went out before the host-path guard and the scrub had been run on its new files; both were run right after and were clean. +- The tables in `RULE.md`, `FUTURE-PREREG.md` and this file were generated from the committed run files by a helper outside the repository and pasted; the figures in running text were copied from the same files by hand. +- No inventory row: nothing was added under `research/operators/`. + +## 9. NOT established + +- **The rule's fidelity.** No integer attention was run with it, in sample or held out. Whether layers 31, 35 and 39 meet the bar under it is a prediction from other layers. Whether layer 43 stays under the bar is a prediction with a 6% margin. +- **The max half of the bar** (rel_y <= 0.05) under the rule: not predicted at all. +- **Range transfer.** The value margin is exceeded by a held-out overshoot already on record. No unseen prompt has been tested against the rule, and PR #206's eight prompts cannot test it (section 6). +- **Admission.** Passing N1 to N9 and the policy conditions is arithmetic on constants. Qwen's attention is still refused elsewhere (dq != d, partial rotary, theta0, dh > 128). No parameter file, table, prover or verifier change exists. +- **Soundness of the listed changes.** `RULE.md` section 4 is a list of obligations read from the code. That a 13-bit value clamp table, a q/k clamp table at 1,665 and three clamps in place of one can be added without changing a legacy verdict, and that the lookups still prove what they must, is not argued. +- **The other uses of `CLAMPED_CELL_BOUND`** (`cp_verify.cpp` `acc` at line 1450, `W-xr` at line 1501, the head sub-proof's `BCh` at lines 1859 to 1897): not evaluated. Whether the committed cell of v and its range check admit 13 bits unchanged: not traced. +- **The policy conditions (kFD occupancy, C) at softmax shapes other than lt = 10, S = 12, rx = 8**: not evaluated. +- **The site "o" for Qwen**: only "no verdict changes between 2,048 and 4,096" is shown, not that the site holds at the shift a Qwen file would use. +- **wide33.** Its formulas are DH256-ROTARY.md's proposal; the 17-bit lookup it depends on does not exist. +- **The alternative PKV**: defined, no exponent table, no prediction (no per-group maxima in the committed records). +- **That the value side is the cause.** The one-bit ratios are a natural experiment between two arms on other layers, not an arm designed to isolate a tensor. The softmax table step, the floor-divided mean and the score scale were not examined as causes. +- **That u0 = 2,307 matches the verifier's own table.** It is the mathematical threshold; the platform table's agreement is the softmax-table test's job. +- Nothing here is replicated, and nothing here is a public headline. + +## 10. Raw data and reproduction + +| file | what | written | +|---|---|---| +| `runs/describe.json` | registered run: D1, D2, D3, decision, margins, rule exponents (both layouts), prediction, B, check of PR #206's five locations | 2026-11-29T02:51:32Z, once | +| `runs/n4-report.json` | exact integers: every condition for six (layout, value clamp) pairs, largest clamps, kFD choices, site "o", clamp-table row sizes | 2026-11-29T02:53:56Z, once | +| `runs/unit-tests-n4.json`, `runs/unit-tests-describe.json` | test receipts: 29 of 29, 18 of 18 (the second suite uses synthetic records only) | 2026-11-29T02:53:56Z, once | +| `runs/headroom.json` | post hoc A2: real headroom per layer and tensor, seen overshoots | 2026-11-29T03:01:09Z, once | +| `runs/implied-clamps.json` | post hoc A3: threshold comparison with PR #178's arms, implied clamp count | 2026-11-29T03:45:35Z, once | + +Commands are in `README.md`. Each script refuses to overwrite its output; to reproduce, write to a new path and compare everything except `t_start`. diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/RULE.md b/experiments/20261129-241-qwen-attn-rescue-rule/RULE.md new file mode 100644 index 00000000..aa8ec59a --- /dev/null +++ b/experiments/20261129-241-qwen-attn-rescue-rule/RULE.md @@ -0,0 +1,155 @@ +# RULE: V13, one extra bit on the value cell (issue #241) + +Status: a rule on paper. It was chosen by the registered procedure of `PREREG.md` from PR #178's committed in-sample records. **It has not been run on any model.** No fidelity number exists for it, in sample or held out. Passing the arithmetic below is not admission of Qwen's attention and not a soundness argument. + +Every number in this file comes from a committed run file of this directory: `runs/describe.json` (the registered run), `runs/n4-report.json` (exact integers), `runs/headroom.json` (post hoc, Amendment A2). The tables were generated from those files, not typed. + +## 1. The rule in one paragraph + +Keep upstream's integer attention as it is (`docs/model.md` section 6; PR #178's `int_attn.py`), with three changes to the scales and clamps only: + +1. The value cell gets one more bit: values are clamped to -4,095 .. 4,095 instead of -2,047 .. 2,047. +2. Queries and keys use the narrow fallback of `research/operators/qwen_ops/DH256-ROTARY.md` section 2a: clamp 1,665, legacy 32-bit score digit, kFD = 16. This is the layout the rule is stated under (PREREG decision step 4). +3. Every exponent is fitted with a headroom margin: 9/8 for q, 9/8 for k, 5/4 for v. + +The alternative (PKV, one value exponent per key-value head with the 12-bit value cell) is section 6. It has no exponent table: the committed records do not contain what it needs. + +## 2. Integer definition + +Per attention layer, from PR #178's `runs/layers.jsonl` (the same in both of its arms): `mx_q` = the largest |q| / sqrt(256) over the 10 in-sample prompts, where q is the rotated query (the 1/sqrt(dh) of the score is folded into q, as in `int_attn.py`), `mx_k` = the largest |k|, `mx_v` = the largest |v|. They are binary64 numbers and are read as exact rationals. + +- Clamps: `CL_q = CL_k = 1,665`, `CL_v = 4,095`. +- Margins: `m_q = 9/8`, `m_k = 9/8`, `m_v = 5/4`. Each is the smallest element of {1, 9/8, 5/4, 3/2, 2} at or above the leave-one-prompt-out overshoot r_t of PREREG definition D3: r_q = 1,725 / 1,553 = 1.1108 (layer 47), r_k = 785 / 737 = 1.0651 (layer 3), r_v = 1,277 / 1,059 = 1.2059 (layer 19); all three on prompt `p03-repeat-word` (`runs/describe.json`, `D3`, `margins`). +- Exponent: `E_t` = the largest integer E with `m_t * mx_t * 2^E <= CL_t`. +- Softmax shift: `sh = E_q + E_k - 8` (rx = 8), moved into 4 .. 12 by changing E_q if needed (PR #176's registered rule). No layer needed the adjustment; sh is 8 or 9 on every layer. +- Quantisation: `w = RNE(x * 2^E_t)` (ties to even), cell = `w` clamped to `-CL_t .. CL_t`. Entries beyond the clamp are clamped and counted. +- The integer core is unchanged: integer scores, row maximum subtracted, `u = floor((M - s) / 2^sh)`, weight `rne(2^12 exp(-u / 256))` for `u < u0 = 2,307` and 0 otherwise, `o = floor((2 * sum(e v) + Z) / (2 Z))`, read at scale `2^-E_v`. + +### The frozen table + +"headroom" is `CL_t / (mx_t * 2^E_t)`: how far above the in-sample maximum an entry may go before it clamps. The margin is only a floor for it; because exponents are powers of two the real headroom lies anywhere from the margin to just under twice the margin (`runs/headroom.json`). The last column is the same arithmetic under wide33 (q and k clamp 2,047, 33-bit digit, kFD = 17): a second table, not a second rule. + +| layer | mx_q | mx_k | mx_v | C2047 fit E_q E_k E_v sh | rule (narrow) E_q E_k E_v sh | headroom q | k | v | wide33 E_q E_k E_v sh | +|---|---|---|---|---|---|---|---|---|---| +| 3 | 0.668039 | 12.2653 | 7.05503 | 11 7 8 10 | 11 6 8 9 | 1.2170 | 2.1211 | 2.2673 | 11 7 8 10 | +| 7 | 0.662265 | 14.2515 | 8.45876 | 11 7 7 10 | 11 6 8 9 | 1.2276 | 1.8255 | 1.8911 | 11 6 8 9 | +| 11 | 0.812793 | 14.5503 | 9.45032 | 11 7 7 10 | 10 6 8 8 | 2.0005 | 1.7880 | 1.6927 | 11 6 8 9 | +| 15 | 0.662047 | 17.9159 | 6.7523 | 11 6 8 9 | 11 6 8 9 | 1.2280 | 1.4521 | 2.3690 | 11 6 8 9 | +| 19 | 0.574431 | 18.1364 | 9.97603 | 11 6 7 9 | 11 6 8 9 | 1.4153 | 1.4344 | 1.6035 | 11 6 8 9 | +| 23 | 0.837149 | 20.2531 | 13.8457 | 11 6 7 9 | 10 6 7 8 | 1.9423 | 1.2845 | 2.3106 | 11 6 7 9 | +| 27 | 0.686449 | 21.6609 | 27.6994 | 11 6 6 9 | 11 6 6 9 | 1.1843 | 1.2010 | 2.3100 | 11 6 6 9 | +| 31 | 0.730817 | 23.0375 | 42.796 | 11 6 5 9 | 10 6 6 8 | 2.2249 | 1.1293 | 1.4951 | 11 6 6 9 | +| 35 | 0.737285 | 19.7726 | 38.3008 | 11 6 5 9 | 10 6 6 8 | 2.2054 | 1.3157 | 1.6706 | 11 6 6 9 | +| 39 | 0.795357 | 20.8431 | 32.1708 | 11 6 5 9 | 10 6 6 8 | 2.0443 | 1.2482 | 1.9889 | 11 6 6 9 | +| 43 | 0.861951 | 20.0702 | 55.1601 | 11 6 5 9 | 10 6 5 8 | 1.8864 | 1.2962 | 2.3200 | 11 6 5 9 | +| 47 | 0.842134 | 18.276 | 50.6574 | 11 6 5 9 | 10 6 6 8 | 1.9308 | 1.4235 | 1.2631 | 11 6 6 9 | +| 51 | 0.837644 | 17.0112 | 49.2379 | 11 6 5 9 | 10 6 6 8 | 1.9411 | 1.5293 | 1.2995 | 11 6 6 9 | +| 55 | 0.905258 | 15.1418 | 34.8955 | 11 7 5 10 | 10 6 6 8 | 1.7961 | 1.7181 | 1.8336 | 10 6 6 8 | +| 59 | 0.950804 | 14.6247 | 94.5129 | 11 7 4 10 | 10 6 5 8 | 1.7101 | 1.7789 | 1.3540 | 10 6 5 8 | +| 63 | 0.888884 | 12.5641 | 133.384 | 11 7 3 10 | 10 6 4 8 | 1.8292 | 2.0706 | 1.9188 | 10 7 4 9 | + +Against PR #178's C2047 fit, the rule under the narrow layout gains one value bit on 11 of the 16 layers (7, 11, 19, 31, 35, 39, 47, 51, 55, 59, 63) and none on 5 (3, 15, 23, 27, 43): on those five the 5/4 margin uses up the extra bit. It loses one query bit on 11 layers and one key bit on 6 (table in `RESULTS.md` section 4). The three failing layers 31, 35 and 39 each gain the value bit and lose a query bit. + +## 3. Admission arithmetic at dh = 256, redone exactly + +Script: `n4_arith.py` (Python integers and `fractions` only; transcribed from `verifier/src/vf_attention_shape.h` `AFork::shape()` and `shd()` at main 02d62eb6). Its 29 unit tests pass and reproduce the constants already on main: PR #176 PREREG's N4 numbers, and the tables of DH256-ROTARY.md sections 2a, 2c and 2d (`runs/unit-tests-n4.json`, `test_n4_arith.py`). No constant on main failed to reproduce. + +Parameters: ldh = 8 (dh = 256), Ty = 2^18, lt = 10, S = 12, rx = 8 (so u0 = 2,307), shifts 4 .. 12. Rows that depend on the shift are shown at sh = 4 and sh = 12; every shift 4 .. 12 was evaluated and holds (`runs/n4-report.json`, `layouts`, `all_ok`). + +### 3a. The rule's layout: q and k clamp 1,665, value clamp 4,095, 32-bit digit, kFD = 16 + +| narrow-1665, value clamp 4,095 | sh | left side | | bound | holds | +|---|---|---|---|---|---| +| af-policy-kF rows>=u0+nHD | 4 | 65,536 | >= | 45,634 | yes | +| af-policy-kF rows<=u0+2nHD | 4 | 65,536 | <= | 88,961 | yes | +| af-policy-C | 4 | 102,448 | <= | 16,777,216 | yes | +| af-no-wrap-N3 | 4 | 578,748,844,554,200,672 | < | 2,305,843,009,213,693,951 | yes | +| af-no-wrap-N4 | 4 | 4,258,408,032 | < | 4,294,967,296 | yes | +| af-policy-kF rows>=u0+nHD | 12 | 65,536 | >= | 48,511 | yes | +| af-policy-kF rows<=u0+2nHD | 12 | 65,536 | <= | 94,715 | yes | +| af-policy-C | 12 | 9,515,008 | <= | 16,777,216 | yes | +| af-no-wrap-N3 | 12 | 578,748,844,573,025,792 | < | 2,305,843,009,213,693,951 | yes | +| af-no-wrap-N4 | 12 | 4,277,233,152 | < | 4,294,967,296 | yes | +| af-no-wrap-N1 | | 4,416,003,440,896 | < | 1,152,921,504,606,846,976 | yes | +| af-no-wrap-N2 first | | 288,232,850,187,354,240 | < | 2,305,843,009,213,693,951 | yes | +| af-no-wrap-N2 radix | | 262,528 | < | 1,048,576 | yes | +| af-no-wrap-N5 | | 4,415,297,945,600 | < | 1,152,921,504,606,846,976 | yes | +| af-no-wrap-N6 | | 565,200,528,932,865 | < | 1,152,921,504,606,846,976 | yes | +| af-no-wrap-N9 | | 131,072 | < | 1,152,921,504,606,846,976 | yes | + +All conditions hold (`all_ok` true). At the largest admitted C (16,711,680) the no-overflow conditions N1 to N9 also hold for every one of the 182 pairs (lt, S) with lt in 2 .. 16, S in 1 .. 14 and lt + S + 1 <= 24 (`superset_failures` 0). This is a superset bound check, not 182 admitted parameter files, and it does not cover the kFD occupancy or C policy rows at those other shapes. + +The only condition of `shape()` that moves when the value clamp goes from 2,047 to 4,095 is N6, whose first term is `2 TS b_v`: its left side goes from 565,183,349,063,681 to 565,200,528,932,865, against a bound of 2^60 (`n6_left`; unit test `test_only_n6_moves_with_bv`). + +### 3b. The same rule under wide33 (second table): q and k clamp 2,047, value clamp 4,095, 33-bit digit, kFD = 17 + +| wide33, value clamp 4,095 | sh | left side | | bound | holds | +|---|---|---|---|---|---| +| af-policy-kF rows>=u0+nHD | 4 | 131,072 | >= | 67,796 | yes | +| af-policy-kF rows<=u0+2nHD | 4 | 131,072 | <= | 133,285 | yes | +| af-policy-C | 4 | 102,448 | <= | 16,777,216 | yes | +| af-no-wrap-N3 | 4 | 1,157,497,687,028,016,736 | < | 2,305,843,009,213,693,951 | yes | +| af-no-wrap-N4 | 4 | 6,436,431,456 | < | 8,589,934,592 | yes | +| af-policy-kF rows>=u0+nHD | 12 | 131,072 | >= | 72,144 | yes | +| af-policy-kF rows<=u0+2nHD | 12 | 131,072 | <= | 141,981 | yes | +| af-policy-C | 12 | 9,515,008 | <= | 16,777,216 | yes | +| af-no-wrap-N3 | 12 | 1,157,497,687,046,841,856 | < | 2,305,843,009,213,693,951 | yes | +| af-no-wrap-N4 | 12 | 6,455,256,576 | < | 8,589,934,592 | yes | +| af-no-wrap-N1 | | 4,416,366,444,800 | < | 1,152,921,504,606,846,976 | yes | +| af-no-wrap-N2 first | | 288,232,850,187,354,240 | < | 2,305,843,009,213,693,951 | yes | +| af-no-wrap-N2 radix | | 262,528 | < | 1,048,576 | yes | +| af-no-wrap-N5 | | 4,415,297,945,600 | < | 1,152,921,504,606,846,976 | yes | +| af-no-wrap-N6 | | 565,200,528,932,865 | < | 1,152,921,504,606,846,976 | yes | +| af-no-wrap-N9 | | 131,072 | < | 1,152,921,504,606,846,976 | yes | + +All conditions hold under the proposed 33-bit digit formulas of DH256-ROTARY.md section 2c. That layout is not implemented and depends on a 17-bit lookup that does not exist (DH256-ROTARY.md section 2d). + +### 3c. For comparison: the legacy layout fails + +With one clamp of 2,047 for q and k, a 32-bit digit and kFD = 16, `af-policy-kF` (rows >= u0 + nHD) and `af-no-wrap-N4` fail at every shift, with either value clamp (`layouts`, `legacy-2047`, `all_ok` false). This is the known obstruction of DH256-ROTARY.md; the value cell does not change it. + +### 3d. The largest admissible clamp or cell + +- q and k, N4, dh = 256, 32-bit digit: the largest clamp is **1,665** for every admitted C (C up to 16,711,680). At the standard softmax's own C for sh = 12 it is 1,668; at C = 0, which is not an admitted configuration, 1,672 (`max_qk_clamp_n4`). +- q and k, N4, dh = 256, 33-bit digit (proposed): 2,360 at the largest C. +- v, N6: the largest value clamp N6 admits is 137,371,580,413 at lt = 10, S = 12, and 68,652,104,701 at the tightest of the 182 pairs (`max_v_clamp_n6`). **N6 does not bind the value cell.** 4,095 is the issue's "one extra bit", not the largest value the arithmetic admits. Wider value cells are not in the registered candidate list and were not examined. + +## 4. What changes for the verifier's admission + +A list of obligations, read from the code at main 02d62eb6. Not a design, not an implementation, not a soundness argument. Nothing under `verifier/`, `prover/` or `blocks/` was changed. + +Today one constant, `CLAMP = 2047` (`vf_attention_shape.h` line 15), serves q, k and v. It enters: `Smax = dh * CLAMP^2` (line 214); N6's first term (line 244); the clamp table FC (`cp_verify.cpp` lines 640 to 641: row `t + 2^28 (clamp(t - 32768) + CLAMP + 1)`); and `CLAMPED_CELL_BOUND = CLAMP + 1` (line 387), which becomes `BC` (`cp_verify.cpp` line 1450) and `BCh` (line 1859). + +1. **Three clamps instead of one.** `Smax` must use the q/k clamp (1,665) and N6 the value clamp (4,095). Legacy parameter files must keep their exact verdicts: the new clamps are opt-in and bound to the statement, never a replacement for the global constant. +2. **A value clamp table with a 13-bit output.** Shaped like FC with offset 4,096: row `t + 2^28 (clamp_4095(t - 32768) + 4096)`, 65,536 rows, largest row 2,198,754,885,631, below 2^41 (`fc_row_max`). The layer-side constant of the CV lookup changes from `2^15 + 2^39` to `2^15 + 2^40` (`vf_layers_check.inc` lines 466 to 475 use `2^39` for CN1, CN2, CQK and CV alike). +3. **A q/k clamp table at 1,665** (DH256-ROTARY.md section 2a's FCQK): if it keeps the offset 2,048, the CQK constant stays `2^15 + 2^39`. CQK must actually prove that q and k are that clamp's outputs; putting 1,665 into Smax while FC still admits 2,047 would be unsound. +4. **The site "o"** (`cp_verify.cpp` line 1488: `A = dq * BC * BWw`). o is a rounded mean of values of v and keeps v's bound, so BC for this site becomes 4,096 and A goes from 51,539,607,552 to 103,079,215,104 (dq = 6,144). For every digit form and every shift the KL range test admits, with 4 or 5 residual-stream limbs, the verdicts of U-o and W-o are the same with 4,096 as with 2,048 (`site_o`, `differs` empty; unit test `test_site_o_no_verdict_change`). +5. **Other uses of `CLAMPED_CELL_BOUND`, read but NOT analysed here.** `acc = d * BC * BWw` (line 1450) is the bound used by the sites gate, up, qk, v and lr. By the comment at lines 1444 to 1449 BC bounds "the clamped cells a, m and v"; a and m are norm outputs and keep 2,047 under this rule, so the single constant would have to be split, and which of those sites would need 4,096 was not worked out. `W-xr` (line 1501, profile 3) and the head sub-proof's `BCh` (lines 1859, 1874, 1897) also use the constant; which cells they bound was not traced. +6. **Cell width, NOT analysed.** Whether the committed cell of v, its limbs and the range check that covers it admit a 13-bit value without change was not traced. N6 itself only needs the clamp as a number. +7. **Format, prover and statement.** A parameter-file field or profile value for the clamps, its place in the statement bytes, the prover's matching tables, the forest accounting for one more table: none of this exists or is designed here. + +Unchanged by the rule: N1, N2, N3, N4, N5, N9 formulas; the softmax table; kFD = 16; the number of committed limbs. + +## 5. What the in-sample records say and do not say + +The registered prediction (PREREG "Prediction") for the rule under the narrow layout is at or under 0.01 on all 16 layers; the largest is 0.00939 at layer 43; layers 31, 35 and 39 are predicted at 0.00631, 0.00627 and 0.00756 (`runs/describe.json`, `prediction`, `B`). Read it with these limits: + +- It is a heuristic carried over from other layers, not a measurement. Layers 31, 35 and 39 have identical exponents in PR #178's two arms, so the paired arms contain no direct evidence about them. The one-bit value ratio used for them (1.7566) comes from layers 3, 15 and 27, where it is the cost of LOSING a bit (E_v from 8, 8 and 6 down to 7, 7 and 5), applied as the gain of ADDING a bit (E_v from 5 to 6) on other layers. +- The operation it predicts (q and k at 1,665, v at 4,095) has never been run. PR #178's C1665 arm lowered v to 1,665 as well. +- Layer 43 gains no value bit, loses a query bit, and is predicted 6% under the bar. +- It says nothing about the second half of the fidelity bar (max rel_y <= 0.05). + +**Known weakness of the margin (post hoc, Amendment A2; the rule was not adjusted).** At PR #206's layer 23 the held-out value entry is 2,317 against an in-sample maximum of 1,772 at the same exponent: a ratio of 1.3076, more than the registered value margin 5/4. It fits under the rule only because layer 23 happens to have a headroom of 2.31. At layers 47 and 51 the rule's value headroom is 1.2631 and 1.2995: an overshoot of the size already seen once would be clamped there. See `RESULTS.md` section 5. + +## 6. The alternative: PKV (one value exponent per key-value head, 12-bit value cell) + +Definition: for key-value head g in 0 .. 3, `E_v[g]` = the largest E with `m_v * mx_v[g] * 2^E <= 2,047`, where `mx_v[g]` is the in-sample maximum over that head's 256 channels; query head h reads group floor(h / 6), and its output is read at scale `2^-E_v[floor(h / 6)]`. q, k, sh and the clamps are as in the rule's layout. + +- Arithmetic: with the value clamp at 2,047 every condition of section 3a holds (`layouts`, `narrow-1665`, value clamp 2,047, `all_ok` true, `superset_failures` 0). No condition of `shape()` sees a per-head exponent. +- What would change for admission: the o cells of the four groups of 1,536 columns would sit at four different scales, while the o_proj site has one rounding shift per layer (`cp_verify.cpp` line 1488). That needs a layer-side change of its own, which is not designed or listed here. +- **No exponent table can be given.** PR #178's committed records hold `mx_v` per layer and `v_maxw` per layer and prompt, not per key-value head. The alternative is defined; it is not computable from the in-sample evidence on main. A run that wanted it would have to record per-head maxima first. +- What the records do say about where the error sits: on layers 31 and 39 all four key-value groups have a median over 0.01, and on layer 35 three of four (`RESULTS.md` section 3). The error is not concentrated in one group. + +## 7. Not established by this file + +See `RESULTS.md` section 8. In one line: the rule's fidelity, its range transfer, the soundness of any of the listed changes, and the admission of Qwen's attention are all open. From b3958d30829ca5bd85f7dcc03bc81d2d8591854c Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:59:18 +0000 Subject: [PATCH 09/12] research: #241 results.yaml row (pr 246), README block and CLAIMS.md regenerated --- CLAIMS.md | 1 + README.md | 3 ++- research/results.yaml | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CLAIMS.md b/CLAIMS.md index 7a67b020..5b57bd23 100644 --- a/CLAIMS.md +++ b/CLAIMS.md @@ -86,3 +86,4 @@ tracked file, which both scripts resolve (they check that it exists, not what it | `qwen-m3a1-weight-side` | Qwen M3a-1 weight side: one DeltaNet head's real weights in a committed table, the trace's 1,666 weight cells in class and tied to it (issue #229): Measured, unreplicated, CPU research harness, research setting (no security level). The 3,288,706 integer weights of V head 0, layer 0 of the pinned stock Qwen3.8-27B (each fetched tensor SHA-256 equal to the merged stream hash) are a committed table; the 1,666 weights the head trace reads (conv taps, gains, cA, dt_bias) are product-oracle cells in their design classes by exact bits and are tied to the table by one point drawn after both commitments and one LIN claim on the table (one-time test). 5 of 5 honest proofs verified; all 8 registered hostile proofs rejected (other root twice, a tap changed two ways, gain 2^50, gain in class but not the table one, dt_bias 2^17, table row 0 non-zero past the cells); 3 of 3 completeness cases accepted (dt_int 78,848, -23,424, 2^17 - 1). NOT established: any bound on the 3,287,040 matrix weights (no Qwen layout of the WF range proof); any head computation (in_proj as a claim, sub-step c, not started); any soundness level (LIN runs on a hand-made test plan, rounds unpriced); hiding; that the table is the advertised checkpoint; accuracy | measured, unreplicated | unreplicated | [experiments/20261121-229-qwen-m3a1-weight-side/RESULTS.md](experiments/20261121-229-qwen-m3a1-weight-side/RESULTS.md), [experiments/20261121-229-qwen-m3a1-weight-side/PREREG.md](experiments/20261121-229-qwen-m3a1-weight-side/PREREG.md), [experiments/20261121-229-qwen-m3a1-weight-side/ENV.json](experiments/20261121-229-qwen-m3a1-weight-side/ENV.json), [experiments/20261121-229-qwen-m3a1-weight-side/runs/summary.json](experiments/20261121-229-qwen-m3a1-weight-side/runs/summary.json), [experiments/20261121-229-qwen-m3a1-weight-side/runs/weights-head0.json](experiments/20261121-229-qwen-m3a1-weight-side/runs/weights-head0.json), [research/operators/qwen_m3a1/README.md](research/operators/qwen_m3a1/README.md) | #231 | | `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-attn-rescue-rule-241` | Qwen integer attention, one rescue scale rule on paper for layers 31, 35, 39 at head size 256: value cell one bit wider, with its exact admission arithmetic (issue #241): Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table | measured, unreplicated (desk: exact arithmetic and a prediction from in-sample records; the rule itself is NOT run) | unreplicated | [experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md](experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md), [experiments/20261129-241-qwen-attn-rescue-rule/RULE.md](experiments/20261129-241-qwen-attn-rescue-rule/RULE.md), [experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md](experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md), [experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md](experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md), [experiments/20261129-241-qwen-attn-rescue-rule/ENV.json](experiments/20261129-241-qwen-attn-rescue-rule/ENV.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json) | #246 | diff --git a/README.md b/README.md index 7903f313..38752888 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,9 @@ Every number below comes from a file on `main` (the one exception, a reviewer fi | Qwen M3a-1 weight side: one DeltaNet head's real weights in a committed table, the trace's 1,666 weight cells in class and tied to it (issue #229) | measured, unreplicated | Measured, unreplicated, CPU research harness, research setting (no security level). The 3,288,706 integer weights of V head 0, layer 0 of the pinned stock Qwen3.8-27B (each fetched tensor SHA-256 equal to the merged stream hash) are a committed table; the 1,666 weights the head trace reads (conv taps, gains, cA, dt_bias) are product-oracle cells in their design classes by exact bits and are tied to the table by one point drawn after both commitments and one LIN claim on the table (one-time test). 5 of 5 honest proofs verified; all 8 registered hostile proofs rejected (other root twice, a tap changed two ways, gain 2^50, gain in class but not the table one, dt_bias 2^17, table row 0 non-zero past the cells); 3 of 3 completeness cases accepted (dt_int 78,848, -23,424, 2^17 - 1). NOT established: any bound on the 3,287,040 matrix weights (no Qwen layout of the WF range proof); any head computation (in_proj as a claim, sub-step c, not started); any soundness level (LIN runs on a hand-made test plan, rounds unpriced); hiding; that the table is the advertised checkpoint; accuracy | CPU only, cores 2-7 of a shared loaded host, single-threaded runs through the heavy-job gate, g++ 13.3.0 -O2; PREREG first and alone, one amendment (implementation choices) committed before the runs; debug only on a synthetic fixture (numpy seed 9101, head 1); research setting target 10 bits, query work 6; LIN plan hand-made (lin_world.h) | [experiments/20261121-229-qwen-m3a1-weight-side/RESULTS.md](experiments/20261121-229-qwen-m3a1-weight-side/RESULTS.md) | | 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) | +| Qwen integer attention, one rescue scale rule on paper for layers 31, 35, 39 at head size 256: value cell one bit wider, with its exact admission arithmetic (issue #241) | measured, unreplicated (desk: exact arithmetic and a prediction from in-sample records; the rule itself is NOT run) | Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table | CPU only, Python 3.12.3 standard library, exact integers and fractions; deterministic scripts on committed files and constants, one run each; PREREG first and alone, amendment A1 before the registered run, amendments A2 and A3 post hoc, each committed with its script before that script's one run; PR 206 used only for its five reported clamp locations (seen before registration, disclosed); the 182 softmax-shape check covers the no-overflow conditions only; shared loaded host; lane finished by a second instance after a run-time cut | [experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md](experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md); a rule on paper, predicted not measured | -_Last regenerated from `research/results.yaml` on 2026-11-21 (UTC), against main `0ffc7985`._ +_Last regenerated from `research/results.yaml` on 2026-11-29 (UTC), against main `57460851`._ What this table does not show: no full-size run on real (Maverick) weights, no real model weights on GPU, no serving, no TEE, no production use, and no comparison with other verifiable-inference systems. The GPU rows are upstream's small example on made-up weights, plus one incomplete, unreplicated full-size study on made-up (synthetic) weights (PR #44: one session per arm, below its registered n). diff --git a/research/results.yaml b/research/results.yaml index 23fee63c..57388c76 100644 --- a/research/results.yaml +++ b/research/results.yaml @@ -2074,3 +2074,24 @@ results: - {"name": "m31t_l31_63_h_ge_2e18", "stat": "count", "value": 635, "unit": "count", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-18", "commit": "864939887782e1428d9e30947a45946c4b0fb06f", "source": "experiments/20261118-221-silu-step-clip/runs/summary.json", "note": "Measured, unreplicated; M31-T entries with |h| >= 2^18 (honest contract), layers 31 to 63; spread null: exact count"} - {"name": "layer_seconds_median_silu221", "stat": "median", "value": 135.9, "unit": "s", "n": 33, "spread": {"sd": null, "min": 116.6, "max": 183.1}, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-18", "commit": "864939887782e1428d9e30947a45946c4b0fb06f", "source": "experiments/20261118-221-silu-step-clip/run-record.json", "note": "Measured, unreplicated, descriptive; wall clock per layer, REF + M31-C + M31-T on all prompts + M31-C#2 on 2 prompts, 6 cores on a shared loaded host; spread over layers of one run, SD not computed"} - {"name": "peak_rss_silu221", "stat": "max", "value": 8424324, "unit": "KiB", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-18", "commit": "864939887782e1428d9e30947a45946c4b0fb06f", "source": "experiments/20261118-221-silu-step-clip/run.time", "note": "Measured, unreplicated; time -v Maximum resident set size (largest single process); one run"} + + - id: qwen-attn-rescue-rule-241 + title: "Qwen integer attention, one rescue scale rule on paper for layers 31, 35, 39 at head size 256: value cell one bit wider, with its exact admission arithmetic (issue #241)" + status: "measured" + status_note: "(desk: exact arithmetic and a prediction from in-sample records; the rule itself is NOT run)" + replication: "unreplicated" + pr: 246 + summary: "Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table" + conditions: "CPU only, Python 3.12.3 standard library, exact integers and fractions; deterministic scripts on committed files and constants, one run each; PREREG first and alone, amendment A1 before the registered run, amendments A2 and A3 post hoc, each committed with its script before that script's one run; PR 206 used only for its five reported clamp locations (seen before registration, disclosed); the 182 softmax-shape check covers the no-overflow conditions only; shared loaded host; lane finished by a second instance after a run-time cut" + evidence: ["experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md", "experiments/20261129-241-qwen-attn-rescue-rule/RULE.md", "experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md", "experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md", "experiments/20261129-241-qwen-attn-rescue-rule/ENV.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json"] + evidence_note: "; a rule on paper, predicted not measured" + metrics: + - {"name": "attnrule_n4_unit_tests_passed", "stat": "count", "value": 29, "total": 29, "unit": "count", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-n4.json", "note": "Exact-integer tests of n4_arith.py, including reproduction of PR 176 PREREG's N4 numbers and DH256-ROTARY.md 2a, 2c, 2d; deterministic, spread null; unreplicated"} + - {"name": "attnrule_max_qk_clamp_n4_dh256_digit32", "stat": "single", "value": 1665, "unit": "int", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json", "note": "Exact arithmetic on constants, not a measurement: largest q/k clamp N4 admits at dh 256 with the legacy 32-bit digit at the largest admitted C (max_qk_clamp_n4.dh256_Cmax_digit32); reproduces DH256-ROTARY.md 2a"} + - {"name": "attnrule_conditions_failing_rule_layout", "stat": "count", "value": 0, "unit": "count", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json", "note": "Exact arithmetic on constants: conditions of AFork::shape() that fail for q/k clamp 1,665, value clamp 4,095, 32-bit digit, kFD 16, dh 256, lt 10, S 12, rx 8, shifts 4 to 12 (layouts entry narrow-1665 with bv 4095: all_ok true, failing empty); not admission of any model"} + - {"name": "attnrule_one_value_bit_ratio_min", "stat": "single", "value": 1.7566, "unit": "ratio", "n": 3, "spread": {"sd": null, "min": 1.7566, "max": 1.9153}, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "note": "Statistic of PR 178's committed in-sample cells, unreplicated: per layer, median over 240 cells of rel_y(C1665) / rel_y(C2047), on the 3 layers (3, 15, 27) where only the value exponent differs between the arms; smallest of the three; spread over those layers; a natural experiment, not a designed arm (D2_summary.v)"} + - {"name": "attnrule_predicted_median_largest", "stat": "max", "value": 0.009393, "unit": "ratio", "n": 16, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "note": "PREDICTED, NOT MEASURED: largest over 16 layers of the registered heuristic's in-sample median rel_y for the rule under the narrow layout (layer 43; B.by_layout.narrow-1665.largest); bar 0.01; the rule was not run"} + - {"name": "attnrule_predicted_median_layer39", "stat": "single", "value": 0.007561, "unit": "ratio", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "note": "PREDICTED, NOT MEASURED: registered heuristic for layer 39 (in-sample median 0.01294 at the old scales), an extrapolation from other layers' one-bit ratios (prediction.narrow-1665.39)"} + - {"name": "attnrule_seen_heldout_value_overshoot", "stat": "single", "value": 1.3076, "unit": "ratio", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "686e058644adfa4419d01487bb4f222295fcf963", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json", "note": "Post hoc, descriptive (PREREG amendment A2): PR 206's held-out value entry at layer 23 (RNE 2,317) over PR 178's in-sample maximum at the same exponent (1,772); exceeds the rule's registered value margin 1.25; the rule was not adjusted (worst_seen_overshoot.v)"} + - {"name": "attnrule_min_value_headroom", "stat": "single", "value": 1.2631, "unit": "ratio", "n": 16, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "686e058644adfa4419d01487bb4f222295fcf963", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json", "note": "Post hoc, descriptive: smallest over 16 layers of the rule's value headroom CL_v / (mx_v 2^E_v), an exact fraction of committed numbers (layer 47); below the seen overshoot 1.3076 on layers 47 and 51 (layouts.narrow-1665.min_headroom.v)"} + - {"name": "attnrule_implied_clamps_on_pr206_prompts", "stat": "count", "value": 0, "unit": "count", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "3fd5f0e9250b703f43d426031e5e096c299418e1", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json", "note": "Post hoc, descriptive (PREREG amendment A3), IMPLIED BY COMMITTED NUMBERS, NOT MEASURED: clamp count of the rule on PR 206's eight held-out prompts, from an exact threshold comparison with PR 178's C1665 arm and PR 206's reported clamp list; relies on PR 206's statements that its list is complete and its exponents were PR 178's; means a run on those prompts cannot test the margin"} From 0a7524556bc16e0f40927f723a9ea9d7c8697d6c Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 04:02:30 +0000 Subject: [PATCH 10/12] attnrule: text fixes (scope of the arithmetic stated as the registered list, cross-references, implied-clamps hash); no number, run or verdict changed --- .../20261129-241-qwen-attn-rescue-rule/ENV.json | 3 ++- .../20261129-241-qwen-attn-rescue-rule/RESULTS.md | 3 ++- experiments/20261129-241-qwen-attn-rescue-rule/RULE.md | 10 ++++++---- research/results.yaml | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/ENV.json b/experiments/20261129-241-qwen-attn-rescue-rule/ENV.json index 53334511..b0db83f1 100644 --- a/experiments/20261129-241-qwen-attn-rescue-rule/ENV.json +++ b/experiments/20261129-241-qwen-attn-rescue-rule/ENV.json @@ -21,7 +21,8 @@ "outputs": { "runs/describe.json": "sha256 968e5d305f65a694f04b71a333c1a7eda0dd29b4dc58433021fc4a774f4d95a7", "runs/n4-report.json": "sha256 708229f81c27b28569a1e5e3cc00f94d53a1b53d8933d30d31f5edefd0a15022", - "runs/headroom.json": "sha256 2800f02c0d11791fc3937d084b4bad855009a0d3b7767e4bd225141d3219cee4" + "runs/headroom.json": "sha256 2800f02c0d11791fc3937d084b4bad855009a0d3b7767e4bd225141d3219cee4", + "runs/implied-clamps.json": "sha256 d65ea5c9a5ecbb39ed6d4c2926a00ba14f91ac1dd3f78eb6e3be25dab941b7e7" }, "toolchain": { "python": "3.12.3, standard library only (json, fractions, math, statistics, unittest); no numpy, no compiled code", diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md b/experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md index 0c197899..2d3b3a65 100644 --- a/experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md +++ b/experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md @@ -8,7 +8,7 @@ Base: main 02d62eb63760fcaf68f47099c70f42aba04a7707. Registration: `PREREG.md` ( - Layers 31, 35 and 39 miss the per-head median bar under upstream's integer attention. The registered procedure, applied to PR #178's in-sample records only, picks the value side as the bottleneck: on the layers where only the value exponent differs between PR #178's two arms, the arm with one value bit fewer has a per-cell error 1.76 to 1.92 times as large (median cell ratio per layer); for one query bit the ratio is 1.00 to 1.03, for one key bit 1.03. - The rule it selects is **V13**: one extra bit on the value cell (clamp 4,095), q and k at the narrow fallback clamp 1,665 with the legacy 32-bit score digit, and a headroom margin of 9/8, 9/8, 5/4 on q, k, v. `RULE.md` has the integer definition and the frozen exponent table. The alternative is one value exponent per key-value head; it is defined but cannot be tabulated from the committed records. -- **Arithmetic: PASS.** Every implemented no-overflow and policy condition of the attention sub-proof holds at dh = 256 for the rule's layout, in exact integers, at every shift 4 to 12. The value clamp enters `shape()` only through N6, which is nowhere near binding. N4 limits q and k to 1,665 and does not see the value cell at all. +- **Arithmetic: PASS.** Every condition of the registered list (the kFD, shift and C policies and the no-overflow conditions N1 to N6 and N9 of `AFork::shape()`) holds at dh = 256 for the rule's layout, in exact integers, at every shift 4 to 12. The value clamp enters `shape()` only through N6, which is nowhere near binding. N4 limits q and k to 1,665 and does not see the value cell at all. - **Prediction: PASS as registered, and it is only a prediction.** The registered heuristic puts every layer's in-sample median at or under 0.01 (largest 0.00939 at layer 43; layers 31, 35, 39 at 0.00631, 0.00627, 0.00756). For the three failing layers it is an extrapolation from other layers. - **The margin is thinner than an overshoot already seen (post hoc).** One held-out value entry that PR #206 reports is 1.3076 times the in-sample maximum; the registered value margin is 1.25. That entry fits under the rule only because of power-of-two slack at its layer. The rule was not adjusted. Section 5 says what this does to the meaning of the PASS. - **A later run on PR #206's eight prompts cannot test the margin (post hoc).** Committed numbers already imply that the rule clamps nothing on those prompts. Section 6. @@ -161,6 +161,7 @@ Consequence for the run the issue asks for: evaluated on PR #206's eight prompts - **Soundness of the listed changes.** `RULE.md` section 4 is a list of obligations read from the code. That a 13-bit value clamp table, a q/k clamp table at 1,665 and three clamps in place of one can be added without changing a legacy verdict, and that the lookups still prove what they must, is not argued. - **The other uses of `CLAMPED_CELL_BOUND`** (`cp_verify.cpp` `acc` at line 1450, `W-xr` at line 1501, the head sub-proof's `BCh` at lines 1859 to 1897): not evaluated. Whether the committed cell of v and its range check admit 13 bits unchanged: not traced. - **The policy conditions (kFD occupancy, C) at softmax shapes other than lt = 10, S = 12, rx = 8**: not evaluated. +- **Tests of `shape()` outside the registered list** (for example `af-shape-lmS`, which depends on parameters not fixed here): not evaluated. - **The site "o" for Qwen**: only "no verdict changes between 2,048 and 4,096" is shown, not that the site holds at the shift a Qwen file would use. - **wide33.** Its formulas are DH256-ROTARY.md's proposal; the 17-bit lookup it depends on does not exist. - **The alternative PKV**: defined, no exponent table, no prediction (no per-group maxima in the committed records). diff --git a/experiments/20261129-241-qwen-attn-rescue-rule/RULE.md b/experiments/20261129-241-qwen-attn-rescue-rule/RULE.md index aa8ec59a..4d151419 100644 --- a/experiments/20261129-241-qwen-attn-rescue-rule/RULE.md +++ b/experiments/20261129-241-qwen-attn-rescue-rule/RULE.md @@ -2,7 +2,7 @@ Status: a rule on paper. It was chosen by the registered procedure of `PREREG.md` from PR #178's committed in-sample records. **It has not been run on any model.** No fidelity number exists for it, in sample or held out. Passing the arithmetic below is not admission of Qwen's attention and not a soundness argument. -Every number in this file comes from a committed run file of this directory: `runs/describe.json` (the registered run), `runs/n4-report.json` (exact integers), `runs/headroom.json` (post hoc, Amendment A2). The tables were generated from those files, not typed. +Every number in this file comes from a committed run file of this directory: `runs/describe.json` (the registered run), `runs/n4-report.json` (exact integers), `runs/headroom.json` (post hoc, Amendment A2), `runs/implied-clamps.json` (post hoc, Amendment A3). The tables were generated from those files, not typed. ## 1. The rule in one paragraph @@ -54,6 +54,8 @@ Against PR #178's C2047 fit, the rule under the narrow layout gains one value bi Script: `n4_arith.py` (Python integers and `fractions` only; transcribed from `verifier/src/vf_attention_shape.h` `AFork::shape()` and `shd()` at main 02d62eb6). Its 29 unit tests pass and reproduce the constants already on main: PR #176 PREREG's N4 numbers, and the tables of DH256-ROTARY.md sections 2a, 2c and 2d (`runs/unit-tests-n4.json`, `test_n4_arith.py`). No constant on main failed to reproduce. +The script transcribes the tests of `shape()` that depend on the numbers below (the list of PREREG Metric A). `shape()` has further tests on parameters that are not fixed here (for example `af-shape-lmS`); those were not evaluated. + Parameters: ldh = 8 (dh = 256), Ty = 2^18, lt = 10, S = 12, rx = 8 (so u0 = 2,307), shifts 4 .. 12. Rows that depend on the shift are shown at sh = 4 and sh = 12; every shift 4 .. 12 was evaluated and holds (`runs/n4-report.json`, `layouts`, `all_ok`). ### 3a. The rule's layout: q and k clamp 1,665, value clamp 4,095, 32-bit digit, kFD = 16 @@ -77,7 +79,7 @@ Parameters: ldh = 8 (dh = 256), Ty = 2^18, lt = 10, S = 12, rx = 8 (so u0 = 2,30 | af-no-wrap-N6 | | 565,200,528,932,865 | < | 1,152,921,504,606,846,976 | yes | | af-no-wrap-N9 | | 131,072 | < | 1,152,921,504,606,846,976 | yes | -All conditions hold (`all_ok` true). At the largest admitted C (16,711,680) the no-overflow conditions N1 to N9 also hold for every one of the 182 pairs (lt, S) with lt in 2 .. 16, S in 1 .. 14 and lt + S + 1 <= 24 (`superset_failures` 0). This is a superset bound check, not 182 admitted parameter files, and it does not cover the kFD occupancy or C policy rows at those other shapes. +All transcribed conditions hold (`all_ok` true). At the largest admitted C (16,711,680) the no-overflow conditions N1 to N9 also hold for every one of the 182 pairs (lt, S) with lt in 2 .. 16, S in 1 .. 14 and lt + S + 1 <= 24 (`superset_failures` 0). This is a superset bound check, not 182 admitted parameter files, and it does not cover the kFD occupancy or C policy rows at those other shapes. The only condition of `shape()` that moves when the value clamp goes from 2,047 to 4,095 is N6, whose first term is `2 TS b_v`: its left side goes from 565,183,349,063,681 to 565,200,528,932,865, against a bound of 2^60 (`n6_left`; unit test `test_only_n6_moves_with_bv`). @@ -139,7 +141,7 @@ The registered prediction (PREREG "Prediction") for the rule under the narrow la - Layer 43 gains no value bit, loses a query bit, and is predicted 6% under the bar. - It says nothing about the second half of the fidelity bar (max rel_y <= 0.05). -**Known weakness of the margin (post hoc, Amendment A2; the rule was not adjusted).** At PR #206's layer 23 the held-out value entry is 2,317 against an in-sample maximum of 1,772 at the same exponent: a ratio of 1.3076, more than the registered value margin 5/4. It fits under the rule only because layer 23 happens to have a headroom of 2.31. At layers 47 and 51 the rule's value headroom is 1.2631 and 1.2995: an overshoot of the size already seen once would be clamped there. See `RESULTS.md` section 5. +**Known weakness of the margin (post hoc, Amendment A2; the rule was not adjusted).** At PR #206's layer 23 the held-out value entry is 2,317 against an in-sample maximum of 1,772 at the same exponent: a ratio of 1.3076, more than the registered value margin 5/4. It fits under the rule only because layer 23 happens to have a headroom of 2.31. At layers 47 and 51 the rule's value headroom is 1.2631 and 1.2995: an overshoot of the size already seen once would be clamped there. See `RESULTS.md` section 5. A later run on PR #206's eight prompts cannot test this margin: committed numbers already imply the rule clamps nothing on them (`runs/implied-clamps.json`, `RESULTS.md` section 6). ## 6. The alternative: PKV (one value exponent per key-value head, 12-bit value cell) @@ -152,4 +154,4 @@ Definition: for key-value head g in 0 .. 3, `E_v[g]` = the largest E with `m_v * ## 7. Not established by this file -See `RESULTS.md` section 8. In one line: the rule's fidelity, its range transfer, the soundness of any of the listed changes, and the admission of Qwen's attention are all open. +See `RESULTS.md` section 9. In one line: the rule's fidelity, its range transfer, the soundness of any of the listed changes, and the admission of Qwen's attention are all open. diff --git a/research/results.yaml b/research/results.yaml index 57388c76..70400ad0 100644 --- a/research/results.yaml +++ b/research/results.yaml @@ -2088,7 +2088,7 @@ results: metrics: - {"name": "attnrule_n4_unit_tests_passed", "stat": "count", "value": 29, "total": 29, "unit": "count", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/unit-tests-n4.json", "note": "Exact-integer tests of n4_arith.py, including reproduction of PR 176 PREREG's N4 numbers and DH256-ROTARY.md 2a, 2c, 2d; deterministic, spread null; unreplicated"} - {"name": "attnrule_max_qk_clamp_n4_dh256_digit32", "stat": "single", "value": 1665, "unit": "int", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json", "note": "Exact arithmetic on constants, not a measurement: largest q/k clamp N4 admits at dh 256 with the legacy 32-bit digit at the largest admitted C (max_qk_clamp_n4.dh256_Cmax_digit32); reproduces DH256-ROTARY.md 2a"} - - {"name": "attnrule_conditions_failing_rule_layout", "stat": "count", "value": 0, "unit": "count", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json", "note": "Exact arithmetic on constants: conditions of AFork::shape() that fail for q/k clamp 1,665, value clamp 4,095, 32-bit digit, kFD 16, dh 256, lt 10, S 12, rx 8, shifts 4 to 12 (layouts entry narrow-1665 with bv 4095: all_ok true, failing empty); not admission of any model"} + - {"name": "attnrule_conditions_failing_rule_layout", "stat": "count", "value": 0, "unit": "count", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json", "note": "Exact arithmetic on constants: transcribed conditions of AFork::shape() (the registered list: kFD, shift and C policies, N1 to N6, N9) that fail for q/k clamp 1,665, value clamp 4,095, 32-bit digit, kFD 16, dh 256, lt 10, S 12, rx 8, shifts 4 to 12 (layouts entry narrow-1665 with bv 4095: all_ok true, failing empty); other tests of shape() not evaluated; not admission of any model"} - {"name": "attnrule_one_value_bit_ratio_min", "stat": "single", "value": 1.7566, "unit": "ratio", "n": 3, "spread": {"sd": null, "min": 1.7566, "max": 1.9153}, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "note": "Statistic of PR 178's committed in-sample cells, unreplicated: per layer, median over 240 cells of rel_y(C1665) / rel_y(C2047), on the 3 layers (3, 15, 27) where only the value exponent differs between the arms; smallest of the three; spread over those layers; a natural experiment, not a designed arm (D2_summary.v)"} - {"name": "attnrule_predicted_median_largest", "stat": "max", "value": 0.009393, "unit": "ratio", "n": 16, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "note": "PREDICTED, NOT MEASURED: largest over 16 layers of the registered heuristic's in-sample median rel_y for the rule under the narrow layout (layer 43; B.by_layout.narrow-1665.largest); bar 0.01; the rule was not run"} - {"name": "attnrule_predicted_median_layer39", "stat": "single", "value": 0.007561, "unit": "ratio", "n": 1, "spread": null, "hardware": "cpu-epyc-rome-kvm-16", "date": "2026-11-29", "commit": "411f4a50a2bb105606b91825c92cab2303728900", "source": "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "note": "PREDICTED, NOT MEASURED: registered heuristic for layer 39 (in-sample median 0.01294 at the old scales), an extrapolation from other layers' one-bit ratios (prediction.narrow-1665.39)"} From 13952e2eeaa1961220fe7fb5694a80a8e37f8e3c Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 04:14:56 +0000 Subject: [PATCH 11/12] research: #241 ledger row conditions made exact (which PR 206 reads the scripts make vs the write-up); no number, run or verdict changed --- README.md | 2 +- research/results.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 38752888..76a4bdda 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Every number below comes from a file on `main` (the one exception, a reviewer fi | Qwen M3a-1 weight side: one DeltaNet head's real weights in a committed table, the trace's 1,666 weight cells in class and tied to it (issue #229) | measured, unreplicated | Measured, unreplicated, CPU research harness, research setting (no security level). The 3,288,706 integer weights of V head 0, layer 0 of the pinned stock Qwen3.8-27B (each fetched tensor SHA-256 equal to the merged stream hash) are a committed table; the 1,666 weights the head trace reads (conv taps, gains, cA, dt_bias) are product-oracle cells in their design classes by exact bits and are tied to the table by one point drawn after both commitments and one LIN claim on the table (one-time test). 5 of 5 honest proofs verified; all 8 registered hostile proofs rejected (other root twice, a tap changed two ways, gain 2^50, gain in class but not the table one, dt_bias 2^17, table row 0 non-zero past the cells); 3 of 3 completeness cases accepted (dt_int 78,848, -23,424, 2^17 - 1). NOT established: any bound on the 3,287,040 matrix weights (no Qwen layout of the WF range proof); any head computation (in_proj as a claim, sub-step c, not started); any soundness level (LIN runs on a hand-made test plan, rounds unpriced); hiding; that the table is the advertised checkpoint; accuracy | CPU only, cores 2-7 of a shared loaded host, single-threaded runs through the heavy-job gate, g++ 13.3.0 -O2; PREREG first and alone, one amendment (implementation choices) committed before the runs; debug only on a synthetic fixture (numpy seed 9101, head 1); research setting target 10 bits, query work 6; LIN plan hand-made (lin_world.h) | [experiments/20261121-229-qwen-m3a1-weight-side/RESULTS.md](experiments/20261121-229-qwen-m3a1-weight-side/RESULTS.md) | | 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) | -| Qwen integer attention, one rescue scale rule on paper for layers 31, 35, 39 at head size 256: value cell one bit wider, with its exact admission arithmetic (issue #241) | measured, unreplicated (desk: exact arithmetic and a prediction from in-sample records; the rule itself is NOT run) | Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table | CPU only, Python 3.12.3 standard library, exact integers and fractions; deterministic scripts on committed files and constants, one run each; PREREG first and alone, amendment A1 before the registered run, amendments A2 and A3 post hoc, each committed with its script before that script's one run; PR 206 used only for its five reported clamp locations (seen before registration, disclosed); the 182 softmax-shape check covers the no-overflow conditions only; shared loaded host; lane finished by a second instance after a run-time cut | [experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md](experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md); a rule on paper, predicted not measured | +| Qwen integer attention, one rescue scale rule on paper for layers 31, 35, 39 at head size 256: value cell one bit wider, with its exact admission arithmetic (issue #241) | measured, unreplicated (desk: exact arithmetic and a prediction from in-sample records; the rule itself is NOT run) | Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table | CPU only, Python 3.12.3 standard library, exact integers and fractions; deterministic scripts on committed files and constants, one run each; PREREG first and alone, amendment A1 before the registered run, amendments A2 and A3 post hoc, each committed with its script before that script's one run; the committed scripts read PR 206 only for its five reported clamp locations (seen before registration, disclosed); other reads of PR 206 files made while writing up are listed in RESULTS.md section 8; the 182 softmax-shape check covers the no-overflow conditions only; shared loaded host; lane finished by a second instance after a run-time cut | [experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md](experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md); a rule on paper, predicted not measured | _Last regenerated from `research/results.yaml` on 2026-11-29 (UTC), against main `57460851`._ diff --git a/research/results.yaml b/research/results.yaml index 70400ad0..b4beb301 100644 --- a/research/results.yaml +++ b/research/results.yaml @@ -2082,7 +2082,7 @@ results: replication: "unreplicated" pr: 246 summary: "Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table" - conditions: "CPU only, Python 3.12.3 standard library, exact integers and fractions; deterministic scripts on committed files and constants, one run each; PREREG first and alone, amendment A1 before the registered run, amendments A2 and A3 post hoc, each committed with its script before that script's one run; PR 206 used only for its five reported clamp locations (seen before registration, disclosed); the 182 softmax-shape check covers the no-overflow conditions only; shared loaded host; lane finished by a second instance after a run-time cut" + conditions: "CPU only, Python 3.12.3 standard library, exact integers and fractions; deterministic scripts on committed files and constants, one run each; PREREG first and alone, amendment A1 before the registered run, amendments A2 and A3 post hoc, each committed with its script before that script's one run; the committed scripts read PR 206 only for its five reported clamp locations (seen before registration, disclosed); other reads of PR 206 files made while writing up are listed in RESULTS.md section 8; the 182 softmax-shape check covers the no-overflow conditions only; shared loaded host; lane finished by a second instance after a run-time cut" evidence: ["experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md", "experiments/20261129-241-qwen-attn-rescue-rule/RULE.md", "experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md", "experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md", "experiments/20261129-241-qwen-attn-rescue-rule/ENV.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json", "experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json"] evidence_note: "; a rule on paper, predicted not measured" metrics: From 6f33cf7dee849a3685b5bcb57d1f360c7ecdff2b Mon Sep 17 00:00:00 2001 From: wakesync <60821182+wakesync@users.noreply.github.com> Date: Sun, 29 Nov 2026 04:25:47 +0000 Subject: [PATCH 12/12] results: regenerate README block and CLAIMS.md after merging main fef9d2b8 scripts/update-results.py after the merge commit (77 results); stamp line kept as main's verbatim. Adds this PR's row for qwen-attn-rescue-rule-241 to the README block and CLAIMS.md on top of main's; no other change. --- CLAIMS.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CLAIMS.md b/CLAIMS.md index 16f5d945..7a6dd0eb 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-attn-rescue-rule-241` | Qwen integer attention, one rescue scale rule on paper for layers 31, 35, 39 at head size 256: value cell one bit wider, with its exact admission arithmetic (issue #241): Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table | measured, unreplicated (desk: exact arithmetic and a prediction from in-sample records; the rule itself is NOT run) | unreplicated | [experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md](experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md), [experiments/20261129-241-qwen-attn-rescue-rule/RULE.md](experiments/20261129-241-qwen-attn-rescue-rule/RULE.md), [experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md](experiments/20261129-241-qwen-attn-rescue-rule/FUTURE-PREREG.md), [experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md](experiments/20261129-241-qwen-attn-rescue-rule/PREREG.md), [experiments/20261129-241-qwen-attn-rescue-rule/ENV.json](experiments/20261129-241-qwen-attn-rescue-rule/ENV.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/describe.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/n4-report.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/headroom.json), [experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json](experiments/20261129-241-qwen-attn-rescue-rule/runs/implied-clamps.json) | #246 | diff --git a/README.md b/README.md index 1d7affcc..ad8e923a 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 integer attention, one rescue scale rule on paper for layers 31, 35, 39 at head size 256: value cell one bit wider, with its exact admission arithmetic (issue #241) | measured, unreplicated (desk: exact arithmetic and a prediction from in-sample records; the rule itself is NOT run) | Desk result, unreplicated. No model run, no weights, no proof; the rule has no fidelity number. A procedure registered before any number was computed, applied to PR 178's in-sample records only, picks the value side (one value bit fewer goes with a 1.76 to 1.92 times larger per-cell error on the layers where only that exponent differs; a query bit 1.00 to 1.03; a key bit 1.03) and selects rule V13: value clamp 4,095, q and k at the narrow 1,665 clamp with the legacy 32-bit score digit, margins 9/8, 9/8, 5/4. Registered items: A1 PASS (29 of 29 exact-integer tests, constants on main reproduced), A2 PASS for the rule's layout at dh 256, shifts 4 to 12 (the value clamp enters shape() only through N6, far from binding; N4 limits q and k to 1,665 and does not contain the value cell), B PASS as a PREDICTION only (registered heuristic puts all 16 in-sample medians at or under 0.01, largest 0.00939 at layer 43; layers 31, 35, 39 are extrapolated from other layers), C PASS (rule, admission consequences and the future run's registration text are files). Post hoc, rule not adjusted: one held-out value entry already on main is 1.3076 times the in-sample maximum against a registered value margin of 1.25 and fits only by power-of-two slack; the rule's value headroom is below 1.3076 on layers 47 and 51. Post hoc: committed numbers already imply the rule clamps nothing on PR 206's eight prompts, so a run on those prompts cannot test the margin. NOT established: the rule's fidelity in sample or held out; the max half of the bar; range transfer; any admission, table, prover or verifier change or its soundness; other uses of the clamped-cell bound in cp_verify; the alternative (per key-value head value exponent) has no table | CPU only, Python 3.12.3 standard library, exact integers and fractions; deterministic scripts on committed files and constants, one run each; PREREG first and alone, amendment A1 before the registered run, amendments A2 and A3 post hoc, each committed with its script before that script's one run; the committed scripts read PR 206 only for its five reported clamp locations (seen before registration, disclosed); other reads of PR 206 files made while writing up are listed in RESULTS.md section 8; the 182 softmax-shape check covers the no-overflow conditions only; shared loaded host; lane finished by a second instance after a run-time cut | [experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md](experiments/20261129-241-qwen-attn-rescue-rule/RESULTS.md); a rule on paper, predicted not measured | _Last regenerated from `research/results.yaml` on 2026-11-29 (UTC), against main `57460851`._