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

DevFeed: [FOSCAR: Accelerating Decode Attention over 2- and 4-Bit KV Caches through Affine Folding](<https://devfeed.tech/articles/foscar-accelerating-decode-attention-over-2-and-4-bit-kv-caches-through-affine-folding-124718.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.09722>)

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

Published: 2026-11-09T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>)

Topics: [LLM optimization](<https://devfeed.tech/topics/llm-optimization.md>), [GPU optimization](<https://devfeed.tech/topics/gpu-optimization.md>), [quantization](<https://devfeed.tech/topics/quantization.md>), [Tensor Cores](<https://devfeed.tech/topics/tensor-cores.md>), [TensorRT-LLM](<https://devfeed.tech/topics/tensorrt-llm.md>)

Tags: [attention](<https://devfeed.tech/tags/attention.md>), [bf16](<https://devfeed.tech/tags/bf16.md>), [blackwell](<https://devfeed.tech/tags/blackwell.md>), [cache](<https://devfeed.tech/tags/cache.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [decode](<https://devfeed.tech/tags/decode.md>), [efficiency](<https://devfeed.tech/tags/efficiency.md>), [efficiently](<https://devfeed.tech/tags/efficiently.md>), [flashinfer](<https://devfeed.tech/tags/flashinfer.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [h100](<https://devfeed.tech/tags/h100.md>), [hopper](<https://devfeed.tech/tags/hopper.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [kernels](<https://devfeed.tech/tags/kernels.md>), [kv-cache](<https://devfeed.tech/tags/kv-cache.md>), [latency](<https://devfeed.tech/tags/latency.md>), [long-context](<https://devfeed.tech/tags/long-context.md>), [quantization](<https://devfeed.tech/tags/quantization.md>), [serving](<https://devfeed.tech/tags/serving.md>), [sglang](<https://devfeed.tech/tags/sglang.md>), [tensor-cores](<https://devfeed.tech/tags/tensor-cores.md>)

## AI overview

FOSCAR accelerates decode attention on 2-bit and 4-bit KV caches by folding quantization scales and offsets into the other matrix-product operand or output, depending on whether quantization is token-wise or channel-wise. The authors report this cuts scale-and-offset operations by up to 100x while preserving the dequantized attention output in exact arithmetic. Bit manipulation and warp-specialized pipelines target H100 and B200 GPUs. In kernel benchmarks, FOSCAR outperforms the stated FlashInfer BF16 and TensorRT-LLM FP8 baselines on both GPUs; against TensorRT-LLM NVFP4 on B200, its INT2 kernel is 1.16x faster while INT4 is at parity. In SGLang long-context serving workloads, peak aggregate throughput rises by up to 170% over a 2-bit baseline and 341% over a 16-bit baseline.

## Source excerpt

arXiv:2611.09722v1 Announce Type: new 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.