Reducing Fine-Tuning Memory Overhead by Approximate and Memory-Sharing Backpropagation

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Yang, Yuchen, Shi, Yingdong, Wang, Cheems, Zhen, Xiantong, Shi, Yuxuan, Xu, Jun
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866916298710056960
author Yang, Yuchen
Shi, Yingdong
Wang, Cheems
Zhen, Xiantong
Shi, Yuxuan
Xu, Jun
author_facet Yang, Yuchen
Shi, Yingdong
Wang, Cheems
Zhen, Xiantong
Shi, Yuxuan
Xu, Jun
contents Fine-tuning pretrained large models to downstream tasks is an important problem, which however suffers from huge memory overhead due to large-scale parameters. This work strives to reduce memory overhead in fine-tuning from perspectives of activation function and layer normalization. To this end, we propose the Approximate Backpropagation (Approx-BP) theory, which provides the theoretical feasibility of decoupling the forward and backward passes. We apply our Approx-BP theory to backpropagation training and derive memory-efficient alternatives of GELU and SiLU activation functions, which use derivative functions of ReLUs in the backward pass while keeping their forward pass unchanged. In addition, we introduce a Memory-Sharing Backpropagation strategy, which enables the activation memory to be shared by two adjacent layers, thereby removing activation memory usage redundancy. Our method neither induces extra computation nor reduces training efficiency. We conduct extensive experiments with pretrained vision and language models, and the results demonstrate that our proposal can reduce up to $\sim$$30\%$ of the peak memory usage. Our code is released at https://github.com/yyyyychen/LowMemoryBP.
format Preprint
id arxiv_https___arxiv_org_abs_2406_16282
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Reducing Fine-Tuning Memory Overhead by Approximate and Memory-Sharing Backpropagation
Yang, Yuchen
Shi, Yingdong
Wang, Cheems
Zhen, Xiantong
Shi, Yuxuan
Xu, Jun
Machine Learning
Artificial Intelligence
Fine-tuning pretrained large models to downstream tasks is an important problem, which however suffers from huge memory overhead due to large-scale parameters. This work strives to reduce memory overhead in fine-tuning from perspectives of activation function and layer normalization. To this end, we propose the Approximate Backpropagation (Approx-BP) theory, which provides the theoretical feasibility of decoupling the forward and backward passes. We apply our Approx-BP theory to backpropagation training and derive memory-efficient alternatives of GELU and SiLU activation functions, which use derivative functions of ReLUs in the backward pass while keeping their forward pass unchanged. In addition, we introduce a Memory-Sharing Backpropagation strategy, which enables the activation memory to be shared by two adjacent layers, thereby removing activation memory usage redundancy. Our method neither induces extra computation nor reduces training efficiency. We conduct extensive experiments with pretrained vision and language models, and the results demonstrate that our proposal can reduce up to $\sim$$30\%$ of the peak memory usage. Our code is released at https://github.com/yyyyychen/LowMemoryBP.
title Reducing Fine-Tuning Memory Overhead by Approximate and Memory-Sharing Backpropagation
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2406.16282