Building a GPT from Scratch with yoctoGPT in PyTorch (2)
Scaling Up yoctoGPT: BPE Tokenization, Model Variants β Session 2 π Scale up from a tiny character-level GPT to a production-style training pipeline β benchmarked across four Colab GPUs including the new 96 GB G4. In this second session of our free 3-part webinar series, Dr. Yves J. Hilpisch shows how three improvements β more data, better tokenization, and optimised architectures β unlock better quality and faster training without changing the core codebase. π Topics in this session: β’ Scaling the character-level corpus: 42Γ more text, 9.2M characters β’ Notebook 2: large char-level training with resume and early stopping β’ Why BPE tokenization beats character-level encoding β’ Notebook 3: token-level training with subword units β’ Vocab size trade-off: 4000 vs 8000 tokens β’ Model variants: gpt_fast (SDPA, FlashAttention) vs gpt_plus (RoPE, RMSNorm, SwiGLU) β’ Performance tools: AMP (bf16/fp16), auto-microbatch, torch.compile, KV cache β’ Regularisation at scale: dropout, weight decay, label smoothing, EMA β’ Benchmarking across T4, L4, A100, and G4 (RTX PRO 6000 Blackwell) β‘ Measured results across Colab GPUs: β’ Char-level val loss: 1.36 β 1.10 (T4) β 0.97 (L4) β 0.94 (A100) β 0.89 (G4) β’ More data eliminates overfitting β the larger G4 model (12L/768d) wins on the 9.2M char corpus β’ Token-level val loss: 4.49 (T4) β 3.87 (L4) β 3.59 (A100, vocab 4000) β’ G4 token runs: val loss 3.65 (vocab 4000) and 4.08 (vocab 8000) β bigger model overfits the 2.6M token corpus β’ Key insight: bigger models help when the corpus is large enough; on small data they overfit π Resources: π Slides: https://tpq.io/tpq_yoctogpt_2.pdf π Notebook repo: https://github.com/yhilpisch/yoctoGPT π TDS: https://thedatascientist.dev π CPF: https://python-for-finance.com π€ TAE: https://theaiengineer.dev βΏ TCE: https://thecryptoengineer.dev π Disclaimer: This content is provided solely for illustration and educational purposes. Training texts consist primarily of public-domain works. No warranties or guarantees of any kind are given. Use at your own risk. #GPT #PyTorch #Transformer #BPE #Tokenization #LanguageModel #GoogleColab #AIEngineering #LLM #DeepLearning #FlashAttention #yoctoGPT #ScalingUp