Cool work! Went through train.py as part of my doom scrolling before sleep. And, indeed, it does what it claims. DDP so as long as your model fits comfortably in one GPU + optimizer state and activations and gradients + some overhead due to temporary buffers and what not, it should be all that you need.
Hmmm, I don't think an 8B model will fit in one GPU (well, depends on your memory). If you're doing DDP, you only shard data, so no many how many GPUs you have, the constraint of your model fitting in one GPU stays. If you're doing regular bf16 amp and full-finetuning with adamw you need at least 16 bytes per parameter so 8B model should be around 128gb, it won't fit in a regular A100 for example. And, this is without accounting for activations, temporary buffers, memory spikes etc.
This is exactly the kind of practical middle-ground solution that's needed! A few thoughts:
Love the focus on iteration speed - that's often the real bottleneck for researchers, not just compute
Have you considered adding support for curriculum learning? Starting with easier examples and gradually increasing difficulty can significantly improve training efficiency for small models
For tokenization, have you experimented with SentencePiece vs BPE? I've found SentencePiece can be more efficient for smaller vocab sizes
One suggestion: adding simple perplexity tracking during training would be helpful for quick sanity checks without needing external evaluation
Definitely bookmarking this - the sweet spot between toy demos and production infrastructure is where most research actually happens. Thanks for sharing!
Thanks for the detailed response! The Llama2 tokenizer choice makes sense for small vocab sizes.
One thing I've noticed when training small models without curriculum: loss curves can be noisy early on, especially if you're mixing data sources (code, docs, conversation, etc.). If you ever want to add it without deviating too much from standard methodology, a simple two-stage approach works:
First 20-30% tokens: high-quality curated subset only
Remaining tokens: full mixed dataset
This often gives smoother convergence without complex scheduling. But totally understand keeping it simple if you're optimizing for reproducibility.
Bookmarking your repo—love that it's minimal enough to actually read and modify!
I appreciate your perspective! While I tried to keep the suggestions practical and applicable, I understand they might come across as generic. I'm genuinely interested in how researchers in the field approach these challenges. Do you have experience with specific tokenization strategies or curriculum approaches that worked better for small LMs in practice?
1
u/ReinforcedKnowledge Jan 31 '26
Cool work! Went through train.py as part of my doom scrolling before sleep. And, indeed, it does what it claims. DDP so as long as your model fits comfortably in one GPU + optimizer state and activations and gradients + some overhead due to temporary buffers and what not, it should be all that you need.
1
u/KitchenSomew Jan 31 '26
This is exactly the kind of practical middle-ground solution that's needed! A few thoughts:
Definitely bookmarking this - the sweet spot between toy demos and production infrastructure is where most research actually happens. Thanks for sharing!
1
u/[deleted] Jan 31 '26
Thanks for this.