---
title: "Build a Tiny Autoregressive Generation Loop"
description: "Rebuild model.generate() as a dozen-line autoregressive loop, watch greedy decoding pick each next token, and find the flaw the KV cache exists to fix."
canonical_url: "https://fanout.sh/inference-eng/curriculum/02-05"
md_url: "https://fanout.sh/inference-eng/curriculum/02-05.md"
access: "public"
---

# Build a Tiny Autoregressive Generation Loop

Rebuild model.generate() as a dozen-line autoregressive loop, watch greedy decoding pick each next token, and find the flaw the KV cache exists to fix.

---
This representation contains public Fanout content only. Protected Pro lessons, account data, billing, checkout, and pricing are not included.

Browse the public content map: https://fanout.sh/sitemap.md
