LLMs-from-scratch social preview
fine-tuning108,263Other

LLMs-from-scratch

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

Updated Nov 12, 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-scratchLink to this section

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

OverviewLink to this section

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 108,263 GitHub stars under the Other license. It was last updated on 2026-09-22.

Key capabilitiesLink to this section

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 stackLink to this section

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:

SourcesLink to this section

Stats from GitHub, 2026-09-28.

From the community

What users are saying

“As an aside, for someone interested and who's an absolute beginner, can someone please recommend good resources on how to build LLMs from scratch? Thank you in advance.”

“1. Build an LLM from Scratch by Sebastian Raschka ( https://sebastianraschka.com/llms-from-scratch/ ) 2. LLM from 0 to Hero, and nanoGPT by Andrej Karpathy”

“Paul Graham: >"Someone asked what I'd do if I were 17. I'd learn how to build LLMs from scratch..." That's funny, Paul Graham, because if I were 17 again, I'd learn how to program in LISP.”

Frequently asked

Quick answers to common questions

What is LLMs-from-scratch?

LLMs-from-scratch is a fine-tuning 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 108,263 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 108,263 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 fine-tuning 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