Large language models and generative AI
Generative AI makes new text, images or sound. Large language models write text by predicting the next token, one piece at a time.
📌 Key points
- Generative AI creates new content, such as text, images, music or code, based on patterns learned from its training data.
- A large language model (LLM) is a neural network, usually a transformer, trained on huge amounts of text such as books and websites.
- Text is split into tokens: words or pieces of words, e.g. "playing" might become "play" + "ing". The model turns tokens into numbers.
- An LLM writes by predicting the next token, adding it to the text, then predicting the next one again. It chooses from likely tokens, so answers can vary.
- "Large" means it is trained on a huge amount of text and has a huge number of parameters (weights), often billions.
- After this first training, models are usually fine-tuned, often with human feedback, to follow instructions and be more helpful and safe.
- LLMs can hallucinate: write confident-sounding text that is false, such as made-up facts or sources, because they predict likely words rather than check the truth.
- The text you give the model is the prompt. A model may not know about events after its training data ends (its knowledge cutoff).
📖 Key words
- Generative AI
- AI that creates new content such as text, images, music or code.
- Large language model (LLM)
- A neural network trained on huge amounts of text to predict and generate language.
- Token
- A word or piece of a word that a language model works with.
- Prompt
- The question or instructions you give to an AI.
- Parameter
- A number inside a model (such as a weight) that is set during training.
- Hallucination
- When an AI produces confident-sounding information that is false or made up.
- Knowledge cutoff
- The date after which a model has no training data, so it may not know newer events.
✏️ Worked example
How does an LLM continue the text "The cat sat on the"?
- The text is split into tokens, and the model works out a score for every possible next token.
- It might give: "mat" 40%, "floor" 20%, "sofa" 15%, and smaller scores for others.
- It picks a likely token, e.g. "mat", adds it to the text, then predicts the next token again (perhaps ".").
- This repeats, one token at a time, until the answer is finished.
- The model is choosing likely words, not checking facts. That is why it can sound sure and still be wrong.
Remember: a chatbot is a very good next-word predictor, not a fact checker. Check anything important.
Test yourself8 questions from a bank of 19. A new mix every time.
Start the quiz →