Large Language Models Explained: How ChatGPT and Claude Actually Work
Large language models power tools like ChatGPT and Claude by predicting the next token. This guide explains tokens, transformers, attention, training, context windows and hallucinations in plain English.
Table of contents
- Key takeaways
- What is a large language model?
- Tokens: the units models actually read
- The transformer and attention, in plain English
- Training, stage by stage
- Stage one: pre-training
- Stage two: learning to follow instructions
- Inference: why answers vary
- Context windows: the model’s working memory
- Why LLMs hallucinate
- Capabilities and limits, honestly stated
- Common misconceptions
- “It looks up the answer in a database”
- “It understands me like a person does”
- “Bigger is always better”
- “If it said it, it must have a source”
- Key concepts at a glance
- Frequently asked questions
- What is the difference between an LLM and a chatbot like ChatGPT or Claude?
- How do LLMs know things if nobody programmed the facts in?
- Why does the model sometimes refuse or hedge?
- Can an LLM learn from our conversation and improve itself?
- Does a bigger context window mean better answers?
- Are ChatGPT and Claude free to use?
- Conclusion
- Sources
Large Language Models Explained: How ChatGPT and Claude Actually Work
When ChatGPT answers a question in polished paragraphs, or Claude rewrites your draft in a different tone, it is natural to picture something reading, thinking, and then replying — much as a person would. The reality is both less magical and more interesting. Behind the chat window sits a large language model: a very large neural network trained to do one thing extremely well — predict what text should come next.
This article explains how large language models, usually shortened to LLMs, actually work. It covers tokens, the transformer architecture and its attention mechanism, how training happens in stages, what a context window is, and why these models sometimes state falsehoods with complete confidence.
It is for curious readers, students, and professionals who use tools like ChatGPT and Claude and want an honest mental model of what is happening underneath. No technical background is assumed.
A note on how this article was put together: this is a research-based explainer drawn from published documentation and primary sources checked in November 2026, including the original transformer research paper and the providers’ own pricing pages. No hands-on testing is claimed, and no unpublished specifications are presented as fact.
Key takeaways
- A large language model is a very large neural network trained to predict the next token — a small chunk of text — given the tokens before it.
- Models read and write in tokens, not whole words, which shapes everything from how they handle rare words to how usage is measured.
- The transformer architecture, introduced in 2017, uses a mechanism called attention to weigh how much each word in a passage matters to the others.
- Training happens in stages: large-scale pre-training on text, followed by fine-tuning methods that teach the model to follow instructions and respond helpfully.
- A context window is the amount of text a model can consider at once; it differs by model and plan, and anything outside it is effectively invisible to the model.
- LLMs generate by prediction rather than retrieval, which is why they can hallucinate — producing fluent, plausible, false statements.
What is a large language model?
Start with the three words. A language model is a system that assigns likelihoods to sequences of text — in plain terms, it has learned which words tend to follow which. A large language model does this at enormous scale: trained on vast collections of text, with a very large number of internal settings, called parameters, adjusted during training until its predictions become remarkably good.
This article deliberately gives no parameter counts for named commercial models such as ChatGPT or Claude: providers do not publish all of those figures, and specific numbers repeated without a primary source should be treated with suspicion.
The striking fact about LLMs is how much behaviour grows out of that single prediction task. A system trained to predict the next piece of text must, in passing, absorb grammar, vocabulary, common knowledge as it appears in writing, the conventions of genres from legal contracts to song lyrics, and patterns of reasoning as people express them in text. Prediction is the training method; the breadth of the result is the surprise.
Tokens: the units models actually read
LLMs do not read letters or whole words. They read tokens — chunks of text produced by splitting writing into pieces from a fixed vocabulary of fragments. A token might be a whole common word, part of a longer word, a number, or a punctuation mark.
Here is a worked example. Take the sentence:
“Understanding transformers takes practice.”
An approximate token split — approximate, because the exact split depends on the model’s own token vocabulary — might look like this:
| Piece of the sentence | Approximate token(s) |
|---|---|
| “Understanding” | “Under” + “standing” |
| “transformers” | “transform” + “ers” |
| “takes” | “takes” |
| “practice” | “practice” |
| ”.” | ”.” |
Tokens matter practically, too: product limits and pricing are commonly expressed in tokens, and tokens are also the unit of the context window discussed below.
The transformer and attention, in plain English
Most modern LLMs are built on the transformer architecture, introduced by Vaswani and colleagues in the 2017 paper “Attention Is All You Need.” Before transformers, language systems typically processed text strictly in order, one word at a time, which made it hard to connect words that were far apart in a long passage and slow to train on large amounts of text.
The transformer’s central idea is attention. As the model processes a passage, attention lets each word weigh the relevance of the other words around it. Consider the sentence: “The trophy does not fit in the suitcase because it is too big.” To make sense of “it,” you instinctively look back — does “it” mean the trophy or the suitcase? Your judgement that the trophy is the thing that is too big comes from relating words to one another in context. Attention gives a model a mechanical way to do something analogous: for each token, it calculates how much attention to pay to each other token, and builds its understanding of the passage from those weighted relationships.
None of this means the model understands a sentence the way you do. Attention is arithmetic over learned patterns, not comprehension. But it is the mechanism that lets LLMs keep track of subjects across long sentences, respect the topic of a paragraph, and produce answers that stay on the point you raised several messages ago — most of the time.
Training, stage by stage
An LLM is not programmed with answers. It is trained, in stages, and each stage explains a different part of its behaviour.
Stage one: pre-training
In pre-training, the model works through a very large corpus of text with a simple, relentless exercise: hide the next token, predict it, compare the prediction with what actually came next, and adjust the parameters slightly to do better. Repeated at scale, this is where the model acquires its language ability and much of its general knowledge of how topics are discussed in writing.
Pre-training alone, however, produces a model that continues text rather than one that helpfully answers questions. Shown a question, a purely pre-trained model might continue with more questions, because that is what often follows a question in its training material. Something more is needed.
Stage two: learning to follow instructions
In the second stage, the model is fine-tuned to behave like an assistant. Instruction tuning trains it on examples of instructions paired with good responses, so it learns the shape of helpful behaviour: answer the question asked, follow the requested format, stay on task. Human-feedback methods — often grouped under the label RLHF, reinforcement learning from human feedback — go further: people compare alternative responses and indicate which is better, and the model is adjusted to favour the qualities those judgements reward, such as accuracy, clarity, and safety.
Inference: why answers vary
Using a trained model is called inference. You provide a prompt; the model converts it to tokens, runs its calculations, and produces a probability for every possible next token. Then it must choose one.
If it always chose the single most likely token, answers would be rigid and repetitive. Instead, generation usually involves sampling — choosing among likely candidates with some randomness, governed by settings often described as temperature. Lower settings make output more conservative and predictable; higher settings allow less expected choices, which can feel more creative and can also drift further from accuracy. The chosen token is added to the sequence, and the process repeats, token by token, until the answer ends.
This explains a familiar experience: ask the same question twice and receive two different, both plausible, answers. The model is not being inconsistent on purpose; variation is built into how generation works. It also explains why re-asking, or asking for a second attempt, is a legitimate technique when a first answer misses the mark.
Context windows: the model’s working memory
The context window is the maximum amount of text — measured in tokens — that a model can take into account at one time: your prompt, the earlier messages in the conversation, any documents you have pasted or attached, and the answer being generated all compete for space inside it.
Think of it as the size of the desk the model can spread papers across. Anything on the desk can influence the answer. Anything not on the desk — a message from last week, a page of the document that did not fit, a fact from a different conversation — cannot, no matter how relevant it would have been.
Context windows differ by model and by plan. Anthropic’s pricing page, for example, notes context windows of up to one million tokens depending on the model for Claude. That headline figure should be read carefully: what applies to your conversation depends on the specific model and tier you are using, so check the provider’s own documentation rather than assuming the largest number applies to you. The practical lesson is universal, though: when a chatbot seems to “forget” something from much earlier in a long conversation, the likely explanation is not carelessness but the edge of the window.
Why LLMs hallucinate
Hallucination is the term for output that is fluent, confident, and false: an invented book title, a citation to a paper that does not exist, a wrong date delivered without hesitation. It follows directly from everything above.
The model generates by predicting plausible text. It has no built-in step that checks a statement against the world before speaking, and its training rewards answers that read well. When it knows a pattern thoroughly, prediction and truth usually coincide. When the material is obscure, recent, or was barely present in training, the model still has to produce a next token — and it produces the most plausible-sounding one, which may be a fabrication wearing the clothes of a fact.
Two implications follow. First, confidence is not a signal: a hallucinated answer is written in the same assured tone as a correct one. Second, the risk is highest exactly where checking is hardest — niche topics, precise figures, quotations, and references. For anything that matters, verify against a source outside the model. Some products reduce the risk by connecting the model to tools such as web search, so it can fetch current material; that helps, but the fetched material still needs a human reader’s judgement.
Capabilities and limits, honestly stated
Within those mechanics, LLMs are genuinely capable. They draft and edit text in many styles and languages, summarise long material, explain concepts at adjustable levels of difficulty, help with code, and sustain a coherent conversation across a wide range of topics. For many everyday writing and learning tasks, that is transformative.
The limits are equally real:
- No live knowledge by default. A model’s knowledge comes from its training, which ends at some point in the past. Unless the product connects it to search or other tools, it cannot know today’s news, prices, or events — and it may not signal that gap.
- No memory of its own. Outside the current context window, and any memory feature the product adds, nothing carries over.
- Reasoning by pattern. LLMs often reason impressively, because text contains a great deal of expressed reasoning. But they can also produce chains of steps that sound logical while containing a quiet error, especially on multi-step problems.
- Sensitivity to phrasing. The same request worded differently can yield noticeably different quality, which is why prompting technique is a real skill.
- Inherited bias. Training text reflects the societies that produced it, and models can reproduce those biases in their output.
Common misconceptions
“It looks up the answer in a database”
By default, it does not. It generates an answer from learned patterns. Products may add search or document retrieval on top, and then the model is working from fetched material — but generation, not lookup, is the model’s native mode.
“It understands me like a person does”
An LLM processes patterns in text with extraordinary sophistication, but it has no experiences, beliefs, or awareness. Treating its fluency as human understanding leads to over-trust — and to the strange disappointment people feel when the “person” they imagined makes an inhumanly simple mistake.
“Bigger is always better”
Larger models are often more capable on difficult tasks, but size is not the only variable. The right model depends on the job: speed, cost, context length, and the quality of fine-tuning all matter, and a smaller, well-suited model can serve a routine task better in practice. Judge by performance on your kind of task, not by scale alone.
“If it said it, it must have a source”
Generated citations can be invented wholesale — plausible authors, real-sounding journals, non-existent papers. Never quote or submit a reference supplied by a chatbot without opening it and confirming it exists and says what is claimed.
Key concepts at a glance
| Concept | Plain-English meaning |
|---|---|
| Token | A small chunk of text — a word or part of a word — that the model reads and writes one at a time. |
| Parameter | One of the model’s internal settings, adjusted during training; together they encode what it has learned. |
| Transformer | The architecture, introduced in 2017, on which most modern LLMs are built. |
| Attention | The mechanism that lets each word weigh the relevance of the other words around it. |
| Pre-training | The first training stage: predicting the next token across a very large text collection. |
| Fine-tuning | Later training that teaches instruction-following and helpful, safe response behaviour. |
| Inference | Generating an answer with the trained model — the moment you actually use it. |
| Temperature | A generation setting that trades predictability for variety in the model’s choices. |
| Context window | The total amount of text, in tokens, the model can consider at once. |
| Hallucination | Fluent but false output, produced because generation optimises for plausibility, not verified truth. |
Frequently asked questions
What is the difference between an LLM and a chatbot like ChatGPT or Claude?
The LLM is the underlying model — the trained prediction system. ChatGPT and Claude are products built around models: they add the chat interface, conversation handling, safety layers, and sometimes extra tools such as web search or file handling. The same distinction explains why a product’s features can change even when the model has not.
How do LLMs know things if nobody programmed the facts in?
Facts enter through training text. When the model reads enormous amounts of writing, statements of fact are part of the patterns it absorbs, encoded indirectly in its parameters. That is why its knowledge is broad but imperfect: it reflects what its training material said, including that material’s errors and gaps, rather than a checked encyclopedia.
Why does the model sometimes refuse or hedge?
Fine-tuning teaches models to decline certain requests and to express uncertainty in some situations. Refusals and hedges are trained behaviour layered over the prediction engine. They reduce some risks, but they are not guarantees — a model can refuse a harmless request or answer a risky one, which is why your own judgement remains part of the system.
Can an LLM learn from our conversation and improve itself?
Not in the way the phrase suggests. Within a conversation, the model uses the context you provide, which can feel like learning. But its parameters do not change as you chat, and it carries nothing into a new conversation unless the product adds a memory feature. Improvements to the model itself arrive through new training by the provider, released as updated models.
Does a bigger context window mean better answers?
A larger window means more material can be considered at once — useful for long documents and extended conversations. It does not by itself make the model more accurate or more intelligent, and important details buried in a very long context can still be underused. Window size is a capacity, not a quality guarantee.
Are ChatGPT and Claude free to use?
Both providers list free tiers alongside paid plans on their pricing pages: OpenAI lists a free version of ChatGPT with limited features and a paid Plus plan, and Anthropic lists a free Claude tier with limited usage and paid plans above it. Limits and features change over time, so the providers’ own pricing pages are the place to check the current position.
Conclusion
A large language model is, at its core, a prediction machine of remarkable scale: it reads tokens, weighs their relationships through attention, and generates text one likely piece at a time. Training gives it language and knowledge; fine-tuning gives it manners and instruction-following; the context window bounds what it can see; and sampling explains why no two answers are quite alike.
Hold on to that picture and the tools built on these models become easier to use well. You will know why they write beautifully and err confidently, why phrasing matters, why long conversations fray at the edges, and why verification is not optional. The model supplies fluency at scale. The understanding, as ever, is your job.
Sources
- Attention Is All You Need — Vaswani et al.: https://arxiv.org/abs/1706.03762
- Claude Pricing — Anthropic: https://claude.com/pricing
- ChatGPT Pricing — OpenAI: https://openai.com/chatgpt/pricing/
Verification note: the facts in this article were checked against the sources listed above in November 2026. This article was compiled on 30 November 2026 as a research-based explainer; it does not report hands-on testing of any product.
Sources & further reading
Written by
Editorial Team
The Education Master editorial team researches, writes and fact-checks every article against primary sources before publication.
Spotted an error? Email [email protected] — see our Corrections Policy.