TL;DR
OpenWebMath is a new, open-source dataset containing 14.7 billion tokens of high-quality mathematical text scraped from the web. By using a custom pipeline to faithfully preserve LaTeX notation and filter for technical quality, the authors provide a public alternative to the proprietary datasets used to train reasoning giants like Google's Minerva. Models trained on this data significantly outperform general-purpose LLMs on quantitative reasoning, even when those general models are trained on 20x more data.
What Problem Does This Paper Address?
Large Language Models (LLMs) have shown a remarkable ability to reason, but this capability is heavily dependent on the quality of their pretraining data—specifically code and mathematics. While models like Minerva have achieved state-of-the-art results in quantitative reasoning, the datasets used to train them are proprietary.
Existing open-source web crawls, such as C4 or RefinedWeb, are "math-blind." Their preprocessing pipelines typically strip out LaTeX formatting or treat mathematical symbols as noise, resulting in a loss of the very structure required for a model to learn mathematical logic. The authors tackle the challenge of extracting, cleaning, and filtering mathematical content from the "messy" HTML of the open web to create a high-fidelity, large-scale dataset for the research community.
Methods
The authors developed a multi-stage pipeline to process 237 billion HTML pages from Common Crawl, as illustrated in the pipeline overview:
Key technical contributions include:
- High-Recall Prefiltering: To manage compute costs, they first scanned for 100 common LaTeX symbols and keywords (e.g., "mathjax", "katex") to reduce the document pool to less than 1% of the total crawl.
- Custom LaTeX Extraction: Unlike standard tools that miss math embedded in non-standard ways, their pipeline handles math in image
alttext, custom delimiters (like[tex]...[/tex]), and MathJax-rendered scripts. - MathScore Classifier: They trained a FastText classifier to predict if a document is "mathematical" based on surrounding text, even if the LaTeX itself was removed. This helped identify high-quality technical discussions that might have failed the initial extraction.
- Quality Filtering & Deduplication: They used KenLM perplexity scores (trained on the technical ProofPile dataset) to remove low-quality text and employed SimHash for document-level deduplication.
Datasets
- OpenWebMath: The primary contribution, consisting of 14.7B tokens across 6.3M documents.
- Common Crawl: The raw source for the dataset.
- ProofPile: An existing dataset of formal and informal math used here for training filters and as a baseline for comparison.
- The Pile: A standard 800GB general-purpose dataset used as a baseline.
- Benchmarks: Evaluation was performed on GSM8k (grade school math), MATH (competition-level problems), and LILA-multiarith.
Key Insights and Ideas
-
Math is Encoded Chaos: Mathematical notation on the web is not standardized. As shown in the figure below, it can be hidden in image URLs, special tags, or arbitrary delimiters. Standard NLP pipelines that ignore these nuances effectively "de-educate" the models they train. LaTeX formulas are embedded in HTML in many diverse ways, from image alt-text to special tags.
-
Domain Specificity Trumps Scale: A 1.4B parameter model trained on 14.7B tokens of OpenWebMath outperformed a similar model (Pythia) trained on 300B tokens of general text from The Pile. This suggests that for reasoning, what you read is far more important than how much you read.
- Forums are Goldmines: 40% of the dataset comes from Q&A forums like StackExchange and PhysicsForums. These are particularly valuable because they contain natural language explanations paired with step-by-step mathematical logic. OpenWebMath is composed largely of forum posts and educational content, primarily focused on Mathematics and Physics.
Key Results
The authors evaluated 1.4B parameter models trained on different data mixes:
- Perplexity: Models trained on OpenWebMath achieved significantly lower (better) perplexity on the MATH benchmark (1.90 vs. 2.20 for The Pile).
- Accuracy: On the "MATH Algebra-Easy" subset, the OpenWebMath model achieved 5.62% accuracy, doubling the 2.81% achieved by models trained on The Pile or ProofPile alone.
- Synergy: A 50/50 mixture of OpenWebMath and ProofPile often yielded the best results, suggesting that diverse sources of technical text (web vs. papers/books) are complementary.
Limitations and Future Work
- Language Bias: The current dataset is English-only. The authors acknowledge that their filtering stage likely discarded valuable mathematical documents in other languages.
- Text-Only: While they extract math from image metadata, the dataset does not include the actual images/figures, which are often crucial for geometric or topological reasoning.
- Pipeline Rigidity: Due to the high cost of processing Common Crawl, the authors could only run their pipeline once, meaning they couldn't perform an ablation study to see which specific filter was most effective.
- Future Directions: The authors suggest that future work should focus on multimodal extraction (images + text) and expanding the pipeline to support non-English technical content.
Summary updated