SLaNC:静态LayerNorm校准
SLaNC: Static LayerNorm Calibration
AI总结:
针对硬件上Transformer模型LayerNorm计算因方差累加需宽动态范围易溢出的问题,提出基于前置线性层静态权重离线计算缩放因子的方法,实现无开销且无数值问题的低精度高效推理。
摘要:
大型语言模型(LLMs)的规模不断增大,参数量已超过数千亿,这给专用硬件加速器制造商带来了巨大压力,并使后者的创新设计成为AI产业中发展最迅速的领域之一。鉴于可用加速器在计算和存储方面的限制,人们已经探索了各种方法以实现LLMs的高效和准确处理。其中,各种量化技术作为减少计算、通信和存储需求的手段,已成为社区的主要关注点。由于可用值表示范围有限,量化到低精度格式自然带来了一系列挑战。在硬件上处理流行的Transformer模型时,主要问题之一变成了LayerNorm的计算,因为方差的累加需要比硬件支持的宽得多的动态范围。在本文中,我们解决了这个问题,并提出了一种计算高效的缩放技术,可以在推理期间轻松应用于Transformer模型。我们的方法提出了一种直接的方式,基于紧邻的前置线性层的静态权重来缩放LayerNorm的输入。缩放因子完全基于线性层权重离线计算,因此在推理期间不会增加任何延迟或计算开销。最重要的是,我们的技术确保在计算过程中不会发生诸如溢出或下溢的数值问题。这种方法在广泛的硬件架构上提供了平滑、准确且资源高效的推理。本文提供了理论证明以及支持性的数值模拟。
英文摘要:
The ever increasing sizes of Large Language Models (LLMs) beyond hundreds of billions of parameters have generated enormous pressure on the manufacturers of dedicated hardware accelerators and made the innovative design of the latter one of the most rapidly expanding fields of the AI industry. Various approaches have been explored to enable efficient and accurate processing of LLMs on the available accelerators given their computational and storage limitations. Among these, various quantization techniques have become the main focus of the community as a means of reducing the compute, communication and storage requirements. Quantization to lower precision formats naturally poses a number of challenges caused by the limited range of the available value representations. When it comes to processing the popular Transformer models on hardware, one of the main issues becomes calculation of the LayerNorm simply because accumulation of the variance requires a much wider dynamic range than the hardware enables. In this article, we address this matter and propose a computationally-efficient scaling technique that can be easily applied to Transformer models during inference. Our method suggests a straightforward way of scaling the LayerNorm inputs based on the static weights of the immediately preceding linear layers. The scaling factors are computed offline, based solely on the linear layer weights, hence no latency or computational overhead is added during inference. Most importantly, our technique ensures that no numerical issues such as overflow or underflow could happen during the compute. This approach offers smooth, accurate and resource-effective inference across a wide range of hardware architectures. The article provides theoretical justification as well as supporting numerical simulations.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。