contract(trace-ffn-sub-block-gguf-v1): v1.0.0 PROPOSED scaffold — SHIP-007 layer-3 H1/H2 unblock#1532
Merged
Conversation
…P-007 layer-3 H1/H2 unblock Authors the GGUF-side sub-FFN telemetry contract that unblocks the SHIP-007 layer-3 ffn_swigl bisection (memory: project_ship_007_layer_3_swiglu_bisection.md). BACKGROUND: SHIP-007 §21 (aprender PR #1072) narrowed the bug to "(layer=3, ffn_swigl element-wise multiply)" on the APR forward path. APR layer-3 ffn_swigl std = 1.222 (17.2× layer-2 baseline). But §21 cannot distinguish: H1: Token-position-dependent correlation (NORMAL model behavior) H2: APR-side bug (forward path produces wrong VALUES vs GGUF) without GGUF-side per-layer sub-FFN telemetry. Currently NO forward_traced method exists on OwnedQuantizedModel. THIS CONTRACT: Pins the architecture for adding GGUF-side traced forward mirroring `trace-ffn-sub-block-v1` (APR sibling). Same 5 sub-FFN fields (gate_proj_out, up_proj_out, silu_gate, swiglu_inner, ffn_down_out). Same equation. Cross-comparison enabled by schema parity (PO-TRACE-FFN-GGUF-002). Implementation stages (multi-PR cascade, deliberate session): - M-FFN-GGUF-0: contract scaffold (this PR) - M-FFN-GGUF-1: LayerActivation struct on GGUF side - M-FFN-GGUF-2: NEW forward_traced on OwnedQuantizedModel - M-FFN-GGUF-3: heavy comparison harness APR vs GGUF layer-3 - M-FFN-GGUF-4: SHIP-007 fix PR cites H1 or H2 4 falsification tests defined: - FFN-GGUF-001: forward_traced exists on OwnedQuantizedModel - FFN-GGUF-002: byte-identity vs production forward - FFN-GGUF-003: APR-vs-GGUF layer-3 ffn_swigl std distinguishes H1/H2 - FFN-GGUF-004: SHIP-007 fix PR cites bisected hypothesis PATTERN PRECEDENT: Mirrors the proven trace-moe-gpu-sub-stages-v1 cascade closure (M50→M87, 2026-05-04→06): contract scaffold first, then implementation stages, then heavy harness, then fix. Bug class is similar: bisection identified a SURFACE but cannot distinguish hypotheses without sibling telemetry. This contract is the parallel-track autonomous work that should have been authored during M-GPU-MOE CI dead time but wasn't. With M-GPU-MOE-1.x cascade now closed, the SHIP-007 layer-3 cascade can proceed in parallel-or-serial fashion. Discharges 5 transitively-blocked MODEL-1 PARTIALs per ship-two- models-spec.md §17.5: SHIP-002, SHIP-005, SHIP-006, SHIP-007, SHIP-008. YAML-only — production hot paths byte-unchanged. `pv validate` 0/0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
18a76aa to
b3928d8
Compare
5 tasks
noahgift
added a commit
that referenced
this pull request
May 6, 2026
…— SHIP-007 H1/H2 bisection Authors the heavy comparison harness pinned in contract trace-ffn-sub-block-gguf-v1 v1.0.0 step M-FFN-GGUF-3 (M88 PR #1532 squash ca03361). Mirrors the M80 skip-if-not-present pattern from `qwen3_moe_gpu_per_stage_diff::falsify_moe_sub_002_*`. What it does: - Loads APR 7B teacher via AprTransformer::from_apr_file - Loads same model GGUF via OwnedQuantizedModel::from_mapped - Runs forward_traced on both with the same canonical SHIP-007 prompt ("What is 2+2?") - Extracts per-layer ffn_swiglu_inner_stats.std_dev for each - Computes ratio at layer 3 (the §21 anomaly site) - Reports verdict: - H1 (ratio in [0.5, 2.0]): NORMAL model behavior — SHIP-007 root cause is ELSEWHERE (lm_head / post-FFN residual / token- position correlation) - H2 (ratio outside band): APR-side bug — fix at `inference.rs:160-164` swigl elementwise multiply Discharges FALSIFY-FFN-GGUF-003 at the algorithm level: the harness EXISTS and produces a single H1/H2 verdict on operator dispatch. Full DISCHARGED requires the operator to run with canonical files present and capture the verdict in evidence. `#[ignore]`-gated; skips cleanly if either canonical 7B .apr or .gguf is missing on the host (verified locally — host has the .gguf at /mnt/nvme-raid0/models/ship-two-001/ but no .apr; test ran clean and skipped). Contract amendment: M-FFN-GGUF-3 status PENDING → ALGORITHM_LEVEL_DISCHARGED. Operator workflow documented inline. No production hot path touched — additive test-only file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
noahgift
added a commit
that referenced
this pull request
May 6, 2026
…— SHIP-007 H1/H2 bisection (#1533) Authors the heavy comparison harness pinned in contract trace-ffn-sub-block-gguf-v1 v1.0.0 step M-FFN-GGUF-3 (M88 PR #1532 squash ca03361). Mirrors the M80 skip-if-not-present pattern from `qwen3_moe_gpu_per_stage_diff::falsify_moe_sub_002_*`. What it does: - Loads APR 7B teacher via AprTransformer::from_apr_file - Loads same model GGUF via OwnedQuantizedModel::from_mapped - Runs forward_traced on both with the same canonical SHIP-007 prompt ("What is 2+2?") - Extracts per-layer ffn_swiglu_inner_stats.std_dev for each - Computes ratio at layer 3 (the §21 anomaly site) - Reports verdict: - H1 (ratio in [0.5, 2.0]): NORMAL model behavior — SHIP-007 root cause is ELSEWHERE (lm_head / post-FFN residual / token- position correlation) - H2 (ratio outside band): APR-side bug — fix at `inference.rs:160-164` swigl elementwise multiply Discharges FALSIFY-FFN-GGUF-003 at the algorithm level: the harness EXISTS and produces a single H1/H2 verdict on operator dispatch. Full DISCHARGED requires the operator to run with canonical files present and capture the verdict in evidence. `#[ignore]`-gated; skips cleanly if either canonical 7B .apr or .gguf is missing on the host (verified locally — host has the .gguf at /mnt/nvme-raid0/models/ship-two-001/ but no .apr; test ran clean and skipped). Contract amendment: M-FFN-GGUF-3 status PENDING → ALGORITHM_LEVEL_DISCHARGED. Operator workflow documented inline. No production hot path touched — additive test-only file. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary (CORRECTED)
Authors the GGUF-side sub-FFN telemetry contract that documents and pins the SHIP-007 layer-3 ffn_swigl bisection cascade.
Correction during authoring: I initially claimed M-FFN-GGUF-1 and M-FFN-GGUF-2 were PENDING. They're actually SHIPPED via prior PRs #1081 (PR A scaffold) and #1082 (PR B sub-FFN populate). The contract has been amended to reflect this. M-FFN-GGUF-3 (heavy comparison harness) and M-FFN-GGUF-4 (SHIP-007 fix PR) remain OPEN.
The blocker this contract documents
SHIP-007 §21 (aprender PR #1072) narrowed the bug to "(layer=3, ffn_swigl element-wise multiply)" on the APR forward path:
§21 cannot distinguish two competing hypotheses:
inference.rs:160-164swigl elementwise multiplyImplementation stages (CORRECTED)
OwnedQuantizedModel::forward_tracedfor dense SwiGLU path (PRs #1081 + #1082)Known limitation in M-FFN-GGUF-2: the MoE path's
forward_qwen3_moe_traceddoes NOT populate the 4 per-layer LayerActivation sub-FFN fields. Not blocking H1/H2 for the dense 7B Qwen2.5-Coder; future enhancement if MoE-side SHIP-007 bisection ever needed.Why ship a contract that retro-records prior work
The contract still serves a load-bearing purpose:
This is the parallel-track autonomous work that should have been authored during M-GPU-MOE CI dead time. With M-GPU-MOE-1.x cascade closed, the SHIP-007 layer-3 cascade is now contract-pinned and only M-FFN-GGUF-3/4 remain.
Test plan
pv validate0/0project_ship_007_layer_3_swiglu_bisection.md, evidence dir, sibling APR contracttrace-ffn-sub-block-v1, prior-work PRs feat(p3-pra): SHIP-007 GGUF forward_traced scaffold — 6 non-FFN LayerActivation fields per layer #1081/feat(p3-prb): SHIP-007 GGUF forward_traced sub-FFN populate — 4 sub-FFN ActivationStats slots filled #1082, and proven precedenttrace-moe-gpu-sub-stages-v1🤖 Generated with Claude Code