- Loading the entire model at the highest precision possible
- Implementing gradient checkpointing
- Using model parallelism or offloading techniques
- Running exclusively on the CPU

- Model parallelism and offloading are the most effective techniques to enable deployment of LLMs that exceed a single GPU’s memory capacity.
- Combine sharding/offload with lower precision (FP16/BF16 or quantization) for best results.
- Use gradient checkpointing primarily for training to reduce activation memory at the cost of extra computation.
- CPU-only execution should be a last resort due to large latency and throughput penalties.
Recommended workflow (practical, ordered steps)
- Try a reduced-precision format first (FP16 / BF16) for inference. This often halves memory usage with minimal accuracy impact on supported hardware.
- Add model sharding or pipeline/tensor parallelism to split parameters across GPUs.
- Use offloading to CPU or NVMe for optimizer/state or rarely-used layers when GPU memory is still insufficient.
- For training, consider gradient checkpointing to reduce activation memory and combine with ZeRO or FSDP to shard optimizer and parameter states.
- If memory still blocks deployment and performance is non-critical, fall back to CPU-only execution.
- DeepSpeed ZeRO Offload: https://www.deepspeed.ai/
- Hugging Face Accelerate: https://huggingface.co/docs/accelerate
- PyTorch FSDP: https://pytorch.org/docs/stable/fsdp.html
- Megatron-LM: https://github.com/NVIDIA/Megatron-LM
- Quantization & bitsandbytes: https://github.com/TimDettmers/bitsandbytes
- Inference of very large models: prioritize sharding/offload + mixed precision / quantization.
- Training very large models: use ZeRO/FSDP + gradient checkpointing (if activation memory is the bottleneck).
- Prototyping or constrained environments: try quantized weights (8-bit/4-bit) to run on smaller GPUs.
- No GPUs available: CPU-only execution as a fallback (expect significantly slower performance).
For inference of very large models, combine sharding/offload with reduced precision (FP16/BF16 or quantization). For training, add gradient checkpointing if you need further memory savings at the cost of extra computation.