coding by Ryan Caldwell

Fine-Tuning a 20B gpt-oss Model on a 24GB GPU

How Unsloth fits gpt-oss-20b QLoRA fine-tuning into 14GB of VRAM, well within consumer 24GB cards, and the MXFP4 hurdles it had to solve.

Fine-Tuning a 20B gpt-oss Model on a 24GB GPU

Fine-tuning large language models has long been associated with data-center hardware, but the gpt-oss models can now be trained on more modest setups. According to the fine-tuning library Unsloth, LoRA training for the 20-billion-parameter gpt-oss-20b model fits in 14GB of VRAM (https://unsloth.ai/blog/gpt-oss). That figure sits comfortably inside the 24GB found on many consumer cards, leaving headroom for longer sequences and larger batches.

Memory Footprint

Unsloth reports that gpt-oss-20b LoRA training fits on 14GB of VRAM, while the much larger gpt-oss-120b model works on 65GB. The company contrasts this with other approaches, stating that competing training methods require a minimum of 65GB of VRAM just to train the 20b model, which it frames as an 80 percent reduction for the smaller model.

Alongside the lower memory use, Unsloth claims roughly 1.5x faster fine-tuning and support for longer context lengths than other implementations. The blog post is internally inconsistent on the exact context multiplier, quoting both “10x longer” in the introduction and “5x longer” in its benchmark table, so the precise figure is best treated as “substantially longer” rather than a single hard number.

The MXFP4 Problem

A large part of the engineering work centered on gpt-oss’s native MXFP4 weight format. Unsloth describes MXFP4 as efficient but notes that it “doesn’t support training” directly. Without special handling, the weights have to be upcast to bf16, which the post says increases memory usage by 300 percent.

To avoid that penalty, Unsloth wrote custom training functions for the MXFP4 layers. For inference it relied on OpenAI’s Triton kernels, but it notes that the backward pass for those kernels was not yet implemented at the time of writing. To make quantization work with the bitsandbytes library, the team also converted the model’s weights from a parameter format to a linear-layer format. The post does not specify an NF4 quantization scheme in the excerpt available.

Reference Training Setup

For its benchmarks, Unsloth used the Alpaca dataset with a batch size of 2 and gradient accumulation steps of 4. It applied QLoRA across all linear layers, listed as the query, key, value, and output projections along with the gate, up, and down projections, using a rank of 32.

The library also publishes a free Colab notebook for fine-tuning gpt-oss-20b, and the post states that the workflow is possible on free Colab hardware. It does not name a specific GPU model for that free tier in the available text.

Takeaway

The headline result is narrower than “train any 20B model anywhere,” but it is concrete: a specific 20-billion-parameter open model, gpt-oss-20b, can be QLoRA fine-tuned within 14GB of VRAM using Unsloth’s tooling. For anyone with a 24GB consumer GPU, that brings fine-tuning of a model this size into reach without renting cloud accelerators. The full methodology, including the MXFP4 workarounds and benchmark caveats, is documented in Unsloth’s write-up at https://unsloth.ai/blog/gpt-oss.

Source: unsloth.ai