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
A firm takes a pretrained language model and trains it further on curated examples of instructions paired with good responses. This process is called:
- retrieval-augmented generationWhy not: Retrieval adds documents to the prompt at query time and changes no model weights.
- pretraining from scratchWhy not: The model is already pretrained; this is further training on a smaller, targeted data set.
- instruction tuning - correct
Instruction tuning is a form of fine-tuning: a pretrained model is trained further on examples of tasks and desired answers so that it follows instructions more reliably.
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: 9 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