Vec-LUT:用于边缘设备上并行超低比特LLM推理的向量表查找
Vec-LUT: Vector Table Lookup for Parallel Ultra-Low-Bit LLM Inference on Edge Devices
AI总结:
本文提出Vec-LUT,通过统一表查找和缓存感知流查找技术,提升边缘设备上超低比特LLM推理效率,实验显示性能提升达4.2倍。
摘要:
大型语言模型(LLMs)越来越多地部署在边缘设备上。为满足严格的资源约束,实际部署将LLM量化从8位推进到4位、2位,甚至1.58位。结合基于查找表(LUT)的推理,CPU能够比NPUs更快地运行这些超低比特LLM,为无处不在的设备智能开辟了新机会。然而,本文发现,在并行推理中,基于LUT的推理未能充分利用内存带宽,这在预填充、测试时扩展等多令牌场景中尤为关键。根本原因是标量LUT范式,它为每个令牌执行重复且非连续的内存访问。为了解决这一问题,我们提出了向量LUT,一种新的查找范式,能够在并行令牌上构建统一的LUT,并对每个索引执行单次$1 \rightarrow N$查找。为了高效实现它,我们进一步引入(1)以向量LUT为中心的张量布局,和(2)缓存感知的流查找技术。在5种边缘设备上对3种LLM的评估显示,Vec-LUT在性能上比最先进的基线高出高达$4.2\times$。我们的实现已集成到llama.cpp中。代码可在https://github.com/OpenBitSys/vlut.cpp获取。
英文摘要:
Large language models (LLMs) are increasingly deployed on edge devices. To meet strict resource constraints, real-world deployment has pushed LLM quantization from 8-bit to 4-bit, 2-bit, and now 1.58-bit. Combined with lookup table (LUT)-based inference, CPUs run these ultra-low-bit LLMs even faster than NPUs, opening new opportunities for ubiquitous on-device intelligence. However, this paper identifies that LUT-based inference underutilizes memory bandwidth during parallel inference, which is required for prefilling, test-time scaling, and other multi-token scenarios. The root cause is the scalar LUT paradigm, which performs repetitive and non-contiguous memory accesses for each token. To solve the issue, we propose vector LUT, a new lookup paradigm that constructs a unified LUT across parallel tokens, and performs a single $1 \rightarrow N$ lookup per index. To realize it efficiently, we further introduce (1) Vector LUT-Centric Tensor Layout, and (2) Cache-Aware Streamed Lookup techniques. Evaluations on 5 edge devices across 3 LLMs show that Vec-LUT outperforms state-of-the-art baselines by up to $4.2\times$. Our implementation is integrated into llama.cpp. The code is available at https://github.com/OpenBitSys/vlut.cpp.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。