How AI Works

The big picture in six drawings and a set of dials, with every term explained in plain words. Click a term in a drawing to read what it means.

Token Tote by URLflows, a free Chrome extension, has these drawings and dials on its How AI Works page in Settings, and every term one click away in its panel.

Where it all fits

Each idea sits inside a bigger one. The chat assistants you use are the innermost: large language models, a kind of generative AI.

  1. Artificial intelligenceSoftware that does things we'd call smart
    1. Machine learningLearns from examples, not rules
      1. Deep learningNeural networks with many layers
        1. Generative AIMakes new text, images, audio and code
          1. Large language modelsClaude, GPT and Gemini: the chat assistants

How a model is made

Months of training first, then every question you ask runs the finished model. What it learned stays fixed until the next version.

  1. DataA vast amount of text, code and images
  2. PretrainingLearns to predict the next token, over and over
  3. Post-trainingFine-tuning and RLHF teach it to follow instructions, helpfully and safely
  4. The modelBillions of parameters, fixed at its training cutoff
  5. InferenceRuns each time you ask, and is what you pay for

What happens when you send a prompt

Everything the model sees is packed into its context window as tokens. It reads all of it, may think first, then writes the reply one token at a time.

0The context window, counted in tokensits limit

  1. Split into tokensAbout three-quarters of a word each
  2. Read it allEvery token weighed against every other
  3. ThinkOptional; more effort means more thinking
  4. Write the replyOne token at a time, each priced as output

Turn the dials: what your choices cost in tokens

Every choice changes how many tokens the model reads and writes, and that is what you pay for. Move a dial to see which choices matter most.

A rough picture for learning, at typical API prices for each kind of model. Each message adds a short question and gets a 500-token reply; thinking is written fresh each time and not sent again. Caching makes re-reading cheaper, and on a monthly plan the same tokens use up your limits instead of costing money.

Companies, models and the tools you use

A few labs train the models. Each sells them in its own apps and to developers through an API, and other tools build on them too.

CompanyModelsWhere you use them
AnthropicClaude: Haiku, Sonnet, Opus and FableClaude, Claude Code and the API
OpenAIGPTChatGPT, Codex and the API
GoogleGeminiGemini, AI Studio and the API
Microsoft and GitHubSeveral labs' modelsMicrosoft Copilot and GitHub Copilot
Many othersTheir own, or open-weight modelsTools you already use, built on the models above

How an agent works

An agent repeats a loop until the job is done. Each pass resends the growing context, which is why agents use far more tokens than a chat.

  1. GoalYou say what done looks like
  2. PlanIt picks the next step
  3. ActUses a tool: search, run code, edit a file, or another app through MCP
  4. CheckReads the result. Not done? Back to plan
  5. ReportYou review it: the human in the loop
Plan, act and check repeat until the job is done

Big jobs can split across several agents working side by side. Watch for prompt injection: an agent that reads a page can be told to do something you didn't ask.

Answering from your documents

A model's memory stops at its training cutoff, so tools look things up first and hand the model what they found. This is RAG, and it's how answers come with citations.

  1. Your question"What's our refund policy?"
  2. SearchYour files or the web, by meaning, using embeddings
  3. Best passagesAdded to the prompt with the question
  4. Answer with sourcesCheck them: models can still make things up

AI terms

Every term in the drawings, and more, in two or three sentences each: see all 63 AI terms.