badGPT is a conglomeration of sequential ML projects I did this summer, culminating in a chatbot like ChatGPT or Claude built from scratch using just python and numpy.
I started off by building a name generation model, then a Shakespeare writing model, then finally a chatGPT-esque model. The model produces, for the most part, complete gibberish, so this was less a practical project and more an exercise in understanding how everything works. It performs so poorly because it’s so small. Models need a lot of parameters to be able to capture all the nuances required to produce coherent text, which makes the models much slower to train. The final model I made includes around 120,000 parameters, 4 transformer blocks of 4 attention heads each, and 64 tokens of context. It’s based largely on GPT-2, which for reference had about 1.5 billion parameters. Current frontier models, like Anthropic’s fable, have trillions of parameters and can have millions of input tokens, so it makes sense that my model is too small to make much sense at all. Even at its small size, it took my laptop more than 20 hours to train, so scaling up with my current hardware is not feasible.
Many people like using libraries like pytorch and tensorflow, which include classes that handle backpropagation (the system that’s at the heart of letting the models learn), but I wanted to start from scratch so I wrote my own. If you wish to try any of my models out, you can visit the demo website (click try project), and click through the tabs to see each of the models. It all runs in your browser. You can also look through the Jupyter notebooks in the Github repository to get a sense of how everything works.
- 24 devlogs
- 121h
- 16.85x multiplier
- 1974 Stardust