Accuracy stays near-perfect in-distribution (≤15 digits) and degrades on longer out-of-distribution operands, with a sharp drop beyond ~24 digits.
1 git clone https://github.com/notabdo/mathcore.git
2 cd mathgo
3 python -m venv venv && source venv/bin/activate
4 pip install -r requirements.txt
1 pip install huggingface-hub
2
3 # PyTorch checkpoint (~152 MB)
4 huggingface-cli download not-abdo/mathcore mathcore_ckpt.pt --local-dir .
5
6 # Optional: pre-exported ONNX (~153 MB, for CPU-only inference)
7 huggingface-cli download not-abdo/mathcore mathcore.onnx --local-dir .
1 from huggingface_hub import hf_hub_download
2 hf_hub_download ( repo_id = "not-abdo/mathcore" , filename = "mathcore_ckpt.pt" , local_dir = "." )
1 python mathcore.py --chat
2 # Examples: 1+2-3+10+5 999+1000-20+5
1 python mathcore.py --service --port 8000
2 curl "http://localhost:8000/solve?expr=123+456"
1 MODE = "train" # "smoke" | "train" | "eval" | "diag" | "chat"
2 CKPT = "mathcore_ckpt.pt"
mathgo/
├── mathcore.py # Inference: chat, API, ONNX export
├── training.py # Training, evaluation, diagnostics
├── benchmark.png # Accuracy plot
├── requirements.txt
└── README.md
Weights (
mathcore_ckpt.pt,
mathcore.onnx) are
not in this repo — download from
Hugging Face .