Fix Gemma 4 default prefill and prepare 0.2.5 - #103
Merged
Conversation
bsbodden
marked this pull request as ready for review
August 3, 2026 17:54
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.
What changed
Root cause
The 0.2.4 singleton fallback correctly left the native batch kernel, but then passed a capacity-sized prefill backing array to the strict one-vector Java projection. On the tester's M1, a one-token 2,816-column expert projection therefore arrived as 360,448 elements (
128 × 2,816) and failed dimension validation.The corrected fallback reuses scratch arrays sized to the exact matrix input and output shape, copies one row into them, performs the projection, and copies the result back into the batched output buffer.
User impact
The qualified
ggml-org/gemma-4-26B-A4B-it-GGUFQ4_K_M artifact now prefills through ModelJars' default Rust/FFM backend without either singleton failure:loaded Gemma 4 batched-prefill kernel rejected Q4_K projection ...Vector dimensions differ: 360448 != 2816Validation
./gradlew --no-daemon spotlessCheck verifyReleaseMetadata :backend-java:test --tests com.integrallis.models.backend.purejava.gemma4.Gemma4ForwardPassTest :models-rag-bench:test --tests com.integrallis.models.rag.ControlledRagQualificationScriptTest --tests com.integrallis.models.rag.CertifiedRagEvidenceTest88f4a13b0bb95f031a7fad973e10854122fb67ebc34d214d39a2f65053046abcrust-ffm, andgemma4-batched-prefillenabled:M3 remains pending provider quota and is not claimed by this PR.