Skip to content
Edition NigeriaGlobal
Country

You are in the Nigeria edition. Type your country to switch.

Set up your profile

AI prompt engineering · Lesson 1 of 12

How language models work, at a useful level

A language model writes by predicting one likely piece of text after another. Knowing about tokens, the context window and temperature explains most of the behaviour you will meet, and why a fluent answer still needs checking.

Beginner12 min read6 steps

This lesson is complete in writing. A video for it is on its way.

What you will learn

  • You can explain, in plain words, how a language model produces an answer.
  • You can estimate a token budget and check it against a context window.
  • You can say why the same prompt can give different answers.
  • You can separate what a model learned in training from what you supply.
  • You can apply a simple habit for checking fluent answers.

Key terms in this lesson

Large language model
An AI model trained on huge amounts of text to understand and generate language.
Training data
The examples an AI model learns from. What is missing, old or biased in the training data shows up in the model's answers.
Token
The small unit of text a language model reads and writes, such as a short word, part of a longer word, a number or a punctuation mark.
Context window
The maximum amount of text, measured in tokens, that a language model can take into account at once, including instructions, pasted material and its own replies.
Temperature
A sampling setting that controls how varied a model's output is: lower values give more predictable wording, higher values give more varied and surprising text.
Knowledge cut-off
The date after which an AI model has no information from its training, so it may not know recent events, prices or rules.
Personal data
Any information that identifies you or could be linked to you, such as your name, account numbers, address, ID number or voice.
AI hallucination
A confident answer from an AI tool that is false or made up, such as an invented figure or a source that does not exist.

Step 1 of 6

A machine that predicts the next piece of text

Opening this step…

Step 2 of 6

Tokens and the token budget

This step opens when you finish the one above.

Step 3 of 6

The context window: what the model can see

This step opens when you finish the one above.

Step 4 of 6

Sampling and temperature: why answers vary

This step opens when you finish the one above.

Step 5 of 6

What it learned against what you tell it

This step opens when you finish the one above.

Step 6 of 6

A fluent answer is not a checked answer

This step opens when you finish the one above.

Key takeaways

The key takeaways open when you finish every step.

Lesson quiz

5 questions. You need 85% to pass.

The quiz opens when you finish every step.

Stockertim Learn is education. It explains how investing works and never recommends buying or selling anything.

Up next

English