---
title: TrueMath
canonical_url: "https://www.modelscope.cn/models/Glint-Research/TrueMath"
md_url: "https://www.modelscope.cn/models/Glint-Research/TrueMath.md"
repository: Glint-Research/TrueMath
last_updated: 2026-06-15
license: apache-2.0
model_type:
  - trueact
architectures:
  - TrueACTLM
library_name:
  - pytorch
frameworks:
  - pytorch
downloads: 0
stars: 0
---

# TrueMath

> TrueMath - Glint-Research 在 ModelScope 开源的模型。A 1-layer TrueACT model trained to generate chain-of-thought reasoning for arithmetic expressions with +, -, , and parentheses.

Glint-Research/TrueMath 是 ModelScope 魔搭社区上的机器学习模型，采用 apache-2.0 许可。

- **Repository**: Glint-Research/TrueMath
- **License**: apache-2.0
- **Downloads**: 0
- **Stars**: 0
- **Last updated**: 2026-06-15

Source: https://www.modelscope.cn/models/Glint-Research/TrueMath

---

# TrueMath

A 1-layer TrueACT model trained to generate chain-of-thought reasoning for arithmetic expressions with `+`, `-`, `*`, and parentheses.

Trained from scratch on purely random binary-tree expressions. Every non-root subexpression is parenthesized, forcing the model to learn step-by-step reduction of nested arithmetic.

## Performance

![Training Curves](training_curves.png)

| Test | Accuracy |
|------|----------|
| Fixed 12-case benchmark | 12/12 (100%) |
| Random 500 expressions | 91.6% |

Errors are exclusively multi-digit arithmetic mistakes (e.g., `42×88=3524`). The model's structural reasoning (parenthesis resolution, operator precedence, chain-of-thought decomposition) is near-perfect.

## Files

| File | Description |
|------|-------------|
| `model.pt` | TorchScript-traced model for inference (no Python source needed) |
| `checkpoint.pt` | Original PyTorch checkpoint (requires the TrueACT architecture code to load) |
| `infer.py` | Standalone inference script |
| `plot.py` | Generate the training curves figure from the training log |

## Usage

```bash
# Single prompt
python infer.py model.pt '((5*5)+(10*2))='

# Interactive mode
python infer.py model.pt
Prompt > (1+2)*3=
```

The model expects a prompt ending with `=` and generates the chain-of-thought steps:

```
Input:  ((5*5)+(10*2))=
Output: ((5*5)+(10*2))=(25+(10*2))=(25+20)=45
```

## Requirements

- Python 3.10+
- PyTorch 2.0+

No other dependencies.
