Memory efficient training method improves transformer accuracy and speed

Local proxies for memory-efficient training

Machine LearningArtificial Intelligence

Summary

Training large AI models like transformers usually needs a lot of memory to remember all details until the end. The authors found a way to train each part of the transformer using smaller, local helper networks, so the memory needed is much less. These helpers learn how the whole model behaves, allowing training to be faster and still accurate. They tested this approach on image and language tasks, showing it uses less memory while keeping or improving quality compared to older local training methods.

What this means in practice

Authors

Wu S. Zihan, Brian A. Yuan, Guillaume Bellec

Abstract

Local learning algorithms can reshape resource requirements of artificial intelligence. The memory bottleneck of standard end-to-end backpropagation lies in the need to store all network activations until the loss gradient has been propagated back through. Local learning avoids this, but typically at a cost in accuracy. We study how to achieve accurate and memory efficient local learning in transformers. For each transformer block, we train a local proxy network to predict the global network output via distillation. Gradients can be independently propagated through this local proxy while estimating well the backpropagation gradients. In theory, this approach is exact for deep linear networks; in non-linear residual models, the gradient error can be bounded when using the appropriate residual proxy. We verify this numerically and demonstrate that optimizing the distillation loss improves gradient estimation. Evaluating the performance of proxy propagation on CIFAR-100 in vision transformers, we find that it achieves a better accuracy/memory trade-off compared to other local algorithms. Finally, we show that the method is further relevant for fine-tuning large language models on a small memory budget. Our method trains faster and achieves higher performance than memory-efficient zeroth-order learning algorithms with comparable memory cost.