KVTuner: Sensitivity-Aware Layer-wise Mixed Precision KV Cache Quantization for Efficient and Nearly Lossless LLM Inference. Li, X., Xing, Z., Li, Y., Qu, L., Zhen, H., Liu, W., Yao, Y., Pan, S. J., & Yuan, M. February, 2025. arXiv:2502.04420 [cs]
Paper doi abstract bibtex KV cache quantization can improve Large Language Models (LLMs) inference throughput and latency in long contexts and large batch-size scenarios while preserving LLMs effectiveness. However, current methods have three unsolved issues: overlooking layer-wise sensitivity to KV cache quantization, high overhead of online fine-grained decision-making, and low flexibility to different LLMs and constraints. Therefore, we thoroughly analyze the inherent correlation of layer-wise transformer attention patterns to KV cache quantization errors and study why key cache is more important than value cache for quantization error reduction. We further propose a simple yet effective framework KVTuner to adaptively search for the optimal hardware-friendly layer-wise KV quantization precision pairs for coarse-grained KV cache with multi-objective optimization and directly utilize the offline searched configurations during online inference. To reduce the computational cost of offline calibration, we utilize the intra-layer KV precision pair pruning and inter-layer clustering to reduce the search space. Experimental results show that we can achieve nearly lossless 3.25-bit mixed precision KV cache quantization for LLMs like Llama-3.1-8B-Instruct and 4.0-bit for sensitive models like Qwen2.5-7B-Instruct on mathematical reasoning tasks. The maximum inference throughput can be improved by 38.3% compared with KV8 quantization over various context lengths. Our code and searched configurations are available at https://github.com/cmd2001/KVTuner.
@misc{li_kvtuner_2025,
title = {{KVTuner}: {Sensitivity}-{Aware} {Layer}-wise {Mixed} {Precision} {KV} {Cache} {Quantization} for {Efficient} and {Nearly} {Lossless} {LLM} {Inference}},
shorttitle = {{KVTuner}},
url = {http://arxiv.org/abs/2502.04420},
doi = {10.48550/arXiv.2502.04420},
abstract = {KV cache quantization can improve Large Language Models (LLMs) inference throughput and latency in long contexts and large batch-size scenarios while preserving LLMs effectiveness. However, current methods have three unsolved issues: overlooking layer-wise sensitivity to KV cache quantization, high overhead of online fine-grained decision-making, and low flexibility to different LLMs and constraints. Therefore, we thoroughly analyze the inherent correlation of layer-wise transformer attention patterns to KV cache quantization errors and study why key cache is more important than value cache for quantization error reduction. We further propose a simple yet effective framework KVTuner to adaptively search for the optimal hardware-friendly layer-wise KV quantization precision pairs for coarse-grained KV cache with multi-objective optimization and directly utilize the offline searched configurations during online inference. To reduce the computational cost of offline calibration, we utilize the intra-layer KV precision pair pruning and inter-layer clustering to reduce the search space. Experimental results show that we can achieve nearly lossless 3.25-bit mixed precision KV cache quantization for LLMs like Llama-3.1-8B-Instruct and 4.0-bit for sensitive models like Qwen2.5-7B-Instruct on mathematical reasoning tasks. The maximum inference throughput can be improved by 38.3\% compared with KV8 quantization over various context lengths. Our code and searched configurations are available at https://github.com/cmd2001/KVTuner.},
urldate = {2025-03-10},
publisher = {arXiv},
author = {Li, Xing and Xing, Zeyu and Li, Yiming and Qu, Linping and Zhen, Hui-Ling and Liu, Wulong and Yao, Yiwu and Pan, Sinno Jialin and Yuan, Mingxuan},
month = feb,
year = {2025},
note = {arXiv:2502.04420 [cs]},
keywords = {Computer Science - Artificial Intelligence, Computer Science - Computation and Language, Computer Science - Machine Learning},
}
Downloads: 0
{"_id":"wrx85rgsMF87tiuyX","bibbaseid":"li-xing-li-qu-zhen-liu-yao-pan-etal-kvtunersensitivityawarelayerwisemixedprecisionkvcachequantizationforefficientandnearlylosslessllminference-2025","author_short":["Li, X.","Xing, Z.","Li, Y.","Qu, L.","Zhen, H.","Liu, W.","Yao, Y.","Pan, S. J.","Yuan, M."],"bibdata":{"bibtype":"misc","type":"misc","title":"KVTuner: Sensitivity-Aware Layer-wise Mixed Precision KV Cache Quantization for Efficient and Nearly Lossless LLM Inference","shorttitle":"KVTuner","url":"http://arxiv.org/abs/2502.04420","doi":"10.48550/arXiv.2502.04420","abstract":"KV cache quantization can improve Large Language Models (LLMs) inference throughput and latency in long contexts and large batch-size scenarios while preserving LLMs effectiveness. However, current methods have three unsolved issues: overlooking layer-wise sensitivity to KV cache quantization, high overhead of online fine-grained decision-making, and low flexibility to different LLMs and constraints. Therefore, we thoroughly analyze the inherent correlation of layer-wise transformer attention patterns to KV cache quantization errors and study why key cache is more important than value cache for quantization error reduction. We further propose a simple yet effective framework KVTuner to adaptively search for the optimal hardware-friendly layer-wise KV quantization precision pairs for coarse-grained KV cache with multi-objective optimization and directly utilize the offline searched configurations during online inference. To reduce the computational cost of offline calibration, we utilize the intra-layer KV precision pair pruning and inter-layer clustering to reduce the search space. Experimental results show that we can achieve nearly lossless 3.25-bit mixed precision KV cache quantization for LLMs like Llama-3.1-8B-Instruct and 4.0-bit for sensitive models like Qwen2.5-7B-Instruct on mathematical reasoning tasks. The maximum inference throughput can be improved by 38.3% compared with KV8 quantization over various context lengths. Our code and searched configurations are available at https://github.com/cmd2001/KVTuner.","urldate":"2025-03-10","publisher":"arXiv","author":[{"propositions":[],"lastnames":["Li"],"firstnames":["Xing"],"suffixes":[]},{"propositions":[],"lastnames":["Xing"],"firstnames":["Zeyu"],"suffixes":[]},{"propositions":[],"lastnames":["Li"],"firstnames":["Yiming"],"suffixes":[]},{"propositions":[],"lastnames":["Qu"],"firstnames":["Linping"],"suffixes":[]},{"propositions":[],"lastnames":["Zhen"],"firstnames":["Hui-Ling"],"suffixes":[]},{"propositions":[],"lastnames":["Liu"],"firstnames":["Wulong"],"suffixes":[]},{"propositions":[],"lastnames":["Yao"],"firstnames":["Yiwu"],"suffixes":[]},{"propositions":[],"lastnames":["Pan"],"firstnames":["Sinno","Jialin"],"suffixes":[]},{"propositions":[],"lastnames":["Yuan"],"firstnames":["Mingxuan"],"suffixes":[]}],"month":"February","year":"2025","note":"arXiv:2502.04420 [cs]","keywords":"Computer Science - Artificial Intelligence, Computer Science - Computation and Language, Computer Science - Machine Learning","bibtex":"@misc{li_kvtuner_2025,\n\ttitle = {{KVTuner}: {Sensitivity}-{Aware} {Layer}-wise {Mixed} {Precision} {KV} {Cache} {Quantization} for {Efficient} and {Nearly} {Lossless} {LLM} {Inference}},\n\tshorttitle = {{KVTuner}},\n\turl = {http://arxiv.org/abs/2502.04420},\n\tdoi = {10.48550/arXiv.2502.04420},\n\tabstract = {KV cache quantization can improve Large Language Models (LLMs) inference throughput and latency in long contexts and large batch-size scenarios while preserving LLMs effectiveness. However, current methods have three unsolved issues: overlooking layer-wise sensitivity to KV cache quantization, high overhead of online fine-grained decision-making, and low flexibility to different LLMs and constraints. Therefore, we thoroughly analyze the inherent correlation of layer-wise transformer attention patterns to KV cache quantization errors and study why key cache is more important than value cache for quantization error reduction. We further propose a simple yet effective framework KVTuner to adaptively search for the optimal hardware-friendly layer-wise KV quantization precision pairs for coarse-grained KV cache with multi-objective optimization and directly utilize the offline searched configurations during online inference. To reduce the computational cost of offline calibration, we utilize the intra-layer KV precision pair pruning and inter-layer clustering to reduce the search space. Experimental results show that we can achieve nearly lossless 3.25-bit mixed precision KV cache quantization for LLMs like Llama-3.1-8B-Instruct and 4.0-bit for sensitive models like Qwen2.5-7B-Instruct on mathematical reasoning tasks. The maximum inference throughput can be improved by 38.3\\% compared with KV8 quantization over various context lengths. Our code and searched configurations are available at https://github.com/cmd2001/KVTuner.},\n\turldate = {2025-03-10},\n\tpublisher = {arXiv},\n\tauthor = {Li, Xing and Xing, Zeyu and Li, Yiming and Qu, Linping and Zhen, Hui-Ling and Liu, Wulong and Yao, Yiwu and Pan, Sinno Jialin and Yuan, Mingxuan},\n\tmonth = feb,\n\tyear = {2025},\n\tnote = {arXiv:2502.04420 [cs]},\n\tkeywords = {Computer Science - Artificial Intelligence, Computer Science - Computation and Language, Computer Science - Machine Learning},\n}\n\n\n\n\n\n\n\n","author_short":["Li, X.","Xing, Z.","Li, Y.","Qu, L.","Zhen, H.","Liu, W.","Yao, Y.","Pan, S. J.","Yuan, M."],"key":"li_kvtuner_2025","id":"li_kvtuner_2025","bibbaseid":"li-xing-li-qu-zhen-liu-yao-pan-etal-kvtunersensitivityawarelayerwisemixedprecisionkvcachequantizationforefficientandnearlylosslessllminference-2025","role":"author","urls":{"Paper":"http://arxiv.org/abs/2502.04420"},"keyword":["Computer Science - Artificial Intelligence","Computer Science - Computation and Language","Computer Science - Machine Learning"],"metadata":{"authorlinks":{}},"html":""},"bibtype":"misc","biburl":"https://bibbase.org/zotero/pa511","dataSources":["MpmemwLeQzDcKDq6x"],"keywords":["computer science - artificial intelligence","computer science - computation and language","computer science - machine learning"],"search_terms":["kvtuner","sensitivity","aware","layer","wise","mixed","precision","cache","quantization","efficient","nearly","lossless","llm","inference","li","xing","li","qu","zhen","liu","yao","pan","yuan"],"title":"KVTuner: Sensitivity-Aware Layer-wise Mixed Precision KV Cache Quantization for Efficient and Nearly Lossless LLM Inference","year":2025}