向学生学习:应用t分布探索大语言模型准确且高效的格式
Learning from Students: Applying t-Distributions to Explore Accurate and Efficient Formats for LLMs
AI总结:
本文通过大规模分析发现LLM权重与激活多服从Student's t分布,据此提出理论最优的SF4格式,并基于超正规支持增强E2M1,在模型准确率与芯片面积之间实现更优的帕累托权衡。
摘要:
大语言模型(LLMs)规模的不断增大,传统上需要低精度整数格式来满足严格的延迟和功耗要求。然而,近来诸如Normal Float(NF4)等替代格式在提高模型准确性的同时,也增加了芯片面积开销。在本工作中,我们首先对30个网络的LLM权重和激活进行了大规模分析,并得出结论:大多数分布遵循Student's t分布。随后,我们推导出一种新的理论最优格式——Student Float(SF4),该格式在现代LLM上优于NF4,例如在LLaMA2-7B上跨任务平均准确率提高了0.76%。以此格式作为高精度参考,我们进一步提出通过两种超正规支持(supernormal support)变体来增强E2M1,以获得更高的模型准确率。最后,我们通过评估11种数据类型的模型准确率和硬件复杂度,探索了质量与效率的前沿边界。我们发现了一条由INT4、E2M1以及带超正规支持的E2M1组成的帕累托曲线,该曲线在模型准确率和芯片面积之间提供了连续的权衡。例如,带超正规支持的E2M1将Phi-2的准确率提高了最多2.19%,而面积开销仅为1.22%,从而使更多基于LLM的应用能够在四比特下运行。支持代码托管于https://github.com/cornell-zhang/llm-datatypes。
英文摘要:
The increasing size of large language models (LLMs) traditionally requires low-precision integer formats to meet strict latency and power demands. Yet recently, alternative formats such as Normal Float (NF4) have increased model accuracy at the cost of increased chip area. In this work, we first conduct a large-scale analysis of LLM weights and activations across 30 networks and conclude that most distributions follow a Student's t-distribution. We then derive a new theoretically optimal format, Student Float (SF4), that improves over NF4 across modern LLMs, for example increasing the average accuracy on LLaMA2-7B by 0.76% across tasks. Using this format as a high-accuracy reference, we then propose augmenting E2M1 with two variants of supernormal support for higher model accuracy. Finally, we explore the quality and efficiency frontier across 11 datatypes by evaluating their model accuracy and hardware complexity. We discover a Pareto curve composed of INT4, E2M1, and E2M1 with supernormal support, which offers a continuous tradeoff between model accuracy and chip area. For example, E2M1 with supernormal support increases the accuracy of Phi-2 by up to 2.19% with 1.22% area overhead, enabling more LLM-based applications to be run at four bits. The supporting code is hosted at https://github.com/cornell-zhang/llm-datatypes.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。