LLMs-from-scratch
Code for building, pretraining and finetuning a GPT-like language model in PyTorch, step by step. It accompanies a book and teaches how large language models work.
Share on XCustom license (see repository)
Overview
This is the official code repository for the book Build a Large Language Model (From Scratch). It contains the code for developing, pretraining and finetuning a GPT-like model in PyTorch, going step by step with text, diagrams and examples. The approach is meant for education and mirrors how large foundation models are made, but at a small scale. The book also covers loading weights of larger pretrained models.
Key features
- Step by step code for building a GPT-like LLM in PyTorch
- Covers pretraining and finetuning
- Includes code for loading weights of larger pretrained models
- Provided as Jupyter Notebooks
Best for
Readers who want to understand how LLMs work by coding one themselves. It is written for learning and produces a small model, and it accompanies the book.
- Upstream
- rasbt/LLMs-from-scratch
- Fork on GitHub
- Guo-astro/LLMs-from-scratch
- Upstream stars
- 106k
- Category
- Learning, interviews and curated lists
- Language
- Jupyter Notebook
- License
- Custom license (see repository)
- Forked
- 2026-08-10
- Sync status
- In syncLast synced 2026-09-29
More in Learning, interviews and curated lists
A collection of real DevOps, SRE and cloud engineering interview questions gathered from candidates in 2025 and 2026. It is meant for interview preparation.
Forked 2026-09-28Last synced 2026-09-29No license declaredLearning, interviews and curated listsGitHub
A free course that teaches the skills needed to administer a remote Linux server from the command line. It is aimed at beginners who want to become sysadmins.
Forked 2026-09-26Last synced 2026-09-29Custom license (see repository)Learning, interviews and curated listsGitHub
- google-interview-preparation-problemsforked from mgechev/google-interview-preparation-problemsIn sync
A collection of LeetCode and GeeksforGeeks problems with solutions that the author solved while preparing for a Google interview. Useful for coding interview practice.
Forked 2026-09-26Last synced 2026-09-29No license declaredLearning, interviews and curated listsGitHub
An online study site for all four books of New Concept English, with audio reading of texts, tap-to-play single sentences and side-by-side English and Chinese.
Forked 2026-09-25Last synced 2026-09-29License: MITLearning, interviews and curated listsGitHub