arXiv:2611.09722cs.AINov 2026

Manuscript Offprint

arXiv:2611.09722

FOSCAR: Accelerating Decode Attention over 2- and 4-Bit KV Caches through Affine Folding

Donglin Zhuang, Pragaash Ponnusamy, Xiaoxia Wu, Shuaiwen Leon Song, Zhongzhu Zhou

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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 only reach less than 31%/15% of peak HBM throughput on H100/B200. We identify that converting each value and applying its scale and offset before feeding Tensor Cores is a major bottleneck because instruction-issue throughput is a scarce resource on modern GPUs. FOSCAR does not apply scale and offset to each value from the KV cache, but uses affine folding to apply scale and offset to either the other operand or the output of matrix products in decode attention, 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 includes carefully designed bit manipulation to feed KV operands to Tensor Cores efficiently, requiring only 1 and 0.19 ALU instructions per element for the INT2 KV cache on H100 and B200, respectively. Finally, FOSCAR builds warp-specialized GPU pipelines for Hopper (H100) and Blackwell (B200), leveraging architecture-specific features such as wgemma and tcgen05. On H100, FOSCAR INT2 and INT4 kernels achieve geo-mean speedups of 3.36× and 2.83× over FlashInfer BF16, and 2.03× and 1.71× over TensorRT-LLM FP8. On B200, the corresponding INT2 and INT4 speedups are 2.67× and 2.30× over FlashInfer BF16, 1.48× and 1.28× over TensorRT-LLM FP8, and 1.16× and 1.00× 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.

1 INTRODUCTION

Autoregressive language-model decoding reads each active request's key-value (KV) cache on every decode step. The cache footprint grows with batch size and context length; storing it consumes high-bandwidth memory (HBM) capacity, and streaming it from HBM often dominates decode-attention latency. Low-bit KV quantization reduces that traffic directly. KIVI (Liu et al., 2024), Kitty (Xia et al., 2025), OSCAR (Zhou et al., 2026), KVQuant (Hooper et al., 2024), and QServe (Lin et al., 2025) store each cached value in 2–4 bits with a group-shared scale and offset.

Compressing the cache in memory does not eliminate on-chip operand preparation. KIVI (Liu et al., 2024), QServe (Lin et al., 2025), TurboAttention (Kang et al., 2025), BitDecoding (Du et al., 2026), SAW-INT4 (Jia et al., 2026), and OSCAR (Zhou et al., 2026) all convert or reconstruct low-bit values before each matrix product. This prepa-

ration consumes instruction-issue throughput, registers, and shared-memory bandwidth even when fused into attention without writing dequantized K and V to HBM. Although bit-packing reduces HBM traffic, per-element operand preparation can still limit the resulting latency speedup.

FOSCAR applies affine folding to the query-key (QK) and probability-value (PV) matrix products, which reduce over channels and tokens. For token-wise K, the kernel scales each group's partial QK result and adds the group's offset times the matching query sum. For token-wise V, the kernel scales the attention weights before PV and adds a weighted sum of offsets to the output. Channel-wise K instead scales the query before QK, while channel-wise V scales each group's partial PV result, and both add the corresponding offset-weighted sum. These per-group operations replace element-wise scale multiplication and offset addition, while bit manipulation constructs Tensor Core KV operands directly from packed integers. In exact arithmetic, affine folding produces the same attention output as dequantizing every KV value before the matrix products.

This paper makes four contributions:

¹Together AI ²University of Sydney. Correspondence to: Donglin Zhuang donglinzhuang@outlook.com.

Preprint.

  • Identify decode attention performance bottleneck. We compare per-byte reconstruction instruction demand against peak instruction-issue and HBM throughputs on H100 and B200, showing how per-element conversion and affine arithmetic limit low-bit decode speedups (Sec. 3).

  • Efficient Tensor Core operand preparation via affine folding. We formulate affine folding for independent token-wise or channel-wise K and V quantization, paired with bit-level Tensor Core operand construction, to feed Tensor Cores efficiently with lower instruction demand (Secs. 4.1 and 4.3).

  • Fast GPU kernels for Hopper and Blackwell. We design warp-specialized decode pipelines for H100 register accumulators and B200 tensor-memory (TMEM) accumulators (Sec. 4.4).

  • Kernel and serving-engine evaluation. We evaluate FOSCAR in standalone kernel benchmarks and integrated into SGLang (Zheng et al., 2024). FOSCAR INT2 achieves geometric-mean kernel-latency speedups over FlashInfer BF16 of 3.36× on H100 and 2.67× on B200. For long-context serving workloads, FOSCAR INT2 increases peak aggregate serving throughput by up to 170% and 341% over 2-bit and 16-bit baselines, respectively (Sec. 6).

References (42)