33
stars
34
commits
Jupyter Notebook
primary language
Jul 29, 2025
updated
This repository contains the code for developing, pretraining, and finetuning a GPT-like LLM.
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. I'll guide you through creating your own LLM, explaining each stage with clear text, diagrams, and examples.
!Environment Setup for Building Large Language Models
The method described 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 repository includes code for loading the weights of larger pretrained models for finetuning.
git clone --depth 1 https://github.com/Sangwan70/Building-an-LLM-From-Scratch.git
[!TIP] If you're seeking guidance on installing Python and Python packages and setting up your code environment, I suggest reading the README.md file located in the setup directory.
The code in the main parts of this course is designed to run on conventional laptops within a reasonable timeframe and does not require specialized hardware. Additionally, the code automatically utilizes GPUs if they are available. (Please see the setup doc for additional recommendations.)
Several folders contain additional materials for interested readers:
I welcome all sorts of feedback via GitHub Discussions. Likewise, if you have any questions or just want to bounce ideas off others, please don't hesitate to post these in the forum as well.
BibTeX entry:
author = {Ram N Sangwan},
title = {Building An LLM From Scratch}
github = {https://github.com/Sangwan70/Building-an-LLM-From-Scratch}
}
33 commits
1 commits
Jupyter Notebook
81.9%
Python
18.1%
33
stars
34
commits
Jupyter Notebook
primary language
Jul 29, 2025
updated
This repository contains the code for developing, pretraining, and finetuning a GPT-like LLM.
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. I'll guide you through creating your own LLM, explaining each stage with clear text, diagrams, and examples.
!Environment Setup for Building Large Language Models
The method described 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 repository includes code for loading the weights of larger pretrained models for finetuning.
git clone --depth 1 https://github.com/Sangwan70/Building-an-LLM-From-Scratch.git
[!TIP] If you're seeking guidance on installing Python and Python packages and setting up your code environment, I suggest reading the README.md file located in the setup directory.
The code in the main parts of this course is designed to run on conventional laptops within a reasonable timeframe and does not require specialized hardware. Additionally, the code automatically utilizes GPUs if they are available. (Please see the setup doc for additional recommendations.)
Several folders contain additional materials for interested readers:
I welcome all sorts of feedback via GitHub Discussions. Likewise, if you have any questions or just want to bounce ideas off others, please don't hesitate to post these in the forum as well.
BibTeX entry:
author = {Ram N Sangwan},
title = {Building An LLM From Scratch}
github = {https://github.com/Sangwan70/Building-an-LLM-From-Scratch}
}
33 commits
1 commits
Jupyter Notebook
81.9%
Python
18.1%