Name | tiny-recursive-model JSON |
Version |
0.0.5
JSON |
| download |
home_page | None |
Summary | Tiny Recursive Model |
upload_time | 2025-10-10 15:21:17 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License
Copyright (c) 2025 Phil Wang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
artificial intelligence
deep learning
reasoning
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<img width="300" alt="trm-fig1" src="https://github.com/user-attachments/assets/950db79e-5f9c-4fec-a4e4-7b9355b39ce8" />
## Tiny Recursive Model (TRM) wip
Implementation of [Tiny Recursive Model](https://arxiv.org/abs/2510.04871) (TRM), improvement to [HRM](https://github.com/lucidrains/hrm) from Sapient AI, by [Alexia Jolicoeur-Martineau](https://ajolicoeur.wordpress.com/about/)
Official repository is [here](https://github.com/SamsungSAILMontreal/TinyRecursiveModels)
<img width="300" alt="trm-fig3" src="https://github.com/user-attachments/assets/bfe3dd2a-e859-492a-84d5-faf37339f534" />
## Install
```bash
$ pip install tiny-recursive-model
```
## Usage
```python
import torch
from tiny_recursive_model import TinyRecursiveModel, MLPMixer1D, Trainer
trm = TinyRecursiveModel(
dim = 16,
num_tokens = 256,
network = MLPMixer1D(
dim = 16,
depth = 2,
seq_len = 256
),
)
# mock dataset
from torch.utils.data import Dataset
class MockDataset(Dataset):
def __len__(self):
return 16
def __getitem__(self, idx):
inp = torch.randint(0, 256, (256,))
out = torch.randint(0, 256, (256,))
return inp, out
mock_dataset = MockDataset()
# trainer
trainer = Trainer(
trm,
mock_dataset,
epochs = 1,
batch_size = 16,
cpu = True
)
trainer()
# inference
pred_answer, exit_indices = trm.predict(
torch.randint(0, 256, (1, 256)),
max_deep_refinement_steps = 12,
halt_prob_thres = 0.1
)
# save to collection of specialized networks for tool call
torch.save(trm.state_dict(), 'saved-trm.pt')
```
## Citations
```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},
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "tiny-recursive-model",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "artificial intelligence, deep learning, reasoning",
"author": null,
"author_email": "Phil Wang <lucidrains@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b1/46/06c48d8dd31c4b0cdd08e9f1b162ab2b29d25a65bcb98dcc82a6283ff8bd/tiny_recursive_model-0.0.5.tar.gz",
"platform": null,
"description": "\n<img width=\"300\" alt=\"trm-fig1\" src=\"https://github.com/user-attachments/assets/950db79e-5f9c-4fec-a4e4-7b9355b39ce8\" />\n\n## Tiny Recursive Model (TRM) wip\n\nImplementation of [Tiny Recursive Model](https://arxiv.org/abs/2510.04871) (TRM), improvement to [HRM](https://github.com/lucidrains/hrm) from Sapient AI, by [Alexia Jolicoeur-Martineau](https://ajolicoeur.wordpress.com/about/)\n\nOfficial repository is [here](https://github.com/SamsungSAILMontreal/TinyRecursiveModels)\n\n<img width=\"300\" alt=\"trm-fig3\" src=\"https://github.com/user-attachments/assets/bfe3dd2a-e859-492a-84d5-faf37339f534\" />\n\n## Install\n\n```bash\n$ pip install tiny-recursive-model\n```\n\n## Usage\n\n```python\nimport torch\nfrom tiny_recursive_model import TinyRecursiveModel, MLPMixer1D, Trainer\n\ntrm = TinyRecursiveModel(\n dim = 16,\n num_tokens = 256,\n network = MLPMixer1D(\n dim = 16,\n depth = 2,\n seq_len = 256\n ),\n)\n\n# mock dataset\n\nfrom torch.utils.data import Dataset\nclass MockDataset(Dataset):\n def __len__(self):\n return 16\n\n def __getitem__(self, idx):\n inp = torch.randint(0, 256, (256,))\n out = torch.randint(0, 256, (256,))\n return inp, out\n\nmock_dataset = MockDataset()\n\n# trainer\n\ntrainer = Trainer(\n trm,\n mock_dataset,\n epochs = 1,\n batch_size = 16,\n cpu = True\n)\n\ntrainer()\n\n# inference\n\npred_answer, exit_indices = trm.predict(\n torch.randint(0, 256, (1, 256)),\n max_deep_refinement_steps = 12,\n halt_prob_thres = 0.1\n)\n\n# save to collection of specialized networks for tool call\n\ntorch.save(trm.state_dict(), 'saved-trm.pt')\n\n```\n\n## Citations\n\n```bibtex\n@misc{jolicoeurmartineau2025morerecursivereasoningtiny,\n title = {Less is More: Recursive Reasoning with Tiny Networks}, \n author = {Alexia Jolicoeur-Martineau},\n year = {2025},\n eprint = {2510.04871},\n archivePrefix = {arXiv},\n primaryClass = {cs.LG},\n url = {https://arxiv.org/abs/2510.04871}, \n}\n```\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Phil Wang\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "Tiny Recursive Model",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://pypi.org/project/tiny-recursive-model/",
"Repository": "https://github.com/lucidrains/tiny-recursive-model"
},
"split_keywords": [
"artificial intelligence",
" deep learning",
" reasoning"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "31f3a69cf431d8ffad6410af12f8ac39dcadb3847cb0315bb0ee5d3f7b678eaf",
"md5": "92a1de270f8f8f4ab98b76537bbaca88",
"sha256": "55f3ec7dfbc6c732d1230742769d73dbdbae6cbc2289357e953522e05489e97b"
},
"downloads": -1,
"filename": "tiny_recursive_model-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "92a1de270f8f8f4ab98b76537bbaca88",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8275,
"upload_time": "2025-10-10T15:21:16",
"upload_time_iso_8601": "2025-10-10T15:21:16.294031Z",
"url": "https://files.pythonhosted.org/packages/31/f3/a69cf431d8ffad6410af12f8ac39dcadb3847cb0315bb0ee5d3f7b678eaf/tiny_recursive_model-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b14606c48d8dd31c4b0cdd08e9f1b162ab2b29d25a65bcb98dcc82a6283ff8bd",
"md5": "d349ab27899af85ae74a79bdae3fd48d",
"sha256": "10da9f9db78d420a1eaf8ba1a5112078c9aafdd71a26a6065b947a22c030e34e"
},
"downloads": -1,
"filename": "tiny_recursive_model-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "d349ab27899af85ae74a79bdae3fd48d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 8960,
"upload_time": "2025-10-10T15:21:17",
"upload_time_iso_8601": "2025-10-10T15:21:17.386057Z",
"url": "https://files.pythonhosted.org/packages/b1/46/06c48d8dd31c4b0cdd08e9f1b162ab2b29d25a65bcb98dcc82a6283ff8bd/tiny_recursive_model-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-10 15:21:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lucidrains",
"github_project": "tiny-recursive-model",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tiny-recursive-model"
}