MegaTrain: Full Precision Training of 100B+ Parameter LLMs on a Single GPU
TL;DR Highlight
Streaming parameters from CPU memory let a single H200 train models up to 120B.
Who Should Read
ML infra or backend developers who hit OOM errors whenever they fine-tune or train large models with limited VRAM
Core Mechanics
- Parameters live in CPU memory, not on the GPU
- MegaTrain stores parameters and optimizer states in host (CPU) memory.
- The GPU is treated as a transient compute engine.
- Layers are streamed in and out
- For each layer, parameters stream into the GPU and gradients stream out.
- The goal is to minimize persistent state on the device.
- Double buffering hides the CPU-GPU bottleneck
- Parameter prefetching, computation, and gradient offloading overlap across multiple CUDA streams.
- This keeps the GPU computing continuously.
- Stateless templates replace autograd graphs
- Persistent autograd graphs (records for backprop) are replaced by stateless layer templates.
- Weights are bound dynamically as they stream in, removing graph metadata.
- Up to 120B on one H200
- The setup is a single H200 GPU with 1.5TB of host memory.
- Throughput on 14B models is 1.84x DeepSpeed ZeRO-3 with CPU offloading.
- Long context also works
- A 7B model can be trained with 512k token context on a single GH200.
Community Reactions
- Hobbyist with a 3080 10GB is excited
- One commenter says they hit OOM beyond 40-50M params on an RTX 3080 with 10GB VRAM.
- They have much more CPU RAM and expect this to raise the model size they can train.
- Not new and low practical value, says one
- A commenter who says they built something similar notes the paper's 341 tok/s for 14B on a 3090 is still slow.
- They report about 1k tok/s on a single 4090 with their own method.
- More tricks exist, per commenters
- One suggests modifying the optimizer to accumulate gradients directly into its states, avoiding gradient offloading.
- They say Muon needs half of Adam's VRAM and a 4-bit quantized Muon worked fairly well.
- Not exactly a slim setup
- Some point out an H200 with 1.5TB host memory is hardly a modest single GPU.
- Another opinion is that it's too slow for pretraining and likely only useful for small fine-tuning jobs.
- Similar to existing tools
- Commenters say it looks like PyTorch FSDP or Microsoft DeepSpeed.
- One asks how it would work on unified memory like Apple's M series.
How to Apply
- Check the memory bottleneck in your training setup
- Write down the GPU VRAM and server CPU RAM for a job that hits OOM today.
- If CPU RAM is far larger, consider whether offloading is a candidate.
- Measure a ZeRO-3 offloading baseline
- Run the same model with DeepSpeed ZeRO-3 CPU offloading and record tok/s.
- This gives you a number from your own environment to compare with the paper's 1.84x claim at 14B.
- Limit single-GPU training to small fine-tuning
- Plan single-GPU training for small fine-tuning jobs rather than pretraining because of its speed.
- Estimate runtime first from your token count and measured throughput.
Try It
# Paste into Claude or ChatGPT (simplified version of the paper's idea: check offloading fit for your setup instead of actual training)
I want to train an LLM on a single GPU. Based on the environment below, assess whether CPU-memory offloading (keeping parameters and optimizer states in host memory and streaming them layer by layer to the GPU) is suitable.
- GPU model/VRAM: {{GPU}}
- CPU RAM: {{RAM}}
- Model size to train: {{parameter count}}
- Goal: {{fine-tuning or pretraining}}
- Training tokens: {{token count}}
Summarize in a table:
1. Approximate memory needed for parameters, gradients, and optimizer states, with the calculation
2. Memory comparison for keeping them on GPU vs CPU
3. Likelihood of a CPU-GPU transfer bottleneck and alternatives (DeepSpeed ZeRO-3 offloading, FSDP, etc.)
State any assumptions explicitly.Terminology
Related Papers
Quadrillion-parameter transformers and how to train them
On fixed data, much bigger models with scaled weight decay and ensembling keep loss falling as compute grows.
Astra can read and write weights to improve Qwen
An LLM edited Qwen3.5-0.8B's weights directly, lifting MATH-500 from 7.9% to 48.1%.
Show HN: Qwen3-4B with the AI writing tics trained out
Distilling Qwen3-4B with LoRA cut its AI-writing slop score from 121 to 12.5 per 1000 words
Dust: Pretraining Transformers Without Backpropagation
Adding per-token noise to activations lets transformers pretrain without backpropagation, rivaling backprop.
Show HN: TurboGPT: train 22KiB transformer in 13s
A CUDA C++ project trains a tiny byte-level GPT in under a minute.
I had Gemini train its own replacement for $9
Fine-tuning GLiNER on $9 of Gemini labels reached 0.83 F1 locally.
Learning to solve hard problems in RL for LLMs by never giving up
Cutting compute on easy problems and retrying hard ones in RL raised accuracy on the hardest problems
Training a 3.8B LLM to 0.384 CORE for $998
A 3.8B LLM trained on 8 B200s in 43 hours for $998 scored 0.384 on CORE.