An LLM From “Scratch”

Reading a book about bowling is not the same as actually bowling. If that resonates with you and you want to learn more about large language models, check out the LLM From Scratch project. The hands-on workshop lets you use a Mac, Linux, or Windows PC running Python and common libraries like numpy and torch to build your own bare-bones LLM.

The project takes inspiration from nanoGPT but scales it down so you can train the model in around an hour on a typical computer. It will use an Apple or NVIDIA GPU, if available.

There are six parts to the workshop: the tokenizer, the transformer, the training loop, text generation, and then wrap-up parts where you train the model and find the best AI poet.

In addition, the references section has a number of interesting papers, including some you’ve probably seen before and some that you may have missed.

We like learning things from first principles when possible. If you aren’t keen on Python, you can also build your own LLM in a spreadsheet.

11 thoughts on “An LLM From “Scratch”

  1. …and to partake, you have to install ‘uv’…with no compile from source option…just a “curl” download of a script, and then run it?

    Not a chance in hell…

    I can understand these direct binary installs for rust-written projects, as I have had to deal with the dependency-hell of projects written in rust as well…even down to having the correct compiler version (only one single version will work), but having no “compile from source” option for an open source project is a disaster waiting to happen. Who do they think are being targeted in supply-chain attacks?…other people?

    1. From wiki:

      Ayoob, Massad (1982). Hit the White Part. Police Bookshelf, Concord, NH, 03302, ISBN 978-0936279015.
      Ota, Mitchell A. (1991). Pin Shooting: A Complete Guide. Wolfe Publishing Co., Prescott, AZ, 86301, ISBN 978-1879356047.

      Rec.guns guide to pin shooting
      South African Pin Shooting Federation
      Indianapolis Bowling Pin Shooting
      Desoto, Kansas Bowling Pin and Steel Shooting

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.