What Is a Large Language Model? How AI Actually Thinks
A large language model explained simply, including how tokens, training, transformers, attention, parameters, and human feedback make AI assistants work.
Picture a movie script with one page torn off.
The script describes a scene between a person and their AI assistant. You can read what the person says. But the AI’s response is missing. Now imagine you had a machine, a very powerful one, that could read any text ever written and make a reasonable guess about what word comes next. You could feed your incomplete script into that machine, see what word it predicts to start the AI’s response, then add that word back in, feed the whole thing again, and repeat. One word at a time, the missing page gets filled in.
That is not a metaphor for how a chatbot works. That is exactly how it works.
Every time you talk to ChatGPT, Claude, Gemini, or any other AI assistant, this is what is happening underneath. The system is completing a script. Over and over, one predicted word at a time, until it has written something that looks like a full, coherent response.
Understanding that changes how you think about all of it.
What a Language Model Actually Is
A large language model is a mathematical function. A very large, very complicated one, but at its core it does one thing: it takes any piece of text, looks at everything that came before, and assigns a probability to every possible word that could come next.
Not just one word. Every word. The model considers the entire vocabulary and assigns each option a score. The highest-scoring word is the most likely next word given the context. But here is the first non-obvious thing: the model does not always pick the most likely word. It picks from the distribution randomly, weighted by those probabilities. That is why the same prompt gives a different answer each time you run it. The model itself is deterministic. Its outputs are not, because randomness is deliberately baked in to make the responses feel more natural and less robotic.
What you experience as a “response” is thousands of these predictions chained together. Word by word, token by token, until the model decides the response is complete.
Where the Knowledge Comes From
The model learns to make these predictions by reading. An extraordinary amount of text, almost incomprehensibly large amounts, pulled mostly from the internet, books, code, academic papers, and more.
To give you a sense of the scale: if a human read non-stop, 24 hours a day, seven days a week without sleeping, it would take them over 2,600 years to read the amount of text used to train GPT-3. That was years ago. The largest models since then have been trained on much, much more.
The way this learning works is that the model starts with all its internal settings, called parameters or weights, set completely at random. At that point it produces gibberish. Then it gets shown an enormous number of examples. For each one, it sees all but the last word, makes a prediction, gets compared to the actual last word, and adjusts. An algorithm called backpropagation goes through every parameter in the model and nudges each one slightly, making the model a tiny bit more likely to get the right answer next time. Do this for trillions of examples and something remarkable happens: the model starts making reasonable predictions not just on text it has seen. Still, on text it has never encountered before.
It does not memorise. It learns patterns. Deep, abstract patterns about how language works, how ideas connect, and how the world is described in words.
To appreciate the scale of computation involved: if you could perform one billion mathematical operations per second without stopping, training the largest language models would still take well over 100 million years. This is only possible because of specialised chips called GPUs, which can run millions of operations in parallel simultaneously, compressing that work into weeks or months of real time.
The Architecture That Made It Possible
Before 2017, most language models read text the way a person reads a sentence: one word at a time, from left to right. The problem was that by the time the model got to the end of a long passage, it had often forgotten what was at the beginning. Context did not travel well.
Then a team at Google introduced a new design called the transformer, and it changed everything.
Transformers do not read text sequentially. They soak it all in at once, processing every word in parallel with every other word. The first step inside a transformer is to convert each word into a long list of numbers, because the training process only works with continuous values. Those numbers try to encode the meaning of the word. But meaning is not fixed. The word “bank” means something very different in the sentence “she sat by the river bank” than in “she opened a bank account.”
Transformers handle this through a mechanism called attention. Every word gets a chance to look at every other word in the passage and update its own meaning based on that context. “Bank” near “river” adjusts its numbers toward riverbank. “Bank” near “account” adjusts toward financial institution. This happens simultaneously across the entire input, in parallel, which is why transformers can take full advantage of GPU hardware in ways earlier models could not.
After attention, the model passes each word’s updated meaning through a second operation, a feed-forward neural network, which gives the model additional capacity to store patterns it has learned during training. The text flows through many iterations of these two operations, and by the end, the final word in the sequence has been influenced by the entire context and everything the model has ever learned, and is used to predict what comes next.
The specific behaviour is an emergent phenomenon. Researchers design the architecture, but nobody sits down and programs the model to understand that“bank” can mean two different things. That understanding emerges from the parameters being tuned over trillions of examples. It is also why it is so difficult to explain exactly why these models make the predictions they do. The behaviour comes from billions of numbers in configuration, not from rules anyone wrote down.
The Part That Makes It Useful
All of the above describes pre-training: the process of teaching a model to predict the next word in a random piece of internet text. That produces something extraordinarily capable, but it is not the same as being a good assistant.
Predicting the next word in a Reddit thread and giving a safe, helpful, honest answer to a person’s question are very different tasks. To bridge that gap, models go through a second round of training called reinforcement learning with human feedback. Human workers review model outputs, flag what is unhelpful or problematic, and those preferences get baked into the model’s parameters through another round of adjustment.
This is the stage that turns a very capable text predictor into something that feels like it is trying to help you. The pre-training gives it knowledge. The reinforcement learning gives it behaviour.
What you interact with when you open ChatGPT or any other AI assistant is a model that has been through both. The knowledge comes from reading more text than any human could process in thousands of lifetimes. The behaviour comes from millions of human corrections and preferences. And the outputs come from the same elegant, simple process that started all of this: predicting, one word at a time, what should come next.
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0