AI engineering

Stage 1 of 8 · 8 lessons · ~3 weeks

How LLMs work: tokens and context

What a model does when it answers: text becomes tokens and the model predicts one token at a time inside a fixed context window. Tokens are both your bill and your limit, so learn to decide what earns a place in the context.

Start: What a model does: predicting the next token

Lessons· one lesson for each topic, in this order

  1. 1What a model does: predicting the next token
  2. 2Tokens and tokenisation
  3. 3The context window as a budget
  4. 4Token pricing and rate limits
  5. 5Temperature and sampling
  6. 6Why models hallucinate
  7. 7Reasoning models and effort settingsOptional
  8. 8Choosing a model: quality, cost, latency

Start with· follow one of these

Keep handy

Also worth your time

Before moving on: Take one real prompt from a feature you want to build, count its input and output tokens, work out its cost per 1,000 requests on two different models, and write down which parts of the context actually earn their place.

Tauseef's advice
You do not need to train a model to build on one, but you do need a correct mental model of tokens and context. Every token you send costs money and pushes something else out, so treat the context window as a budget from day one and leave the attention maths until you have shipped something.

Mark this stage as not done?