beat(P3): composed QLoRA forward-equivalence gate (base + LoRA + bias ≡ merged)#2266
Merged
Merged
Conversation
… ≡ 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>
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.
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 biasesFALSIFY-CPU-LORA-QKV-BIAS-001— bias parity, but at zero LoRANothing drove all three terms — base + nonzero LoRA + bias — through the real
forward_with_lorapath 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 plainforwardon 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.Enforcement
Runs in the existing per-PR
nextest --workspace --libstep (aprender-train isn't excluded) — noci.ymledit needed — and the diff-scoped mutants gate covers the new code. CPU, deterministic. Contractapr-qlora-composed-forward-equivalence-beat-v1.yaml(pv validate+pv lintclean).🤖 Generated with Claude Code