arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2603.27462cs.DScs.LGcs.PF
收藏

RSR-core:一种高性能的低比特矩阵向量乘法引擎

RSR-core: A High-Performance Engine for Low-Bit Matrix-Vector Multiplication

University of Illinois Chicago(伊利诺伊大学芝加哥分校)

Mohsen Dehghankar, Abolfazl Asudeh

AI总结:

本文提出RSR-core,一种基于RSR算法的高性能引擎,实现低比特矩阵向量乘法的优化低层内核,支持CPU和CUDA环境,显著提升推理效率。

摘要:

矩阵向量乘法是神经网络、向量数据库和大语言模型中的基本构建块,尤其是在推理过程中。因此,高效的矩阵向量乘法引擎直接转化为更高效的推理。最近的研究探索了低比特量化模型权重,其中矩阵用二进制(1位)或三进制(1.58位)值表示,而激活保持较高精度。这些表示方法使硬件层面的计算更高效。同时,如冗余段减少(RSR)等算法为加速低比特矩阵向量乘法提供了理论保证。然而,现有实现处于应用层面,无法高效集成到硬件内核中,限制了实际性能。为弥合这一差距,我们提出了RSR-core,一种高性能引擎,将RSR算法实现为优化的低层内核,适用于CPU和CUDA环境。RSR-core支持二进制和三进制权重矩阵以及通用向量的高效矩阵向量乘法,并使RSR算法在实际推理管道中的部署成为可能。RSR-core作为生产就绪引擎,通过HuggingFace集成实现低比特模型的预处理和加速推理。实验结果表明,与基准HuggingFace PyTorch乘法相比,RSR-core在CPU上实现了高达62倍的加速,在CUDA上实现了高达1.9倍的token生成加速。源代码可在https://github.com/UIC-InDeXLab/RSR-core公开获取。

英文摘要:

Matrix-vector multiplication is a fundamental building block in neural networks, vector databases, and large language models, particularly during inference. As a result, efficient matrix-vector multiplication engines directly translate into more efficient inference. Recent work has explored low-bit quantization of model weights, where matrices are represented using binary (1-bit) or ternary (1.58-bit) values while activation is kept in higher precision. These representations enable efficient hardware-level computation. In parallel, algorithms such as Redundant Segment Reduction (RSR) provide theoretical guarantees for accelerating low-bit matrix-vector multiplication. However, existing implementations operate at the application level and cannot be efficiently integrated into hardware kernels, limiting practical performance. To bridge this gap, we present RSR-core, a high-performance engine that implements the RSR algorithm as optimized low-level kernels for both CPU and CUDA environments. RSR-core supports efficient matrix-vector multiplication for binary and ternary weight matrices and general vectors while enabling practical deployment of RSR algorithm in real inference pipelines. RSR-core is provided as a production-ready engine with HuggingFace integration for preprocessing low-bit models and running accelerated inference. Experimental results demonstrate significant performance improvements over baseline HuggingFace PyTorch multiplication, achieving up to 62x speedup on CPU and up to 1.9x speedup for token generation on CUDA for popular ternary LLMs. The source code is publicly available at https://github.com/UIC-InDeXLab/RSR-core.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑