Skip to content
r.

train-llm-from-scratch

FareedKhan-dev/train-llm-from-scratch · Public GitHub repository

A straightforward method for training your LLM, from downloading data to generating text.

Open project in RepoShelf

Open the project to try its demo, view the repository, or save it to your collection. Repository and demo actions use RepoShelf’s sign-in flow.

train-llm-from-scratch live demo screenshot
Captured from the live demo · 2026-10-30

About this project

Author-written excerpt from the project README.

I am Looking for a PhD position in AI. GitHub

I implemented a transformer model from scratch using PyTorch, based on the paper Attention is All You Need. You can use my scripts to train your own billion or million parameter LLM using a single GPU, or a small one on a laptop CPU with no GPU at all.

This started as a pretraining tutorial. It now goes all the way from raw text to an aligned, reasoning style model, with every algorithm hand written in plain PyTorch (no trl, no peft, no transformers). The whole journey is one idea repeated: turn text into numbers, predict the next token, then keep changing the data and the loss until the model does what we want.

Requirements and intended audience

I am Looking for a PhD position in AI. GitHub

Not recorded: account, external api key, paid service, self-hosting. Missing information does not mean there are no requirements.

Statements extracted from the author’s documentation · Checked 2026-11-05. Source: https://github.com/FareedKhan-dev/train-llm-from-scratch/blob/main/README.md

Recorded maintenance information

Last recorded source update: 2026-10-02. A published release has not been recorded. These dates do not guarantee ongoing maintenance.

Technologies
Python
Licence
MIT. Generally permits modification and commercial use, subject to the licence’s notices and conditions.
Demo check
A public page loaded on 2026-11-19. This does not test every feature.

Browse related categories