Case · 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:

Scope

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.

At a glance

Mechanism and trust boundary

  1. 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

  2. 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

  3. 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

Link to claim
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

Link to claim
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

Link to claim

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

  1. Nov 16, 2026 · Published version · first publication · revision 254