Problem Statement: The Bottleneck of Scalar Lookups
As Large Language Models (LLMs) migrate to edge devices like smartphones and laptops, ultra-low-bit quantization (e.g., ternary models at 1.58-bit) has become essential for fitting models into limited memory. Since edge CPUs lack native support for 1.58-bit arithmetic, they typically employ Lookup Tables (LUTs) to replace expensive multiplications with precomputed additions.
While effective for single-token generation, scalar LUT methods falter during parallel inference tasks, such as prompt prefilling or batch decoding. In these scenarios, the CPU must perform thousands of small, random memory lookups for every token. This "per-token repetitive" access pattern saturates memory bandwidth and leaves significant hardware compute capacity underutilized, resulting in suboptimal performance.
Methods: From Scalar to Vector Lookups
Vec-LUT addresses these inefficiencies by shifting from a "1 index $\rightarrow$ 1 result" model to a "1 index $\rightarrow$ N results" paradigm, where $N$ represents the number of parallel tokens. By transforming repetitive scalar table lookups into a single vectorized access, the lookup cost is effectively shared across all tokens.
The core technical contributions include:
- Vector LUT-Centric Tensor Layout: Weights and activations are reorganized into a "token-contiguous" layout. This allows the CPU to fetch a vector of results for multiple tokens in a single, efficient memory sweep.
- Cache-Aware Streamed Lookup: To avoid cache thrashing caused by large lookup tables, Vec-LUT employs locality-aware tiling. It partitions the computation so that active portions of the table fit within the high-speed L1 cache.
- Topological Precomputing: The table construction process is optimized by reusing intermediate sums (e.g., using the result of $A+B$ to calculate $A+B+C$), reducing the total operations required for table generation by over 3×.
- Flexible Sub-2-bit Packing: A lossless packing scheme for ternary weights (-1, 0, 1) achieves 1.6 bits per weight (BPW) without requiring strict memory alignment.
Key Results and Performance
The researchers evaluated Vec-LUT on models like BitNet 3B, Llama 3 8B, and Falcon 1B across various hardware, including Intel i7, Snapdragon 8 Elite, and AWS Graviton 3.
- Significant Speedups: Vec-LUT demonstrated up to 4.2× faster prefilling and 3.0× faster parallel decoding compared to
llama.cpp. - High Throughput: On an AWS Graviton 3 instance, Vec-LUT achieved 273.5 tokens/second for Falcon 1B with 32 parallel requests.
- Edge Viability: The approach often outperforms dedicated NPUs on mobile chips, which frequently lack optimized support for non-standard low-bit widths.
- Community Integration: The implementation is already integrated into the
llama.cppframework, facilitating immediate adoption.
Discussion and Future Outlook
Vec-LUT highlights that memory bandwidth, rather than raw compute, is the primary bottleneck for ultra-low-bit LLMs on edge devices. By prioritizing vectorization over multiplication, it bypasses hardware limitations.
However, challenges remain. The current implementation is highly specialized for CPU instruction sets (AVX2, NEON) and may not translate directly to GPUs. Additionally, the exponential growth of lookup tables with higher bit-widths limits the approach primarily to 1-bit and 2-bit models. Future work may explore "vector LUT-centric" hardware designs to further optimize silicon for these emerging quantization paradigms.
Summary updated