Topic 03

How modern AI actually works

18 min readPart 1 — Foundations
By the end you'll be able to

Build a practical, no-math understanding of how today's AI (LLMs) works.

Llm Next Token PredictionPretraining And FinetuningTokens And Context WindowHallucination BasicsProbabilistic Not Deterministic

Topic 3 — How modern AI actually works

Goal: Build a practical, no-math understanding of how today's AI (LLMs) works.

Lesson 3.1 — The autocomplete that ate the world

Bina Velasquez is two months into her job as an AI quality analyst at Trellix Health, reviewing drafts that Scribe — the company's AI assistant — writes for small clinics. On her third day she asked Pri, the engineer who builds the thing, a question that had been bugging her: "How does it actually know what to write?"

Pri grinned and said, "It doesn't know anything. It's guessing the next word."

That sounds like a joke until you sit with it. The AI behind ChatGPT, Claude, and Gemini is a Large Language Model (LLM), and it does one mechanical thing: given a stretch of text, it predicts what comes next. Not the answer. Not the meaning. The next little piece of text.

Type "The patient reported a sore" and the model weighs every possible continuation and leans toward throat. Then it adds that word and runs again on "The patient reported a sore throat", predicting the next piece, and the next, one at a time, until a whole clinical note exists. Fluent paragraphs, built like a chain — each link is just a very good guess about what should follow.

An LLM doesn't retrieve answers. It generates the next likely word, over and over, until your reply exists.

Eight years teaching biology trained Bina to spot a student who writes beautifully and is completely wrong. That instinct, it turns out, is the whole job here — because a next-word predictor can be both at once.

Lesson 3.2 — Tokens: the unit everything is measured in

Pri said "next word," but she was rounding off. The real unit is the token — a word or a word-piece. Common words are usually one token; longer or unusual words get chopped into several. "Velasquez" might land as Vel + asquez; "hypertension" could split into hyper + tension.

The rough conversion is worth memorizing, because you'll use it constantly:

  • One token ≈ 3–4 characters of English.
  • One token ≈ 0.75 words — so ~100 tokens is about 75 words.

Tokens matter because everything you'll deal with is counted and billed in them. When Marc, the AI product manager, looks at what Scribe costs to run, he's looking at tokens. Providers quote prices per million tokens, and they charge input and output separately — the text you send in is priced differently from the text the model writes back, and output is usually the more expensive of the two.

To the billing system, a single Scribe visit note is not "a note." It's this many input tokens (the patient transcript and instructions you fed in) plus that many output tokens (the draft it wrote), each metered at its own rate. When Bina suggests trimming a bloated prompt to save money, she's really saying: fewer tokens in, smaller bill. The unit is the cost.

Lesson 3.3 — Where the "knowledge" comes from

A next-word predictor that starts out blank predicts gibberish. So how does it end up writing a competent clinical note? Training — and it happens in two stages.

Pre-training comes first. The model reads an enormous pile of text — much of the public internet, books, code — and practices predicting the next token billions upon billions of times. Each miss nudges its internal settings a hair. Do that at staggering scale and it absorbs grammar, facts, reasoning patterns, and style. This stage is brutally expensive and is done by a handful of big labs. It's where the raw knowledge and language ability come from.

A freshly pre-trained model, though, is a strange beast. It's knowledgeable but unruly — as likely to continue your question with more questions as to answer it. So comes post-training, which shapes that raw ability into something helpful, honest, and safe:

  • Supervised fine-tuning (SFT) — the model studies many examples of good prompt-and-response pairs, learning the shape of a helpful answer.
  • Alignment from feedback — people rate and rank the model's responses so it learns what "good" looks like. This is RLHF (Reinforcement Learning from Human Feedback). Increasingly, a capable model generates some of that feedback itself, which is called RLAIF (the AI-feedback version), used to scale the work beyond what humans can label by hand.

That ranking step is not abstract trivia. It's a job. The people rating responses to teach the model are doing exactly the human-in-the-loop work many AI-adjacent roles perform every day — the work Bina is being trained toward, which gets its own treatment in Topic 6.

Lesson 3.4 — Context windows and the knowledge cutoff

Two limits trip up every newcomer, and Bina hit both in her first week.

The first is the context window — how much text the model can "see" at one time. It includes your prompt, the running conversation, and any documents you paste in. Frontier models have huge windows now — typically hundreds of thousands of tokens, with a few models reaching a million or more (enough to hold whole books). Don't expect a million-token window everywhere, though; that's still the exception, not what you'll meet by default. And large as they get, every window is still finite. And here's the part that surprises people: outside the current window, the base model has no memory. Start a fresh chat and yesterday's conversation is gone, unless the system around it deliberately stores and re-supplies that history. The model isn't remembering you; something is re-feeding it the context.

The second limit is the knowledge cutoff. Everything the model "knows" came from training data gathered up to some date. Ask about an event after that date and the base model simply doesn't have it — and it inherits whatever gaps and biases lived in that data, too.

This bit Bina directly. She asked Scribe about a medication dosing guideline that had been updated three months earlier. The draft cited the old guideline, confidently, with no hint anything was stale.

The model doesn't look things up. By default, it answers from frozen training data — current only up to its cutoff.

The fix isn't magic: connect the model to live tools or search so it can fetch fresh information instead of reciting what it memorized. That's why Scribe's pipeline pulls in the clinic's current guidelines at request time rather than trusting the model's baked-in knowledge.

Lesson 3.5 — Plausible, not true (and why it varies)

Now the two behaviors that make Bina's job exist.

The first is hallucination. Because the model generates plausible-sounding text rather than retrieving verified facts, it can state something false with exactly the same confidence it states something true. There's no internal alarm that goes off on a wrong answer. Scribe once produced a note that read perfectly and named a lab test the patient never had — fluent, formatted, and fabricated. Dr. Marchetti, the physician on the pilot, caught it in a glance. A patient might not have. Every output needs human verification (Topics 5 and 7); that requirement is the foundation of the whole AI-adjacent field.

The second is that LLMs are probabilistic, not deterministic. At each step the model has a spread of likely next tokens and samples among them, so the same prompt can produce different answers on different runs. A setting called temperature controls how adventurous that sampling is: low temperature stays predictable and repetitive; high temperature roams toward more varied, creative, riskier text.

Here's the rule worth carrying out of this lesson: when you want the same steady, faithful output every time — clinical notes, pulling fields out of a document, sorting tickets into categories — you reach for low temperature; when you want range and surprise — brainstorming, marketing copy, draft variations to choose from — you can afford to turn it up. That's exactly why Trellix keeps Scribe's temperature low: a visit note should read the same careful way for the same transcript, not reinvent itself each run.

When Bina first noticed Scribe giving two different drafts for the identical transcript, she assumed a bug and flagged it. Pri laughed gently: not a bug. Sampling. An LLM is not a calculator that returns one fixed answer — it produces a plausible response from a range of them.

Which is the punchline of this whole topic. If the output were guaranteed correct and identical every time, no one would need to evaluate it. Because it's plausible-but-variable, someone has to judge it. That someone is increasingly people like Bina.

Worked example — Tracing one Scribe note end to end

Dr. Marchetti finishes a visit and Trellix's Scribe turns the recorded conversation into a draft note. Watch every idea from this topic show up in that one trip.

The transcript plus the clinic's note-format instructions go in as the prompt — counted as input tokens, sitting inside Scribe's context window alongside the current guidelines the pipeline injected (because the model's own knowledge cutoff can't be trusted for live medical rules). The model then writes the draft one token at a time, each token its best next-token prediction, the finished draft metered as output tokens at its own price.

Because the model is probabilistic, running the same transcript twice gives two slightly different drafts — Trellix keeps temperature low so clinical notes stay steady. The draft's fluency traces back to pre-training; its sensible structure and safe tone trace back to post-training (the SFT-and-RLHF shaping).

Then Bina reviews it, because somewhere in that plausible draft might sit a hallucination — a confident, well-formatted falsehood. She catches a stated allergy the transcript never mentioned, flags it, and rewrites the line. Her rating of that draft feeds back into improving the system: human-in-the-loop, the loop closing. One note, every concept in this topic, doing real work.

Key terms

  • LLM (Large Language Model) — the AI behind ChatGPT/Claude/Gemini; at heart a next-token predictor.
  • Token — a word or word-piece; ~3–4 characters or ~0.75 words. The unit of usage, limits, and cost.
  • Pre-training — the expensive first stage where the model learns language and knowledge by predicting next tokens across massive text.
  • Post-training (SFT + RLHF/RLAIF) — the second stage that makes the model helpful, honest, and safe using example responses and human (or AI) feedback.
  • Context window — how much text the model can see at once (prompt + conversation + documents); large but finite, with no memory beyond it by default.
  • Knowledge cutoff — the date its training data stops; the base model can't know events after it unless connected to live tools.
  • Hallucination — a confident, plausible statement that is false, because the model generates text rather than verifying facts.
  • Probabilistic / temperature — the model samples among likely tokens, so answers can vary; temperature dials how much.

Try this

Open any chat AI you have access to and run the same prompt three times in fresh chats — something with room to vary, like "Write a two-sentence welcome message for a new patient." Notice how the wording shifts each time: that's probabilistic sampling you're watching live. Then ask it about something that happened last week in the news. Read the answer for a knowledge-cutoff tell — a hedge, a refusal, or a confident claim you should go verify. Five minutes, and the two core behaviors from this topic stop being abstract.

Common pitfalls

  • Believing the model "knows" or "looks things up." By default it generates from frozen training data, not a live lookup. Confident does not mean current, or correct.
  • Trusting fluent output. A hallucination is fluent and well-formatted by design — that's exactly why it slips past. Polish is not evidence.
  • Treating different answers as a bug. Variation from the same prompt is normal sampling, not a malfunction. If you need it steady, you lower temperature, not file a ticket.
  • Forgetting the context window has an edge. Paste in too much and early content falls out of view; the model can't use what no longer fits, and it won't warn you.

Key takeaways

  • An LLM is a sophisticated next-token predictor — it builds replies one token at a time from learned patterns.
  • Tokens (~4 characters / ~0.75 words) are the unit of everything; pricing is per million tokens, input and output charged separately.
  • Ability comes from pre-training (knowledge + language) plus post-training — SFT and RLHF/RLAIF — the human-feedback work many AI-adjacent roles do.
  • The context window is large but finite with no memory beyond it, and a knowledge cutoff means the base model can't know recent events without live tools.
  • It's probabilistic and can hallucinate — plausible, variable, sometimes confidently wrong — which is why human verification and evaluation are the core of this field.
Score 100% to unlock the next topic

Preparing your quiz…