Skip to main content

The proposal from a Singaporean AGI company

Project description

Hierarchical Reasoning Model (wip)

Explorations into the proposed recurrent hierarchical reasoning model by Wang et al. from Sapient Intelligence. Official repository is here

Install

$ pip install HRM-pytorch

Usage

import torch
from HRM import HRM

hrm = HRM(
    networks = [
        dict(
            dim = 32,
            depth = 2,
            attn_dim_head = 8,
            heads = 1,
            use_rmsnorm = True,
            rotary_pos_emb = True,
            pre_norm = False
        ),
        dict(
            dim = 32,
            depth = 4,
            attn_dim_head = 8,
            heads = 1,
            use_rmsnorm = True,
            rotary_pos_emb = True,
            pre_norm = False
        )
    ],
    num_tokens = 256,
    dim = 32,
    reasoning_steps = 10
)

seq = torch.randint(0, 256, (3, 1024))
labels = torch.randint(0, 256, (3, 1024))

loss, hiddens, _ = hrm(seq, labels = labels)
loss.backward()

loss, hiddens, _ = hrm(seq, hiddens = hiddens, labels = labels)
loss.backward()

# after much training

pred = hrm(seq, reasoning_steps = 5)

Citations

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hrm_pytorch-0.1.6.tar.gz (194.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hrm_pytorch-0.1.6-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file hrm_pytorch-0.1.6.tar.gz.

File metadata

  • Download URL: hrm_pytorch-0.1.6.tar.gz
  • Upload date:
  • Size: 194.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for hrm_pytorch-0.1.6.tar.gz
Algorithm Hash digest
SHA256 545f1954c02521bb7e11f96f79a787213637c4e241445440e24244625ceb6c4a
MD5 0a847df599a824d6b8476d4d045b7aef
BLAKE2b-256 b9a53c0471b2e55e82cb3dc3e02c581329fb6e986e5c63c52f55c550676ac6fe

See more details on using hashes here.

File details

Details for the file hrm_pytorch-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: hrm_pytorch-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for hrm_pytorch-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b9aaf484cb0fe5aad08f62886c08502a9225bb483eaf6e34d06244e0f16b84c1
MD5 3b63240eb1afd2ae8dc07dfa50a84482
BLAKE2b-256 d9614d603837284873640eb67bde62705afab1906b53b7d17eaf62adc0894a5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page