microgpt — 200 lines pure Python GPT, no deps

BlogApr 18, 2026

Original excerpt

This is a brief guide to my new art project microgpt, a single file of 200 lines of pure Python with no dependencies that trains and inferences a GPT. This file contains the full algorithmic content of what is needed: dataset of documents, tokenizer, autograd engine, a GPT-2-like neural network architecture, the Adam optimizer, training loop, and inference loop. Everything else is just efficiency. I cannot simplify this any further. This script is the culmination of multiple projects (micrograd, makemore, nanogpt, etc.) and a decade-long obsession to simplify LLMs to their bare essentials, and I think it is beautiful 🥹. It even breaks perfectly across 3 columns:

This GitHub gist has the…

How the community received it

From Hacker News · 1,936 points · 324 comments

It's pretty staggering that a core algorithm simple enough to be expressed in 200 lines of Python can apparently be scaled up to achieve AGI. Yes with some extra tricks and tweaks. But the core ideas are all here.

jimbokun · awe

LLMs won't lead to AGI. Almost by definition, they can't. The thought experiment I use constantly to explain this: Train an LLM on all human knowledge up to 1905 and see if it comes up with General Relativity. It won't.

darkpicnic · skeptical

One of the biggest HN threads of early 2026. The dominant reaction was awe at the compression — that the core of a GPT fits in 200 dependency-free lines — with several commenters immediately porting it to C++ and Rust. The counter-current took the same fact in the opposite direction: if the algorithm is this simple, scale alone may not be a path to general intelligence. A third group flagged the thread itself being flooded by AI-generated comments, which moderators confirmed banning — an oddly fitting footnote for the subject matter.

Frequently asked questions

What is "microgpt — 200 lines pure Python GPT, no deps" about?

This article by Andrej Karpathy is part of the Andrej Karpathy reading list on Burn 451, covering ai agents.

Who wrote "microgpt — 200 lines pure Python GPT, no deps"?

This piece is part of the Andrej Karpathy vault on Burn 451, covering ai agents. The original author is attributed at the source link.

How can I read more content from Andrej Karpathy?

The complete Andrej Karpathy reading list is available at burn451.cloud/vault/karpathy. Each article includes an AI-generated summary so you can decide what to read in seconds. Connect the Burn 451 MCP server to Claude or Cursor to query all Andrej Karpathy articles as live AI context.

Can I use "microgpt — 200 lines pure Python GPT, no deps" with Claude or Cursor?

Yes. Install the burn-mcp-server npm package and connect it to Claude Desktop, Claude Code, or Cursor. Once connected, your AI can search and reference this article and the full Andrej Karpathy vault in real time — no manual copy-paste required.

37 more articles in this vault.

Import the full Andrej Karpathy vault to Burn 451 and build your own knowledge base.

Content attributed to the original author. Burn 451 curates publicly available writing as a reading index. For removal requests, contact @hawking520.