TernaryLLM:三值化大语言模型
TernaryLLM: Ternarized Large Language Model
AI总结:
针对 LLM 三值化受权重和激活异常值影响的问题,本文提出可学习缩放与偏移的 DLT 及基于余弦相似度互信息的 OFF 蒸馏,TernaryLLM 在 LLaMA-3 等基准上显著优于现有低比特方法。
摘要:
大语言模型(LLM)在自然语言处理(NLP)任务上取得了显著性能,但其发展受到高昂计算成本和内存需求的阻碍。三值化作为一种极端量化形式,通过减少内存占用并支持节能的浮点加法提供了解决方案。然而,将三值化应用于 LLM 面临着由权重和激活中的异常值所引发的挑战。在本研究中,我们观察到权重中存在非对称异常值和非零均值,因此提出了双重可学习三值化(Dual Learnable Ternarization,DLT),使缩放因子和偏移量均可学习。我们还提出了异常值友好的特征知识蒸馏(Outlier-Friendly Feature Knowledge Distillation,OFF),以恢复在极低比特量化中丢失的信息。所提出的 OFF 能够融合语义信息,并且对异常值不敏感。OFF 的核心是利用余弦相似度最大化三值化模型与浮点模型特征之间的互信息。大量实验表明,在面向不同 LLM 系列的标准文本生成和零样本基准测试中,我们的 TernaryLLM 优于以往的低比特量化方法。具体而言,对于最强大的开源模型之一 LLaMA-3,我们的方法(W1.58A16)在 C4 上的困惑度方面比此前最先进方法(W2A16)优 5.8,在零样本任务的平均准确率方面高出 8.2%。
英文摘要:
Large language models (LLMs) have achieved remarkable performance on Natural Language Processing (NLP) tasks, but they are hindered by high computational costs and memory requirements. Ternarization, an extreme form of quantization, offers a solution by reducing memory usage and enabling energy-efficient floating-point additions. However, applying ternarization to LLMs faces challenges stemming from outliers in both weights and activations. In this work, observing asymmetric outliers and non-zero means in weights, we introduce Dual Learnable Ternarization (DLT), which enables both scales and shifts to be learnable. We also propose Outlier-Friendly Feature Knowledge Distillation (OFF) to recover the information lost in extremely low-bit quantization. The proposed OFF can incorporate semantic information and is insensitive to outliers. At the core of OFF is maximizing the mutual information between features in ternarized and floating-point models using cosine similarity. Extensive experiments demonstrate that our TernaryLLM surpasses previous low-bit quantization methods on the standard text generation and zero-shot benchmarks for different LLM families. Specifically, for one of the most powerful open-source models, LLaMA-3, our approach (W1.58A16) outperforms the previous state-of-the-art method (W2A16) by 5.8 in terms of perplexity on C4 and by 8.2% in terms of average accuracy on zero-shot tasks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。