Pre-training, Fine-tuning, LoRA, and RAG: Concepts and Differences

Separate missing-knowledge problems from output-behavior problems, and learn which customization layer makes sense for individual builders.

Source reliability tiers: [Verified] = backed by official documentation or trusted primary sources; [Community Consensus] = widely observed by community users but not officially confirmed; [Unverified / Speculative] = inferred or not yet independently verified — treat with caution.

When people say "I trained an AI model," they might mean four completely different things: pre-training from scratch, continued pre-training, fine-tuning/LoRA, or simply writing a system prompt with attached documents. This guide untangles those terms and explains which layer individual users should actually focus on.

Map of Training Stages

1. Terminology Reference Table

Everyday Phrase Standard Technical Term Modifies Model Weights? Typical Cost Reliability Tier
Training a foundation/base model Pre-training (from scratch) Yes, initialized from random weights Extremely high (frontier lab scale) Verified (concept); exact costs vary
Training on top of a base model Continued Pre-training or Fine-tuning Yes Medium to high Verified (concept)
Post-training / adapting a model Supervised Fine-Tuning (SFT) / Preference Alignment (RLHF, DPO) / RL Yes Low to medium Verified
LoRA / QLoRA Parameter-Efficient Fine-Tuning (PEFT) Trains only a small set of adapter weights Low (feasible on a single consumer GPU) Verified
Distillation Knowledge Distillation Trains a smaller student model Medium Verified
"I trained a custom GPT / Agent" Prompt engineering + RAG knowledge base + tools No Very low Community Consensus

2. Breaking Down Each Stage

2.1 Pre-training (Building the Base Model)

  • What it does: Trains a model on massive unlabelled text corpora to repeatedly predict the next token.
  • Output: A Base Model — rich in world knowledge and language patterns, but not yet trained to follow conversational instructions. If you ask it a question, it may respond by generating five more questions. [Community Consensus]
  • Who does it: Major AI labs and well-funded research organizations. Pre-training a competitive large model from scratch as an individual is not practical. [Community Consensus]

2.2 Continued Pre-training (Domain Corpus Adaptation)

  • What it does: Takes an existing base model and continues pre-training on a large volume of domain-specific text (such as legal codes, medical literature, or a niche programming language).
  • When it fits: When core domain vocabulary and foundational concepts are largely absent from the base model.
  • Risk: Can trigger "catastrophic forgetting" of general capabilities if not carefully balanced. [Community Consensus]

2.3 Supervised Fine-Tuning (SFT)

  • What it does: Trains on curated "prompt → ideal response" pairs to teach the model how to follow instructions, adopt a specific tone, or format outputs reliably.
  • Example: Training a model to consistently reply in your company's support voice or emit a strict domain schema.

2.4 Preference Alignment and Reinforcement Learning

Method One-Line Summary Reference
RLHF Humans rank candidate outputs → train a reward model → optimize the LLM via reinforcement learning [Verified] InstructGPT, arXiv:2203.02155
DPO Optimizes directly on "chosen vs. rejected" response pairs without training a separate reward model [Verified] arXiv:2305.18290
RL with Verifiable Rewards Uses deterministic checks (e.g., exact math answer or passing unit tests) as the reward signal to strengthen reasoning [Community Consensus]

2.5 LoRA: Attaching Lightweight Adapters to a Frozen Model

[Verified] LoRA (Low-Rank Adaptation, Hu et al., 2021, arXiv:2106.09685) freezes the original pretrained weights and trains only small low-rank matrices injected into specific layers. QLoRA (arXiv:2305.14314) goes a step further by backpropagating through a quantized 4-bit base model into LoRA adapters, drastically cutting VRAM requirements.

Diagram 1

2.6 Distillation: Teacher Training a Student

[Verified] Knowledge distillation (Hinton et al., 2015, arXiv:1503.02531) uses outputs or logits from a large "teacher" model to train a smaller "student" model so the student approximates the teacher's capability at a fraction of the inference cost.

⚠️ Terms-of-service note [Community Consensus / Unverified]: Most commercial model providers explicitly prohibit using their API outputs to train competing models. Always read the provider's terms of use before running distillation pipelines on commercial API responses.


3. Which Layer Should Individual Builders Focus On?

Diagram 2

Editorial recommendations:

  • Start with approaches that do not modify weights (clear prompts, few-shot examples, and RAG). The biggest bottleneck in fine-tuning is rarely GPU rent — it is curating and cleaning high-quality training data.
  • Before fine-tuning an open-weight model, check its license terms (commercial use permissions, attribution rules, or active-user caps).
  • When fine-tuning is genuinely necessary, managed fine-tuning APIs from major providers are often simpler to maintain than self-hosted training rigs, provided your data governance allows uploading the training set.

4. Common Misconceptions

Misconception Reality
"Fine-tuning is the best way to teach a model new facts" Fine-tuning is best at shaping behavior, tone, and output format; injecting changeable facts via fine-tuning is brittle, whereas RAG is far more reliable [Community Consensus]
"A 100-row LoRA dataset will turn a base model into a domain expert" Very small datasets mostly teach surface formatting rather than deep domain reasoning [Community Consensus]
"Open weights = unrestricted commercial use" Always inspect the license; some open-weight licenses restrict commercial hosting or set revenue/user thresholds
"Distillation is inherently plagiarism" Distillation is a standard machine-learning technique, though distilling from a proprietary API without permission may breach that vendor's terms of service

5. Unverified Items and Practical Caveats

  • True end-to-end pre-training budgets: vendors rarely disclose full compute and data costs.
  • Exact policy wording on training/distillation across commercial APIs: check each provider's current terms directly.
  • Dataset size thresholds for effective LoRA adaptation vary widely by task complexity.

Hands-On Practice: Step-by-Step Verification

Goal: Diagnose whether a failure comes from missing reference data or from output formatting/behavior.

Before reaching for LoRA or fine-tuning, work through the diagnostic steps below on a real task of your own.

  1. Write down the exact failure mode: does the model lack access to the required facts, or does it have the facts in context but fail to follow your required format or style?

  2. If facts are missing, paste a short, authoritative reference snippet directly into the prompt and ask the model to cite its source lines. Only after confirming that grounded context fixes the answer should you design a RAG retrieval pipeline.

  3. If the format or tone is wrong, add two concrete input-output examples (few-shot prompting) and test on a fresh query.

  4. Log the specific failure cases that still persist after steps 2 and 3 before deciding whether fine-tuning is justified; collecting examples is not the same thing as having trained a model.

  5. If you proceed with weight modification, verify the base model license, data rights, compute budget, and held-out validation set first — and evaluate both target task gains and potential regression on general tasks.

Back to Tutorials Back to Learn →Back to top ↑
On this page
Tutorial diagram100%
Tutorial diagram