LogoAISecKit

LLMs-from-scratch

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

Introduction

Introduction

This repository contains the code for developing, pretraining, and finetuning a GPT-like LLM, serving as the official code repository for the book Build a Large Language Model (From Scratch). The book guides readers through the process of creating their own LLM, explaining each stage with clear text, diagrams, and examples. The approach mirrors that used in creating large-scale foundational models like ChatGPT, making it accessible for educational purposes.

Key Features
  • Step-by-Step Guidance: Learn how large language models work from the ground up.
  • Hands-On Coding: Implement a ChatGPT-like model in PyTorch.
  • Pretraining and Finetuning: Includes code for loading weights of larger pretrained models.
  • Accessible for All: Designed to run on conventional laptops without specialized hardware.
Benefits
  • Gain a deep understanding of LLMs and their inner workings.
  • Engage with practical coding exercises that reinforce learning.
  • Utilize GPUs automatically if available, enhancing performance.
Highlights
  • Bonus materials for interested readers.
  • Community feedback encouraged via GitHub Discussions.
  • Consistent with the print book to ensure a smooth learning experience.

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates