The key-value (KV) cache in large language models presents a significant memory bottleneck during inference, growing linearly with sequence length and often exceeding the memory footprint of model weights themselves. We implement and evaluate GPU-accelerated INT8 quantization for KV cache compression, achieving 4$\times$ memory reduction with minimal accuracy degradation. We develop four CUDA kernel variants -- naive, tiled, coarsened, and vectorized -- and benchmark them across realistic workload sizes up to 1 billion elements. Our vectorized kernel achieves up to 1,694$\times$ speedup over CPU baselines while maintaining reconstruction error below 0.004 and attention score error below 0.1 even for 8K-dimensional heads. These results demonstrate that INT8 quantization provides a practical approach for reducing memory pressure in LLM inference with negligible computational overhead (6--58ms) and minimal impact on downstream model behavior


翻译:大型语言模型中的键值(KV)缓存已成为推理过程中的显著内存瓶颈,其容量随序列长度线性增长,并常超过模型权重本身的内存占用。我们实现并评估了基于GPU加速的INT8量化KV缓存压缩方案,在精度损失最小的前提下实现了4倍内存压缩。我们开发了四种CUDA内核变体——基础版、分块版、粗粒度版和向量化版,并在高达10亿元素的实际工作负载规模上进行了基准测试。我们的向量化内核相比CPU基线实现了最高1,694倍的加速比,同时即使面对8K维注意力头,其重构误差仍低于0.004,注意力分数误差低于0.1。这些结果表明,INT8量化为缓解LLM推理内存压力提供了实用方案,其计算开销可忽略不计(6-58毫秒),且对下游模型行为的影响微乎其微。

0
下载
关闭预览

相关内容

TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
低比特大语言模型综述:基础、系统与算法
专知会员服务
28+阅读 · 2024年10月6日
大模型的模型压缩与有效推理综述
专知会员服务
43+阅读 · 2024年7月8日
《大型语言模型加速生成技术》最新综述
专知会员服务
50+阅读 · 2024年5月25日
大型语言模型的模型压缩与高效推理:综述
专知会员服务
94+阅读 · 2024年2月17日
谷歌EfficientNet缩放模型,PyTorch实现登热榜
机器学习算法与Python学习
11+阅读 · 2019年6月4日
【资源】深度学习模型压缩资源汇总
专知
38+阅读 · 2019年5月8日
【资源推荐】模型压缩与加速相关资源汇总
【优青论文】深度神经网络压缩与加速综述
计算机研究与发展
17+阅读 · 2018年9月20日
超全总结:神经网络加速之量化模型 | 附带代码
如何设计基于深度学习的图像压缩算法
论智
41+阅读 · 2018年4月26日
CNN 模型压缩与加速算法综述
机器学习研究会
16+阅读 · 2017年8月25日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关VIP内容
TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
低比特大语言模型综述:基础、系统与算法
专知会员服务
28+阅读 · 2024年10月6日
大模型的模型压缩与有效推理综述
专知会员服务
43+阅读 · 2024年7月8日
《大型语言模型加速生成技术》最新综述
专知会员服务
50+阅读 · 2024年5月25日
大型语言模型的模型压缩与高效推理:综述
专知会员服务
94+阅读 · 2024年2月17日
相关资讯
谷歌EfficientNet缩放模型,PyTorch实现登热榜
机器学习算法与Python学习
11+阅读 · 2019年6月4日
【资源】深度学习模型压缩资源汇总
专知
38+阅读 · 2019年5月8日
【资源推荐】模型压缩与加速相关资源汇总
【优青论文】深度神经网络压缩与加速综述
计算机研究与发展
17+阅读 · 2018年9月20日
超全总结:神经网络加速之量化模型 | 附带代码
如何设计基于深度学习的图像压缩算法
论智
41+阅读 · 2018年4月26日
CNN 模型压缩与加速算法综述
机器学习研究会
16+阅读 · 2017年8月25日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员