Skip to content
AI DemystifiedHow AI actually works
Lesson 05 of 22Foundationsintermediate5 min

How AI is Trained

From random numbers to a useful assistant

Where does knowledge come from?

A language model trained from scratch starts with randomly initialized weights. Pretraining updates them to predict tokens across a large corpus; later stages can teach instruction following, preferences, tool use, or reasoning behavior. This is a pipeline map, not a universal recipe: developers use different data, objectives, and stage order.

Teaching factory

Phases and the chart are a simplified walkthrough. Real pipelines overlap, branch, repeat, and optimize different objectives. Cross-entropy, preference losses, rewards, and task evals do not share one directly comparable scale. Values here are staged visual markers, not a run log or evidence that each phase improved the same metric.

Weights are not a fact table

Pretraining encodes statistical structure in parameters. Models can generalize from it, but cannot reliably retrieve every learned claim like a database row.

Post-training steers behavior

SFT and preference methods can improve instruction following and shape refusals, tone, and tool behavior; the exact recipe differs by system.

Objectives are proxies

Lower next-token or preference loss is not proof of truth, safety, or task success. Each deployment still needs representative evaluations.

Phase 1 / 7

Collect Training Data

Training corpora can combine web text, books, papers, code, licensed collections, and purpose-built examples. Teams filter and deduplicate data, but quality, representation, consent, privacy, and licensing remain substantive design choices—not cleanup details.

Raw text arrives on the loading dock. No learning yet.

Illustrative stage signal
1.00

Start marker for the teaching sequence.

Advance phases to draw the illustrative stage sequence.

Not one continuous loss curve: each stage may optimize a different objective.

Do not compare unlike objectives

Pretraining cross-entropy, an SFT loss, a preference objective, a reinforcement learning reward, and a task-success eval answer different questions. A lower number in one stage does not prove that it contributed more than another stage. Compare checkpoints on held-out capabilities, safety, and product tasks instead.

Key Insight

Model weights encode statistical structure, not reliably queryable database rows. Pretraining, instruction tuning, preference optimization, and reasoning-focused training each target different behavior—and none replaces representative evaluation. Next: meaning as geometry in embedding space.

Check your understanding

1/5

What objective is commonly used to pretrain a causal language model?

Sources, scope & review statusVerified Jul 29, 2026

Claims this lesson makes

  • Stable conceptModern assistants commonly combine large-scale pretraining with one or more post-training stages.

    Scope: The exact recipe, datasets, and optimization stages differ by model developer.

  • Stable conceptSupervised instruction tuning, RLHF, AI-feedback methods, and direct preference optimization are distinct post-training approaches rather than interchangeable names for one objective.
  • Stable conceptReasoning-focused training and extra inference-time computation are separate levers: training can incentivize reasoning behavior, while serving can allocate more computation to a particular answer.

    Scope: The staged chart does not compare real loss values across objectives; its values are an illustrative progress signal only.

Next content review: 2027-07-29. Source links establish the lesson's claims; interactive numbers remain labeled simulations unless explicitly identified as measured data.