Explain how training works for large language models and the way they produce text
The idea
A large language model is a deep neural network trained on text. Text is split into tokens, which are words or pieces of words. In pretraining, the model reads a very large body of text and learns to predict the next token; the text itself supplies the answers, so no human labelling is needed. The pretrained model is then usually fine-tuned, including instruction tuning on curated examples of requests and good responses, and often further adjusted using human preference feedback. To answer a prompt, the model repeatedly estimates probabilities for the next token, selects one and appends it. That sampling is why identical prompts can produce different wording, and why fluent output is not the same as verified fact.
A practice question
A large language model produces text by:
- retrieving whole stored sentencesWhy not: An LLM does not keep a database of sentences to look up; it generates text from learned patterns.
- applying hand-written grammar rulesWhy not: Its behaviour is learned from data, not coded as explicit grammar rules by programmers.
- predicting the next token again and again — correct
Given the text so far, the model outputs a probability for each possible next token, one is selected, it is appended, and the process repeats until the response is complete.
A harder one
The main objective during an LLM's pretraining stage is to:
- maximise human ratings of its answersWhy not: Tuning to human preferences comes later, after pretraining, on a much smaller data set.
- predict the next token in large text corpora — correct
- sort documents into labelled categoriesWhy not: Pretraining uses raw text without human labels; the next token itself serves as the target.
Pretraining exposes the model to very large amounts of text and trains it to predict the next token. The text supplies its own targets, so no human labelling is required.
The hardest tier
An analyst asks an LLM the same question twice and receives differently worded answers. The most likely reason is that:
- each next token is sampled from probabilities — correct
- the model was retrained between the queriesWhy not: A deployed model's weights do not change between two ordinary queries.
- it searched different websites each timeWhy not: A plain LLM generates text from its parameters; it does not browse unless given a retrieval tool.
Generation usually samples from the model's probability distribution over next tokens, so identical prompts can yield different wording. Settings such as temperature control how much variation occurs.
In the app: 6 practice questions on this outcome, a narrated walkthrough with diagrams, spaced review that brings it back before you forget it.
Take the free diagnostic →More in Introduction to Financial Data Science
- Explain which parts of fintech matter for collecting and analysing financial data
- Explain what is meant by machine learning, artificial intelligence and big data
- Explain how big data and data science are used in investment management
- Explain deep, supervised and unsupervised learning and how investment managers use them
- Explain how investment managers put large language models and generative AI to use
- Explain where AI and large language models fall short or pose risks in investment work