Home Projects LLMs-from-scratch
LLMs-from-scratch
Jupyter Notebook

LLMs-from-scratch

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

by rasbt · GitHub
Top 1% most starred in the catalogue
Stars
Forks
Created
Last commit
Category
aiartificial-intelligenceattention-mechanismJupyter Notebook
View on GitHub
In plain words

Sebastian Raschka's companion repository to "Build a Large Language Model (From Scratch)": you implement attention, a transformer, pretraining and fine-tuning yourself, in plain PyTorch.

From the README

Install
git clone --depth 1 https://github.com/rasbt/LLMs-from-scratch.git

Excerpts from the project README on GitHub. Copyright and licensing remain with the respective authors.

You maintain this project?

Claim its page: indexed whatever its rank, translated into six languages, and enriched with what you write yourself.

Claim this page →
LLMs-from-scratch — GitHub preview card
📈 Star history
104k98k
2026-06-272026-08-31
📈 Track LLMs-from-scratch

Get an email alert on its next release or when it starts trending — never miss the moment.

Free · no card · unsubscribe anytime
Get email alerts →
📄 About

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

LLMs-from-scratch has 104k stars on GitHub. It has been forked 15.9k times. LLMs-from-scratch is written mainly in Jupyter Notebook. It has been in active development since 2023. Its main topics are ai, artificial-intelligence, attention-mechanism, deep-learning.

Read the full guide
Frequently asked questions

What is LLMs-from-scratch?

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

Is LLMs-from-scratch open source?

LLMs-from-scratch is an open-source project.

Is LLMs-from-scratch free?

Yes. LLMs-from-scratch is free and open source — you can use, modify and self-host it.

What language is LLMs-from-scratch written in?

LLMs-from-scratch is written mainly in Jupyter Notebook.

🏅 Maintainer of this project?
olud.ai badge — LLMs-from-scratch

Add this live badge to your README — your GitHub stars and directory rank, refreshed daily.

[![olud.ai](https://olud.ai/badge.php?tool=rasbt-llms-from-scratch)](https://olud.ai/project/rasbt-llms-from-scratch.html)
More badge options →
🧬 Shares DNA with🧬 View the DNA map →

Measured from GitHub topics shared by both projects, weighted by how rare each topic is.