Scores Into Chances

How do a model's three scores become three chances, and why does the program subtract the biggest score first? A TL;DR film from chapter one of INFO 7375, Prompt Engineering for Generative AI (Nik Bear Brown, Northeastern University). Liam, in for Bear.

5:15 video8 min readWatch on YouTube

Scores Into Chances

How do a model's three scores become three chances, and why does the program subtract the biggest score first? A TL;DR film from chapter one of INFO 7375, Prompt Engineering for Generative AI (Nik Bear Brown, Northeastern University). Liam, in for Bear.

The point first: push every score up an exponential ramp, then divide by the total. That makes every chance positive and keeps the order, from any finite score. Subtract the biggest score first and every weight shrinks by the same factor, so the shares do not move. The trap is dividing by the sum: it works on 1, 2, 3 and dies the moment a score goes negative.

Then the lesson, 3Blue1Brown-style: three scores on a line, the naive divide-by-total breaking on a negative score, the exponential ramp as the representation, a moment to commit before the reveal, the three dots sliding down the ramp together while the strip of shares does not move, and only then the name: softmax.

Series: Claude & Agentic AI Course: INFO 7375 · Prompt Engineering for Generative AI · Chapter 1


Chapters

0:00 What this film is about 0:21 Why you should care 0:39 The question 0:55 Terms in this film 1:10 Three scores, three chances? 1:28 Divide by the total 1:39 Where dividing breaks 1:57 The exponential ramp 2:21 Heights into shares 2:39 Commit 2:52 Slide together 3:11 The recipe has a name: softmax 3:31 Read the line 3:52 Why shift at all 4:13 Verdict 4:34 Your turn


YOUR TURN

Paste this into Claude:

Take the scores [4, -3, 0.5]. Before computing anything, predict the order of the three chances and roughly what share the leader gets. Then compute the weights by hand with e^x, divide by the total, and write the three shares. Now subtract the biggest score from all three and do it again. Show me, in one line of algebra, why the two answers must be identical. Finally: for scores [900, 900, 899], explain which of the two routes a computer can actually run, and why.

Two things to look for: did it make the prediction before the arithmetic, and does the algebra name the factor that cancels, not just say "they're the same"?


@NikBearBrown

Part of the Claude & Agentic AI series. Every number in this film was recomputed from the course's own reference implementation; see the reel's FACTCHECK.md in the open course repository.

▶ The full series playlist — Brutalist https://www.youtube.com/playlist?list=PLG9H-C6rp5RU

What this video covers

  • 0:00 — What this film is about
  • 0:21 — Why you should care
  • 0:39 — The question
  • 0:55 — Terms in this film
  • 1:10 — Three scores, three chances?
  • 1:28 — Divide by the total
  • 1:39 — Where dividing breaks
  • 1:57 — The exponential ramp
  • 2:21 — Heights into shares
  • 2:39 — Commit
  • 2:52 — Slide together
  • 3:11 — The recipe has a name: softmax
  • 3:31 — Read the line
  • 3:52 — Why shift at all
  • 4:13 — Verdict
  • 4:34 — Your turn

Transcript

A lightly formatted transcript of the video, with timestamps so you can jump to any section on YouTube.

What this film is about

[0:00] Ciao, this is Liam in for Bear with chapter one of INFO 7375 prompt engineering at Northeastern. This film is about one step, how models three scores become three chances. Push every score up an exponential ramp, then divide by the total. And why the program subtracts the biggest score first. Every weight shrinks by the same factor, so the shares don't move. The trap is dividing by the sum. Why should you

Why you should care

[0:22] Care? Every chatbot answer you have ever read came out of this exact step. A list of scores turned into a list of chances. If you think you can just divide, you will misread every negative score. If you think the subtraction changes the answer, you will misread the code you are about to write. Get the ramp and the shift, and softmax stops being a word you memorize. The question this film is

The question

[0:41] Really asking, three scores into three chances, why can't we just divide by the total? And why subtract the biggest score first? Why not sounds like a shortcut nobody took. Why can't we is the real question, and the answer is one negative number. Three words you'll hear, a score the

Terms in this film

[0:56] Chapter also says logit, is the number a model attaches to one option. Can be negative. An index is which option we mean, zero, one, or two. Outcome two has score three, do not mix those up. And to normalize is to scale a list so it sums to one.

Three scores, three chances?

[1:10] Three scores, one, two, three, sitting on a number line. Outcome zero has score one, outcome two has score three. Somewhere a program turns these three numbers into three chances, numbers that are all positive and add up to one. These add up to six, so what is the rule? And why does the real program change the scores before it applies it? The obvious rule, divide each score by

Divide by the total

[1:29] The total. 1/6, 1/3, 1/2. The strip fills exactly. Order kept, everything positive, sums to one. On these three numbers, it works perfectly.

Where dividing breaks

[1:39] Now let one score be negative, and model scores are negative all the time. 2 - 1 1, the total is 2. The middle outcome gets -1/2, a chance below zero. Try 1 - 1 0, the total is zero. You are dividing by nothing. The naive rule needs every score positive, and nobody promised that. Here's the refrain, draw the

The exponential ramp

[1:57] Exponential ramp e to the x. Drop each score onto it and read off the height. Score one about 2.7. Score two 7.4. Score three 20.1. Three things just happened. Every height is positive. Even a negative score lands above zero. The order survived and gaps became ratios. Each step of plus one multiplied the height by e about 2.7. A score is a position on the ramp. It's weight is its height. Now divide the heights by their

Heights into shares

[2:21] Total 30.19. .09 .24 .67. The strip fills. The leader takes 2/3. In the case that broke us two minus one one now gives 7.4 .37 2.7. All positive. The strip fills again. Whatever the scores, the ramp hands you something you can divide. One more thing the real program

Commit

[2:40] Does. Before the ramp, it subtracts the biggest score from every score. One two three becomes minus two minus one zero. Before it moves, commit. The heights will change. Will the shares in the strip change?

Slide together

[2:52] Slide. All three marks move left by three together. Every height shrinks. 20.1 to one. 7.4 to .37. 2.7 to .14. Look at the strip. It did not move. Every bar shrank by the same factor e to the minus three. Shares are ratios and a ratio does not care that everything got smaller together. This thing we keep doing deserves a

The recipe has a name: softmax

[3:11] Name. Softmax. The probability of outcome i is e to the zi divided by the sum over every outcome of e to the zj. Ramp on top. Total underneath. There is one more symbol t. A positive temperature that divides every score. We leave it at one. It is the next film. And the subtraction is just the same factor on top and underneath which cancels. Read the line. Left side the

Read the line

[3:32] Chance of outcome i. Right side outcome i's height as a share of all the heights. The equal sign is a claim the shares must add to one. zi is one score. zj walks over every score. The sigma adds their heights up. T divides every score before the ramp. One for now. Plug in. E to the three over 30.19 is .67. Same number the strip has been showing you.

Why shift at all

[3:52] Back to 123, the strip reads .09.24.67, the same shares with or without the shift. So, why shift at all? Scale up two scores a thousand each. E to the thousand is a number no computer wants to hold. Subtract the max, zero and zero. Heights, one and one. Shares, a half and a half. Nothing large was ever computed. Not taught here what temperature does to the shares. That's your turn. Let's recap with Claude. Scores become

Verdict

[4:14] Chances by exponentiate, then divide the softmax. The ramp makes every weight positive and keeps the order from any finite score. Dividing by the sum only looked like a rule. One negative score kills it. Subtracting the biggest score shrinks every weight by the same factor, so the shares never move and the computer never meets E to the thousand. Your turn. Paste this into Claude. Take

Your turn

[4:34] The scores 4 -3 0 5. Before computing anything, predict the order of the three chances and roughly what share the leader gets. Then compute the weights by hand with EX divide by the total and write the three shares. Now subtract the biggest score from all three and do it again. Show me in one line of algebra why the two answers must be identical. Finally, for scores 900 900 899, explain which of the two routes a computer can actually run and why. Two things to look for. Did it make the prediction before the arithmetic? If it jumps to numbers, make it go back. And in the algebra, does it name the factor that cancels, not just say they're the same? Scores into chances at Nick Bear Brown.

More from @NikBearBrown

Nik Bear Brown Poet and Songwriter