StackMathQA

Nearly two million mathematical questions and answers
curated from expert communities across the Stack Exchange network.

2024  ·  Math-AI
MathematicsQuestion AnsweringPre-trainingReasoning

Abstract

The development of sophisticated mathematical reasoning in large language models is often limited by the scarcity of large-scale, high-quality, domain-specific training data. StackMathQA addresses this gap with nearly two million question-and-answer pairs from the Stack Exchange network, aggregating expert and enthusiast discussions from Mathematics Stack Exchange, MathOverflow, Cross Validated, and Physics Stack Exchange.

The dataset is available in multiple formats and curated subsets created through importance resampling, supporting use cases from large-scale continual pre-training to targeted supervised fine-tuning.

Read the paper🤗 Dataset

Dataset

~2MQ&A pairs
4Communities
5Curated scales
2Data formats

Mathematics Stack Exchange

Questions and answers spanning mathematics at every level, from foundational topics to advanced problem solving.

MathOverflow

Research-level discussions and expert answers from the professional mathematics community.

Cross Validated

Statistics, machine learning, data analysis, and related quantitative methods.

Physics Stack Exchange

Technical questions from active researchers, academics, and students across physics.

Formats and curated subsets

Data is released as one-question-to-many-answers (qalist) and flattened one-question-to-one-answer (1q1a) pairs. Importance-resampled subsets are available at 100K, 200K, 400K, 800K, and 1.6M examples, prioritizing higher-engagement material at every scale.

Applications

Continual pre-training

Extend foundation models with mathematical language, notation, and reasoning structures at scale.

Supervised fine-tuning

Train models to follow mathematical instructions and generate detailed, step-by-step answers.

Domain specialization

Build systems for advanced mathematics, theoretical physics, statistics, and econometrics.

Reasoning evaluation

Evaluate models on diverse, real-world quantitative questions drawn from expert communities.

Citation

If you use StackMathQA in your research, please cite the technical report:

@techreport{zhang2024stackmathqa,
  title       = {StackMathQA: A Curated Collection of 2 Million Mathematical
                 Questions and Answers Sourced from Stack Exchange},
  author      = {Zhang, Yifan},
  year        = {2024},
  institution = {Math-AI},
  url         = {https://stackmathqa.github.io/StackMathQA.pdf}
}