Repository navigation
ggml-hrx: int4-activation SwiGLU prefill is opt-in (27B KLD 0.0019 -> 0.000003, speed -0..0.7%) - #121
Merged
bong-water-water-bong merged 1 commit intoOct 21, 2026
Conversation
…C_I4_PREFILL=1) common.mul_mat_swiglu_q5_projection.symmetric_i4_q8_plane quantizes the gate/up activations of the Q5_K/IQ4_XS SwiGLU layers to symmetric int4 in every prompt batch of up to 2048 tokens (its 2048-token cap is why -ub 4096 measured a different answer, engine #390). New file dispatch-i4-prefill-opt-in.{h,cpp} (ours); one early return in its matcher; the exact f16 path (the HIP dense SwiGLU) takes those layers instead. Measured on strixhalo gfx1151, performance mode, Qwen3.8-27B UD-Q4_K_XL: - llama-perplexity -c 4096 --chunks 2 -ub 2048 against the -ub 4096 logits (which never took this path): default 0.001949 mean KLD (same top 97.9%) -> 0.000003, PPL 6.7183 -> 6.7097; GGML_HRX_SYMMETRIC_I4_PREFILL=1 reproduces 0.001949. At -c 512 -ub 512 the KLD against the previous default is 0.002222, PPL 6.6835 -> 6.6381. - Speed with the matcher off (interleaved llama-bench x3, medians): pp512 645.8 -> 645.7 at ub 512 and 645.2 -> 640.8 at ub 2048, pp2048 617.0 -> 615.8 / 594.2 -> 592.9, pp4096 603.2 -> 600.5 / 573.1 -> 571.1 (-0.0..-0.7%). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
common.mul_mat_swiglu_q5_projection.symmetric_i4_q8_plane quantizes the gate/up activations of
the Q5_K/IQ4_XS SwiGLU layers to symmetric int4 in every prompt batch of up to 2048 tokens (its
2048-token cap is why -ub 4096 measured a different answer, engine #390). New file
dispatch-i4-prefill-opt-in.{h,cpp} (ours); one early return in its matcher; the exact f16 path
(the HIP dense SwiGLU) takes those layers instead.
Measured on strixhalo gfx1151, performance mode, Qwen3.8-27B UD-Q4_K_XL:
this path): default 0.001949 mean KLD (same top 97.9%) -> 0.000003, PPL 6.7183 -> 6.7097;
GGML_HRX_SYMMETRIC_I4_PREFILL=1 reproduces 0.001949. At -c 512 -ub 512 the KLD against the
previous default is 0.002222, PPL 6.6835 -> 6.6381.
512 and 645.2 -> 640.8 at ub 2048, pp2048 617.0 -> 615.8 / 594.2 -> 592.9, pp4096 603.2 ->
600.5 / 573.1 -> 571.1 (-0.0..-0.7%).
🤖 Generated with Claude Code