Skip to main content
trm-fig1

Tiny Recursive Model (TRM)

Implementation of Tiny Recursive Model (TRM), improvement to HRM from Sapient AI, by Alexia Jolicoeur-Martineau

Official repository is here

Interview with Alexia!

Paper review by bycloud

URM

trm-fig3

Install

$ pip install tiny-recursive-model

Usage

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

@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}, 
}

Metadata

Release files for tiny-recursive-model 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tiny-recursive-model 0.0.15
File Size Uploaded Provenance Actions
tiny_recursive_model-0.0.15.tar.gz 10.0 kB Without provenance Details for tiny_recursive_model-0.0.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tiny-recursive-model 0.0.15
File Interpreter ABI Platform Actions
tiny_recursive_model-0.0.15-py3-none-any.whl Python 3 none any Details for tiny_recursive_model-0.0.15-py3-none-any.whl

Total release size: 21.0 kB

Release files / tiny_recursive_model-0.0.15.tar.gz

Download URL tiny_recursive_model-0.0.15.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ed3011a66be8dc365922f14c5dd2f5f31e4afc5f6191487e57c298fdd6e7cf97
BLAKE2b-256 checksum
How to use checksums
554f82c0218b4fdd6911af55e6342de46d77bf951090319b98f765d5276eb445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / tiny_recursive_model-0.0.15-py3-none-any.whl

Download URL tiny_recursive_model-0.0.15-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3099441e29f6f048b1b21c4bebf58ba4bc641039016ac686a0044bc22f4cc587
BLAKE2b-256 checksum
How to use checksums
4d7bfc7f929a6482ad2fa541381738aae4d8bf9897e97e412433d3566b3dd8ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for tiny-recursive-model 0.0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page