arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2403.08058cs.LGcs.CL
收藏

CHAI:用于高效LLM推理的聚类头注意力

CHAI: Clustered Head Attention for Efficient LLM Inference

University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Meta-FAIR(元平台FAIR研究院)

Saurabh Agarwal, Bilge Acun, Basil Hosmer, Mostafa Elhoushi, Yejin Lee, Shivaram Venkataraman, Dimitris Papailiopoulos, Carole-Jean Wu

AI总结:

本文提出聚类头注意力(CHAI),通过在运行时合并高相关性的注意力头进行自注意力计算,在不需微调的情况下,将K,V cache内存需求降低21.4%、推理延迟降低1.73倍,且在多种模型和数据集上准确率偏差最大仅3.2%。

摘要:

具有数千亿参数的大型语言模型(LLMs)已经改变了机器学习领域。然而,在推理时部署这些模型对计算和内存的要求都很高,单个请求可能需要多个GPU和数十GB的内存。多头注意力是LLMs的关键组件之一,可能占LLMs内存和计算需求的50%以上。我们观察到,各个头在关注哪些token上存在大量冗余。基于这一洞察,我们提出了聚类头注意力(Clustered Head Attention, CHAI)。CHAI在运行时将具有高度相关性的头结合起来进行自注意力计算,从而减少内存和计算量。在我们的实验中,我们表明CHAI能够将存储K,V cache的内存需求减少高达21.4%,并将推理时间延迟降低高达1.73倍,且无需任何微调。CHAI在3种不同模型(即OPT-66B、LLAMA-7B、LLAMA-33B)和5个不同评估数据集上实现了最大3.2%的准确率偏差。

英文摘要:

Large Language Models (LLMs) with hundreds of billions of parameters have transformed the field of machine learning. However, serving these models at inference time is both compute and memory intensive, where a single request can require multiple GPUs and tens of Gigabytes of memory. Multi-Head Attention is one of the key components of LLMs, which can account for over 50% of LLMs memory and compute requirement. We observe that there is a high amount of redundancy across heads on which tokens they pay attention to. Based on this insight, we propose Clustered Head Attention (CHAI). CHAI combines heads with a high amount of correlation for self-attention at runtime, thus reducing both memory and compute. In our experiments, we show that CHAI is able to reduce the memory requirements for storing K,V cache by up to 21.4% and inference time latency by up to 1.73x without any fine-tuning required. CHAI achieves this with a maximum 3.2% deviation in accuracy across 3 different models (i.e. OPT-66B, LLAMA-7B, LLAMA-33B) and 5 different evaluation datasets.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑