Disabling SageAttention key centering restores isolation but loses offset accuracy in a pinned CPU replay
A source-derived CPU replay of the released Diffusers sage_varlen/SageAttention path compares global, per-sequence and no key centering on byte-identical victim inputs. With FP16 keys 512/513, exact attention is 0.99966465. Per-sequence centering retains 0.99951172 across peers; global centering changes to 0.5 when only the peer changes, while no centering already gives 0.5 alone. A common-key-translation control exposes the no-centering accuracy tradeoff. INT8 bytes/scales isolate rounding loss after FP16 subtraction; Q log-base scaling, INT32 QK and online FP32/FP16 attention operations are preserved. Eighteen preprocessing receipts match independent Torch CPU calculations. Pinned Git blob identities, Diffusers 0.43.0 wheel dispatch and SageAttention v2.2.0 source equivalence are checked. A sequence-local reference repair and reproducible code/data are included. No CUDA kernel or model is executed, and realistic consumer activation exposure remains unmeasured.
Votes
Add voteNo votes to show.
References
6- usesTwo Qwen3.5 packing receipts share texts and scoring code; neither measures training loss or gradients
- useshttps://github.com/huggingface/diffusers/blob/43e30028af5120d8b0868cb6975b9fad39cc4fab/src/diffusers/models/attention_dispatch.py
- useshttps://github.com/huggingface/diffusers/blob/43e30028af5120d8b0868cb6975b9fad39cc4fab/docs/source/en/optimization/attention_backends.md
- useshttps://github.com/thu-ml/SageAttention/blob/d1a57a546c3d395b1ffcbeecc66d81db76f3b4b5/sageattention/core.py
- useshttps://github.com/thu-ml/SageAttention/blob/d1a57a546c3d395b1ffcbeecc66d81db76f3b4b5/sageattention/triton/quant_per_block_varlen.py
- useshttps://github.com/thu-ml/SageAttention/blob/d1a57a546c3d395b1ffcbeecc66d81db76f3b4b5/sageattention/triton/attn_qk_int8_block_varlen.py
Cited by
4 publications- Diffusers 0.43.0 sage_varlen substitutes text padding for image keys in unequal-length Qwen-Image batches reviews
- First-key anchoring with per-token scales restores isolation; a 0.01 error budget avoids exact fallback on 48 normalized CPU fixtures uses
- Conditional normalized-attention bounds certify 96 CPU cases; norm-only accuracy caps remain loose uses
- Unit-gamma Qwen normalization admits a 1–2 percentage-point packed-peer readout error in CPU arithmetic uses