Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 02 · AI · From a model to an app · about 17 min to read

Play it as a journeyTutor comes with a plan

The Maths Floor, Part 2: Probability, Softmax and Temperature

Inference
Inference · Open board

The Inference board of the How LLMs Work track. Its first section, sampling, says “divide the logits by T before softmax”. This lesson is the arithmetic under that one line.

Before you start. Vectors, Dot Products and Matrix Multiply showed that a layer is a row of dot products, so the model’s last layer hands back one plain number, a score, for every word it could say next. From Transformer to LLM is where that last layer comes from: a machine trained to fill in the next blank, one word at a time. Inference (sampling, context, KV cache, hallucination) is where this lesson is used: the model draws its next word at random, with a dial on how random. Here you learn what the draw and the dial actually compute. Adding, dividing, and one button on a calculator.

Lesson 11 of 83 in AI

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1989: a speech recogniser whose scores did not add up
  • Probability: shares of one raffle drum
  • Why exp: the one exchange rate that never goes negative
  • Temperature: dividing every score before the exchange
  • What the dial does to the model’s next word
  • How far can the dial go?
  • The board’s line, in drum words
  • Why only the gaps between scores matter
  • All of it in code

Terms it explains: inference, How LLMs Work, probability, sampling, exponential, Softmax, temperature, greedy, logits, Argmax, context window, grounding, hallucination, KV cache, prefill vs decode, stateless, the KV cache grows with context, throughput, top-k / top-p (nucleus), TTFT.

Lab

One GPU, one chat, cores 99% idle. How many more chats fit before anything gets slower?

Drag Chats sharing one read of the weights to the right and watch operations per byte rise until The wall stops it.

Open The batch size dial

The model has read 'The weather today is'. How often does it say something other than sunny?

Drag How hard the drum is shaken from T = 0.1 to 5 and watch Outside the top word climb.

Open The temperature dial

Review AI