Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MathGPT
|
| 2 |
+
|
| 3 |
+
A 10.7M-parameter decoder-only Transformer trained from scratch for arithmetic reasoning.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
MathGPT explores how carefully designed numerical representations, structured scratchpads, and randomized training data can help small language models perform arithmetic.
|
| 8 |
+
|
| 9 |
+
- **Parameters:** 10.7M
|
| 10 |
+
- **Architecture:** Decoder-only Transformer
|
| 11 |
+
- **Framework:** PyTorch
|
| 12 |
+
- **Training hardware:** Google Colab NVIDIA T4
|
| 13 |
+
- **Tokenizer:** Character-level
|
| 14 |
+
- **Training:** From scratch
|
| 15 |
+
|
| 16 |
+
## Benchmark results
|
| 17 |
+
|
| 18 |
+
MathGPT was evaluated against published GPT-3 few-shot results using samples of 300 problems per task from OpenAI's arithmetic benchmark files.
|
| 19 |
+
|
| 20 |
+
| Task | MathGPT | GPT-3 |
|
| 21 |
+
|---|---:|---:|
|
| 22 |
+
| 2-digit addition | 100.0% | 100.0% |
|
| 23 |
+
| 3-digit addition | 99.3% | 80.4% |
|
| 24 |
+
| 4-digit addition | 95.3% | 25.5% |
|
| 25 |
+
| 5-digit addition | 80.0% | 9.3% |
|
| 26 |
+
| 2-digit subtraction | 86.0% | 98.9% |
|
| 27 |
+
| 3-digit subtraction | 80.7% | 94.2% |
|
| 28 |
+
| 4-digit subtraction | 74.0% | 26.8% |
|
| 29 |
+
| 5-digit subtraction | 29.3% | 9.9% |
|
| 30 |
+
| 2-digit multiplication | 98.3% | 29.2% |
|
| 31 |
+
| 1-digit composite | 6.3% | 21.3% |
|
| 32 |
+
|
| 33 |
+
MathGPT achieved higher accuracy on 6 of the 10 tasks.
|
| 34 |
+
|
| 35 |
+
These results are task-specific and should not be interpreted as general mathematical superiority over GPT-3.
|
| 36 |
+
|
| 37 |
+
## Methodology
|
| 38 |
+
|
| 39 |
+
1. Each numerical digit is represented by an individual token.
|
| 40 |
+
2. Answers are generated least-significant-digit first.
|
| 41 |
+
3. Structured scratchpads teach intermediate arithmetic operations.
|
| 42 |
+
4. Randomized problems provide varied training examples.
|
| 43 |
+
|
| 44 |
+
Approximately 14 million training examples were seen throughout training.
|
| 45 |
+
|
| 46 |
+
## Limitations
|
| 47 |
+
|
| 48 |
+
- Weak generalization to unfamiliar natural-language word problems.
|
| 49 |
+
- Lower accuracy on complex bracket-based arithmetic.
|
| 50 |
+
- Performance decreases as arithmetic complexity increases.
|
| 51 |
+
- Evaluation uses a 300-question sample per task.
|
| 52 |
+
|
| 53 |
+
## Intended use
|
| 54 |
+
|
| 55 |
+
Research and experimentation involving small language models, arithmetic reasoning, numerical tokenization, and structured generation.
|
| 56 |
+
|
| 57 |
+
## Training and evaluation
|
| 58 |
+
|
| 59 |
+
Source code, training notebooks, and evaluation scripts:
|
| 60 |
+
|
| 61 |
+
[GitHub repository](https://github.com/Shahir1134/MATH_GPT)
|
| 62 |
+
|
| 63 |
+
## License
|
| 64 |
+
|
| 65 |
+
Apache-2.0
|