Skip to content
Edition NigeriaGlobal
Country: Taiwan

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

Set up your profile

You are learning in the Taiwan edition, with examples in dollars and from Taiwan.

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

AI at workThe anatomy of a good promptRead nowThe anatomy of a good promptAI at work · Beginner · 15 minAI at workGiving context and clear instruc…Read nowGiving context and clear instructionsAI at work · Beginner · 15 minAI at workExamples: zero-shot, one-shot an…Read nowExamples: zero-shot, one-shot and few-shot promptingAI at work · Beginner · 15 minAI at workRoles, audience and toneRead nowRoles, audience and toneAI at work · Beginner · 15 minCreative & media productionIdeation: methods that produce i…Read nowIdeation: methods that produce ideasCreative & media production · Intermediate · 5 minPortfolio managementWriting an investment policy sta…Read nowWriting an investment policy statementPortfolio management · Intermediate · 15 minStock marketCash flow: why cash matters more…Read nowCash flow: why cash matters more than you thinkStock market · Intermediate · 15 minAI & securityCyber-resilience frameworks: DOR…Read nowCyber-resilience frameworks: DORA, PCI DSS, NIST CSF and ISO 27001AI & security · Advanced · 15 minAccounting & financeThe accounting equation and doub…Read nowThe accounting equation and double entryAccounting & finance · Beginner · 15 minMarket operationsQuoting and pricing: mid, skew a…Read nowQuoting and pricing: mid, skew and riskMarket operations · Advanced · 15 minProjects, consulting & analysisProcess modelling: as-is and to-beRead nowProcess modelling: as-is and to-beProjects, consulting & analysis · Intermediate · 15 minFinancial data & analyticsFinancial data sourcesRead nowFinancial data sourcesFinancial data & analytics · Intermediate · 15 min
English