Hands-on LLM: From Building It by Hand to Real Applications
A Chinese self-study path for LLMs that hand-implements a transformer in native PyTorch and runs pretraining, SFT, LoRA, DPO and GRPO on a single consumer GPU, then covers an industrial fine-tuning framework, agent engineering and a RAG system.
Hands-on LLM is a self-study and hands-on project path that goes from theory to a working system: Stanford's CS336 course material explained in Chinese, a from-scratch PyTorch and Triton implementation of a transformer, including a byte-level tokenizer, RMSNorm, RoPE, grouped-query attention and SwiGLU each checked numerically, a full five-stage training run of pretraining, SFT, LoRA, DPO and GRPO plus verifiable-reward reinforcement learning, a source-level walkthrough of the LLaMA-Factory fine-tuning framework, an agent-engineering module, and a medical-literature retrieval-augmented question-answering system.
All training experiments run on a single RTX 3080 Ti with 12 GB of VRAM, and the repository keeps the resulting numbers, curves, generated samples and problems encountered rather than only a finished write-up. Results include a 63.91-million-parameter model where doubling pretraining data lowered loss from 3.35 to 2.53; a LoRA adapter trained on 0.61 percent of parameters shrinking from 132 MB to 0.78 MB and cutting VRAM from 7.36 GB to 4.60 GB; a 300-step GRPO run under 22 minutes using a rule-based reward instead of a reward model; and a verifiable-reward run raising greedy accuracy on a held-out arithmetic test from 0.633 to 0.792.
It is aimed at people who already use these techniques as library calls but want to understand and reproduce them from first principles on a single GPU.