All Foundations
Stage 1 · Talk to the AI Beginner Last reviewed June 2026

What Is an LLM? (Tokens & Context Explained)

Understand the engine you're driving — what an LLM actually does, and the two words (tokens, context) that explain most of its behaviour.

You'll vibe code better if you understand, at a basic level, what's under the hood. A large language model (LLM) isn't magic and isn't a search engine — it's a very sophisticated next-word predictor. That single idea explains most of what it does well and where it slips up.

Where you are: 1 · Talk to the AI → you are here 2 · Understand the build 3 · Check & secure 4 · Ship it
A prompt is split into tokens, the model predicts the next token repeatedly, then tokens become the answer
How an LLM turns words into answers

It Predicts the Next Token

An LLM reads your text, breaks it into tokens (chunks roughly the size of a short word or word-part), and repeatedly predicts the most fitting next token. Do that thousands of times and you get a full, coherent answer. It's not looking anything up — it's generating, one piece at a time, based on patterns learned from huge amounts of text.

The Context Window

The context window is how much text the model can "hold in mind" at once — your prompt plus its reply. If a conversation gets very long, the earliest parts can fall out of view. That's why a focused, well-structured brief beats a rambling one: it keeps what matters inside the window.

THE ONE-LINE VERSION

An LLM predicts text one token at a time. The context window is how much it can read at once — keep your brief inside it.

A search engine looks the answer up; an LLM predicts the next token to generate one
Generate, don't retrieve

Why This Explains Its Quirks

Because it generates rather than retrieves, an LLM can sound completely confident while being wrong (a "hallucination"). It's predicting plausible text, not checking facts. That's not a reason to distrust it — it's a reason to verify its output, especially for code that touches money, data, or security.

Q: Does the model remember me between sessions?

A: By default, no — once the context window resets, it starts fresh. Anything it needs to know, you provide in the conversation.

Q: Why does it sometimes make things up?

A: It generates plausible text rather than looking up facts, so it can produce confident-sounding errors. Always verify anything important.

The Prompt Template

Because the model only "remembers" what's in the context window, re-orient it whenever a chat gets long or starts to drift:

Quick recap before we continue.
What we're building: <one line>.
Decisions made so far: <bullet list>.
Constraints to keep: <bullet list>.
My next request: <what you want now>.

Next Steps

Now that you know how it thinks, learn how to direct it in How to Brief an AI and how to trust-but-verify in How to Check AI-Written Code.

Related foundations