Training an LLM from scratch is a multi-stage process that costs tens of millions of dollars and requires clusters of thousands of GPUs. Most developers never need to do it. But understanding how training works helps you make better decisions about when to fine-tune, which alignment techniques to use, and why models behave the way they do.
The base model is trained on a massive corpus of text (typically 1-15 trillion tokens) to predict the next token in a sequence. This is where the model learns language, facts, reasoning patterns, and world knowledge.
The pre-trained base model is fine-tuned on a curated dataset of instruction-response pairs to teach it to be a helpful assistant. This is where the model learns to follow instructions, format responses, and behave appropriately.
The SFT model is aligned with human preferences to make it helpful, honest, and safe. This is where RLHF or DPO comes in — training the model to produce responses humans rate as better over ones they rate as worse.
Starting from scratch is almost never the right choice. Pre-training requires resources only frontier labs have. Most teams start from an existing pre-trained base model and apply:
from peft import get_peft_model, LoraConfig
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-8B")
config = LoraConfig(r=8, lora_alpha=32, target_modules=["q_proj", "v_proj"])
model = get_peft_model(model, config)
# Now train normally on your dataset
| Goal | Recommended approach |
|---|---|
| Domain knowledge / Q&A | RAG — no training needed |
| Custom output format/style | SFT with LoRA |
| Reduce system prompt size | SFT — bake behavior into weights |
| Safety/alignment adjustments | DPO on preference data |
| New language or domain | Continued pre-training + SFT |
| Frontier capability | Not feasible — use cloud API |
LoRA fine-tuning has become remarkably accessible:
The hidden cost is data preparation — high-quality instruction pairs take significant time to create or curate. Budget 10-50 hours of human effort per 1,000 high-quality examples.
Tokoscope works with any fine-tuned model via OpenAI-compatible endpoints. See whether training actually improved cost-efficiency. Free to start.
Get started free →