VQ-LLM:面向向量量化增强LLM推理的高性能代码生成
VQ-LLM: High-performance Code Generation for Vector Quantization Augmented LLM Inference
AI总结:
本文提出VQ-LLM框架,通过引入codebook cache软件抽象和以码本为中心的计算引擎,优化向量量化LLM推理中的内存访问与计算,显著降低延迟并达到优于现有方法的性能。
摘要:
在这项工作中,我们设计并实现了VQ-LLM,一个高效的融合Vector Quantization(VQ,向量量化)内核生成框架。我们首先引入了一种称为codebook cache(码本缓存)的软件抽象,以优化码本访问效率并支持VQ与各种计算的集成。codebook cache自适应地跨GPU的内存层次结构存储不同的条目,包括片外全局内存、片上共享内存和寄存器。围绕codebook cache,我们设计了一个高效的计算引擎,以优化涉及码本计算期间的内存流量。该计算引擎采用了以码本为中心的数据流和融合优化。此外,我们提供了自适应启发式方法,以针对优化中的参数选择适应多样化的VQ配置。与未优化版本相比,我们的优化实现了平均46.13%的延迟降低。与现有的开源实现相比,我们的方法将延迟降低了64.36%至99.1%。最后,与AWQ和KVQuant等最先进的逐元素量化方法的比较表明,我们的VQ-LLM具有实际可行性,在等效位宽下实现了接近甚至更好的延迟,并可能提供更高的精度。
英文摘要:
In this work, we design and implement VQ-LLM, an efficient fused Vector Quantization (VQ) kernel generation framework. We first introduce a software abstraction called codebook cache to optimize codebook access efficiency and support the integration of VQ with various computations. The codebook cache adaptively stores different entries across the GPU's memory hierarchy, including off-chip global memory, on-chip shared memory, and registers. Centered around the codebook cache, we design an efficient computation engine that optimizes memory traffic during computations involving codebooks. This compute engine adopts the codebook-centric dataflow and fusion optimizations. Additionally, we provide adaptive heuristics to tailor parameter selection in our optimizations to diverse VQ configurations. Our optimizations achieve an average latency reduction of 46.13% compared to unoptimized versions. Compared to existing open-source implementations, our methods decrease latency by 64.36% to 99.1%. A final comparison with state-of-the-art element-wise quantization methods like AWQ and KVQuant shows that our VQ-LLM is practically viable, achieving latencies close or even better latencies to those at equivalent bit-widths, potentially offering greater accuracy.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。