为三值大模型设计高效边缘推理系统,速度提升超6倍。
Bitnet.cpp: Efficient Edge Inference for Ternary LLMs
- 创新mpGEMM库实现每权重低于2比特的无损推理
- 实测速度比全精度快6.25倍,比低比特基线快2.32倍
- 适合需要轻量化部署的大模型边缘应用开发者
1-bit大语言模型(如BitNet b1.58)的兴起激发了对三值大模型的研究兴趣。然而,针对三值大模型高效边缘推理的研究与应用仍十分有限。为此,我们提出Bitnet.cpp,一个专为BitNet b1.58和三值大模型优化的推理系统。由于混合精度矩阵乘法(mpGEMM)占三值大模型推理时间的绝大部分,Bitnet.cpp引入新型mpGEMM库,实现每权重低于2比特、高效且无损的推理。该库包含两项核心技术:三值查找表(TL),解决以往位级方法的空间效率问题;带缩放的Int2(I2_S),确保边缘推理无损失。实验表明,Bitnet.cpp相比全精度基线最高提速6.25倍,相比低比特基线最高提速2.32倍,创下新基准。此外,附录中将TL扩展为逐元素查找表(ELUT),为低比特大模型提供理论与实证支持。代码已开源:https://github.com/microsoft/BitNet/tree/paper,为边缘大模型高效部署提供完整解决方案。
原文摘要 · Abstract (English)
The advent of 1-bit large language models (LLMs), led by BitNet b1.58, has spurred interest in ternary LLMs. Despite this, research and practical applications focusing on efficient edge inference for ternary LLMs remain scarce. To bridge this gap, we introduce Bitnet.cpp, an inference system optimized for BitNet b1.58 and ternary LLMs. Given that mixed-precision matrix multiplication (mpGEMM) constitutes the bulk of inference time in ternary LLMs, Bitnet.cpp incorporates a novel mpGEMM library to facilitate sub-2-bits-per-weight, efficient and lossless inference. The library features two core solutions: Ternary Lookup Table (TL), which addresses spatial inefficiencies of previous bit-wise methods, and Int2 with a Scale (I2_S), which ensures lossless edge inference, both enabling high-speed inference. Our experiments show that Bitnet.cpp achieves up to a 6.25x increase in speed over full-precision baselines and up to 2.32x over low-bit baselines, setting new benchmarks in the field. Additionally, we expand TL to element-wise lookup table (ELUT) for low-bit LLMs in the appendix, presenting both theoretical and empirical evidence of its considerable potential. Bitnet.cpp is publicly available at https://github.com/microsoft/BitNet/tree/paper , offering a sophisticated solution for the efficient and practical deployment of edge LLMs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。