An LLM is autocomplete trained on the internet, scaled until the autocomplete becomes useful. A large language model is a neural network that predicts the next token in a sequence of text, and that is the whole job. It is not a search engine, not a database, and not a reasoning engine with stored facts. Everything an LLM appears to do, answering questions, writing code, summarizing a contract, comes from running that one prediction over and over, feeding each predicted token back in to predict the next one.
An LLM does not look anything up and does not 'know' that Paris is the capital of France the way a lookup table knows it. It computes which token is most likely to come next given everything before it. Once you internalize that single fact, every quirk you have ever hit, the confident wrong answers, the forgetting, the inability to count, stops being mysterious.
What an LLM is, in one sentence
An LLM is a very large transformer neural network that, given a sequence of tokens, outputs a probability for every possible next token in its vocabulary. The 'large' refers to two things at once: the number of trainable parameters (often tens to hundreds of billions) and the size of the text corpus it was trained on. Both are large because predicting the next word well across all of human writing is a hard problem that needs a lot of capacity.
The architecture underneath almost every modern LLM is the transformer, introduced in the 2017 paper 'Attention Is All You Need' by Vaswani and colleagues at Google. The paper's key move was to drop recurrence and convolutions and rely entirely on an attention mechanism, which made the model far more parallelizable and better at handling long-range relationships between words.
The one job: predict the next token
LLMs are trained with next-token prediction, also called self-supervised learning. You take ordinary text, hide the next token, and ask the model to guess it. The correct answer is just the token that actually came next, so the training labels come free from the text itself, no human annotation required. The model is penalized whenever it assigns low probability to the real next token, and that penalty nudges billions of weights until correct continuations get higher probability.
Crucially, an LLM predicts tokens, not whole words. A token is a subword chunk produced by a tokenizer. The word 'tokenization' might split into 'token' and 'ization', and a rare name might split into several pieces. For more on why text gets chopped this way, see our breakdown of what a token is and how LLM tokenization works.
The mental model that fixes everything: an LLM is autocomplete trained on the internet, scaled until the autocomplete becomes useful. It is not a search engine, not a database, and not a reasoning engine with stored facts. It is a probability machine over tokens.
Trace of a single prompt, start to finish
Watch one prompt move through the full pipeline. Take the input: 'The capital of France is'. Watch it become a next token.
Step 1: Tokenize
Byte pair encoding (BPE) splits the text into tokens, iteratively merging the most frequent character pairs into a fixed vocabulary. GPT-4's tokenizer (cl100k_base) has a vocabulary of roughly 100,000 tokens and averages about 4 characters per token for English. So 'The capital of France is' becomes a short list of token IDs, integers that index into that vocabulary, for example a handful of tokens rather than 24 characters.
Step 2: Embed
The model converts each token ID into a vector, a long list of numbers, called an embedding. This is how the model turns discrete tokens into something it can do math on. Similar tokens land near each other in this vector space, which is why the model can generalize across phrasings. We cover this in plain language in our guide to vector embeddings explained without the math.
Step 3: Attention
The embeddings flow through stacked transformer layers. In each layer, the self-attention mechanism lets every token look at every preceding token and weigh how relevant each one is. When processing the token after 'is', attention heavily weights 'capital' and 'France', because those are the tokens that determine what should come next. Attention computes soft, weighted relationships across the whole sequence at once, which is the mechanism that lets the model use context rather than just the last word.
Step 4: The probability-to-text handoff
After the final layer, the model outputs a vector of raw scores called logits, one score for every token in the vocabulary. For 'The capital of France is', the logit for ' Paris' is high, the logit for ' London' is lower, and the logit for ' banana' is far lower. A softmax function then converts these logits into a probability distribution that sums to 1: ' Paris' might get 0.92, ' London' 0.03, and everything else splits the rest.
Now the model picks one token from that distribution, and this is the exact moment probability becomes text. With greedy decoding it takes the single highest-probability token, ' Paris'. With temperature sampling it scales the logits first: temperature below 1 sharpens the distribution toward the top token, temperature above 1 flattens it so less likely tokens get a real chance, which is what makes output feel more random or more creative. At temperature 0 the model just takes the argmax, the most probable token, every time.
The chosen token, ' Paris', is appended to the input. Now the model runs the entire pipeline again on 'The capital of France is Paris' to predict the token after that. This loop, predict one token, append it, predict the next, is called autoregressive generation. It is the entire generation process. A 500-word answer is 500-plus passes through the network, each producing exactly one token.
The handoff in one line: logits (raw scores) → softmax (probabilities) → sampling (pick one token) → append → repeat. Text is just a long chain of single-token bets, each one conditioned on every token before it.
Where the 'knowledge' actually lives
An LLM's knowledge lives in its weights, the billions of numbers adjusted during training, not in any database it queries at runtime. There is no row that says 'France → Paris'. Instead, that fact is smeared across billions of parameters in a compressed, non-human-readable form. The model reconstructs it on the fly by computing token probabilities, which is why it can be confidently wrong: it is regenerating a likely continuation, not retrieving a verified record.
Those weights are frozen at inference time. The model that answers your question is the exact same model, byte for byte, that answered someone else's question a second earlier. It does not learn from your conversation, and it does not change. Two famous behaviors follow: the knowledge cutoff (the model only 'knows' what was in its training data) and hallucination (when no strong continuation exists, the model still produces its most probable guess, which can sound right and be wrong).
Four things an LLM cannot do on its own
Vendor definition pages tell you what LLMs can do. They rarely spell out the structural limits that fall straight out of 'it predicts the next token.' Four, each a direct consequence of the architecture, not a bug to patch next release.
| Capability | Why the base model cannot do it alone | What it needs instead |
|---|---|---|
| Recall a specific fact | Facts are compressed across billions of weights, not stored as retrievable records, so exact recall is approximate and can be wrong. | Retrieval (RAG): fetch the real document and put it in the prompt. |
| Cite a real source | The model generates plausible-looking citations token by token; URLs and titles can be invented because nothing checks them against reality. | A tool or search step that returns verified, live links. |
| Count or do exact arithmetic | Counting and exact math are token-prediction tasks here, not real computation, so long sums and letter counts drift. | A calculator or code-execution tool the model can call. |
| Persist across sessions | Weights are frozen and inference is stateless; once the context ends, nothing is saved. | An external memory layer that stores and re-injects context. |
Every production AI system you admire is really an LLM wrapped in tools that cover these four gaps: a retriever for recall and citations, a code sandbox for counting, and a memory store for persistence. The model is the language engine; the scaffolding around it supplies everything the engine structurally lacks.
Why it forgets: tokens in, tokens out, nothing saved
An LLM forgets because it has no memory between requests. Every call works the same way: tokens go in, attention runs, tokens come out, and then the call ends with nothing persisting. The only thing the model 'remembers' within a conversation is whatever text is fed back into the prompt on the next turn. The model is not recalling your earlier messages; the application is resending them as part of the input.
The context window matters here, and people confuse it with memory. The context window is the maximum number of tokens the model can attend to in a single pass. It is working memory, a scratchpad erased the moment the call finishes, not long-term storage. We unpack that distinction in our piece on context window versus memory.
Quick diagnostic: if an AI assistant 'remembers' you across separate sessions, that memory is not in the model. It is an external system saving facts and injecting them back into the prompt before each call. The model itself is reading them fresh every single time.
LLM vs chatbot vs agent: the words people mix up
These three terms get used interchangeably and they are not the same thing. An LLM is the raw next-token prediction model, the engine. A chatbot is an LLM plus a chat interface and a system prompt that frames the model as a helpful assistant and keeps resending the conversation so it appears to follow along. An agent is a chatbot plus tools and a control loop: it can decide to call a search API, run code, or query a database, read the result, and feed it back into the next prediction.
The progression is additive. The LLM never stops being a next-token predictor. Chatbots and agents are layers of software that decide what tokens to feed it and what to do with the tokens it produces. When an agent 'browses the web' or 'remembers your preferences', the LLM is not doing those things. The surrounding system is, and it hands the model the results as more input tokens.
How an external memory layer fixes statelessness
Because the model is stateless by design, persistent memory has to be built around it. That is the gap MemX targets, but as a consumer app rather than a developer component: a second brain on your phone and WhatsApp that remembers your documents, photos, voice notes, and chats, then answers your questions about them in plain language with citations to the original source. The underlying model is still a forgetful next-token predictor; MemX is the layer that holds your life's context and hands you the answer. For the broader picture of how this works, see our explainer on how AI long-term memory works.
What to read next
- What is a token and how LLM tokenization works: the unit the model actually predicts.
- Vector embeddings explained without the math: how tokens become numbers the model can reason over.
- Context window versus memory: why a big context window is not the same as remembering you.
- How AI long-term memory works: the external systems that make stateless models feel persistent.
01Does an LLM actually understand language?
It predicts the most likely next token given context, which can look like understanding but is sometimes plainly wrong. An LLM models statistical relationships between tokens well enough to produce coherent, often correct text, but it has no grounded experience and does not retrieve verified facts. Whether that counts as understanding depends on what you mean by the word.
02What is the difference between an LLM and ChatGPT?
An LLM is the underlying model. ChatGPT is a product built on top of an LLM, adding a chat interface, a system prompt, conversation handling, and tools. The LLM does the next-token prediction; the product decides what to feed it and how to present the output.
03Why do LLMs make up facts and fake citations?
Because they generate text by predicting probable tokens, not by looking anything up. When no strong, correct continuation exists, the model still produces its most likely guess, which can be fluent and false. Citations are generated the same way, so URLs and titles can be invented unless a retrieval tool supplies real ones.
04Do LLMs remember previous conversations?
Not on their own. The model is stateless: each request starts fresh and nothing persists after the call ends. Any memory you see comes from an external system that saves information and re-injects it into the prompt, or from the application resending earlier messages within the same context window.
05How does an LLM choose its next word?
It outputs a logit (raw score) for every token in its vocabulary, applies softmax to turn those scores into probabilities, then picks one token. Greedy decoding takes the highest-probability token; temperature sampling adjusts the distribution so lower-probability tokens can be chosen, making output more varied.
