DoRA的扩展:通过因子范数和融合内核进行高秩适应
Scaling DoRA: High-Rank Adaptation via Factored Norms and Fused Kernels
AI总结:
本文提出通过因子范数和融合内核实现高秩适应,减少内存占用并提升计算效率,适用于大规模视觉-语言模型。
摘要:
Weight-Decomposed Low-Rank Adaptation (DoRA)通过解耦权重幅度与方向扩展LoRA,但其前向传递需要计算W + sBA的行范数,这要求主要框架通过显式计算稠密的[d_out, d_in]乘积BA来实现。在d_in = 8192和rank r = 384时,单个模块的范数需要约512 MB的临时工作内存,在bf16中,高秩DoRA成本高昂且在常见单GPU设置中难以实现,尤其是在涉及数百个适应模块和检查点时。本文提出两个系统贡献:因子范数将平方范数分解为基础、交叉和Gram项,通过O(d_out r + r^2)中间步骤计算,消除了稠密乘积。融合Triton内核将四内核DoRA组合折叠为单次传递,减少内存交通约4倍,并使用数值稳定的格式避免在接近单位重缩放区域中的灾难性抵消。在六个8-32B视觉-语言模型(VLMs)上,使用三种NVIDIA GPU(RTX 6000 PRO、H200、B200)在bf16中r = 384的情况下,融合实现比Hugging Face PEFT的DoRA实现快1.5-2.0倍(推理),并比梯度计算(排除优化器步骤)快1.5-1.9倍,峰值VRAM低至7 GB。在六个GPU上的微基准测试确认1.5-2.7倍的组合内核加速。最终logit余弦相似度在所有模型/GPU配对中超过0.9999,多种子训练曲线在2000步内平均每步损失差异不超过7.1 x 10^-4。
英文摘要:
Weight-Decomposed Low-Rank Adaptation (DoRA) extends LoRA by decoupling weight magnitude from direction, but its forward pass requires the row-wise norm of W + sBA, a computation that every major framework we surveyed implements by materializing the dense [d_out, d_in] product BA. At d_in = 8192 and rank r = 384, a single module's norm requires about 512 MB of transient working memory in bf16, making high-rank DoRA costly and often infeasible on common single-GPU setups once hundreds of adapted modules and checkpointing are involved. We present two systems contributions. A factored norm decomposes the squared norm into base, cross, and Gram terms computable through O(d_out r + r^2) intermediates, eliminating the dense product. Fused Triton kernels collapse the four-kernel DoRA composition into a single pass, reducing memory traffic by about 4x and using a numerically stable form that avoids catastrophic cancellation in the near-unity rescaling regime where magnitude scales concentrate in practice. Across six 8-32B vision-language models (VLMs) on three NVIDIA GPUs (RTX 6000 PRO, H200, B200) at r = 384 in bf16, the fused implementation is 1.5-2.0x faster than Hugging Face PEFT's DoRA implementation for inference and 1.5-1.9x faster for gradient computation (optimizer step excluded), with up to 7 GB lower peak VRAM. Microbenchmarks on six GPUs spanning four architecture generations (L40S, A100, RTX 6000 PRO, H200, B200, B300) confirm 1.5-2.7x compose-kernel speedup. Final-logit cosine similarity exceeds 0.9999 across all model/GPU pairs, and multi-seed training curves match within 7.1 x 10^-4 mean per-step loss delta over 2000 steps.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。