Pillar-2 — Q4_K + τ-bowl ceiling-break (NATIVE operational map)
Date: 2026-06-06
This is the NATIVE-side operational map for Pillar-2: produce a Q4_K .knot,
admit it through the qspec gate, serve it, and (stretch) run the masked compute
through the certified τ-bowl gate. It cites the load-bearing files so the next
agent can act without re-deriving the layout. It does not run heavy builds.
0. State of the world (verified 2026-06-06)
- The admitted
~/.edgework/models/qwen2.5-0.5b-instruct.knotis ALREADY a mixed K-quant repack. Header histogram:Q5_0:132 F32:121 Q8_0:13 Q6_K:12 Q4_K:12(archqwen2). It is ADMITTED (ledger:monster-swarm/ADMITTED_MODELS.md, qspecmonster-swarm/qspecs/paris.qspec.json, expect Paris=12095). - Its source GGUF
~/.edgework/models/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf(~380 MB on disk) has the identical tensor-type mix —gguf-to-knot.pycopies quantized bytes verbatim, so the knot inherits the GGUF's "Q4_K_M" mixture. So a Q4_K-bearing admitted knot already exists; Pillar-2's new work is (a) a more Q4_K-dominant model if desired and (b) wiring the τ-bowl serving gate, which is currently standalone. - Prebuilt (no build needed):
distributed-inference/target/release/paris-probe-rknot(Jun 5),bowl-probe,bowl-probe-ffn,fat-station. NOT prebuilt:monster-guardandmonster-swarm(no*/release/monster-guard). - Python
ggufmodule v0.18.0 + numpy 2.4.1 are present (gguf-to-knot.py runs).
1. Q4_K knot production path (CPU-safe)
gguf-to-knot.py (distributed-inference/gguf-to-knot.py) repacks a
pre-quantized GGUF into KNOT verbatim — Q4_K stays Q4_K (144 B / 256-elem
super-block preserved, see header docstring L17 + L279). It does NOT requantize.
Command (already has a suitable local GGUF — no fetch needed):
cd open-source/gnosis/distributed-inference
python3 gguf-to-knot.py \
~/.edgework/models/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf \
~/.edgework/models/qwen2.5-0.5b-q4km.knot \
--name qwen2.5-0.5b-q4kmOutput is byte-identical to the admitted knot's payload (verbatim copy) plus a self-check round-trip (gguf-to-knot.py L347-394 samples 3 tensors and refuses on mismatch). For a MORE Q4_K-dominant model, fetch a pure-Q4_K GGUF (minimal fetch, do NOT download now):
- TinyLlama-1.1B
*-Q4_K_M.gguf≈ 0.67 GB (bartowski/TinyLlama-1.1B-Chat-v1.0-GGUF), or - Qwen2.5-1.5B-Instruct
*-Q4_K_M.gguf≈ 1.1 GB (bartowski/Qwen2.5-1.5B-Instruct-GGUF).
Note: GGUF Q4_K_M is a mixture (attn_v / ffn_down promoted to Q6_K). A
strictly-all-Q4_K knot would need a Q4_K_S GGUF (still mixes some Q5_K). The
parity oracle (§4) only needs the Q4_K blocks, which both carry.
2. Admission (needs-build for monster-guard; probe itself is prebuilt)
The qspec is a tiny JSON contract (schema: monster-guard/src/qspec.rs L29-58). Shape (mirror paris.qspec.json with the new knot path + same tokenizer tokens):
{
"probe": "paris-probe-rknot",
"knot": "~/.edgework/models/qwen2.5-0.5b-q4km.knot",
"prompt_tokens": [785, 6722, 315, 9625, 374],
"expect_token": 12095,
"expect": "Paris",
"reject_token": 576
}What the gate checks (qspec.rs verify L187-205):
- POSITIVE — runs the probe expecting
expect_token; the probe (paris-probe-rknot --dense <knot> --dense-only --tokens <ids> --expected <id> --top-k 8, args built in qspec.rs L132-151) embeds → all layers → lm_head → argmax, exits 0 iff argmax == expect_token. - NEGATIVE CONTROL — if
reject_tokenis set, re-runs expecting it and requires the probe to FAIL (so a fixed-output / phoney model is refused).parse(L89) rejectsreject_token == expect_token.
Admit command (ledger ADMITTED_MODELS.md "How admission works"):
cd open-source/gnosis
PATH=$PWD/distributed-inference/target/release:$PATH \
./monster-guard/target/release/monster-guard qspec verify \
monster-swarm/qspecs/qwen2.5-0.5b-q4km.qspec.json
# exit 0 = ADMITTED, non-zero = DENIEDmonster-guard is NOT prebuilt — it needs one cargo build -p monster-guard --release (or the monster sovereign build). The PROBE it shells out to IS
prebuilt, so a fast functional pre-check needs no build:
./distributed-inference/target/release/paris-probe-rknot \
--dense ~/.edgework/models/qwen2.5-0.5b-q4km.knot --dense-only \
--tokens 785,6722,315,9625,374 --expected 12095 --top-k 8
# PASS → argmax 12095 (Paris). Then negative: --expected 576 must FAIL.On PASS, add a row to monster-swarm/ADMITTED_MODELS.md.
3. τ-bowl serving — the operationalization gap
The τ-bowl is fully built and tested but NOT wired into the matmul serving hot path. Concretely:
tukey_bowl.rs— the certified gate:gate()(L230, sup-norm2τ≤γ) andgate_energy()(L261, L24τ²≤γ²), thePrecisionSpeculatortrait (L289),CentroidSpeculatorbaseline (L302),mask_streamscoreboard (L351). All unit-tested; runtime twin ofGnosis.QualityMarginCacheAdmissibility.jit_speculator_race.rs— races 4 drafters (Centroid / LatticeE8 / SelfRecursionAR / DistilledHead) throughgate_energyon SYNTHETIC AR(1) KV (L35 import). Offline benchmark, not a serve path.polyglot/src/foil_speculative_dequant.rs— the FOIL fold point that composes the value-door Reynolds gate +gate_energy+conformal_admit+ the lattice G-ladder. This is the intended serving composition but lives inpolyglot, not in the model.rs forward.bowl-probe/bowl-probe-ffn(prebuilt) — run the gate on REAL admitted weights offline (bowl-probe.rs docstring; default knot = the 0.5B). This is the measurement surface, not serving.
Proof the serving forward does NOT call it: grep -c "tukey_bowl\|jit_speculator_race\|foil_speculative_dequant" over
distributed-inference/src/model.rs returns 0. The only live gate
consumer in model.rs's family is kv_cache_e8.rs (L44 imports gate), used
in the OFFLINE bowl_gate_report (kv_cache_e8.rs ~L430), not the matvec.
What model.rs does have is a different, coarser speculation: an FFN
hidden-block skip mask (ffn_hidden_block_mask) routed through
cached_masked_mat_vec (model.rs L1121) + mat_vec_q4k_masked (dispatched at
L5529 for QType::Q4K ffn_down). This skips whole 256-elem blocks; it is NOT
the certified per-tile precision gate.
Integration seam (what "operationalize" requires)
The fold point is the quantized matvec dispatch
mat_vec_dispatch_batch (model.rs L932) — specifically the QType::Q4K arm
(L948 / L1022) and the masked variant cached_masked_mat_vec (L1121). To wire
the τ-bowl:
- Add a flag (mirror the existing
ffn_guard_*/explicitly_speculatedfields, model.rs L1309/L1371/L1465) e.g.tau_bowl_enabled— DEFAULT-ON per the project's default-on policy, kill-switchGNOSIS_TAU_BOWL=false. - In the Q4_K matvec arm, for each 256-elem super-block: dequant the coarse
draft (centroid via
dequantize_q4k_row, math.rs L71) and calltukey_bowl::gate_energy(τ, γ)where γ is the observed decision margin and τ is the certified cell covering bound (serve-time has no truth — use the conformalq-quantile fromconformal_gate::conformal_admit, asfoil_speculative_dequant.rsalready composes). OnAdmitcarry the coarse draft; onMisstake the real high-precision load ("miss, not lie"). - Sample drafts on the leech-turbo stride 11 (
tukey_bowl::LEECH_TURBO_STRIDE, coprime to the Leech carrier 196560) so the schedule cannot alias weight structure. - Report accept-rate via
MaskReport(tukey_bowl.rs L318) so the win is measured end-to-end (not assumed).
The cleanest first move is to lift polyglot/foil_speculative_dequant.rs into
the distributed-inference matvec call site (it already imports everything from
this crate), rather than re-implementing the composition.
4. Parity contract — Rust oracle for the WGSL Q4_K kernel
math.rs::dequantize_q4k_row (L71) is the byte-for-byte oracle the browser
WGSL Q4_K kernel must match. It is also the same dequant the serving matvec uses
(model.rs L4050/4159/4771/4842 + the kernels behind L948), so a WGSL kernel that
matches it matches serving exactly. Exact block layout (super-block = 256
elements = 144 bytes):
| Offset (bytes) | Size | Field | Meaning |
|---|---|---|---|
| 0..2 | 2 | d |
f16 super-block scale (math.rs L77) |
| 2..4 | 2 | dmin |
f16 super-block min (L78) |
| 4..16 | 12 | scales |
8 × 6-bit packed scales + 8 × 6-bit packed mins (L79) |
| 16..144 | 128 | qs |
256 × 4-bit quants, two per byte (L80) |
Decode (math.rs L81-89), per 64-element half-group j ∈ {0,64,128,192}:
- 6-bit scale/min unpack
get_scale_min_k4(j/32, scales)(math.rs L52-61):- sub-block
i < 4:sc = scales[i] & 63,m = scales[i+4] & 63 - sub-block
i ≥ 4:sc = (scales[i+4] & 0xF) | ((scales[i-4] >> 6) << 4),m = (scales[i+4] >> 4) | ((scales[i] >> 6) << 4)
- sub-block
- For the two 32-element sub-blocks of the 64-group (qb =
(j/64)*32):- low nibble:
out[j+l] = d·sc1·(qs[qb+l] & 0xF) − dmin·m1 - high nibble:
out[j+32+l] = d·sc2·(qs[qb+l] >> 4) − dmin·m2for l in 0..32
- low nibble:
A WGSL author mirrors: f16→f32 (math.rs f16_to_f32 L30), the 6-bit
scale/min unpack, and the affine d·sc·q − dmin·m. Verify against the Rust by
running the same random bytes through both and asserting f32 tolerance — exactly
the discipline kquant_dequant.rs uses for Q5_0/Q6_K/Q8_0 (its tests verify
dequant_row · x == mat_vec_dispatch_batch[i], kquant_dequant.rs L138-169).
5. Ordered operational checklist
- [CPU-safe] Repack a Q4_K knot from the local GGUF (§1). Source GGUF is already present — no fetch. (For a Q4_K-dominant model, §1 fetch note; do not download under the current resource constraint.)
- [CPU-safe] Write
monster-swarm/qspecs/<model>.qspec.json(§2 shape). - [CPU-safe] Functional pre-check with the PREBUILT
paris-probe-rknot --dense-only(§2): positive expect PASS, reject FAIL. - [needs-build] Build
monster-guard(cargo build -p monster-guard --release/ monster sovereign build) — only once; the probe is prebuilt. - [CPU-safe]
monster-guard qspec verify <qspec>→ exit 0 = ADMITTED; add the row toADMITTED_MODELS.md. - [needs-build] (stretch) Wire
tukey_bowl::gate_energy+conformal_admitinto the Q4_K matvec arm ofmat_vec_dispatch_batch(model.rs L932 / L948 / L1121), gatedtau_bowl_enableddefault-on, stride 11; reusepolyglot/foil_speculative_dequant.rs. Rebuildparis-probe-rknotand re-run §3-§5 to confirm the gate never lowers admission (miss-not-lie). - [CPU-safe] Measure with the prebuilt
bowl-probe/bowl-probe-ffnon the admitted Q4_K knot to read the certified accept-rate before/after. - [needs-GPU] Browser WGSL Q4_K kernel parity (§4) — out of scope for the
native side; verify the WGSL against
math.rs::dequantize_q4k_rowbyte-for-byte.