LLMs from Scratch

Build a GPT from nothing, line by line
Learn AI & machine learningBook + codeApache-2.0Runs locallyPythonIntermediate
OSAI Pulse ⓘ ★★★★★★★★★★ /100 signals tracked
🐳 Docker pulls 📦 PyPI downloads / month 📦 npm downloads / month 🚀 Latest release ·
Visit website →View on GitHub

What is LLMs from Scratch?

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.

Why people choose LLMs from Scratch

LLMs from Scratch at a glance

CategoryLearn AI & machine learning
TypeBook + code
LicenseApache-2.0
Runs locallyYes
Built withPython
Skill levelIntermediate
Best forgenuinely understanding how an LLM works

Open-source alternatives to LLMs from Scratch

Other open-source learn ai & machine learning tools worth comparing:

VirgilioA structured mentor for data science and MLML for BeginnersMicrosoft's classic machine learning courseAI for BeginnersFrom symbolic AI to neural networksGenerative AI for BeginnersBuild generative AI apps, lesson by lessonData Science for BeginnersThe data foundations before any MLLLM CourseThe reference roadmap for learning LLMsNeural Networks: Zero to HeroKarpathy builds backprop, then GPT, from scratchAnnotated Paper Implementations60+ papers implemented and explained side by sideDive into Deep LearningThe textbook where every equation is runnablefastai Book (fastbook)Deep learning for coders, top-downHands-On Machine LearningThe notebooks of the best-selling ML bookHugging Face CourseMaster transformers with the actual libraryHugging Face Agents CourseBuild AI agents, properlyMade With MLFrom notebook to production systemPrompt Engineering GuideThe reference on prompting, backed by papersApplied MLHow real companies actually ship MLML YouTube CoursesThe best free ML courses on YouTube, curatedOpenAI CookbookPractical recipes that work with any OpenAI-compatible APIAwesome Machine LearningThe reference index of ML libraries, by languageAwesome LLMPapers, models and tools of the LLM eraDeep Learning DrizzleUniversity lectures, from the sourceML Interviews BookWhat ML interviews actually ask

LLMs from Scratch head-to-head

LLMs from Scratch vs VirgilioLLMs from Scratch vs ML for BeginnersLLMs from Scratch vs AI for BeginnersLLMs from Scratch vs Generative AI for BeginnersLLMs from Scratch vs Data Science for BeginnersLLMs from Scratch vs LLM CourseLLMs from Scratch vs Neural Networks: Zero to HeroLLMs from Scratch vs Annotated Paper ImplementationsLLMs from Scratch vs Dive into Deep LearningLLMs from Scratch vs fastai Book (fastbook)LLMs from Scratch vs Hands-On Machine LearningLLMs from Scratch vs Hugging Face CourseLLMs from Scratch vs Hugging Face Agents CourseLLMs from Scratch vs Made With MLLLMs from Scratch vs Prompt Engineering GuideLLMs from Scratch vs Applied MLLLMs from Scratch vs ML YouTube CoursesLLMs from Scratch vs OpenAI CookbookLLMs from Scratch vs Awesome Machine LearningLLMs from Scratch vs Awesome LLMLLMs from Scratch vs Deep Learning DrizzleLLMs from Scratch vs ML Interviews Book

FAQ

Is LLMs from Scratch free?

LLMs from Scratch is free and open-source (Apache-2.0 license), so you can use, self-host and modify it at no cost.

Can I run LLMs from Scratch locally?

Yes. LLMs from Scratch is designed to run on your own machine or server, keeping your data private.

What is the best alternative to LLMs from Scratch?

Popular open-source alternatives include Virgilio, ML for Beginners, AI for Beginners. See the comparisons above to choose.

Explore more open-source AI

Browse the full directory of open-source AI tools, models and projects — updated daily.

Browse all tools →