How Large Language Models Work: A Plain-English Guide to AI Chatbots
What an LLM really is, how it learns from text, why it sometimes makes things up, and how to get better, safer answers from AI chatbots.
On this page
- The core idea: predicting the next piece of text
- Tokens: how the model reads text
- Parameters: where the "knowledge" lives
- The transformer and attention
- How an LLM is trained, step by step
- What happens when you send a prompt
- Why LLMs sometimes make things up
- What LLMs are good at and not good at
- How to get better results from AI chatbots
- Privacy and safety basics
- Frequently asked questions
- The bottom line
A large language model (LLM) is a computer program trained on huge amounts of text to predict what words are likely to come next. By doing that one small prediction over and over, it can write, summarise, translate and answer questions in ways that feel like conversation.
You do not need a maths degree to understand the idea. This guide explains how these systems are built, why they are so capable, why they sometimes confidently get things wrong, and how you can use them more effectively and safely.
If you use AI tools with personal accounts, also read our password manager guide, since good account security matters more as these tools become part of daily life.
The core idea: predicting the next piece of text
Imagine you see the phrase "The capital of France is ___". Almost everyone can fill the blank. A language model learns to do this on a gigantic scale. It is shown enormous amounts of text and repeatedly asked to guess the next piece. When it guesses wrong, its internal settings are nudged slightly so the next guess is a bit better.
After billions of these small corrections, the model captures patterns in grammar, facts, writing styles, reasoning steps and even programming languages. It is not looking up answers in a database. It is generating text based on patterns it learned.
Tokens: how the model reads text
Models do not read whole words. They split text into smaller chunks called tokens. A token might be a whole common word, part of a longer word or a punctuation mark. This is why limits on prompts and answers are often measured in tokens rather than words. As a rough guide in English, a token is a bit less than one word.
Parameters: where the "knowledge" lives
Inside the model are billions of numbers called parameters (or weights). They are the adjustable settings that training tunes. You can think of them as an enormous set of dials that together encode patterns about language and the world. No single parameter stores a fact. Knowledge is spread across many of them.
The transformer and attention
Most modern LLMs use an architecture called the transformer, introduced in a 2017 research paper titled "Attention Is All You Need". Its key feature is attention, a way for the model to weigh which earlier words matter most when producing the next one.
In the sentence "The trophy didn’t fit in the suitcase because it was too big", attention helps the model work out that "it" most likely refers to the trophy. This ability to relate words across long passages is a major reason transformers beat earlier approaches.
How an LLM is trained, step by step
- Pretraining. The model learns from vast collections of text such as books, articles, websites and code, by predicting the next token. This stage builds general language ability and requires enormous computing power.
- Fine-tuning. The model is trained further on carefully chosen examples of helpful conversations, so it behaves like an assistant rather than a text completer.
- Learning from human feedback. People compare or rate different answers, and the model is adjusted to prefer responses that are helpful, honest and safe. This step shapes tone and behaviour.
- Safety testing and tuning. Developers test for harmful outputs, bias and misuse, then add safeguards.
What happens when you send a prompt
- Your text is split into tokens.
- The model reads those tokens, along with the earlier conversation, within its context window, which is the amount of text it can consider at once.
- It calculates probabilities for what the next token should be.
- It picks one token, adds it to the text and repeats the process until the answer is complete.
Settings such as temperature control how adventurous the choice is. A low temperature makes answers more predictable. A higher temperature makes them more varied and creative.
Why LLMs sometimes make things up
The model’s goal during training was to produce plausible text, not to verify truth. When it lacks reliable information, it can still generate something that sounds right. These errors are often called hallucinations.
They are more likely when:
- You ask about obscure facts, recent events or very specific numbers.
- You request quotes, citations or links, which the model may invent.
- The question contains a false assumption the model accepts.
- The task needs precise multi-step calculation without tools.
Newer systems reduce this by connecting to search engines, documents and calculators, but no system is perfectly reliable.
What LLMs are good at and not good at
| Usually good at | Needs extra care |
|---|---|
| Drafting and editing text | Medical, legal and financial decisions |
| Summarising long documents you provide | Exact facts, statistics and quotes |
| Explaining concepts at different levels | Recent news or fast-changing information |
| Brainstorming ideas and outlines | Maths and logic without verification |
| Writing and debugging code | Anything where an error is costly |
How to get better results from AI chatbots
- Be specific. Include the goal, audience, format and length. "Write a 150-word friendly email declining a meeting, offering Thursday instead" beats "write an email".
- Give context. Paste the relevant text instead of expecting the model to know it.
- Ask for reasoning or steps when solving problems, then check them.
- Iterate. Treat the first answer as a draft and refine with follow-up instructions.
- Request sources, then verify them. Open the links yourself and confirm they support the claim.
- Ask it to flag uncertainty, and treat confident language with caution.
Privacy and safety basics
- Do not paste secrets such as passwords, bank details or confidential work documents unless your organisation approves the tool.
- Check data settings. Some services may use conversations to improve their models unless you opt out.
- Verify before acting. For health, legal or money decisions, use the answer as a starting point and consult a qualified professional.
- Watch for AI-generated scams. Fluent, personalised phishing is easier to produce now, so our guide to spotting phishing is more relevant than ever.
Frequently asked questions
Does an LLM understand what it says?
That is debated. It clearly models patterns in language and can reason about many problems, but it works very differently from a human mind and can fail in surprising ways. Treat it as a powerful tool, not an authority.
Does it search the internet every time?
Not by default. A base model answers from what it learned in training. Some products add search or document tools, and they usually say when they use them.
Why do answers change when I ask the same question twice?
Generation involves probability. Unless randomness is turned down, the model can pick different words each time.
Will AI replace writers and programmers?
It is already changing how many jobs are done, mostly by automating parts of tasks. People who learn to direct and check these tools well tend to gain the most.
The bottom line
An LLM is a very large pattern-learning system that predicts text one token at a time. That simple mechanism produces impressive results, along with real limitations. Use it for drafting, explaining and brainstorming, give it clear instructions and always verify anything important.
Get new articles by email
One short email when we publish. No spam, unsubscribe any time.