AI Model Training 2026: From Pretraining to Fine-Tuning, the Complete Workflow
Pretraining, fine-tuning, RLHF - the terms blur together. Here is the full training stack in one guide, with real tools and costs.
💡 What You Will Learn
Pretraining, fine-tuning, RLHF - the terms blur together. Here is the full training stack in one guide, with real tools and costs.
📜 Table of Contents
The Three-Stage Pipeline
Modern LLM training is a pipeline, and most people only need the last stage. Knowing where you sit in the pipeline saves you from renting a data center.
Stage 1: Pretraining
Training a model from scratch on trillions of tokens. This is the expensive part: frontier models cost tens of millions of dollars in GPU time. You will almost never do this. You will consume its output: download a pretrained model from Hugging Face (the Transformers library, 163,500 stars, is the standard interface).
Stage 2: Fine-Tuning (Where 99% of People Work)
Taking a pretrained model and training it further on your data. Two dominant approaches:
- Full fine-tuning - updates all parameters. Powerful, but a 7B model needs ~28GB+ VRAM for full training, and it is easy to overfit on small datasets.
- LoRA / QLoRA - trains small adapter matrices instead. QLoRA quantizes the base model to 4-bit, letting you fine-tune a 7B model on a single 16GB consumer GPU. The tools: LLaMA-Factory (73,939 stars) is the most complete fine-tuning toolkit; Unsloth (69,757 stars) is the speed champion, roughly 2x faster with lower VRAM.
Stage 3: Alignment (RLHF / DPO)
After fine-tuning, models get an alignment pass so they follow instructions and refuse harmful requests. Most open source pipelines now use DPO (direct preference optimization) - simpler and cheaper than RLHF. This stage is usually handled by the model provider, not you.
The Real Cost Picture
- Fine-tuning a 7B model with QLoRA: hours on one consumer GPU (a 16GB card) - electricity, not cloud bills.
- Fine-tuning the same model fully: 4-8x the VRAM and time.
- Pretraining: out of scope unless you are a lab with a GPU cluster.
- Cloud inference servers (vLLM, 88,595 stars) are the deployment layer - fine-tuned weights run there for production.
The Workflow That Works
- Start with a strong base (pick the best open model in your language/domain).
- Collect 1,000-10,000 high-quality examples - quality beats quantity every time.
- QLoRA fine-tune, evaluate on a held-out set, iterate.
- Merge the adapters into the base weights, quantize to GGUF, deploy with Ollama (178,131 stars) or vLLM.
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only โ no paid placements.
