Every word, explained.
No prior knowledge assumed — every term starts in plain English, with an analogy, the mistake almost everyone makes first, how it actually works, a worked example, a diagram, what to say in an interview, and three questions to check yourself. Levels are only a hint about who usually meets a term first; read in any order you like.
Foundations17
A program that has read a staggering amount of text and learned one trick very well: guess what comes next. Chat, agents and search all run on that trick.
The bite-sized chunk of text a model reads and writes — usually a word or part of one. Length limits, speed and price are all counted in tokens.
How much text a model can hold in one go — instructions, chat, documents and the answer, all together. Outside the window, it does not exist for the model.
Everything you send the model in one request: the instructions, the examples, the documents and the user's question. Your main steering wheel.
The facts a model soaked up during training and stores inside its own numbers. Broad, instant, and frozen on the day training stopped.
When a model says something fluent, confident and simply not true — in the same tone it uses when it is right, which is what makes it tricky.
Training an existing model a little further on your own examples, so it picks up your format, tone or task. Lovely for style, poor for facts.
Search first, then answer: find the documents that matter, paste them into the prompt, and ask the model to answer from them — with citations.
The whole pile of documents your search can see. If something is not in there, no answer will ever mention it.
How a model works out which earlier words matter for the word it is writing right now.
Reusing the work already done on a prompt's repeated opening, so the next request that starts the same way is cheaper and faster.
Forcing the model to produce output that fits your format — valid JSON every time — by blocking any next token that would break it.
Training a small, cheap model to copy a big model's answers on your task. Most of the quality, a fraction of the bill.
Models that take in more than words — photos, scanned PDFs, charts, audio, video — and reason about them alongside your text.
Someone asks in plain words, the model writes the database query, the system runs it safely and turns the result into an answer.
Retrieval where the model decides what to look up, where, and whether to search again — a short loop instead of one fixed search.
Using a model with a clear marking scheme to grade your AI's answers, so a test run can cover hundreds of cases instead of five.
LLM Foundations27
A program that learns a pattern from examples instead of being given rules. The machinery under every model on this site.
The learned numbers inside a model. '70B' means 70 billion of them — which sets memory and cost, and on its own says little about quality.
The design inside nearly every modern model: stacked layers where each word gathers context from the others, then refines itself.
The first and most expensive training stage, where a model learns language and world knowledge by guessing the next word, trillions of times.
The one task a model is trained on and runs every time it answers: given the text so far, score every possible next token.
The text, code and examples a model learned from. Its mix, quality, recency and licensing decide what the model knows and how it behaves.
The measured pattern that error falls predictably as parameters, data and compute grow — with each step costing many times more than the last.
Training a base model on pairs of 'instruction' and 'good response', which turns a text continuer into something that answers you.
Training on human preferences: people pick the better of two answers, those picks train a scoring model, and the model learns to score well.
Methods like DPO that train straight from 'chosen vs rejected' answer pairs — RLHF-like results without the reward model or the RL loop.
Fine-tune by training a small add-on while the original weights stay frozen. Cheap, fast, and swappable per task or customer.
A model picking up a task purely from the instructions and examples in your prompt, with nothing about it changed.
Showing the model a handful of worked examples in the prompt so it copies the format, labels and tone you want.
Having the model write its working before the answer. Better on multi-step problems, paid for in tokens.
Models trained to think at length before answering: much better at hard maths, code and planning, slower and pricier per answer.
The dial between predictable and adventurous when the model picks its next word. It changes variety, not knowledge.
Sample only from the smallest group of likely words that together cover p of the probability — 90%, say — and ignore the weird tail.
The raw scores a model gives every possible next word, before they are turned into probabilities.
Running a trained model to get output. Training happens occasionally; this happens on every single request.
The saved intermediate results for earlier words, so each new word doesn't re-read the whole conversation. It eats GPU memory.
Storing a model's weights in 8 or 4 bits instead of 16, to cut memory and speed things up — at a quality cost you have to measure.
How long the user waits before any words appear. With streaming, this is what 'fast' actually means to them.
Running many requests through the GPU together, so one read of the weights serves lots of tokens. More throughput, slightly slower per stream.
A small model guesses the next few words and the big model checks them all in one pass. Same output, fewer slow steps.
A model made of many sub-networks where each word only uses a few, so a huge model computes like a much smaller one.
Models whose trained numbers you can download and run yourself. Closed models live behind an API. You are trading control for convenience.
The date a model's training data stops. Anything after it is unknown — and the model usually doesn't realise that.
Embeddings & Encoders13
A list of numbers that stands for the meaning of a piece of text, arranged so that similar meanings land close together.
The space embeddings live in, where 'close together' means 'similar in meaning'.
A model that reads text and turns it into meaning-numbers, instead of writing a reply.
Turns the question and each document into vectors separately, then compares them. Fast enough to search millions.
Reads the question and one document together and scores the match. Much sharper than comparing vectors, far too slow to run over everything.
A score from −1 to 1 for how closely two embeddings point the same way: the usual way to ask 'are these two texts about the same thing?'
Multiply two lists of numbers position by position and add it all up. The cheapest way to ask 'do these two texts mean the same thing?'
How many numbers are in each embedding — 384, 768, 1024, 3072. Storage, speed and cost grow with it in a straight line. Quality does not.
Symmetric search matches like with like (ticket to ticket). Asymmetric search matches a short question to the long passage that answers it.
A tiny label such as 'query: ' or 'passage: ' stuck in front of text before embedding it, telling the model which role this text is playing.
Embeddings trained so the first few hundred numbers work on their own: cut 3072 down to 256 and keep most of the quality.
The big public scoreboard for embedding models. Perfect for picking three to try; your own test set decides the winner.
Training an embedding model a bit further on your own question-and-passage pairs, so your field's jargon finally lands near its meaning.
Chunking & Ingestion14
Cutting documents into passages small enough to search and hand to a model. Usually a few hundred tokens, cut where the document itself breaks.
Repeating the tail of one chunk at the start of the next, so an idea cut in half still appears whole somewhere.
Cutting where the topic changes rather than every N words, spotted by a drop in similarity between neighbouring sentences.
Search small chunks so the match is precise, then hand the model the bigger section around them. Retrieve small, return big.
Adding a short model-written note to each chunk saying where it came from, before it is stored. Anthropic measured 35–67% fewer retrieval misses.
Pulling text out of PDFs and scans with reading order, headings, tables and figures intact — so everything downstream has structure to work with.
Turning pictures of text — scans, photos, faxes — into text a computer can actually read. Mistakes here spread into everything downstream.
The machinery that collects your documents, parses, chunks, embeds and indexes them — and keeps the index honest as sources change and vanish.
The record book for ingestion: one row per source document — where it came from, its version, its status, who may see it, which chunks it made.
A fingerprint of a document's text. Same text, same fingerprint — so you can skip unchanged files, spot duplicates and retry safely.
Change data capture: reading a database's own change log so your search index follows every insert, update and delete within seconds.
A little note saying 'this was deleted', travelling through the system so every copy and index learns to drop it.
Rebuilding the whole index the new way — new model, new chunker, new fields — beside the live one, then switching over once it checks out.
The labels stored next to each chunk — customer, permissions, source, date, page — used for filtering, access control and citations.
Retrieval & Search22
Good old keyword search: find the documents containing the words you typed. Fast, easy to explain, and still unbeatable for IDs, codes and names.
The keyword scoring formula behind most search engines: rare words count more, repeats count less and less, long documents don't win by being long.
Keyword search with a brain: a model writes the weighted word list, and adds related words the text never used.
Search by meaning: turn the question and every passage into number-lists, and return the passages whose numbers sit closest.
Run keyword search and meaning search side by side, then merge the two lists — each one covers what the other misses.
Search that goes after what you meant rather than the words you typed. Usually embeddings, plus a reranker to tidy up the top.
Approximate nearest neighbour search: find vectors close to your query without checking them all. Give up a sliver of accuracy, gain huge speed.
The most common way to index vectors in memory: a layered map of 'who is near whom', walked greedily from the top down.
Sort the vectors into buckets, then only search the buckets nearest your question. Cheap to build, easy to split across machines.
Squash each vector into a handful of bytes by describing it with 'standard pieces' from a learned catalogue. 3,072 bytes become 64.
Storing each number in an embedding with fewer bits — 16-bit, 8-bit, even 1-bit — to cut memory 2–32×, with a re-check pass to win the accuracy back.
How many of the genuinely closest vectors your fast index actually returned. Measured against slow exact search, not against human opinion.
Restricting a search to items whose fields match conditions — this customer, this language, after 2024 — without quietly wrecking recall.
The cheap first pass that cuts millions of items down to a few hundred, so something slower and smarter can order them properly.
How many results a stage returns. Early stages want lots (100+); the few you hand the model want to be few (5–10).
Turning the user's messy message into a proper search query: resolving 'it', expanding jargon, dropping the small talk.
Breaking a question that is really three questions into parts, searching for each, then answering from all the evidence together.
Have the model write a pretend answer first, then search with that instead of the question — because answers look like documents, and questions don't.
Working out what kind of request just arrived, so it can be sent down the right path: document search, database query, tool call, or a polite 'no'.
A store built to search embeddings quickly, with filters, updates, deletes and backups. Often Postgres with pgvector is already enough.
Splitting an index across machines so each holds a slice. Buys you size and write throughput — not a faster single query.
Keeping copies of each shard on several machines, so you survive a failure and can answer more queries at once.
Ranking & Generation9
A slower, sharper model that re-scores the top 50–200 candidates, so only the best 5–10 ever reach the model writing the answer.
A merge trick for two result lists: score each document by its position in each list, not by the raw numbers. No calibration needed.
Combining retriever scores rather than ranks: rescale each list to a common range, then blend them with a weight you tune.
Turning ranked chunks into an actual prompt: drop duplicates, fit the token budget, order them, label them so they can be cited.
Models used to overlook facts buried in the middle of a long prompt. Finding one fact is largely fixed; joining several across a long text still isn't.
Making the model answer from the sources you handed it rather than from memory — and then checking that it actually did.
Linking each claim in an answer to the exact passage that backs it — and measuring whether those citations are right and complete.
Letting the system say 'I don't know' on purpose when the evidence isn't there, instead of guessing beautifully.
Reusing a stored answer when a new question means roughly the same as an old one. Cheap and fast, with a real risk attached.
Agents22
An AI that is allowed to act, not just write: it picks a tool, reads the result, picks again — until the goal is met or a limit stops it.
In a workflow, you write the steps and the model fills them in. In an agent, the model picks the steps. Predictability versus flexibility.
The model asks for something it can't do alone — 'call get_order_status with order 48213' — and your code decides whether to actually do it.
The cycle at the heart of every agent: the model decides, your code runs a tool, the result goes back in, repeat — until done or stopped.
Having the agent write out its steps before acting — and rewrite them when a result contradicts the plan.
The model reviews its own work and tries again. Works well when the review has something real to check against — tests, a validator — and much less without.
A fixed sequence of model calls, each feeding the next, with your own checks between the steps.
Several agents with their own contexts, instructions and tools working one task. Strong for parallel breadth, and roughly 15× the tokens of a chat.
One model looks at the task, decides what pieces are needed, farms them out to workers, and merges what comes back.
One agent passes a task to another — or to a person — with a structured briefing, and the tools and permissions change with it.
Model Context Protocol: an open standard for plugging tools and data into AI apps. Rather like USB, but for AI.
How an agent keeps anything beyond one request: working memory in the context, plus a long-term store it writes to and searches later.
Deciding exactly what goes into the model's context at each step — and what stays out — to get the most signal per token.
An agent working a screen the way a person does — look at a screenshot, click, type, repeat. The fallback when there is no API.
A walled-off space where an agent's code and actions run, with only the files, network and credentials it genuinely needs.
Checks around a model or agent that block, fix or escalate unsafe inputs, outputs and actions — layered, with the important ones in code.
A person reviews, approves or corrects the AI's work at chosen moments — usually just before anything irreversible.
The rules that end an agent's run: task done, or a cap on turns, tokens, time, spend, repeats or errors — each logged with a reason.
Running agent workflows so progress is saved step by step, and a crash, a deploy or a two-day wait doesn't redo what already happened.
Judging an agent's whole path — which tools, in what order, how safely, how cheaply — and not just whether the final answer was right.
Designing an agent's tools — names, descriptions, inputs, outputs, errors — so the model picks the right one and uses it well.
What a run costs in tokens, money and time. Because the whole history is re-sent each turn, it grows faster than you'd guess.
Evaluation & Metrics14
A fixed, version-controlled set of realistic questions with known-good answers, so every change gets scored the same way.
The test runner for AI behaviour: run the golden set through the real pipeline, score it, and report what changed since last time.
Of all the documents that should have been found, how many made it into the top k. This is the ceiling on what your system can answer.
Of the results you returned, how many were actually relevant. Precision@5 of 0.4 means two of your five were useful.
A ranking score for when some results are more relevant than others, and being near the top counts more. 1.0 is the perfect order.
How far down the list the first good result appears, averaged over all your questions. First place scores 1, second 1/2, third 1/3.
How much of an answer is actually supported by the sources it was given. Measures grounding, not truth.
Of the chunks you gave the model, are the useful ones at the top? Noise sitting above the evidence costs more than noise below it.
Speed at a percentile: p50 is the typical request, p95 and p99 are the slow tail. Targets use the tail, because averages hide the people waiting.
Queries per second. For LLM apps it is only the starting number: you also need concurrency and tokens per second.
A written target for how well a service should behave: '99.5% of answers under 5 seconds, over 30 days'. The gap you are allowed to miss is the error budget.
Cheat on purpose: hand one stage perfect input and see how good the answer gets. The jump tells you which stage to fix.
Read your actual failures, label why each happened, count the groups, fix the biggest. Unglamorous, and hard to beat.
The slow slide where a system that scored well at launch gets worse, because users, documents, models or the right answers all moved.
Evals & LLMOps23
Decide what number a change should move, build the cases that measure it, then change one thing and read the difference.
Offline eval scores a fixed test set before release. Online eval watches real users afterwards. Offline is the gate; online is the verdict.
A written scoring guide: one observable criterion per line, a small scale, and an example anchoring each score.
Grade by asking which of two answers is better, rather than scoring each alone. More reliable for subjective quality — if you swap the order.
People labelling model outputs against a rubric. The ground truth every AI judge is measured against — and the most expensive data you own.
How often two graders agree beyond luck, usually Cohen's kappa. Below about 0.6, your labels — and any judge checked against them — cannot be trusted.
A public, fixed test and scoring rule — MMLU, GPQA, SWE-bench — for comparing models. A coarse filter, never a stand-in for your own test set.
When test questions, or close paraphrases, were in a model's training data — so the score measures memory rather than skill.
A CI check that runs your evals on every prompt, model or config change and blocks the rollout if quality drops beyond the noise.
Randomly split live users between the current version and the new one, then compare an outcome you chose in advance.
Whether the difference you're looking at is bigger than the random wobble. Report confidence intervals, and pick your sample size before you run.
Inputs, labels or conversations written by a model to fill gaps. Quick to produce, trustworthy only after filtering, de-duping and human spot checks.
The weekly loop that turns production traces into labelled failures, new test cases and fixes — so each week of traffic makes the system better.
Attacking your own AI on purpose — jailbreaks, injections, data extraction, unsafe tool calls — to find the failures before anyone else does.
An input crafted to talk a model out of its own rules: role-play, encoded text, long fake conversations, odd suffixes.
Finding and masking personal data — names, emails, IDs, health details — before it reaches a model, a log or a vendor.
One service every app calls instead of calling model providers directly: keys, routing, fallback, limits, budgets, caching, redaction and logs in one place.
Capping requests and tokens per key, customer or user per time window, so one caller cannot drink the shared quota.
Routing to a backup model or provider when the primary errors out, times out or is overloaded. Only safe if the backup passed the same evals.
Treating prompts as numbered, unchangeable bundles pinned to a model snapshot and logged on every call, so any output traces back to what produced it.
What it really costs to answer one request: input, cache writes and reads, output, hidden reasoning, retrieval, reranking, tool calls and retries.
A provider retiring a model on a set date. Every prompt, eval and fallback that depends on it needs migrating and re-checking before requests start failing.
Whether stated confidence means anything: of the answers given 80% confidence, about 80% should be right.
Production & Ops16
Doing something twice leaves things exactly as doing it once. This is the property that makes retries safe.
How a busy system tells its callers to slow down — bounded queues and honest 429s, instead of buffering until everything falls over at once.
A parking spot for messages your workers keep failing on, so one bad item stops blocking everything behind it.
Wait longer after each failed retry — 1s, 2s, 4s — plus a little randomness, so a struggling service isn't hammered by everyone at once.
Run the new version beside the old one, check it on real infrastructure, switch all traffic at once, and keep the old one warm for an instant rollback.
Writing the same change into two stores. Done the obvious way it drifts apart; the outbox pattern plus change data capture makes it stick.
Send a copy of real requests to the new version, show nobody the results, and compare outputs, latency and cost before risking live traffic.
Release to a small slice of real traffic first — 1%, then 5%, then 25% — compare against the old version, and roll back if anything gets worse.
A switch outside the code that turns a path, model or prompt on or off — per user, per customer, per percentage — with no redeploy.
A nickname that points at a real index, so you can build a new one and repoint every reader in a single step.
The background tidy-up that rewrites an index without its deleted entries, winning back space and speed.
Being able to work out why production did something, without shipping new code to find out.
Time to live: how long a stored or cached item stays valid. Too long serves stale answers; too short throws the savings away.
A scheduled audit comparing the source of truth with everything derived from it — index, cache, permissions — and repairing the gaps.
When a dependency dies, serve something smaller but still useful — a lighter model, a cached answer, the sources alone — instead of an error page.
The blameless write-up after an incident: timeline, impact, causes, what went well, and owned actions with dates.
Security & Tenancy9
Serving many customers from shared infrastructure while keeping their data, quotas and performance apart. How far you isolate is a cost-versus-risk call.
One customer's heavy load — a bulk import, a runaway agent — making everyone else on the same infrastructure slow.
Who is allowed to see a document. In RAG this has to be checked while searching, or the model will quote files the user cannot open.
If you cannot confirm something is allowed, treat it as not allowed. Fail-open is the opposite: keep serving and skip the check.
Text the model reads as instructions — typed by a user, or hidden in a page, email or document an agent fetches. No filter fully fixes it.
Getting data out of a system without permission. For agents: a tool call, a fetched URL, or a rendered image whose address carries the data.
Give every user, service and agent only the permissions this task needs, only for as long as it needs them.
How much breaks when one thing fails: how many users, customers, records or actions. Keep it small and known.
Stacking independent safeguards so that one failing — and each will, sometimes — is not the whole story.
Interview Craft3
Situation, Task, Action, Result: a shape for interview stories. Spend most of it on what you did and what changed — with numbers.
A choice where getting more of one thing costs you another. Good answers name the axes, the deciding constraint, and when they'd switch.
A senior individual-contributor level whose scope crosses teams: setting direction, de-risking big bets, and making other people better — mostly in writing.