ArXiv-to-Model: A Practical Study of Scientific LM Training
Organizations: Independent Researcher India
Abstract
While frontier large language models demonstrate strong reasoning and mathematical capabilities, the practical process of training domain-specialized scientific language models from raw sources remains under-documented. In this work, we present a detailed case study of training a 1.36B-parameter scientific language model directly from raw arXiv LaTeX sources spanning mathematics, computer science, and theoretical physics. We describe an end-to-end pipeline covering metadata filtering, archive validation, LaTeX extraction, text normalization, domain-aware tokenization, and dense transformer training under constrained compute (2xA100 GPUs). Through 24 experimental runs, we analyze training stability, scaling behavior, data yield losses, and infrastructure bottlenecks. Our findings highlight how preprocessing decisions significantly affect usable token volume, how tokenization impacts symbolic stability, and how storage and I/O constraints can rival compute as limiting factors. We further analyze convergence dynamics and show stable training behavior in a data-rich regime (52B pretraining tokens). Rather than proposing a novel architecture, this work provides an engineering-grounded, transparent account of training a small scientific language model from scratch. We hope these insights support researchers operating under moderate compute budgets who seek to build domain-specialized models.
Figures & tables
| Source | Volume | Stage | Weight | Relevance |
|---|---|---|---|---|
| Cleaned arXiv (LaTeX) | 80GB | Pretraining | 2.0X | Core scientific reasoning, formal proofs, mathematical structure |
| OpenWebMath | 50GB | Pretraining | 1.0X | Informal mathematical intuition and diverse problem formulations |
| StackExchange (STEM) | 10GB | Post-training | 1.0X | Logical question-answer reasoning and structured explanations |
| MathInstruct | 100MB | Post-training | 1.0X | Supervised problem-solving and step-by-step reasoning |
| UltraChat | 1.2GB | Post-training | 1.0X | Conversational alignment and dialogue formatting |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Aspect | Influenced |
|---|---|
| Tokenizer class (e.g., LLaMATokenizer) | Yes |
| Tokenizer vocabulary | No |
| BPE vs. SentencePiece | Yes |
| Special tokens (BOS, EOS, <s> , </s> ) | Yes |
| Chat templates | Often |
| Problem | Result |
|---|---|
| Token ID mismatch | Nonsensical generation |
| Special token differences | BOS/EOS errors |
| Different vocabulary size | Runtime failures |
| Different token segmentation | Severe perplexity increase |
Language Model Pretraining
Language model pretraining teaches models language patterns and knowledge from large text corpora before they are adapted to specific tasks.
See all 440 papers