延迟解码,一次乘法:重新思考量化权重的点积计算
Decode Late, Multiply Once: Rethinking the Dot Product for Quantized Weights
AI总结:
本文提出延迟解码、一次乘法的点积计算方法,减少乘法器数量与内存占用,设计SA-PE处理单元,经FPGA实现验证可降低算术能耗。
摘要:
大型神经网络越来越多地采用1-4位权重和16位或32位激活值部署,但其点积仍为每个元素使用一个乘法器。本文证明,长度为n、权重编码为k位的点积可通过n+2^k次加法、最多2^k次解码和2^k次乘法计算。每个权重编码直接作为地址偏移量,选择2^k个累加器之一;每个激活值被加到选中的累加器中;仅在最后一步,通过融合解码-乘法步骤对累加和进行解码和乘法,且从不形成解码后的权重向量。这种重构对整数运算精确成立,适用于整数或浮点操作数,以及任意(包括非线性)解码器,还可扩展到分组缩放和矩阵、张量乘积。乘法器数量减少n/2^k,而总算术能耗的提升幅度较小,为有界因子,本文通过成本模型对其进行量化。本文描述了一种散射-累加处理单元(SA-PE),用于替换权重固定脉动阵列中的MAC单元,其采用加载/流处理/归约/排空调度,其中小型可时分复用的乘法器每个 tile 仅运行2^k次。由于不存储解码后的权重,本地权重内存可缩小w_d/k(w_d为解码后权重的位数)。为FPGA综合的RTL实现与匹配的MAC阵列对比显示,未复用的SA-PE比MAC PE更大,但当归约乘法器在PE间共享时,节省效果显现。软件模型证实整数等价性精确,浮点误差不劣于传统流水线。本文不声称该底层恒等式是新的,并讨论了权重共享和基于查找的内核的相关工作。
英文摘要:
Large neural networks are increasingly deployed with 1-4 bit weights and 16- or 32-bit activations, yet their dot products still use one multiplier per element. We show that a length-n dot product with k-bit weight codes can be computed with n+2^k additions and at most 2^k decodes and 2^k multiplications. Each weight code is used directly as an address offset that selects one of 2^k accumulators; each activation is added into the selected accumulator; and the accumulated sums are decoded and multiplied only once, at the end, in a fused decode-and-multiply step. The decoded weight vector is never formed. The refactoring is exact for integer arithmetic, works with integer or floating-point operands and with arbitrary, including nonlinear, decoders, and extends to group-wise scales and to matrix and tensor products. The multiplier count falls by n/2^k, while total arithmetic energy improves by a smaller, bounded factor that we quantify with a cost model. We describe a scatter-accumulate processing element (SA-PE) that replaces the MAC unit in a weight-stationary systolic array, with a load/stream/reduce/drain schedule in which a small, time-shareable multiplier runs only 2^k times per tile. Because decoded weights are not stored, local weight memory shrinks by up to w_d/k for w_d-bit decoded weights. An RTL implementation synthesized for FPGA and compared with a matched MAC array shows that an unshared SA-PE is larger than a MAC PE, and that the saving appears when the reduction multiplier is shared across PEs. Software models confirm exact integer equivalence and floating-point error no worse than the conventional pipeline. We do not claim the underlying identity is new, and we discuss related work on weight sharing and lookup-based kernels.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。