Skip to content

fix: preserve Gemma 4 12B long-context MTP parity - #2315

Merged
inureyes merged 5 commits into
mainfrom
fix/issue-1986-gemma4-long-parity
Oct 15, 2026
Merged

inureyes merged 5 commits into
mainfrom
fix/issue-1986-gemma4-long-parity

Conversation

@inureyes

@inureyes inureyes commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Reproduce Gemma 4 12B long-buffered MTP divergence on current Metal, then extend the exact-verification contract only to its active-Metal geometry. Preserve existing CUDA/31B policy, physical-ring and maskless single-query attention, classic prefill chunking, fail-closed layout restrictions and CUDA-only row-wise RoPE.

Validation on M1 Ultra: 107 narrow tests and the refined backend matrix pass. Corrected width-4 verification has 0/256 teacher-forced top-1 disagreements and 0/155 decided disagreements behind 1,536 tokens, versus 18/256 and 2/155 before correction. Three long-prompt completions match stable classic references; all six 31B/Qwen before/after MTP outputs and counters match.

Three counterbalanced release repetitions preserve all 27 output hashes. Forced-width MTP is slower here: paired MTP/classic throughput medians are 0.837x/0.903x/0.815x. Scheduler-setup-to-probe-pass increases from 1.245s to 7.041s; process-to-health from 4.796s to 10.408s. These are pinned validation settings, not untouched defaults. Default eligibility/profitability policy is unchanged. Benchmark evidence retains dispersion, load, exact requests and artifact provenance.

Final-source release smoke also matches all three classic/MTP outputs and prior hashes; a separate default-environment startup passes without an inexact override. Implementation, security review and bilingual reports are complete; all applicable CI checks pass. Repeated release measurements retain bd6d33f provenance before the backend-scope refinement; final-source correctness is recorded separately. M5, CUDA, ROCm and CPU are unmeasured here; this does not claim original-M5 validation or a CUDA-only resolution.

Closes #1986

Long-context 12B MTP verification diverged from classic decode because buffered sliding-ring and full attention used a different reduction order, and serving prefill did not follow the classic chunking policy.

Match the measured 12B geometry to row-wise singleton verification, extend probe coverage, and retain fail-closed dispatch for unsupported layouts. Record M1 Ultra evidence: 107 focused tests, a 256-position teacher trace, three byte-identical free generations, and unchanged 31B/Qwen regressions.

Startup-cost and release-throughput measurements remain pending.

Refs #1986
@inureyes inureyes added status:review Under review type:bug Bug fixes, error corrections, or issue resolutions priority:high High priority area:inference Generation, sampling, decoding (incl. speculative, DRY) platform:macos macOS (Apple Silicon) specific labels Oct 14, 2026
Preserve the existing 31B and CUDA policies while enabling the measured 12B correction only for active Metal execution, not CPU-selected Metal or unmeasured ROCm. Add a pure backend/geometry matrix test and update the shared contract comments.

The focused test and workspace formatting check pass. Existing M1 release evidence retains its pre-refinement artifact provenance; final-head release validation follows separately. Refs #1986.
Record three counterbalanced release repetitions, matching output hashes, real MTP counters and the negative M1 throughput result. Include startup cost with its interval definition and distinguish measured artifacts from the subsequent backend-scope refinement.

Preserve exact request bodies and validation switches rather than describing forced B=1 runs as product defaults. Final-head release smoke remains pending. Refs #1986.
Record matching final-source classic/MTP outputs and live draft counters for all three long prompts. A separate startup with no runtime environment overrides passes the exactness guard; this is not a default throughput claim.

Keep repeated performance measurements tied to their original artifact and expose the negative M1 result in the benchmark index. Refs #1986.
Record the long-buffered divergence, measured correction, backend restriction, and final-source smoke in English and Korean. Preserve the negative M1 Ultra throughput result, startup cost, artifact provenance, unchanged defaults, and unmeasured backend limits.

Validation:
- cargo fmt --check
- git diff --check
- benchmark JSON and report evidence consistency checks

Refs #1986
@inureyes
inureyes marked this pull request as ready for review October 14, 2026 17:43
@inureyes inureyes added status:done Completed and removed status:review Under review labels Oct 14, 2026
@inureyes
inureyes merged commit 15c3da3 into main Oct 15, 2026
27 checks passed
@inureyes
inureyes deleted the fix/issue-1986-gemma4-long-parity branch October 15, 2026 12:31
@inureyes inureyes added this to the 0.8 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:inference Generation, sampling, decoding (incl. speculative, DRY) platform:macos macOS (Apple Silicon) specific priority:high High priority status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: investigate Gemma 4 12B long-context MTP parity on Metal

1 participant