Zeroth-Order Fine-Tuning of LLMs in Random Subspaces

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Yu, Ziming, Zhou, Pan, Wang, Sike, Li, Jia, Tian, Mi, Huang, Hua
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866911073352810496
author Yu, Ziming
Zhou, Pan
Wang, Sike
Li, Jia
Tian, Mi
Huang, Hua
author_facet Yu, Ziming
Zhou, Pan
Wang, Sike
Li, Jia
Tian, Mi
Huang, Hua
contents Fine-tuning Large Language Models (LLMs) has proven effective for a variety of downstream tasks. However, as LLMs grow in size, the memory demands for backpropagation become increasingly prohibitive. Zeroth-order (ZO) optimization methods offer a memory-efficient alternative by using forward passes to estimate gradients, but the variance of gradient estimates typically scales linearly with the model's parameter dimension$\unicode{x2013}$a significant issue for LLMs. In this paper, we propose the random Subspace Zeroth-order (SubZero) optimization to address the challenges posed by LLMs' high dimensionality. We introduce a low-rank perturbation tailored for LLMs that significantly reduces memory consumption while improving training performance. Additionally, we prove that our gradient estimation closely approximates the backpropagation gradient, exhibits lower variance than traditional ZO methods, and ensures convergence when combined with SGD. Experimental results show that SubZero enhances fine-tuning performance and achieves faster convergence compared to standard ZO approaches like MeZO across various language modeling tasks. Code is available at https://github.com/zimingyy/SubZero.
format Preprint
id arxiv_https___arxiv_org_abs_2410_08989
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Zeroth-Order Fine-Tuning of LLMs in Random Subspaces
Yu, Ziming
Zhou, Pan
Wang, Sike
Li, Jia
Tian, Mi
Huang, Hua
Machine Learning
Artificial Intelligence
Fine-tuning Large Language Models (LLMs) has proven effective for a variety of downstream tasks. However, as LLMs grow in size, the memory demands for backpropagation become increasingly prohibitive. Zeroth-order (ZO) optimization methods offer a memory-efficient alternative by using forward passes to estimate gradients, but the variance of gradient estimates typically scales linearly with the model's parameter dimension$\unicode{x2013}$a significant issue for LLMs. In this paper, we propose the random Subspace Zeroth-order (SubZero) optimization to address the challenges posed by LLMs' high dimensionality. We introduce a low-rank perturbation tailored for LLMs that significantly reduces memory consumption while improving training performance. Additionally, we prove that our gradient estimation closely approximates the backpropagation gradient, exhibits lower variance than traditional ZO methods, and ensures convergence when combined with SGD. Experimental results show that SubZero enhances fine-tuning performance and achieves faster convergence compared to standard ZO approaches like MeZO across various language modeling tasks. Code is available at https://github.com/zimingyy/SubZero.
title Zeroth-Order Fine-Tuning of LLMs in Random Subspaces
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2410.08989