Papers › Fine-tuning Quantized Neural Networks with Zeroth-order Optimization

Fine-tuning Quantized Neural Networks with Zeroth-order Optimization

19 May 2025arXiv:2505.13430archive 2025-07-28

Sifeng Shang, Jiayi Zhou, Chenyu Lin, Minxian Li, Kaiyang Zhou

As the size of large language models grows exponentially, GPU memory has become a bottleneck for adapting these models to downstream tasks. In this paper, we aim to push the limits of memory-efficient training by minimizing memory usage on model weights, gradients, and optimizer states, within a unified framework. Our idea is to eliminate both gradients and optimizer states using zeroth-order optimization, which approximates gradients by perturbing weights during forward passes to identify gradient directions. To minimize memory usage on weights, we employ model quantization, e.g., converting from bfloat16 to int4. However, directly applying zeroth-order optimization to quantized weights is infeasible due to the precision gap between discrete weights and continuous gradients, which would otherwise require de-quantization and re-quantization. To overcome this challenge, we propose Quantized Zeroth-order Optimization (QZO), a novel approach that perturbs the continuous quantization scale for gradient estimation and uses a directional derivative clipping method to stabilize training. QZO is orthogonal to both scalar-based and codebook-based post-training quantization methods. Compared to full-parameter fine-tuning in bfloat16, QZO can reduce the total memory cost by more than 18× for 4-bit LLMs, and enables fine-tuning Llama-2-13B and Stable Diffusion 3.5 Large within a single 24GB GPU.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2505.13430")

Code

Syntology Ran 3 of 15 code samples harvested from 1 repository linked to this paper; 12 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 2 ran with no contract checked.

By repository: official repository: 15 samples from 1 repository, 3 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

maifoundations/qzo officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 3 ran; 0 honoured the contract we drafted; 12 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
2ran
12unverified

Licence: 0 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from maifoundations/qzo. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

forward_wrap_with_option_len maifoundations/qzo/large_language_models/utils.py official repository ran MIT (permissive) · 54a6124d697bc2c2 · report
next_power_of_2 maifoundations/qzo/large_language_models/aqlm_inference_kernel/triton_kernel_dequant.py official repository ran fingerprinted MIT (permissive) · 9782bd07382e951c · report
normalize_answer maifoundations/qzo/large_language_models/metrics.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · e7e75981cb464788 · report
calculate_metric maifoundations/qzo/large_language_models/metrics.py official repository unverified MIT (permissive) · 84c658f2c9252878 · report
encode_prompt maifoundations/qzo/large_language_models/utils.py official repository unverified MIT (permissive) · e82be1ebda714ec3 · report
encode_sd3_prompt_with_clip maifoundations/qzo/stable_diffusion/text_to_image/train_utils.py official repository unverified MIT (permissive) · 93a86bf0447b5071 · report
encode_sd3_prompt_with_t5 maifoundations/qzo/stable_diffusion/text_to_image/train_utils.py official repository unverified MIT (permissive) · 2b6f26327780ae00 · report
f1 maifoundations/qzo/large_language_models/metrics.py official repository unverified MIT (permissive) · b989d4bce26f77ce · report
get_backward_pass_kernel maifoundations/qzo/large_language_models/aqlm_inference_kernel/kernel_selector.py official repository unverified MIT (permissive) · e5420b8f9ec6a920 · report
get_calib_dataset maifoundations/qzo/large_language_models/quantization.py official repository unverified MIT (permissive) · 0e575c7c824b1546 · report
get_forward_pass_kernel maifoundations/qzo/large_language_models/aqlm_inference_kernel/kernel_selector.py official repository unverified MIT (permissive) · 72f47794c604a79d · report
get_task maifoundations/qzo/large_language_models/tasks.py official repository unverified MIT (permissive) · f7c384f1e681ea7a · report
load_tes maifoundations/qzo/stable_diffusion/text_to_image/train_utils.py official repository unverified MIT (permissive) · d7899d043687bf12 · report
zo_forward maifoundations/qzo/stable_diffusion/text_to_image/MeZO_utils.py official repository unverified MIT (permissive) · 4347ff075572d341 · report
zo_step maifoundations/qzo/stable_diffusion/text_to_image/MeZO_utils.py official repository unverified MIT (permissive) · c66c0606fd369119 · report

Tasks

Quantization

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Diffusion

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections