Next-token prediction
Next-token prediction
- The model predicts one token at a time — short text chunks (a word, sub-word, or punctuation).
-
A learned stop token
(
<|END|>) signals end-of-turn.
Chat is just structured text
-
System:/User:/Assistant:are training-time conventions. The model sees a flat string and continues it. - Fully stateless — every call re-sends the full history. No memory or learning between turns.
Tools are text too
- Tool definitions are added to the prompt; the model emits a tool call as text in a special format.
- The runtime watches for that, executes the tool, and feeds the result back as a new turn.
- This is the foundation of an agent.
Hallucinated citations
-
The company is fictional, but the assistant is already committed
partway into a real-looking URL
(
…sec.gov/news/press-release/) — the only plausible continuation is a specific release number, so the model invents one. - Every token is statistically likely; the result is a confident, official-looking link the model never looked up. Paste it in a browser: it either 404s, or resolves to a real press release about a completely unrelated company — both prove the point.
- This is why you ground facts — attach the source document or give the model a search tool, rather than asking it to recall.
-
The grounded example is identical — same question,
same pre-seeded reply ending at
…press-release/— but asearch_webcall and its result are now in the window. The model completes the URL from the tool response (2025-187-northridge-…), every time. Ungrounded it invents a different number on every run.