Skip to content

contract(trace-ffn-sub-block-gguf-v1): v1.0.0 PROPOSED scaffold — SHIP-007 layer-3 H1/H2 unblock#1532

Merged
noahgift merged 1 commit into
mainfrom
contract/trace-ffn-sub-block-gguf-v1.0.0-scaffold
May 6, 2026
Merged

contract(trace-ffn-sub-block-gguf-v1): v1.0.0 PROPOSED scaffold — SHIP-007 layer-3 H1/H2 unblock#1532
noahgift merged 1 commit into
mainfrom
contract/trace-ffn-sub-block-gguf-v1.0.0-scaffold

Conversation

@noahgift

@noahgift noahgift commented May 6, 2026

Copy link
Copy Markdown
Contributor

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:

  • APR layer-3 ffn_swigl std = 1.222 (17.2× layer-2 baseline 0.071)

§21 cannot distinguish two competing hypotheses:

Hypothesis What it means
H1 Token-position-dependent correlation — NORMAL model behavior; SHIP-007 root cause is ELSEWHERE
H2 APR-side bug — fix at inference.rs:160-164 swigl elementwise multiply

Implementation stages (CORRECTED)

Stage Status What
M-FFN-GGUF-0 SHIPPED (this PR) Contract scaffold
M-FFN-GGUF-1 SHIPPED LayerActivation shared APR↔GGUF (re-export verified)
M-FFN-GGUF-2 SHIPPED OwnedQuantizedModel::forward_traced for dense SwiGLU path (PRs #1081 + #1082)
M-FFN-GGUF-3 PENDING Heavy comparison harness APR vs GGUF layer-3 ffn_swigl
M-FFN-GGUF-4 PENDING SHIP-007 fix PR cites H1 or H2

Known limitation in M-FFN-GGUF-2: the MoE path's forward_qwen3_moe_traced does 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

🤖 Generated with Claude Code

@noahgift noahgift enabled auto-merge (squash) May 6, 2026 10:57
…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>
@noahgift noahgift force-pushed the contract/trace-ffn-sub-block-gguf-v1.0.0-scaffold branch from 18a76aa to b3928d8 Compare May 6, 2026 11:15
@noahgift noahgift merged commit ca03361 into main May 6, 2026
10 checks passed
@noahgift noahgift deleted the contract/trace-ffn-sub-block-gguf-v1.0.0-scaffold branch May 6, 2026 11:32
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant