Download README.md from ShahirDevs/Math_GPT: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/ShahirDevs/Math_GPT/resolve/main/README.md
- Command line
-
hf download hf://ShahirDevs/Math_GPT/README.md
-
curl -L -o README.md https://huggingface.co/ShahirDevs/Math_GPT/resolve/main/README.md
license: apache-2.0
language:
- en
pipeline_tag: text-generation
tags:
- math
- arithmetic
- pytorch
- decoder-only
- from-scratch
- small-language-model
MathGPT
A 10.7M-parameter decoder-only Transformer trained from scratch for arithmetic reasoning.
Overview
MathGPT explores how carefully designed numerical representations, structured scratchpads, and randomized training data can help small language models perform arithmetic.
- Parameters: 10.7M
- Architecture: Decoder-only Transformer
- Framework: PyTorch
- Training hardware: Google Colab NVIDIA T4
- Tokenizer: Character-level
- Training: From scratch
Benchmark results
MathGPT was evaluated against published GPT-3 few-shot results using samples of 300 problems per task from OpenAI's arithmetic benchmark files.
| Task | MathGPT | GPT-3 |
|---|---|---|
| 2-digit addition | 100.0% | 100.0% |
| 3-digit addition | 99.3% | 80.4% |
| 4-digit addition | 95.3% | 25.5% |
| 5-digit addition | 80.0% | 9.3% |
| 2-digit subtraction | 86.0% | 98.9% |
| 3-digit subtraction | 80.7% | 94.2% |
| 4-digit subtraction | 74.0% | 26.8% |
| 5-digit subtraction | 29.3% | 9.9% |
| 2-digit multiplication | 98.3% | 29.2% |
| 1-digit composite | 6.3% | 21.3% |
MathGPT achieved higher accuracy on 6 of the 10 tasks.
These results are task-specific and should not be interpreted as general mathematical superiority over GPT-3.
Methodology
- Each numerical digit is represented by an individual token.
- Answers are generated least-significant-digit first.
- Structured scratchpads teach intermediate arithmetic operations.
- Randomized problems provide varied training examples.
Approximately 14 million training examples were seen throughout training.
Limitations
- Weak generalization to unfamiliar natural-language word problems.
- Lower accuracy on complex bracket-based arithmetic.
- Performance decreases as arithmetic complexity increases.
- Evaluation uses a 300-question sample per task.
Intended use
Research and experimentation involving small language models, arithmetic reasoning, numerical tokenization, and structured generation.
Training and evaluation
Source code, training notebooks, and evaluation scripts:
License
Apache-2.0