让视觉模型第一层激活值可训练,提升训练速度1.25至4倍。
TrAct: Making First-layer Pre-Activations Trainable
- 在第一层激活上做梯度下降,反推最优权重
- 实测训练加速1.25倍到4倍,开销极小
- 适用于卷积与Transformer模型,适配多种优化器
我们研究视觉模型第一层的训练问题,发现输入像素值与梯度更新幅度直接相关:第一层权重的梯度正比于归一化后的像素值。低对比度图像对学习影响小,而过亮或过暗图像影响更大。为此,我们提出在第一层激活上执行梯度下降,生成激活提案,并求解使平方距离最小的最优权重。提供闭式解,并设计高效且鲁棒的随机训练策略。实验表明,TrAct(Training Activations)在多种视觉模型(包括卷积与Transformer架构)上实现1.25x至4x的训练加速,计算开销极小,且兼容多种优化器。
原文摘要 · Abstract (English)
We consider the training of the first layer of vision models and notice the clear relationship between pixel values and gradient update magnitudes: the gradients arriving at the weights of a first layer are by definition directly proportional to (normalized) input pixel values. Thus, an image with low contrast has a smaller impact on learning than an image with higher contrast, and a very bright or very dark image has a stronger impact on the weights than an image with moderate brightness. In this work, we propose performing gradient descent on the embeddings produced by the first layer of the model. However, switching to discrete inputs with an embedding layer is not a reasonable option for vision models. Thus, we propose the conceptual procedure of (i) a gradient descent step on first layer activations to construct an activation proposal, and (ii) finding the optimal weights of the first layer, i.e., those weights which minimize the squared distance to the activation proposal. We provide a closed form solution of the procedure and adjust it for robust stochastic training while computing everything efficiently. Empirically, we find that TrAct (Training Activations) speeds up training by factors between 1.25x and 4x while requiring only a small computational overhead. We demonstrate the utility of TrAct with different optimizers for a range of different vision models including convolutional and transformer architectures.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。