Paper commentary
FOSCAR: Accelerating Decode Attention over 2- and 4-Bit KV Caches through Affine Folding
FOSCAR folds scales into matrix products to speed up low-bit KV caches
- Problem Packed 2-bit and 4-bit KV caches save memory traffic but not latency, because existing kernels convert and scale every cached value. That per-value work uses up scarce instruction-issue slots on modern GPUs.
- Method FOSCAR applies each group's scale and offset to the matrix product inputs or outputs instead of each value. Unlike per-value reconstruction, it builds Tensor Core operands directly with bit manipulation.
- Results On H100, FOSCAR INT2 kernels reach a geo-mean speedup of 3.36× over FlashInfer BF16 and 2.03× over TensorRT-LLM FP8. On B200, the INT2 speedup over FlashInfer BF16 is 2.67×.

Figure 12 . Per-user and aggregate Qwen3-8B serving throughput on a single GPU with 100K input and 1K output tokens.
Original paper · CC BY 4.0 · Donglin Zhuang, Pragaash Ponnusamy, Xiaoxia Wu, Shuaiwen Leon Song, Zhongzhu Zhou · FOSCAR: Accelerating Decode Attention over 2- and 4-Bit KV Caches through Affine Folding · Original paper figure · Extracted the figure area from page 9 of the original PDF.Why smaller caches stall on instruction issue
Decode attention reads the cached K and V at every decode step, so a smaller cache should cut the memory traffic it generates. Existing fused kernels still unpack each integer, apply its group scale and offset, and convert the result into a Tensor Core operand before every matrix product. That per-value work consumes instruction-issue slots, and its cost stays fixed as the stored bit width drops.
Because HBM transfer time falls while this instruction cost does not, the bottleneck shifts from memory bandwidth to instruction issue. Compressing the cache doesn't remove the on-chip operand preparation, which is why the speedup falls short of the storage saving.
Figure 1 measures effective KV access throughput at batch size B = 128 and context length KV = 32K, as a fraction of peak HBM throughput. FlashInfer BF16 exceeds 90% of peak on both H100 and B200, while the INT2 kernel from BitDecoding reaches only 30.7% on H100 and 14.5% on B200. The authors also count the instructions per operand, so the gap can be traced to a per-byte cost rather than to memory alone.
On H100, converting and applying the affine transform for four values takes six lane-slots, which is six instructions per warp lane. Four INT4 values occupy two bytes and four INT2 values occupy one byte, so reconstruction alone can consume 30% and 60% of H100's peak hardware budget of 9.99 lane-slots/byte. That leaves little issue capacity for softmax and the rest of the kernel.
FOSCAR is built to avoid this per-value cost, and the design section that follows shows how. Instead of rebuilding each K or V tile, FOSCAR constructs Tensor Core operands directly from q and applies group scales and offsets to matrix-product inputs or outputs. With four query heads per KV head and group size 128, this reduces issue demand to 2.13 and 4.25 lane-slots/byte for INT4 and INT2 on H100.
Folding scales and offsets into the matrix products
FOSCAR keeps the stored integers as they are and moves each group's scale and offset onto the matrix products. In exact arithmetic, this gives the same attention output as dequantizing every value before the products. Instead of touching each value, the kernel only handles one correction per group of partial products.
Operand-fold starts from a row k of q that shares one scale s_k and offset z_k across columns j. The product C_{i,j} then splits into a sum of (s_k A_{i,k}) times q_{k,j}, plus a sum of z_k A_{i,k}. The scale now multiplies the other input A, and the offset becomes its own reduction over A. Because of this split, q is never rebuilt entry by entry.
Acc-fold handles the opposite case, where column j shares one scale s_j and offset z_j across the reduction index k. Both terms then factor out of the sum, so the scale multiplies the accumulated product and the offset multiplies the row sum of A.
The choice follows the reduction axis, because QK⊤ reduces over D and P V reduces over L. Token-wise K therefore uses acc-fold, while channel-wise K uses operand-fold into Q. Token-wise V uses operand-fold into P, and channel-wise V uses acc-fold. K and V choose their schemes independently, so the cache's quantization policy decides each path.
Operand-fold lets the accumulator span several groups without rescaling, which is why the authors chose it in that case. QK corrections must come before the softmax, and PV corrections must come before the softmax denominator divides the output.
From packed bits to Tensor Core operands
Folding removes the per-value affine step, but the stored integers still have to become floating-point Tensor Core operands. On Hopper, each integer is combined with the fixed pattern 0x4300 by bitwise OR, which gives the exact BF16 value q+128 for q from 0 to 15. The paper calls this step mantissa injection, and it borrows the idea from earlier weight-kernel work.
On Blackwell, the integer bits sit in the low bits of an FP4 or FP8 operand, and the remaining bits stay zero. Under this layout, the INT2 values 0, 1, 2 and 3 stand for 0, 0.5, 1 and 1.5 in E2M1, so y equals q/2.
These mappings produce y = αq + β rather than the stored integer q, so the mapping changes the value the Tensor Cores see. Instead of spending extra instructions per element, FOSCAR folds α and β into each group's shared scale and offset. Substituting q = (y − β)/α into x = sq + z gives the new scale s′ = s/α and offset z′ = z − βs′. The folded scale and offset are computed in FP32 when the quantized cache is stored in HBM, so the decode kernel doesn't recompute them.
Table 1 lists these mappings with their static ALU cost, which is 1.00 per element on Hopper and 0.19 for INT2 on Blackwell.

Table 1 . Tensor Core operand mappings and their static ALU costs per stored value. The q→y column gives the bit-level construction ofyfromq.
Original paper · CC BY 4.0The packing layout has to match these bit-level constructions, so FOSCAR arranges INT2 K values inside each 32-bit register. On Hopper, one bit shift and one masked merge with LOP3 produce two BF16 operands in a 32-bit register. On Blackwell, one bit shift and two masks unpack a register holding 16 two-bit values into two 32-bit registers of FP4 operands.
Hopper consumers build K operands in registers and issue wgmma together, while Blackwell hands a shared-memory tile to a separate issue thread that calls tcgen05.
On Hopper, each consumer warpgroup builds its own KV operands and runs its own QK, softmax and PV chain. Each consumer keeps its online-softmax state and output accumulators in registers, and one consumer merges the two states at the end. On Blackwell, the work splits across warpgroups: one issues copies and tcgen05 products, another prepares operands in shared memory, and two more handle softmax and the output.
Kernel speedups and where folding helps
FOSCAR's kernel speedups are reported as geometric means over FlashInfer BF16 across the benchmark grid. On H100, FOSCAR INT2 reaches 3.36× over FlashInfer BF16 and 2.03× over TensorRT-LLM FP8, with maxima of 4.15× and 2.44×. On H100, FOSCAR INT4 reaches 2.83× over FlashInfer BF16 and 1.71× over TensorRT-LLM FP8. On B200, FOSCAR INT2 reaches 2.67× over FlashInfer BF16, 1.48× over TensorRT-LLM FP8, and 1.16× over TensorRT-LLM NVFP4.
The margin shrinks as the baseline gets faster, so the INT2 gain drops from 2.67× over BF16 to 1.16× over NVFP4 on B200.
To isolate folding, the authors compare it against per-value reconstruction at equal split-KV counts on INT2 caches. On B200, the reconstruction baseline dequantizes INT2 values into FP8 (E4M3) operands before each matrix product. Folding reaches 7.36–8.86× there because that per-value reconstruction exceeds B200's issue peak. Figure 10 reports these results as latency ratios between each pair of ablation variants.
The main kernel settings use HQ = 32, HKV = 8, and D = 128 on H100 (80 GB HBM3) and B200 (180 GB HBM3e). Token-wise K and V groups use g = 128 values with FP32 scales and offsets, and the kernels are written in CuTe DSL. Batch sizes 1 and 8 run at contexts of 8K, 32K, 128K, and 512K, while batch 64 runs at 8K through 128K.
Accuracy holds while serving throughput rises
The authors stress-test accuracy with a synthetic input that amplifies eight K channels and ramps the per-token K scale along the sequence. FOSCAR and OSCAR decode the same clipped cache that OSCAR's quantizer wrote, with no BF16 windows. Both INT2 kernels reach L2 errors of 0.52–0.61. FOSCAR INT4 reaches L2 errors of 0.16–0.22, compared with (2.13–2.25)×10 −3 for BF16 decode.
Measured against the dequantized INT2 cache, FOSCAR's kernel arithmetic error is only (1.68–1.76)×10 −3 on both H100 and B200.
OSCAR INT2 + Ours keeps OSCAR's rotations and its 128 initial and 512 recent BF16 tokens. Ours INT2 drops those windows and rotations, so it tests pure 2-bit kernel speed. At a 99% hit rate, OSCAR INT2 + Ours peaks at 487 tokens/s on H100, compared with 269 tokens/s for OSCAR. Ours INT2 peaks at 506 tokens/s on H100, which is 88% above OSCAR.
On B200, Ours INT2 peaks at 897 tokens/s, 170% above OSCAR. Peak throughput also depends on how many concurrent requests fit in memory, so the gain isn't purely kernel speed.
Table 2 measures serving accuracy on H100 over five runs per configuration, against FlashInfer BF16 and OSCAR INT2. On GSM8K, FlashInfer BF16 scores 95.71±0.11, OSCAR INT2 scores 95.74±0.38, and OSCAR INT2 + Ours scores 95.92±0.15. Five runs show no measurable gain or loss, though they don't establish formal equivalence. OSCAR INT2 + Ours decodes the same quantized cache as OSCAR, with below 1.8×10 −3 arithmetic error, so it keeps OSCAR's accuracy.
Where the results stop
Accuracy was measured on GPQA-Diamond and GSM8K only, and only on H100. The authors ran five runs per configuration and reported the mean and sample standard deviation. Table 2 leaves out the pure Ours INT2 configuration, which drops the recent windows and rotations.
Nonlinear lookup formats and sparse outlier representations can't be written as a single affine transform. Such formats would need separate kernel support instead of FOSCAR's affine folding. The main kernel grid uses token-wise K and V quantization groups of g= 128 values. The other combinations of token-wise and channel-wise K and V appear only in Appendix B.
Blackwell reconstruction costs depend on the PTX ISA version the kernel targets. Under that older path, reconstruction costs twelve instructions, or 6 and 12 lane-slots/byte for INT4 and INT2. Those figures assume four query heads per KV head and group size 128.
Paper info
- Authors
- Donglin Zhuang, Pragaash Ponnusamy, Xiaoxia Wu, Shuaiwen Leon Song, Zhongzhu Zhou
- Venue
- arXiv · Preprint
- First published
- 2026-11-6
- Added
- 2026-11-9
- Updated
- 2026-11-6
- Version
- v1
- arXiv
- 2611.09722
- Category
- cs.AI
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Large-language-model decode attention streams the key-value (KV) cache for every generated token. Packing that cache into 2-bit or 4-bit quantized integers reduces memory traffic but does not automatically translate into latency saving. Existing 2-bit fused kernels reach under 31%/15% of peak HBM throughput on H100/B200. Converting each value and applying its scale and offset before feeding Tensor Cores is a major bottleneck because instruction-issue throughput is scarce on modern GPUs. Instead of applying scale and offset to each KV value, FOSCAR uses affine folding to apply them to the other operand or the output of decode-attention matrix products, depending on the quantization scheme (token-wise or channel-wise). This reduces scale-and-offset operations by up to two orders of magnitude while preserving the dequantized attention output in exact arithmetic. FOSCAR also uses bit manipulation to feed KV operands to Tensor Cores efficiently, requiring only 1 and 0.19 ALU instructions per INT2 element on H100 and B200, respectively. Finally, FOSCAR builds warp-specialized GPU pipelines for Hopper (H100) and Blackwell (B200) using wgmma and tcgen05. On H100, FOSCAR INT2 and INT4 kernels achieve geo-mean speedups of $3.36\times$ and $2.83\times$ over FlashInfer BF16, and $2.03\times$ and $1.71\times$ over TensorRT-LLM FP8. On B200, the corresponding INT2 and INT4 speedups are $2.67\times$ and $2.30\times$ over FlashInfer BF16, $1.48\times$ and $1.28\times$ over TensorRT-LLM FP8, and $1.16\times$ and $1.00\times$ over TensorRT-LLM NVFP4. We integrate FOSCAR into SGLang to benchmark serving efficiency. On long-context serving workloads, FOSCAR increases peak aggregate throughput by up to 170% and 341% over 2-bit and 16-bit baselines, respectively. We open-source FOSCAR as a kernel library at https://github.com/FutureMLS-Lab/FOSCAR.
Quote from the paper
Donglin Zhuang, Pragaash Ponnusamy, Xiaoxia Wu, Shuaiwen Leon Song, Zhongzhu Zhou (2026). FOSCAR: Accelerating Decode Attention over 2- and 4-Bit KV Caches through Affine Folding. arXiv:2611.09722v1. https://arxiv.org/abs/2611.09722v1
BibTeX
@misc{zhuang2026foscar,
title = {{FOSCAR: Accelerating Decode Attention over 2- and 4-Bit KV Caches through Affine Folding}},
author = {Donglin Zhuang and Pragaash Ponnusamy and Xiaoxia Wu and Shuaiwen Leon Song and Zhongzhu Zhou},
year = {2026},
eprint = {2611.09722},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.09722v1}
}