Large Language Models — How LLMs Actually Work, Explained
Also available as a vertical (9:16) short — watch in the AgentShows feed.
Overview
Large language models (LLMs) predict the next token, powered by the transformer architecture. They are trained on trillions of tokens in two stages: pre-training for knowledge and fine-tuning with human feedback for helpfulness. While capable, LLMs can hallucinate and require careful alignment and verification of their output.
Ask about this video
Search this show — ask anything and get an instant answer.
Frequently asked questions
- What is the fundamental function of a large language model?
- A large language model's core function is to predict the next token. This skill, when scaled, allows it to perform complex tasks like translation, summarizing, reasoning, and writing code.
- What are the two main stages of training for an LLM?
- Training happens in two stages: pre-training, where the model learns knowledge by predicting the next token from vast amounts of text, and fine-tuning, which includes reinforcement learning from human feedback (RLHF) to teach it helpfulness and to follow instructions.
- What breakthrough technology made modern large language models possible?
- The breakthrough technology that made modern LLMs possible arrived in 2017: the transformer. Its key idea is "attention," which allows the model to capture long-range relationships in text efficiently.
- Why do large language models sometimes "hallucinate" or make things up?
- LLMs hallucinate because they are trained to produce plausible text, not verified truth, and lack a built-in fact-checker. They can confidently state false information, highlighting the need to verify their output.
- What are "tokens" and "context window" in the context of LLMs?
- Tokens are word-piece chunks that the model sees, rather than letters or whole words. The context window is the number of tokens an LLM can hold in mind at once, ranging from thousands to over a million, influencing how much it can read before answering.
Transcript
Show Host: You have almost certainly typed a question to one and gotten back a paragraph that felt written by a person. Large language models — L-L-Ms — are the A-I behind chatbots and coding assistants, systems that generate fluent, human-like text on demand. Tonight, what they actually are, how they are trained, the transformer architecture that makes them work, why they sometimes make things up, and how they are steered to be helpful. With me are a Language Model Researcher and an A-I Engineer.
Language Model Researcher: Strip away the mystique and a large language model does one thing: it predicts the next token. A token is a chunk of text, roughly four characters. Trained on trillions of tokens — much of the public internet — the model learns which token tends to follow which. That is the entire training objective. Yet at a large enough scale, that single skill blossoms into translation, summarizing, reasoning, and writing code. Modern models carry hundreds of billions of these adjustable weights.
AI Engineer: Training happens in two stages. First, pre-training: the model reads enormous amounts of text and just predicts the next token, over and over — no human labels required. That is where its knowledge comes from. Then fine-tuning, including a step called R-L-H-F, reinforcement learning from human feedback, where people rate answers to teach it to be helpful and follow instructions. Pre-training gives it knowledge; fine-tuning gives it manners.
Language Model Researcher: The breakthrough that made all of this possible arrived in twenty-seventeen: the transformer. Its key idea is attention. As the model reads, every token gets to look at every other token and decide which ones matter for what comes next. That lets it capture long-range relationships — a pronoun and the noun it refers to, paragraphs apart — and do it in parallel rather than word by word. Every major large language model today is a transformer.
AI Engineer: Two words you will keep hearing: tokens and context. The model never sees letters or whole words — it sees tokens, those word-piece chunks. The context window is how many tokens it can hold in mind at once, anywhere from a few thousand to over a million. Everything lives in that window: your prompt, the documents you paste, and its own reply so far. A bigger window simply means it can read more before it answers.
Language Model Researcher: So how does a reply appear? One token at a time. The model produces a probability for every possible next token, picks one, appends it, and repeats — which is why you watch text stream out left to right. A setting called temperature controls how adventurous those picks are: low is focused and predictable, high is creative and riskier. What looks like reasoning is this next-token loop, running very fast.
AI Engineer: Now the famous weakness: hallucination. Because the model is trained to produce plausible text, not verified truth, it can state something false with total confidence — there is no built-in fact-checker inside. The fixes are grounding: give it real sources to quote, connect it to search or tools, and check anything that matters. Treat a language model's output as a fast first draft to verify, never as an oracle.
Language Model Researcher: Which is why alignment matters. Using human feedback and guardrails, labs shape a model to be helpful, honest, and harmless, and to refuse genuinely dangerous requests. Your prompt and the surrounding context steer its behavior turn by turn. But it is not solved — models can still be jailbroken, or reflect biases from their training data. Alignment is an ongoing discipline, and a bigger model is not automatically a safer one.
Show Host: Three takeaways. First — a large language model predicts the next token, trained on trillions of tokens, powered by the transformer's attention. Second — it works over tokens inside a context window and generates one token at a time. Third — it can hallucinate and needs alignment, so ground it with sources and verify what matters. Thank you, Language Model Researcher, and thank you, A-I Engineer.
Note: Informational only. Figures are a guide — verify before relying on them.