1ConceptBeginner 1
What is a large language model, and how does it produce an answer?
Short answer
A large language model is a neural network trained on a huge amount of text to predict the next token. It writes an answer one token at a time, each time choosing a likely next token given everything before it. It has no lookup table of facts; it has patterns learned during training.
The explanation
Training happens in stages. Pre-training teaches the model to predict the next token on a very large text corpus, which is where its knowledge of language and the world comes from. Later stages, such as instruction tuning and learning from human feedback, teach it to follow instructions and answer helpfully.
At inference time the model takes your prompt as tokens, computes a probability for every possible next token, picks one (how it picks depends on settings such as temperature), appends it, and repeats until it stops. That is why the same prompt can give different answers, and why a fluent answer can still be wrong: the model optimises for likely text, not for checked truth.
It is like a very well-read autocomplete. Type 'The capital of Karnataka is' and it predicts 'Bengaluru' because that pattern appeared often in its training text, then predicts the next token after that, and so on. It does not look anything up, which is why it can also confidently complete a sentence with something wrong if the pattern seems likely.
They may follow up with
- What does pre-training give the model that instruction tuning does not?
- Why can the same prompt give different answers?
- Where does a model's knowledge cut-off come from?
Avoid
- Saying the model searches a database of facts when it answers
- Treating fluent output as evidence that the answer is correct
Practice this oneLesson: What AI, machine learning and a language model are