How a chatbot is made: from pre-training to alignment

A chatbot like ChatGPT or Claude is built in stages. Pre-training on huge amounts of text creates a base model that can continue text but doesn't follow instructions well. Instruction tuning teaches it to answer questions helpfully (an instruct model). RLHF (reinforcement learning from human feedback) and other alignment methods make it more helpful, honest and harmless. Once trained, every time you use it is called inference.

Everyday analogy

Training a new doctor: years of reading textbooks (pre-training), then supervised practice on real patients (instruction tuning), then feedback from senior doctors on bedside manner and judgement (RLHF). Seeing patients afterwards is inference.

Example

Ask a base model "What is the capital of France?" and it might continue with more quiz questions. An instruct model simply answers "Paris".

📚Pre-trainingread huge amounts oftext📝Instruction tuninglearn to followrequests👍Alignment (RLHF)learn what peopleprefer💬Inferencechat with you
Three training stages turn a text predictor into a helpful assistant.
1. Pre-trainingRead trillions of words; learn to predict the next token
→
2. Base modelKnows a lot, but just continues text
→
3. Instruction tuningLearns from example questions and good answers
→
4. RLHF & alignmentHuman ratings reward helpful, honest, safe answers
→
5. InferenceYou chat with it; it uses what it learned

Distillation: a large "teacher" model trains a smaller "student" model to imitate it. The student is faster and cheaper, and nearly as good. Many small, fast models are made this way.

Try it yourself

About 10 min

Spot pre-training vs alignment

  1. Ask an AI chatbot a harmful question, e.g. how to pick a lock to break in. Notice it refuses or redirects.
  2. Ask it to explain how it was trained to behave that way.
  3. Write which part came from pre-training (knowledge) and which from alignment (behaviour).

What you should see: The knowledge comes from pre-training; the helpful, careful manners come from later training.

Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.

Build it for real · guided projectLook inside a chatbot: tokens, temperature and hallucinationsAbout 45 min · No coding needed · step by step
Test what you learned

Take a quick quiz, or look up any word in the glossary.