Module 3 · Turning scores into text

Reading the numbers the model will give you

In this lesson

  • 9 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 4 of 10 in this chapter

This chapter’s goalChoose and justify a decoding strategy for a given task, read raw log-probabilities to get a usable confidence signal, force structurally valid output without prompt-begging, and explain why identical requests at temperature zero can still differ.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

The one honest number

Ask a model how confident it is and it produces text: the word “95%” generated the same way as any other word, with no connection to anything internal. But the model does expose a real number: the probability it assigned to each token it chose, and to the alternatives it did not.

Most APIs return this on request, and every local library gives it to you for free.

Python
resp = client.chat.completions.create(
    model="...", messages=msgs, logprobs=True, top_logprobs=5,
)
for t in resp.choices[0].logprobs.content:
    print(t.token, round(t.logprob, 2),
          [(a.token, round(a.logprob, 2)) for a in t.top_logprobs])

Log-probabilities are negative. Zero means certainty; −0.02 is about 98 per cent; −2.3 is about 10 per cent. Exponentiate to get back to a probability.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the AI, Actually Explained exam.

Stuck on something?Ask Anjali, your AI tutor

How to cite: Addaly (2026) ‘Reading the numbers the model will give you’, in How a Language Model Actually Works. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/how-llms-work/reading-logprobs (Accessed: 29 November 2026).