arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2505.17852cs.LGcs.AI
收藏

将循环神经网络扩展到十亿参数:零阶优化方法

Scaling Recurrent Neural Networks to a Billion Parameters with Zero-Order Optimization

Department of Computer Science Stanford University(计算机科学系 斯坦福大学);Department of Aeronautics and Astronautics Stanford University(航空与航天系 斯坦福大学)

Francois Chaubard, Mykel Kochenderfer

AI总结:

本文提出用零阶优化(如随机向量梯度估计)替代BPTT训练大规模RNN,在保持推理模式的同时实现十亿参数规模,收敛速度匹配或超越BPTT达19倍,内存成本大幅降低,并在多种任务中泛化性能相当或更优。

摘要:

在推理过程中,循环神经网络(RNN)随着上下文长度的增加,其FLOPs和GPU内存消耗保持恒定,因为它们将所有先前的令牌压缩为固定大小的记忆。相比之下,Transformer在生成过程中FLOPs线性增长,内存使用至多线性增长,因为它们必须显式地关注所有先前的令牌。尽管具有推理时的优势,但在长上下文上训练大型RNN仍然不切实际,因为标准优化方法依赖于通过时间的反向传播(BPTT)。BPTT要求在前向传播过程中保留所有中间激活,导致内存使用随上下文长度和模型大小线性增长。在本文中,我们展示了零阶优化(ZOO)方法,如随机向量梯度估计(RGE),可以成功替代BPTT来训练RNN,其收敛速度与BPTT相当,或超过BPTT多达19倍,同时使用少几个数量级的内存和成本,因为模型在整个训练过程中保持推理模式。我们进一步证明,中心差分RGE(CD-RGE)对应于优化一个平滑的替代损失,固有地正则化训练并改善泛化。我们的方法在三种设置中匹配或优于BPTT:(1)过拟合,(2)转导,以及(3)语言建模。在所有任务中,通过足够的扰动,我们的模型泛化能力与BPTT训练的模型相当或更好,且通常需要更少的步骤。尽管每步需要更多的前向传播,我们利用诸如FlashRNN和分布式推理等最新进展,可以在每步墙钟时间上超越BPTT。

英文摘要:

During inference, Recurrent Neural Networks (RNNs) scale constant in both FLOPs and GPU memory with increasing context length, as they compress all prior tokens into a fixed-size memory. In contrast, transformers scale linearly in FLOPs and, at best, linearly in memory during generation, since they must attend to all previous tokens explicitly. Despite this inference-time advantage, training large RNNs on long contexts remains impractical because standard optimization methods depend on Backpropagation Through Time (BPTT). BPTT requires retention of all intermediate activations during the forward pass, causing memory usage to scale linearly with both context length and model size. In this paper, we show that Zero-Order Optimization (ZOO) methods such as Random-vector Gradient Estimation (RGE) can successfully replace BPTT to train RNNs with convergence rates that match, or exceed BPTT by up to 19 fold, while using orders of magnitude less memory and cost, as the model remains in inference mode throughout training. We further demonstrate that Central-Difference RGE (CD-RGE) corresponds to optimizing a smoothed surrogate loss, inherently regularizing training and improving generalization. Our method matches or outperforms BPTT across three settings: (1) overfitting, (2) transduction, and (3) language modeling. Across all tasks, with sufficient perturbations, our models generalize as well as or better than those trained with BPTT, often in fewer steps. Despite the need for more forward passes per step, we can surpass BPTT wall-clock time per step using recent advancements such as FlashRNN and distributed inference.

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

↑