File size: 3,901 Bytes
e23fb6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
dataset_info:
  features:
    - name: Q
      dtype: string
      description: "The mathematical question in LaTeX encoded format."
    - name: A
      dtype: string
      description: "The answer to the mathematical question, also in LaTeX encoded format."
    - name: metadata
      dtype: object
      description: "A collection of metadata for each question-answer pair."
      fields:
        - name: language
          dtype: string
          description: "The language in which the question and answer are written."
        - name: url
          dtype: string
          description: "The URL of the original question on Stack Exchange."
        - name: timestamp
          dtype: string
          description: "The date and time when the question was posted."
        - name: source
          dtype: string
          description: "The source from which the data was obtained, in this case, Stack Exchange."
        - name: question_score
          dtype: integer
          description: "The score (upvotes - downvotes) of the question."
        - name: answer_count
          dtype: integer
          description: "The number of answers the question received."
        - name: answer_id
          dtype: integer
          description: "A unique identifier for the answer."
  license: mit
  task_categories:
    - text-generation
  language:
    - en
  pretty_name: StackMathQA
  size_categories:
    - 1B<n<10B
---

# StackMathQA
StackMathQA is a meticulously curated collection of **2 million** mathematical questions and answers, sourced from various Stack Exchange sites. This repository is designed to serve as a comprehensive resource for researchers, educators, and enthusiasts in the field of mathematics and data science.

## Preprocessed Data
In the `./preprocessed/stackexchange-math` directory and `./preprocessed/stackexchange-math--1q1a` directory, you will find the data structured in two formats:

1. **Question and List of Answers Format**:
   Each entry is structured as {"Q": "question", "A_List": ["answer1", "answer2", ...]}.
   - `math.stackexchange.com.jsonl`: 827,439 lines
   - `mathoverflow.net.jsonl`: 90,645 lines
   - `stats.stackexchange.com.jsonl`: 103,024 lines
   - `physics.stackexchange.com.jsonl`: 117,318 lines
   - In total: **1,138,426** questions

2. **Question and Single Answer Format**:
   Each line contains a question and one corresponding answer, structured as {"Q": "question", "A": "answer"}. Multiple answers for the same question are separated into different lines.
   - `math.stackexchange.com.jsonl`: 1,407,739 lines
   - `mathoverflow.net.jsonl`: 166,592 lines
   - `stats.stackexchange.com.jsonl`: 156,143 lines
   - `physics.stackexchange.com.jsonl`: 226,532 lines
   - In total: **1,957,006** answers
  
## Selected Data
The dataset has been carefully curated using importance sampling. We offer selected subsets of the dataset (`./preprocessed/stackexchange-math--1q1a`) with different sizes to cater to varied needs:

### StackMathQA1600K
- Location: `./data/stackmathqa1600k`
- Contents:
  - `all.jsonl`: Containing 1.6 million entries.
  - `meta.json`: Metadata and additional information.

### StackMathQA800K
- Location: `./data/stackmathqa800k`
- Contents:
  - `all.jsonl`: Containing 800k entries.
  - `meta.json`: Metadata and additional information.

Similar structures are available for StackMathQA400K, StackMathQA200K, and StackMathQA100K subsets.

## Citation
We appreciate your use of StackMathQA in your work. If you find this repository helpful, please consider citing it and star this repo. Feel free to contact zhangyif21@tsinghua.edu.cn or open an issue if you have any questions.

```bibtex
@misc{stackmathqa2024,
      title={StackMathQA: A Curated Collection of 2 Million High-Quality Mathematical Questions and Answers Sourced from Stack Exchange}, 
      author={Yifan Zhang, et al.},
      year={2024},
}
```