LLMs-from-scratch social preview
other105,668Other

LLMs-from-scratch

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

Updated Sep 28, 2026
Platforms
macos, linux, windows, web
Pricing
free-open-source
Status
active
License
Other

What it does

Core capabilities at a glance

  • Artificial Intelligence
  • Attention Mechanism
  • Finetuning
  • From Scratch
  • Generative AI
  • GPT
  • Instruction Tuning
  • Language Model

Deep dive

The full breakdown - performance, comparisons, and setup

LLMs-from-scratch

LLMs-from-scratch is a local-AI tool - Implement a ChatGPT-like LLM in PyTorch from scratch, step by step.

Overview

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.

  • Link to the official source code repository - Link to the book at Manning (the publisher's website) - Link to the book page on Amazon.com - ISBN 9781633437166

(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.)

LLMs-from-scratch is open-source, written primarily in Jupyter Notebook, with 105,668 GitHub stars under the Other license. It was last updated on 2026-09-22.

Key capabilities

From the project's documentation:

  • Link to the official source code repository
  • Link to the book at Manning (the publisher's website)
  • Link to the book page on Amazon.com
  • Installing Python Packages and Libraries Used in This Book
  • Docker Environment Setup Guide
  • Chapter 2: Working With Text Data

How it fits a local-AI stack

LLMs-from-scratch runs on your own hardware, so pair it with a model and a GPU sized to your needs. Use the VRAM calculator to pick a model that fits your card, and see what you can run for hardware guidance. Related local-AI tools in the directory:

Sources

Stats from GitHub, 2026-09-28.

Frequently asked

Quick answers to common questions

What is LLMs-from-scratch?

LLMs-from-scratch is a other tool for local AI workloads. Implement a ChatGPT-like LLM in PyTorch from scratch, step by step

Is LLMs-from-scratch free and open source?

Yes, LLMs-from-scratch has 105,668 GitHub stars and is licensed under Other. You can self-host it for free on macos, linux, windows, web.

What platforms does LLMs-from-scratch support?

LLMs-from-scratch runs on macos, linux, windows, web.

What hardware do I need for LLMs-from-scratch?

The hardware requirements depend on which models you run. Check our hardware directory for compatible GPUs and systems. LLMs-from-scratch has 105,668 GitHub stars and an active community.

Does LLMs-from-scratch support GPU acceleration?

LLMs-from-scratch supports GPU acceleration via CUDA, Metal, or Vulkan depending on your platform. For the best performance, pair it with an NVIDIA RTX 4090 or 5090.

What are the best alternatives to LLMs-from-scratch?

Popular alternatives include other other tools in our directory. Browse our full collection at /tool for comparisons, community reviews, and benchmark data to find the right fit for your workflow.

How much does LLMs-from-scratch cost?

LLMs-from-scratch is free-open-source. It is completely free and open source to self-host.

Pairs well with

Complementary tools, models, and hardware