A Reproducible Systems Stack for Domain-Specialized Small Language Models: Tokenizer, Training, and Evaluation on Constrained Hardware.
We present a complete, reproducible systems stack for building domain-specialized small language models (SLMs) on resource-constrained hardware. Our implementation combines a production-grade Rust Byte Pair Encoding (BPE) tokenizer with a custom Python-based trans-former training pipeline designed for Apple Silicon (MPS). Using a 23M-parameter decoder-only transformer with RoPE, RMSNorm, and SwiGLU—trained on 81K physics arXiv papers—we achieve a physics QA score of 0.550 on a 20-question multiple-choice benchmark, outper- forming GPT-2 Large (774M) by 69% despite being 33×smaller. We document the complete iterative development process: from an initial model exhibiting early-EOS collapse (P(EOS)=0.9999), through root-cause analysis (missing causal mask, EOS-heavy training data), to a fixed architecture achieving P(EOS)=0.0000 with document packing. The contribution is a transparent, end-to-end reference implementation demonstrating that domain specialization decisively outperforms scale for narrow factual tasks.
Authors
- Jaydip Singh (ORCID: https://orcid.org/0000-0003-3413-9548)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-26
- DOI
- https://doi.org/10.5281/zenodo.24552388
- Primary Topic
- Topic Modeling
- Type
- preprint