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
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 and over FlashInfer BF16, and and over TensorRT-LLM FP8. On B200, the corresponding INT2 and INT4 speedups are and over FlashInfer BF16, and over TensorRT-LLM FP8, and and 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.
Create a lesson
Related papers
BitDecoding-FP4: Native FP4 KV Cache Decoding via Algorithm-System Co-Design
Shared title terminology · Dayou Du, Woon Yee Ng, Guangming Sheng et al.
Specialized Large Language Models for Markovian Reasoning: Structural Cache Compression, Transition Pretraining, and Dual-Loop Transformers
Shared title terminology · Haibin Tong, Liangliang Xin, Yamei Zhu et al.
Speculative Decoding Is Less Speculative Than You Think
Shared title terminology · Guanning Zeng, Andrea Zanette
Vega-Fafnir: Is Greedy Decoding the Same Decoding? Where Rounding Noise in Speculative Verification Comes From and What Removing It Costs
Shared title terminology · Mohammed Nayeem Khan, Navin Kumar R
Beyond Linear Decodability: Understanding and Improving Instruction Following in World Action Models
Shared title terminology · Bokai Ji, Jiapeng Chen, Yi Zhang et al.
ReActWAM: Action-Consistent Caching for Efficient World-Action Models
Shared title terminology · Zhaochen Guo, Yunke Wang, Siyu Xu et al.