12.5K-star GitHub repo is a full LLM engineering course: pretraining to GRPO in plain PyTorch
techNmak · x · 2026-10-27
A 12.5K-star GitHub repo, "Train LLM From Scratch", packs an entire LLM engineering course into one codebase: it builds a Transformer in plain PyTorch from raw text and goes all the way to RL, without trl, peft or transformers.
It implements tokenization/attention/pretraining, SFT with assistant-token loss masking, Bradley-Terry reward modeling, DPO/ORPO/KTO preference optimization, PPO with a value head and GAE, and GRPO with group-relative rewards plus GSM8K eval. All post-training methods build on the same base Transformer so you can compare objectives and optimization loops across stages; a modern variant adds RoPE, RMSNorm, SwiGLU, GQA, MoE, KV cache, plus Muon, LoRA, SimPO, speculative decoding and int8 weights — trainable on a single GPU or laptop CPU.
More from coding & agent
- Hyphenate raises $45M Series A as revenue grows 86x with autonomous finance agents — aakashgupta · 2026-10-27
- t3code vs latest Codex: dev says one feature — Astras spinning up Opus armies — wins — ludwigABAP · 2026-10-27
- OpenAI's Ari Weinstein says AI agents already use computers faster than average humans — VraserX · 2026-10-27
- OpenAI, Google, Anthropic Reportedly Building FINRA-Style AI Self-Regulator by 2027 — emmanuelvivier · 2026-10-27
- IBM Launches Verifiable Identity and Control for Enterprise AI Agents — emmanuelvivier · 2026-10-27
- One word in your prompt decides the language: 'easy' gets Python, 'fast' gets Rust — rseroter · 2026-10-27