What Is an LLM?
A large language model (LLM) is a program that writes text one piece at a time. At each step, it gives every possible next word a probability, based on the text so far, and picks one. Repeating that one step produces chat, code, and summaries. Because the pick involves chance, the same question can get different answers.
The program is a neural network: a set of numbers, adjusted on examples until its predictions match real text. The pieces it predicts are tokens, a word or part of a word.
Core components #

Tokens #
A tokenizer splits text into tokens. In English, one token averages about 4 characters, or three-quarters of a word. hello world becomes two tokens, hello and world. A rare word splits into pieces. Each token maps to an integer ID, and each ID maps to a vector of numbers. The network only sees those vectors.
Network #
Most LLMs use a transformer network.1 A transformer is a stack of layers with the same structure. Each layer lets every token weigh itself and every earlier token through a step called attention. It then passes the result through a feed-forward network.
Weights #
The learned numbers inside those layers are the weights, or parameters. “Large” refers to their count. GPT-3 had 175 billion.2 Many newer models are larger, though most vendors no longer publish the count.
Context window #
The context window caps how many tokens the model can see at once, input and output combined. Current models range from tens of thousands to over a million. Anything outside the window does not exist for the model.
Training #
Training sets the weights in two stages:
- Pretraining. The model reads trillions of tokens of text and code, mostly from the public web. At each position, it predicts the next token and compares the guess to the real one. It then adjusts its weights to make a better guess next time. This stage teaches grammar, facts, and patterns of reasoning, and it takes most of the compute.
- Post-training. A pretrained model only continues text. Teams fine-tune it on example conversations and human ratings of its answers so it follows instructions and declines harmful requests.3
After training, the weights do not change. The model does not learn from your conversation, though a vendor may use it to train a later version.
Generating an answer #

Each prompt runs through four steps. The example prompt is The capital of Colombia is.
- Split the prompt into tokens. The tokenizer splits the prompt into tokens, and the model looks up each token’s vector.
- Predict the next token. The network runs the vectors through its layers. The output layer assigns a probability to every token in its vocabulary. For the example prompt, the first token of
Bogotámight get 85% of the probability. - Pick one token. The model doesn’t always take the most likely token, because text built that way tends to be flat and repetitive. Instead, it samples from the probabilities, and a setting called temperature controls how random that sampling is. At temperature 0, it always picks the most likely token.
- Append and repeat. The model appends the picked token to the input and goes back to step 2. It stops when it emits a stop token or hits a length limit. The tokenizer then converts the tokens back to text.
Reasoning models use the same loop to generate hidden thinking tokens before they start the visible answer.
Practical limits #
- It produces plausible text, not verified text. The model picks likely tokens. When the likely answer is wrong, it states it with the same fluency. This is called hallucination.
- Its knowledge stops at a cutoff date. It knows only what was in the training data, unless a tool or the prompt supplies newer information.
- It has no memory between calls. A chat app resends the conversation history with every message. The model itself keeps nothing.
- The same prompt can give different answers. Because step 3 samples at random, one different early token sends the rest of the answer down a different path. Even at temperature 0, server batching changes floating-point addition order, which can flip nearly tied tokens.
Treat an LLM’s output as a draft to check, not a source of truth.
References #
Vaswani, A., et al. (2017), “Attention Is All You Need,” NeurIPS (arXiv:1706.03762). ↩︎
Brown, T., et al. (2020), “Language Models are Few-Shot Learners,” NeurIPS (arXiv:2005.14165). ↩︎
Ouyang, L., et al. (2022), “Training language models to follow instructions with human feedback,” NeurIPS (arXiv:2203.02155). ↩︎