Generative AI · Beginner level

Beginner level · Module 3: Introduction to Large Language Models · Lesson 1 of 3

How LLMs Write Text

A plain-language walk-through of next-token prediction and why it produces fluent but not always correct text.

In this lesson you will

  • Explain next-token prediction
  • Explain why fluency differs from accuracy

Key concepts

tokennext-token predictionprobabilityfluencyaccuracy

The lesson

An LLM writes by repeatedly predicting a likely next token (a piece of a word) based on all the text so far. It learned these likelihoods from enormous amounts of text.

This makes it excellent at producing natural, well-structured language. It does not look facts up unless a tool or document is provided, so a sentence can be perfectly fluent and still wrong.

Tokens also matter for cost and limits: providers count and charge by tokens, and a word in a language the model saw rarely may be split into many tokens.

Step by step

  1. Type a sentence into a free tokeniser demo or view the offline example.
  2. Count its tokens.
  3. Compare an English sentence with one in another language you know.
  4. Note the difference.

Practice activity

Compare token counts for three sentences in different languages.

Expected result: A small table showing token counts and a note on what it means for cost.

Check your understanding

  1. What does an LLM predict at each step?

    Show answer

    A likely next token.

  2. Why can a fluent answer be wrong?

    Show answer

    The model predicts likely text; it does not check facts unless given sources.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.