Update: Due to many automatically generated and irrelevant issues submitted to this repo (that have been deleted now) and our limited capac…
Update: Due to many automatically generated and irrelevant issues submitted to this repo (that have been deleted now) and our limited capac…
Tiny Recursion Model (TRM) recursively improves its predicted answer y with a tiny network. It starts with the embedded input question x and initial embedded answer y and latent z. For up to K improvements steps, it tries to improve its answer y. It does so by i) recursively updating n times its latent z given the question x, current answer y, and current latent z (recursive reasoning), and then ii) updating its answer y given the current answer y and current latent z. This recursive process allows the model to progressively improve its answer (potentially addressing any errors from its previous answer) in an extremely parameter-efficient manner while minimizing overfitting. ### Requirements Installation should take a few minutes. For the smallest experiments on Sudoku-Extreme (pretrain_mlp_t_sudoku), you need 1 GPU with enough memory. With 1 L40S (48Gb Ram), it takes around 18h to finish. In case that you run into issues due to library versions, here is the requirements with the exact versions used: [specific_requirements.txt](https://github.com/SamsungSAILMontreal/TinyRecursiveModels/blob/main/specific_requirements.txt). - Python 3.10 (or similar) - Cuda 12.6.0 (or similar) ```bash pip install --upgrade pip wheel setuptools pip install --pre --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu126 # install torch based on your cuda version pip install -r requirements.txt # install requirements pip install --no-cache-dir --no-build-isolation adam-atan2 wandb login YOUR-LOGIN # login if you want the logger to sync results to your Weights & Biases (https://wandb.ai/) ``` ### Dataset Preparation ``` … ``` ## Experiments ### Sudoku-Extreme (assuming 1 L40S GPU): ``` … ``` Expected: Around 75% exact-accuracy (+- 2%) *Runtime:* < 20 hours ### Maze-Hard (assuming 4 L40S GPUs): ```bash run_name="pretrain_att_maze30x30" torchrun --nproc-per-node 4 --rdzv_backend=c10d --rdzv_endpoint=localhost:0 --nnodes=1 pretrain.py \ arch=trm \ data_paths="[data/maze-30x30-hard-1k]" \ evaluators="[]" \ epochs=50000 eval_interval=5000 \ lr=1e-4 puzzle_emb_lr=1e-4 weight_decay=1.0 puzzle_emb_weight_decay=1.0 \ arch.L_layers=2 \ arch.H_cycles=3 arch.L_cycles=4 \ +run_name=${run_name} ema=True ``` *Runtime:* < 24 hours Actually, you can run Maze-Hard with 1 L40S GPU by reducing the batch-size with no noticable loss in performance: ```bash run_name="pretrain_att_maze30x30_1gpu" python pretrain.py \ arch=trm \ data_paths="[data/maze-30x30-hard-1k]" \ evaluators="[]" \ epochs=50000 eval_interval=5000 \ lr=1e-4 puzzle_emb_lr=1e-4 weight_decay=1.0 puzzle_emb_weight_decay=1.0 global_batch_size=128 \ arch.L_layers=2 \ arch.H_cycles=3 arch.L_cycles=4 \ +run_name=${run_name} ema=True ``` *Runtime:* < 24 hours ### ARC-AGI-1 (assuming 4 H-100 GPUs): ```bash run_name="pretrain_att_arc1concept_4" torchrun --nproc-per-node 4 --rdzv_backend=c10d --rdzv_endpoint=localhost:0 --nnodes=1 pretrain.py \ arch=trm \ data_paths="[data/arc1concept-aug-1000]" \ arch.L_layers=2 \ arch.H_cycles=3 arch.L_cycles=4 \ +run_name=${run_name} ema=True ``` *Runtime:* ~3 days ### ARC-AGI-2 (assuming 4 H-100 GPUs): ```bash run_name="pretrain_att_arc2concept_4" torchrun --nproc-per-node 4 --rdzv_backend=c10d --rdzv_endpoint=localhost:0 --nnodes=1 pretrain.py \ arch=trm \ data_paths="[data/arc2concept-aug-1000]" \ arch.L_layers=2 \ arch.H_cycles=3 arch.L_cycles=4 \ +run_name=${run_name} ema=True ``` *Runtime:* ~3 days ## Reference If you find our work useful, please consider citing: ```bibtex @misc{jolicoeurmartineau2025morerecursivereasoningtiny, title={Less is More: Recursive Reasoning with Tiny Networks}, author={Alexia Jolicoeur-Martineau}, year={2025}, eprint={2510.04871}, archivePrefix={arXiv}, primaryClass={cs.LG}, url={https://arxiv.org/abs/2510.04871}, } ``` and the Hierarchical Reasoning Model (HRM): ```bibtex @misc{wang2025hierarchicalreasoningmodel, title={Hierarchical Reasoning Model}, author={Guan Wang and Jin Li and Yuhao Sun and Xing Chen and Changling Liu and Yue Wu and Meng Lu and Sen Song and Yasin Abbasi Yadkori}, year={2025}, eprint={2506.21734}, archivePrefix={arXiv}, primaryClass={cs.AI}, url={https://arxiv.org/abs/2506.21734}, } ``` This code is based on the Hierarchical Reasoning Model [code](https://github.com/sapientinc/HRM) and the Hierarchical Reasoning Model Analysis [code](https://github.com/arcprize/hierarchical-reasoning-model-analysis).
暂无开放 Issues,或尚未同步最近议题。