LLM Training Pipeline

Pretraining → fine-tuning → RLHF → production deployment

Custom CSS — phase cards + step badges · /visualcave LLM training pipeline, rich CSS, phase badges
Input Data
Raw Training Corpus
web crawl · books · code · scientific papers · articles
Trillions of tokens scraped from the internet and licensed sources. No labels — raw text only. Quality filtering and deduplication applied before training.
01
Phase 1 — Pretraining
Unsupervised Next-Token Prediction
self-supervised · cross-entropy loss · transformer decoder
Model predicts the next token given all previous tokens. No human labels. Runs on thousands of GPUs for weeks to months. Learns language, facts, and reasoning patterns from raw text alone.
output → Foundation Model (knows language, not helpful yet)
02
Phase 2 — Supervised Fine-Tuning
Instruction Tuning (SFT)
SFT · (instruction, ideal response) pairs · human annotators
Small, high-quality dataset of instruction–response pairs written or curated by humans. Teaches the model to follow directions, respond helpfully, and adopt the desired tone. Far fewer compute hours than pretraining.
output → Instruction Model (follows directions, basic alignment)
03
Phase 3 — RLHF
Reinforcement Learning from Human Feedback
reward model · PPO · preference ranking · constitutional AI
Humans rank pairs of model outputs by quality. A reward model learns those preferences. The LLM is then fine-tuned via RL to maximise reward — producing responses humans prefer over raw SFT output.
output → Production LLM (ChatGPT, Claude, Gemini, Llama)
Deployment
Production API + Safety Guardrails
inference serving · rate limits · system prompts · monitoring
Model served via API with system prompts, content filters, and usage policies. Continuous red-teaming and RLHF updates applied post-launch.