The SGLang Triton grouped-query attention forward kernel used a fixed head tile size that did not always align with the model’s query-to-key/value head grouping. The reported GLM-4-32B configuration had 48 query heads and two KV heads, so one group spanned 24 query heads. A tile boundary at 16 could map query heads 24 through 31 back to the first KV head…
Inspect the ClaimsCase · DiggingBeagle record
An SGLang Triton GQA kernel silently read the wrong KV head on certain model shapes
A merged SGLang patch corrected a grouped-query attention head-mapping bug that returned plausible but degraded results on a particular GLM model without crashing; a controlled benchmark changed from about 51% to 93% under one prompt.
Published by DiggingBeagle:
SGLang Triton grouped attention with GQA group sizes not aligned to the 16-head tile, demonstrated on GLM-4-32B and H100; merged PR #47802.
Assessment profile
Assessment method- Setting
- research demonstration
- Exploitation
- demonstrated
- Evidence
- Grade B
- Remediation
- patch available
- AI role
- AGAINST AI
Basis and provenance
Maintainer patch includes matched numerical/benchmark comparisons; independent production impact and fixed release tag are unverified.
Assessed Nov 16, 2026 using diggingbeagle.assessment/1.
Evidence basis: CLM-SGLANG-GQA-01 · CLM-SGLANG-GQA-02 · SGLang PR 47802: grouped-attention kernel wrong KV-head addressing
At a glance
The model weights and user prompt were not the changing variable. A backend kernel selected the wrong key/value head for a particular nonmultiple-of-tile grouped-query shape, producing normal-looking but materially worse answers. This can contaminate safety and accuracy comparisons when the same model is hosted on different backends; it is not evidence of a…
Read the implicationsThe merged patch is not proof of inclusion in a particular released image. The error’s impact on real customers or irreversible agent actions is unknown. Alternative prompts give different absolute benchmark scores; only matched conditions support the reported comparison.
Limits and uncertaintyFull account
The SGLang Triton grouped-query attention forward kernel used a fixed head tile size that did not always align with the model’s query-to-key/value head grouping. The reported GLM-4-32B configuration had 48 query heads and two KV heads, so one group spanned 24 query heads. A tile boundary at 16 could map query heads 24 through 31 back to the first KV head instead of the second. The model still produced syntactically normal output, which made this a silent numerical correctness failure rather than a service outage.
Maintainer tests on a selected H100/GLM setup found a GSM8K exact-answer score of 50.87% before the correction and 93.48% after it under one standard prompt, matching a FlashAttention comparison. Another prompt format produced smaller absolute values for both implementations. The benchmark therefore measures a combination of model, kernel, prompt and task; it is not evidence that the base GLM checkpoint itself regressed or that a universal 42.61-point gain is available to all deployments.
The kernel correction adjusts tile mapping and masks across affected shapes. The source records a merged pull request, not a verified fixed version in every packaged SGLang release. For serving platforms whose agents depend on numeric or tool outputs, silent backend differences can change an action recommendation without appearing in normal HTTP error logs. Operators should compare outputs on deterministic fixtures across kernels and document both exact version and hardware when they report model evaluations.
Mechanism and trust boundary
- 01
Starting access and objective
A model with a 24-query-head-to-KV-head grouping is served through a Triton kernel using a fixed 16-head tile.
Boundary: attacker or evaluator precondition
- 02
Trust or execution boundary
The kernel maps part of a group to a different KV head, silently changing attention inputs without breaking request completion.
Boundary: untrusted material and acquired authority
- 03
Observed result and limit
Maintainer GSM8K tests show a large prompt-dependent accuracy discrepancy compared with the corrected kernel and FlashAttention.
Boundary: measured effect and evidentiary limit
Claims & evidence
CLM-SGLANG-GQA-01SGLang PR #47802 describes a Triton grouped-attention head mapping error for the GLM model’s 48-query/two-KV head layout and a patch for the tile boundary.supported
Basis: reported finding
- supportsSGLang PR 47802: grouped-attention kernel wrong KV-head addressingpatch commit artifact
PR 47802 problem description and kernel code review
CLM-SGLANG-GQA-02In the maintainer’s specific GSM8K test configuration the corrected kernel improved exact-answer score from 50.87% to 93.48%; the result is prompt- and backend-dependent.supported
Basis: reported finding
- supportsSGLang PR 47802: grouped-attention kernel wrong KV-head addressingpatch commit artifact
PR benchmark comparison tables and prompt variants
CLM-ENR253-SGLANG-TRITON-GQA-WRONG-KV-HEADFor GLM-4-32B-0414 with 48 query heads and two KV heads, the SGLang maintainer reported Triton GSM8K accuracy rising from 50.87% to 93.48% after the head-mapping fix on a specific greedy H100 prompt; an alternate boxed-answer prompt changed the absolute scores to 30.02% and 38.67%.supported
Basis: reported finding
- supportsSGLang PR 47802: grouped-attention kernel wrong KV-head addressingpatch commit artifact
SGLang PR #47802, Accuracy Tests, GLM-4-32B GSM8K and boxed-answer prompt
Implications
The model weights and user prompt were not the changing variable. A backend kernel selected the wrong key/value head for a particular nonmultiple-of-tile grouped-query shape, producing normal-looking but materially worse answers. This can contaminate safety and accuracy comparisons when the same model is hosted on different backends; it is not evidence of a malicious actor or a universal cross-request data leak. Before reporting a model regression, capture exact inference engine commit, head layout, dtype, kernel and prompt template, and compare numerically against a known-correct attention backend. A merged patch is not the same thing as a deployed fixed release.
Controls and mitigations
- Pin SGLang build, attention backend and model head configuration, and verify the fix is included before publishing model scores.
- Use differential test vectors across Triton, FlashAttention and reference implementations, including odd GQA group sizes and quantization.
- Log serving backend and model version with any consequential inference decision so silent numerical regression can be investigated.
Unknowns and contradictions
- The merged patch is not proof of inclusion in a particular released image.
- The error’s impact on real customers or irreversible agent actions is unknown.
- Alternative prompts give different absolute benchmark scores; only matched conditions support the reported comparison.
Sources and citation
Material revision history
- Nov 16, 2026 · Published version · first publication · revision 254