Connect with us

Artificial Intelligence

Under the Bonnet of a Chatbot: What a Large Language Model Actually Does

Published

on

A tidy home-office desk by a window in an Australian house in warm afternoon light, with an open laptop screen angled away and blank, a closed notebook, a stack of books and printed papers, and a cup of tea.

The short version

  • It predicts the next token. An LLM writes by guessing the most likely next chunk of text, one piece at a time, based on patterns learned from enormous amounts of writing.
  • Training is reading. The model learned those patterns by studying a very large body of text, not by being given a database of facts.
  • Confidence is not truth. Because it is built to produce plausible text, not to check facts, it can sound certain and still be wrong.

Chatbots are now how millions of people get answers, draft emails and look things up. The term “large language model” sits underneath all of them, and it is used so often that most people have stopped asking what it actually means. Understanding the machine underneath the chat window is the difference between using it well and trusting it blindly. This article explains what a large language model is, how it learns, and why it can sound so sure while getting things wrong.

What a large language model is

A large language model, usually shortened to LLM, is a type of artificial-intelligence system trained on a very large amount of written text. During that training it learns the statistical patterns of language: which words and phrases tend to follow which others, and in what contexts.

The name is a description of what it is. “Language model” means a model of how language fits together, built by observing a huge quantity of real writing. “Large” refers to the scale of the model itself, which contains an enormous number of internal parameters, the adjustable values learned during training, running into the billions. Those parameters are where the model stores, in compressed form, what it has learned about language.

A useful way to think about an LLM is as a very advanced version of the autocomplete on your phone. The phone guesses the next word from a short recent history. The LLM does the same thing at vastly larger scale, with vastly more context, and with far more sophisticated patterns. But the underlying operation is closer to autocomplete than to a search engine.

A language model is not a database, a knowledge base or a search index, even though it can answer questions in a way that makes it look like all three. It is a statistical engine for language. Holding onto that distinction is the single most useful habit for anyone who uses these tools, because it predicts almost every surprise they will meet.

It is worth pausing on that comparison, because it explains most of what follows. The model has no memory beyond the text in front of it, no opinion about your question and no way to know whether what it produces is true. It has only the patterns it learned and the words you gave it.

Training: how the model learns

The training process is where the “under the bonnet” promise gets kept. The model is shown a vast amount of text and asked, again and again, to predict the next word. It starts with random guesses and is corrected each time. Over millions of repetitions, it adjusts its internal parameters so that its guesses get steadily better.

What the model actually learns is not a list of facts. It is an internal sense of probability: in this kind of sentence, after these words, this kind of word tends to come next. It builds a statistical map of language, not a fact database. When you later ask it a question, it is not looking up the answer the way a search engine looks up a page. It is drawing on that map of patterns to generate the most likely response.

The amount of text involved in training is far more than any person could read in a lifetime. That scale is what lets the model pick up patterns no single writer would notice, and it is also why the model can seem to know things it was never explicitly taught. It was not taught them. It inferred them from the patterns.

The training happens once, before you ever use the model. That is why a model can be out of date: it knows the world only up to the point where its training text stops, and it has no built-in way to learn anything after that.

This distinction matters. A search engine retrieves something that already exists. An LLM constructs something new, one piece at a time, from patterns. That is why it can answer questions it has never seen before, and it is also why it can produce confident nonsense. The same mechanism gives you both abilities.

A neat stack of books and printed documents on a wooden table near a window in an Australian home, the pages angled so no text is readable, in soft daylight.

The image that captures the process is not a robot. It is a large stack of books and papers, because training is, at heart, an enormous amount of reading distilled into patterns.

Tokens and next-word prediction: how it writes

When an LLM writes, it does not work in whole sentences. It works in tokens, which are chunks of text. A token is often part of a word, sometimes a whole word, sometimes a piece of punctuation. The model never sees your prompt as one lump. It breaks everything, including your question, into tokens.

Generation is a loop. Given your prompt and everything it has written so far, the model predicts the most likely next token, adds it to what it has produced, and repeats. It does this one small piece at a time, and it does not compose a whole answer in one pass. Each new token becomes part of the context for the next prediction.

Tokenising is the name for the step that chops your text into these chunks before the model reads it. It is invisible to you, but it is why a model can handle typos and informal language, and why a very long document is fed through in pieces rather than all at once.

This explains a few things about how chatbots behave. Because the model is always guessing what comes next based on what it has just written, longer answers can drift off topic or start to repeat themselves. The model is not following a plan it wrote in advance. It is improvising, one token at a time, and the further it gets from your original prompt, the more the thread can wander.

The loop runs very quickly. By the time a reply appears on your screen, the model has repeated that predict-and-add step once for every token in the answer, which for a long reply can be thousands of times.

This design is also why a model can seem to change its mind mid-answer or trail off. It is not reconsidering. It is doing the same thing it always does, guessing what comes next, and the guess has simply gone somewhere less useful.

The wrapper: what turns a model into a chatbot

The raw language model is not what you chat with. A chatbot is the user-facing layer around the model, and the difference matters.

The wrapper handles the parts the model cannot do alone. It formats your prompt so the model can process it. It adds instructions that shape how the model responds, such as the style and length expected. It keeps the conversation in context, so the model remembers earlier messages in the same chat. And it applies rules designed to make the model refuse harmful requests and stay roughly on topic.

This is why the same underlying kind of model can power very different assistants. The wrapper and the instructions are a large part of what makes one chatbot feel formal and another feel friendly. The model underneath is doing the same fundamental work in both cases: predicting text.

The instructions layer is also why two chatbots can give quite different answers to the same question, even when the model underneath is similar. The rules of the wrapper shape the tone, the length and sometimes even the substance of the reply.

Why chatbots sound confident and still get things wrong

This is the honest core of the article, and it is the part most people do not realise. An LLM is optimised to produce plausible text, not to verify facts. It has no internal truth check, no separate engine that compares its answer against reality.

When the model does not know something, it does not say “I do not know”. It does the only thing it can do: it generates the most likely-sounding answer given the patterns it learned. If that answer is wrong, it is usually wrong in a confident, fluent way, because the model is very good at producing text that sounds like a person who knows what they are talking about.

This behaviour has a name. It is often called a hallucination, which captures the way the model invents something that sounds real but is not. The important point is that the model cannot tell you when it is doing this, because it does not know. It has no way to distinguish a correct answer from a plausible one.

A concrete example makes it clearer. Ask a chatbot for a specific detail it is unlikely to know, such as the publication year of an obscure book, and it will often supply a year that sounds entirely plausible. That year is not a memory. It is the most likely-sounding answer the pattern produced.

For most everyday use the failures are quieter than that. A date that is slightly off, a citation that does not exist, a confident summary of a study that was never published. They slip through because the sentences around them are fluent, and fluency is exactly what the model was built to produce.

What this means for the reader is practical. Treat the output of a chatbot as a well-worded suggestion to check, not as a source. For anything important, verify against something the model did not generate. The fluency of the answer is a feature of the language, not evidence of the truth.

The rule of thumb is simple. Anything a chatbot tells you that matters, whether it is a date, a figure, a legal detail or a health instruction, is a lead to verify, not a finished answer.

What the model cannot do

A clear picture of an LLM includes its limits. It does not reason the way a person does. It produces text that looks like reasoning, but it has no underlying model of the world, no lived experience and no ability to check whether its claims are true.

It is only as good as the patterns in its training text. If the writing it learned from contains errors, biases or outdated information, those flow into its answers. It can be out of date, because the text it trained on has a fixed end point, and it has no automatic way to know what has happened since. And it cannot reliably judge what is true, because truth is not a pattern it was trained to detect.

The patterns it learned come from human writing, and human writing carries human biases. A model can repeat those biases without intending to, which is one more reason to read its confident answers with a critical eye rather than accepting them at face value.

These limits are not a reason to avoid the tools. They are a reason to keep a human check in the loop for anything that matters, whether that is a work email, a health question or a financial decision.

Where you already meet these models

You have been using these models for longer than you might think, often without noticing. The autocomplete in your search bar and your email is a small cousin of the same idea. Translation tools predict the most likely rendering of one language into another. Chatbots on websites run on the same underlying technology. Writing assistants suggest the next sentence or rephrase the one you just typed.

The list extends into more visible places too. AI tools that generate images or game content are built on related kinds of models, and the site’s look at how AI game generators are shaping gaming shows one of these tools in action. The common thread is prediction: these systems all work by learning patterns from large amounts of data and generating the most likely next thing.

The same underlying approach now powers the AI summaries some search engines show above their usual results, which is why a search can read like a direct answer rather than a list of links. Whether that answer is reliable is the same question this article has been asking, and it deserves the same caution.

What an LLM is, in one paragraph

A large language model is a pattern-predicting machine trained on a vast amount of text. It writes one likely piece at a time, predicting the next token from everything that has come before, and it has learned to sound fluent rather than to be correct. That combination makes it a fast, useful assistant for drafting, summarising and exploring ideas, and it makes it an unreliable source for facts.

Use it for what it is good at, and keep the human check for everything that matters. The model does not know when it is guessing. Now you do.

Sources: Google Cloud and IBM, what are large language models · 3Blue1Brown, neural networks and language models · Academic and industry primers on transformers and next-token prediction