27 votes

microgpt - GPT in 200 lines

2 comments

  1. [2]
    skybrian
    Link
    From the article:

    From the article:

    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 🥹.

    15 votes
    1. Noox
      Link Parent
      Thanks for sharing, this was incredibly cool to read!

      Thanks for sharing, this was incredibly cool to read!

      3 votes