Transformers Quanto int4 KV on Llama-2-7B-chat: LongBench within 0.5 points of fp16
Fields
kv-efficiency/transformers-quanto-int4-kv-llama2-7b-chatNotes
vendor_claim. Closes the plain-int4, per-token KV gap. The collection's 4-bit rows are ExLlamaV2's Hadamard Q4 and TurboQuant's 3.5-bit vector quantiser; neither is the quantiser a Transformers user actually turns on, and neither publishes a per-task table against fp16. QUALITY COST, LongBench, fp16 to Quanto int4 (higher is better): TREC 63.0 to 63.0 (0), SAMSum 41.12 to 41.3 (+0.18), TriviaQA 84.28 to 84.76 (+0.48), HotPotQA 30.08 to 30.04 (-0.04), Passage_retrieval_en 8.5 to 9.5 (+1.0). Four of five tasks are flat or slightly up; the largest move is +1.0 on passage retrieval, which is small relative to the int2 collapse on the same table (SAMSum 41.12 to 14.04, TriviaQA 84.28 to 63.64, Passage_retrieval_en 8.5 to 4.82). So int4 is close to free and int2 is not, on this setup. Perplexity is only shown as a plot, so no perplexity delta is quoted. FOOTPRINT: the blog says int4 gives roughly a 2.5x memory saving rather than the 4x the element width implies, because of the 128-token fp16 residual, the per-group scales (group_size 64), and the quantisation metadata. The 4x figure in the basis is the element width only. CAPACITY: with Flash Attention on an 80GB A100 the post says the quantised cache reaches 128k tokens where the fp16 cache reaches 40k, a 3.2x context increase, consistent with a saving closer to 2.5x than to 4x once the residual and the weights are counted. CAVEATS: the LongBench prompt lengths are not given, so context_length is the 128k capacity claim and not the length of those tasks. The A100-80GB figure is a single-GPU capacity statement, not a latency. Per-token quantisation of the keys is the opposite of what KIVI recommends, and the int2 column shows that choice hurting; the int4 column does not. Confidence is 0.66 because the source is a blog post and the memory and speed evidence is a chart rather than a table. ENGINE: the run is the Hugging Face transformers library with the quanto backend, which has no engine record of its own. vllm is the required engine_id and did not produce these numbers.