FareedKhan-dev/train-llm-from-scratch resource
A straightforward method for training your LLM, from downloading data to generating text. observed · 2026-08-28
Health v2 · maintenance only
65/100
- Activity 98
- Release rhythm 35
- Longevity 42
Flags: no_releases
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 598
- days_rel: n/a
- days_push: 16
- n_releases_24m: 0
Adoption not part of the score
9432 stars · 1306 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
An educational repository and tutorial that implements a transformer-based LLM entirely from scratch in plain PyTorch, covering the full pipeline from raw text data to an aligned, reasoning-style model. It walks through pretraining, SFT, reward modeling, and preference optimization (DPO, PPO, GRPO) without relying on libraries like transformers, trl, or peft.
Use cases
- learn how transformers work by implementing attention from scratch
- train a small LLM on a single GPU
- understand RLHF alignment algorithms like DPO and PPO
- build a next-token prediction model from raw text
- study the full LLM training pipeline end to end
- implement reward models and GRPO in plain PyTorch
When to choose
- you want to deeply understand LLM internals rather than use high-level libraries
- you are learning how pretraining, SFT, and RLHF fit together
- you need a from-scratch PyTorch reference implementation of transformer training
- you want to train a small (million to billion parameter) model on limited hardware
When to avoid
- you need a production-ready LLM training framework with optimizations and ecosystem support
- you want to fine-tune existing pretrained models quickly with Hugging Face tooling
- you need multi-node distributed training at scale
- you are looking for inference or deployment tooling rather than training education
Facets
learning-resource · maturity active
llm-training deep-learning machine-learning nlp developer-tools large-language-models deep-learning machine-learning tutorials artificial-intelligence python cross-platform transformer-from-scratch pytorch pretraining sft rlhf dpo ppo grpo reward-model educational single-gpu natural-language-processing gpu
2 sources
- readme: https://github.com/FareedKhan-dev/train-llm-from-scratch · fetched 2026-08-28 · 57fd0a66b988
- homepage: https://fareedkhan-dev.github.io/train-llm-from-scratch/ · fetched 2026-08-29 · 0ebf2b5131ef
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| FareedKhan-dev/train-llm-from-scratch | main | 65 |
For agents
markdown · JSON · MCP: product_card(name="FareedKhan-dev/train-llm-from-scratch")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem