Index Ai Academy
Phase 1 · Building with LLMs · Prompting

What an LLM actually does

Next-token prediction, and why that produces useful behavior.

About 25 minutes · Free lesson

Start this lesson

Why it matters

You can send a request and read the reply. To build something reliable on that call, you need a working picture of what happens in between. Most prompting advice in Phase 1, and most of the ways LLM apps fail, follow from one fact: the model writes its reply by predicting the next token, over and over. Once that clicks, you'll know when to trust a model, when to check it, and when to hand the job to ordinary code.

What you'll be able to do

  • Describe how a model writes a reply one token at a time
  • Explain where a model's knowledge comes from, and why it can sound sure and still be wrong
  • Spot tasks that need checking or plain code instead: counting, recent facts, exact math
  • Simulate the generation loop in Python with a toy probability table

Before this lesson

Next in this phase: Tokens and the context window