Skip to content

beat(P3): composed QLoRA forward-equivalence gate (base + LoRA + bias ≡ merged)#2266

Merged
noahgift merged 1 commit into
mainfrom
beat/qlora-composed-forward-equivalence-20260703
Jul 3, 2026
Merged

beat(P3): composed QLoRA forward-equivalence gate (base + LoRA + bias ≡ merged)#2266
noahgift merged 1 commit into
mainfrom
beat/qlora-composed-forward-equivalence-20260703

Conversation

@noahgift

@noahgift noahgift commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

A new per-PR-blocking Pillar-3 correctness beat, closing a real coverage gap the v0.58 audit surfaced.

The gap

The existing P3 forward gates test the pieces in isolation:

  • apr-lora-merge-equivalence-beat — merge faithfulness, but no biases
  • FALSIFY-CPU-LORA-QKV-BIAS-001 — bias parity, but at zero LoRA

Nothing drove all three terms — base + nonzero LoRA + bias — through the real forward_with_lora path at once. That combination is exactly where #2260 silently dropped the Q/K/V biases (every CPU LoRA train/eval ran a bias-less model).

The beat

forward_with_lora (base + scale·(B@A) + bias) must equal a plain forward on the model with the LoRA delta merged into the base weight (W_merged = W + scale·B@A, identical biases). The reference is an independent code path (fold-then-forward), so it's not a tautology — a dropped bias, wrong LoRA scale, or transpose diverges.

result
GREEN (measured) max|Δ| = 2.98e-8
RED — inject #2260 bias-drop |Δ| = 3.1e-4 ✓ caught
RED — 2× LoRA scale |Δ| = 1.8e-3 ✓ caught

Enforcement

Runs in the existing per-PR nextest --workspace --lib step (aprender-train isn't excluded) — no ci.yml edit needed — and the diff-scoped mutants gate covers the new code. CPU, deterministic. Contract apr-qlora-composed-forward-equivalence-beat-v1.yaml (pv validate + pv lint clean).

🤖 Generated with Claude Code

… ≡ merged)

New per-PR-blocking Pillar-3 beat: the on-the-fly QLoRA forward — base
projection + scale·(B@A) LoRA delta + Q/K/V bias, through the real
forward_with_lora path — must equal a plain forward on the model with the LoRA
delta MERGED into the base weight (W_merged = W + scale·B@A, same biases).

This closes a real coverage gap the v0.58 audit surfaced: the existing P3 gates
test the pieces in isolation — apr-lora-merge-equivalence-beat proves merge
faithfulness with NO biases, and FALSIFY-CPU-LORA-QKV-BIAS proves bias parity at
ZERO LoRA — but nothing drove all three terms (base + nonzero LoRA + bias)
through forward_with_lora at once. That combination is exactly where #2260
silently dropped the Q/K/V biases (CPU LoRA train/eval ran a bias-less model).

The reference is an INDEPENDENT code path (fold the delta into the weight, run
plain forward), so it is not a tautology. Runs in the per-PR nextest --lib step
(no ci.yml edit; aprender-train is not excluded) and the diff-scoped mutants
gate covers the new code. CPU, deterministic.

Verified: max|Δ| = 2.98e-8 (GREEN). Mutation-verified RED — inject the #2260
bias-drop → |Δ|=3.1e-4, a 2x LoRA scale → |Δ|=1.8e-3. Contract
apr-qlora-composed-forward-equivalence-beat-v1.yaml (pv validate + lint clean).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@noahgift noahgift enabled auto-merge July 3, 2026 15:03
@noahgift noahgift added this pull request to the merge queue Jul 3, 2026
Merged via the queue into main with commit e45d888 Jul 3, 2026
11 checks passed
@noahgift noahgift deleted the beat/qlora-composed-forward-equivalence-20260703 branch July 3, 2026 16:12
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