arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.20137cs.AIcs.ARcs.NAmath.NA
收藏

面向含离群值的大语言模型的精确块量化

Accurate Block Quantization in LLMs with Outliers

d-Matrix

Nikita Trukhanov, Ilya Soloveychik

AI总结:

本文针对大语言模型 KV-cache 存储受限问题,提出利用离群值的通道级模式进行编译时通道重排,从而在不显著损失模型精度的情况下使用低精度块浮点格式,实现 2 倍内存节省且不影响推理延迟。

摘要:

近几个月来,对超大规模大语言模型(LLMs)推理的需求出现了巨大增长。这凸显了能够高效、快速处理所涉及计算和内存移动的专用硬件的严重短缺。由于所处理序列长度的爆炸式增长,这一问题进一步加剧,因为这些序列需要将与序列长度成正比的 KV-cache 高效地存储在片上。为了使所需计算可行并将相关数据放入可用内存,人们提出了大量量化技术,这些技术能够对权重和激活进行精确量化。该方向近期的主要突破之一是引入了块浮点(Block Floating Point, BFP)格式系列,其特征是由具有共享缩放因子的尾数块组成。这些格式能够以内存、功耗和计算高效的方式为张量运算提供硬件支持,并提供极好的量化精度。阻碍块格式广泛应用的主要问题源于权重和激活中存在离群值,因为这些离群值会影响同一块中其他值的精度。在本文中,我们聚焦于最关键的有限 KV-cache 存储问题。我们提出了一种新方法,能够在不损害最终模型精度的情况下使用低精度 BFP 格式。我们利用离群值表现出的常见通道级模式,以显著提高其量化质量的方式对它们进行重新排列。该方法在内存占用上实现了 2 倍的节省,且模型精度没有显著下降。重要的是,通道的重新排列发生在编译时,因此对推理延迟没有影响。

英文摘要:

The demand for inference on extremely large scale LLMs has seen enormous growth in the recent months. It made evident the colossal shortage of dedicated hardware capable of efficient and fast processing of the involved compute and memory movement. The problem is aggravated by the exploding raise in the lengths of the sequences being processed, since those require efficient on-chip storage of the KV-cache of size proportional to the sequence length. To make the required compute feasible and fit the involved data into available memory, numerous quantization techniques have been proposed that allow accurate quantization for both weights and activations. One of the main recent breakthroughs in this direction was introduction of the family of Block Floating Point (BFP) formats characterized by a block of mantissas with a shared scale factor. These enable memory- power-, and compute- efficient hardware support of the tensor operations and provide extremely good quantization accuracy. The main issues preventing widespread application of block formats is caused by the presence of outliers in weights and activations since those affect the accuracy of the other values in the same block. In this paper, we focus on the most critical problem of limited KV-cache storage. We propose a novel approach enabling usage of low precision BFP formats without compromising the resulting model accuracy. We exploit the common channel-wise patterns exhibited by the outliers to rearrange them in such a way, that their quantization quality is significantly improved. The methodology yields 2x savings in the memory footprint without significant degradation of the model's accuracy. Importantly, the rearrangement of channels happens at the compile time and thus has no impact on the inference latency.

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

↑