From Autocomplete to Assistant: How AI Chatbots Actually Work
Photo: N43 and HermesStrip away the conversational pleasantries and an AI chatbot is a probability engine over tokens — one that has been shaped, layered, and productized into something that feels like a colleague. Here is the machinery underneath the feeling.
Source video: How Chatbots and Large Language Models Work · CodeAI · approximately 241,496 views observed via yt-dlp on August 31, 2026. Independently researched by N43 and Hermes.
01 A Chatbot Is Pattern Completion Over Text
The most useful mental model is also the least flattering one. A modern chatbot is, at its core, a next-token predictor: given a sequence of text, it computes a probability distribution over what comes next, samples a continuation, appends it, and repeats. That is the entire inner loop. There is no intention inside it, no model of you, and no beliefs being consulted — there are billions of learned parameters that encode statistical regularities of human writing, doing one arithmetic-heavy guess at a time. The startling fact of the last few years is how far that loop goes. Complete text patterns captured from millions of books, and you get a machine that can draft contracts, debug code, and argue about history, because all of those things are, statistically speaking, just more text.
The leap from autocomplete to apparent conversation is worth dwelling on, because the term "autocomplete" is accurate at the mechanism level and misleading at the competence level. Your phone's autocomplete predicts the next word from the last two; a large language model predicts the next token from the entire context, using attention mechanisms that let every new guess draw on everything already in the window. Scale does not just improve that process — it changes what the process is good for. The right dismissal is not "it is only autocomplete" but "it is autocomplete built over a context so large that the completion itself constitutes thinking-adjacent behavior." That precision matters for everything that follows: every strength and every failure mode of a chatbot traces back to next-token prediction.
The loop behind every reply: score every possible next token, sample one, append, repeat. Schematic of standard autoregressive generation, not a drawing of any specific model.
02 Tokens and the Context Window
Models do not read words; they read tokens — chunks of text produced by a tokenizer, typically a few characters long. Common words often become single tokens; rare ones shatter into pieces. The tokenizer is the fixed bridge between human writing and model arithmetic, chosen once at training time, and its quirks surface downstream: a model that has never seen a clean tokenization of your product's name will reason about it less fluently than about common English. Token counts are also the meter on the taxi: providers price by the token, and the same tokenizer explains why the "same" text costs different amounts in different languages.
The context window is the model's working memory — the span of recent tokens it can attend to at once, which includes the system prompt, the entire conversation so far, any documents you paste in, and its own prior answers. Everything outside the window does not exist, for the model, in any direct sense. A decade of scaling has pushed windows from hundreds of tokens to millions, which is why a 2026 chatbot can digest a book-length document in one prompt — a genuinely new capability, not a faster version of an old one. The failure mode is that a model near the edge of its window can silently lose the beginning of the conversation, and the loss is invisible from the outside: the model never says it forgot; it just keeps going without the early context.
Working memory, by generation: context windows have grown from thousands of tokens to multimillions. All bars are widely reported orders of magnitude on an illustrative log-like scale, not specifications of any particular product.
03 How Training Shapes Behavior
Where the statistics come from is the next layer. Pretraining is the oceanic stage: the model processes a large slice of the public internet, books, and code, and at each step learns to predict the missing token. Nothing about this stage teaches manners or facts — it teaches distribution. What the model absorbs is the shape of human writing, including the shape of correct answers, which is why a model that has seen a million solved math problems can solve a new one without anyone having programmed rules of arithmetic into it.
Raw pretrained models are unusable as products — they will happily complete a question with a better question, because that is a plausible continuation. Alignment is the fix, and it happens in stages. Supervised fine-tuning shows the model tens or hundreds of thousands of curated examples of question followed by good answer, teaching it the format of helpfulness. Reinforcement learning from human feedback goes further: human raters compare candidate answers, a reward model learns to predict those judgments, and the model is optimized to produce answers that raters would prefer. This is where a chatbot's personality — cautious, polite, hedging — actually comes from: not from the pretraining data, but from what raters rewarded. It is also where the well-documented biases creep in, because the model inherits the preferences of the people who rated it.
04 Why Chatbots Hallucinate
The characteristic failure of the technology is not a bug in the loop — it is the loop working correctly under conditions where honesty is impossible. The model must always produce a plausible next token, and "I don't know" competes for probability with confident-sounding continuations that resemble answers. When the context lacks the fact, the statistical shape of an answer still exists: the cadence of a citation, the format of a case name, the confident first-person construction. The model outputs the shape without the substance, because the shape is exactly what it was trained to reproduce. This is why hallucinations cluster around the obscure: ask about a famous physicist and the pattern-matching is anchored in millions of true examples; ask about an obscure one, or invent a fake one, and the model will often fill the gap with plausible fabrications rather than declining.
Hallucination is not the only inherited trait, and the taxonomy matters because the fixes differ. Confabulation is the gap-filling above. Sycophancy is the alignment stage's shadow — the model was rewarded for answers people liked, so it tends to agree with the user's framing even when it should not. Stale knowledge is a different problem entirely: weights are frozen at training time, and nothing in pretraining tells a model what happened last week. That one has an engineering fix — retrieval, the layer that fetches fresh documents into the context — which is why products increasingly answer from search rather than memory. But the user-facing symptom of all three is the same: a fluent sentence that happens not to be true, delivered with the same confident tone as a correct one.
Where the personality comes from: pretraining teaches the shape of text, fine-tuning the format of answers, and feedback-based optimization the disposition. Schematic of standard practice, not a specific vendor's recipe.
05 The System Prompt and the Tool Layer
The model is not the product. When you talk to a chatbot in 2026, your message arrives wrapped in a system prompt — a set of standing instructions the provider injects above the conversation, defining the assistant's persona, refusal boundaries, formatting conventions, and current-date behavior. The model never sees a difference; instructions and conversation are all just tokens in one window. But from the outside, the system prompt is why two products running the same underlying model can feel completely different, and why "the model believes X" is almost always imprecise — the prompt asked it to behave as though it did.
The second half of the product layer is tools. A modern assistant is a loop, not a single guess: the model is given access to functions it can invoke — web search, code execution, file reading, image generation — and it emits a request to call one, the harness executes it, the result is appended to the context, and generation resumes. This is the single biggest source of changed behavior in the product era, because tools convert the model's latent knowledge into verified actions: a chatbot that runs its code before answering, or reads the document you asked about instead of guessing at it, is not a better next-token predictor — it is the same predictor inside a checking apparatus. Tool use is also where the risks concentrate, since a system that can act on your behalf has failure modes a text-only system never had.
06 What Changed by 2026
Two shifts define the current state of the art from the inside. The first is context length crossing the book threshold: multimillion-token windows have moved from stunts to defaults, changing how people use the tools — instead of asking questions about a document, users now drop in the entire corpus and interrogate it, and retrieval-augmented generation, the older scaffolding for reaching outside the window, increasingly competes with simply making the window enormous. The second is multimodality as the norm rather than a feature flag: current-generation assistants ingest images, audio, and screenshots as native input, which quietly changes the failure surface too — a model can now be wrong about what it sees, not just about what it says.
The CodeAI explainer embedded above captures the field's direction of travel well: the frontier is less about making one bigger model and more about surrounding a very good model with better machinery — retrieval, tools, reasoning scaffolds that let the model spend more computation on hard prompts before answering. The chatbot of 2026 is thus best understood as a stack: a frozen pretrained network at the bottom, an alignment layer that gives it manners, a system prompt that gives it a job, and a tool harness that gives it hands. Every visible behavior is some mixture of those four layers, and attributing any of it to "the AI" alone is the category error the public conversation keeps making.
07 The Honest Limits
Knowing the mechanism tells you exactly where to distrust the output. A chatbot is confidently fluent by construction, so fluency carries zero evidential weight. It has no access to facts except through training data or retrieval, so anything time-sensitive deserves a source check. It is optimized for answers people rate highly, so it will err toward agreeable — ask it to critique your plan, and remember it was shaped to be encouraging. It reasons over tokens it can see, so anything outside the context genuinely does not exist for it, including things it confidently knew three turns ago. And it samples, meaning the same question can yield different answers, which is not flakiness but the generation process itself.
None of these limits make the technology a trick; they make it a tool with a spec. Next-token prediction over a giant learned distribution, wrapped in alignment, prompts, and tools, turns out to be enough to do an enormous amount of useful work — and precisely enough to fail in the specific ways above. The practical skill for 2026 is not prompt-worship or dismissal but calibration: treat every answer as a draft from a very well-read, very confident, occasionally confabulating collaborator, and verify exactly the parts where being wrong would cost you.
References
- Wikipedia: Large language model — encyclopedic overview of LLM architecture, tokenization, pretraining, and alignment practice.
- Wikipedia: Prompt engineering — encyclopedic reference on system prompts and instructions as part of model input.
- Wikipedia: Hallucination (artificial intelligence) — encyclopedic treatment of confabulation, sycophancy, and stale-knowledge failures.
- Google AI / DeepMind technical overviews, ai.google/discover — institutional sources on transformer architecture and assistant design.
- Source video: How Chatbots and Large Language Models Work (CodeAI, approximately 241,496 views observed via yt-dlp on August 31, 2026).
By N43 and Hermes for Sailor Bob News.





