Understand language models from first principles.

Learn the Python, mathematics, neural networks, and Transformer ideas behind modern language models through concise lessons, worked examples, exercises, and projects.

Core lessons, exercises, and projects are free. No account required.

How learning works: one idea, five connected views.

We use one small example to show how a concept moves from intuition to definition, hand calculation, exploration, and executable code.

Example concept

How a model chooses its next token

01 Intuition

If a phrase is often followed by the same word, a simple language model can learn that pattern by counting examples. More matching examples make a completion more likely.

02 Define it

A next-word distribution lists the probability of each possible completion. Divide each word's count by the total count so the probabilities add to 100%.

03 Work it out

Suppose ten matching examples end with mat six times, chair three times, and floor once.

total6 + 3 + 1 = 10

mat6 / 10 = 60%

chair3 / 10 = 30%

floor1 / 10 = 10%

04 Explore it

Add or remove examples ending in mat. The other counts stay fixed while the model recalculates all three probabilities.

mat 60%

chair 30%

floor 10%

05 Code it

The same calculation is short enough to inspect. Python loads only when you run it, and executes locally in your browser.

counts = {
    "mat": 6,
    "chair": 3,
    "floor": 1,
}

total = sum(counts.values())

for word, count in counts.items():
    probability = count / total
    print(f"{word:>5}: {probability:.1%}")

Ready to run.

Run the program to compare its output with the hand calculation.

What each Foundation Path subject teaches.

Each subject develops a distinct part of the path from programming and mathematics to modern language models. Frontier topics and AI engineering will extend this foundation later.

View the complete curriculum
  1. 01
    PythonOpen

    Programming and numerical experiments

    A short instruction runs immediately and produces a visible result.

  2. 02

    Vectors, calculus, probability, and optimization

    A function maps inputs to outputs, tracing a visible curve.

  3. 03
    Deep LearningIn review

    Neural networks from forward pass to training

    Layers of connected units transform an input into an output.

  4. 04

    Sequences, prediction, and learned representations

    A token prefix becomes probabilities for what could come next.

  5. 05
    TransformersIn review

    Attention, architecture, training, and inference

    Attention lets each token draw context from other tokens.

  6. 06

    Scaling, adaptation, evaluation, and systems

    A prompt enters a trained model and a response emerges.