rasbt

    rasbt/LLMs-from-scratch

    Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

    108.2K stars
    16.7K forks
    869 GitHub watchers
    Updated Nov 11, 2026
    View on GitHub

    Build with Backblaze B2

    SDKs, agent skills, IDE extensions, and reference pipelines from Backblaze Labs. All open source.

    Explore Backblaze Labs

    Loading star history...

    Where it stands

    Rank, growth pace and release cadence relative to everything GStars tracks.

    The project lists 73 contributors on GitHub.

    Peaked at #4 in the weekly ranking the week of Sep 28, its best in the past year.

    Use Cases & Benefits

    • Implements a GPT-like large language model in PyTorch from scratch with step-by-step educational notebooks.
    • Provides a comprehensive, hands-on approach to understanding and building LLMs without relying on external libraries.
    • Use for learning the fundamentals of attention mechanisms and transformer architectures through coding exercises.
    • Use for pretraining and finetuning custom language models on unlabeled and labeled text datasets.
    • Use for experimenting with instruction tuning and building interactive interfaces for GPT-based models.

    Should you depend on it?

    License terms, project hygiene and risks, from GitHub metadata and GStars' snapshots.

    License

    Other

    GitHub could not identify this license; read the LICENSE file before depending on it.

    Community files

    • README: present

    Watch-outs

    • License not identified by GitHub; read the LICENSE file before depending on it.
    • No GitHub releases; pin a commit or tag instead of a release.

    General guidance from repository metadata, not legal advice. How we score

    From the README

    This repository contains the code for developing, pretraining, and finetuning a GPT-like LLM and is the official code repository for the book Build a Large Language Model (From Scratch).

    In Build a Large Language Model (From Scratch), you'll learn and understand how large language models (LLMs) work from the inside out by coding them from the ground up, step by step. In this book, I'll guide you through creating your own LLM, explaining each stage with clear text, diagrams, and examples.

    The method described in this book for training and developing your own small-but-functional model for educational purposes mirrors the approach used in creating large-scale foundational models such as those behind ChatGPT. In addition, this book includes code for loading the weights of larger pretrained models for finetuning.

    To download a copy of this repository, click on the Download ZIP button or execute the following command in your terminal:

    (If you downloaded the code bundle from the Manning website, please consider visiting the official code repository on GitHub at https://github.com/rasbt/LLMs-from-scratch for the latest updates.)

    Excerpt from the rasbt/LLMs-from-scratch README on GitHub (NOASSERTION license). © its authors.Read the full README on GitHub

    Daily snapshots

    Stars gained per day, and how forks and open issues moved, from GStars' daily snapshots

    Forks

    16.7K+979

    Open issues

    4+2

    Compared with peers in AI

    Fastest-growing repositories GStars tracks in this cohort for the week of Nov 8, by 7-day star growth

    rasbt/LLMs-from-scratch compared with AI repositories by stars, 7-day star growth, health score and last release
    RepositoryStars+7dHealthLast release
    D4Vinci/Scrapling101.1K+6.3K756 days ago
    thedotmack/claude-mem115.8K+4.7K75today
    heygen-com/hyperframes82.3K+4.0K75today
    harry0703/MoneyPrinterTurbo142.0K+3.8K753 days ago
    github/spec-kit149.2K+2.6K75today
    rasbt/LLMs-from-scratch108.2K—75—
    Category median115.8K+4.0K75—

    Discover Repositories

    Search across tracked repositories by name or description