[논문리뷰] Hierarchical Reasoning Model

 

 

GitHub - sapientinc/HRM: Hierarchical Reasoning Model Official Release

Hierarchical Reasoning Model Official Release. Contribute to sapientinc/HRM development by creating an account on GitHub.

github.com

 

본문

https://arxiv.org/pdf/2506.21734

 

 

 

Chain-of-Thought [CoT] 돌릴 때 더. 가벼운 모델로 돌리기

Low-level 에서 작은 모델로 빠르게 돌리고 → High-level에서 큰 모델로 느리게 돌리기

 

 

관련 정보

https://youtu.be/RK7lysjz_G0?si=4GYLAbIJ3zTMTQOR

 

https://news.hada.io/topic?id=22203

 

계층적 추론 모델 | GeekNews

계층적 추론 모델(Hierarchical Reasoning Model) 은 AI의 복잡한 목표 지향적 행동 실행 과정에서 기존 LLM 기반 Chain-of-Thought 기법의 한계(불안정한 작업 분해, 많은 데이터 요구, 지연 문제)를 극복함인간

news.hada.io

 

 

Abstract

Reasoning, the process of devising and executing complex goal-oriented action sequences, remains a critical challenge in AI. Current large language models (LLMs) primarily employ Chain-of-Thought (CoT) techniques, which suffer from brittle task decomposition, extensive data requirements, and high latency. Inspired by the hierarchical and multi-timescale processing in the human brain, we propose the Hierarchical Reasoning Model (HRM), a novel recurrent architecture that attains significant computational depth while maintaining both training stability and efficiency. HRM executes sequential reasoning tasks in a single forward pass without explicit supervision of the intermediate process, through two interdependent recurrent modules: a high-level module responsible for slow, abstract planning, and a low-level module handling rapid, detailed computations. With only 27 million parameters, HRM achieves exceptional performance on complex reasoning tasks using only 1000 training samples. The model operates without pre-training or CoT data, yet achieves nearly perfect performance on challenging tasks including complex Sudoku puzzles and optimal path finding in large mazes. Furthermore, HRM outperforms much larger models with significantly longer context windows on the Abstraction and Reasoning Corpus (ARC), a key benchmark for measuring artificial general intelligence capabilities. These results underscore HRM’s potential as a transformative advancement toward universal computation and general-purpose reasoning systems.

 

기존 문제점 : 기존의 LLM들은 주로 Chain-of-Thought (CoT) 기법을 통해 reasoning을 수행

  • brittle한(깨지기 쉬운) task 분해
  • 대량의 데이터 필요
  • 높은 latency

간 두뇌의 계층적·다중 시간척도 처리(hierarchical & multi-timescale processing) 에서 영감을 받아 새로운 recurrent architecture인 Hierarchical Reasoning Model (HRM) 을 제안

 

1 Introduction

Figure 1: Left: HRM is inspired by hierarchical processing and temporal separation in the brain. It has two recurrent networks operating at different timescales to collaboratively solve tasks. Right: With only about 1000 training examples, the HRM (~27M parameters) surpasses state-of-the-art CoT models on inductive benchmarks (ARC-AGI) and challenging symbolic tree-search puzzles (Sudoku-Extreme, Maze-Hard) where CoT models failed completely. The HRM was randomly initialized, and it solved the tasks directly from inputs without chain of thoughts.

 

 

Deep Learning의 “Depth” 문제

layer를 깊게 쌓을수록 표현력과 성능이 향상된다는 가정 → Transformer 기반 LLM은 “shallow”한 구조를 유지한다는 점에서 역설적

Transformer는

고정된 연산 깊이(fixed depth), AC⁰, TC⁰ 복잡도 클래스(즉, 병렬 연산은 빠르지만 다항시간 계산 불가)에 속함.

→ 따라서 Turing-complete하지 않음

→ 복잡한 알고리즘적 reasoning, 계획, 상징 조작(symbolic manipulation)을 수행할 수 없음.

 

AC⁰, TC⁰ 는 constant-depth circuit

  • AC⁰: AND/OR/NOT 게이트를 일정한 깊이로 연결한 회로
  • TC⁰: AC⁰ + Majority 연산이 추가된 회로

이런 회로는 입력 크기가 커져도 연산 단계 수가 일정합니다.

→ 즉, “병렬화는 잘 되지만 연속적 사고(sequence reasoning)”는 못함.

Deep이라는 의미는 단순 architectural depth를 넘어서 computational depth가 증가해야함.

Transformer는 layer는 많지만 각 토큰에 대한 계산은 한 번의 forward 끝남

  • 즉, 토큰 입력 → self-attention → MLP → 바로 출력.

이건 “한 번의 feedforward로 끝나는 얕은 함수 계산(shallow circuit)”

RNN은 “시간 방향으로 깊고”, Transformer는 “공간적으로 넓지만 시간적으로 얕다.
RNN : 토큰 하나씩 입력 [ $h_1 \to h_2 \to h_3 \to \dots \to h_{1024}$]
TR : 토큰이 한번에 들어가서 계산됨

 

예시: Sudoku와 같은 퍼즐 문제에서 layer 수를 늘려도

정확도는 향상되지만, “탐색적 reasoning”은 여전히 실패함.

→ scaling law로는 해결되지 않음.

 

Limitation of Chain-of-Thought (CoT)

  • CoT는 LLM이 reasoning을 “토큰 단위 언어 시퀀스”로 외재화하는 방식.
    • 복잡한 문제를 여러 중간 단계(step)로 나누어 텍스트 형태로 추론.
  • 하지만 CoT는 “임시방편적(heuristic)” 해결책일 뿐, 구조적 해결이 아님.
문제 설명
비신뢰성 (brittle) 한 단계라도 잘못되면 전체 reasoning이 붕괴
비효율성 복잡한 문제일수록 더 많은 토큰을 생성 → 속도 저하
데이터 의존성 CoT 예시나 fine-tuning이 필요
언어적 제약 reasoning이 “언어 패턴”에 묶여 있음

 

 

Latent Reasoning

모델이 언어를 출력하지 않고, 내부 hidden state 상에서 계산을 수행.

여전히 effective computational depth가 제한적

시도 한계
layer 쌓기 gradient vanishing → 학습 불안정, 계산 비효율
recurrent 구조 사용 BPTT로 인한 O(T) 메모리 비용, 생물학적 비현실성
Transformer 유지 여전히 shallow, parallel-only

 

 

기존 Recurrent Network의 한계

  • RNN류 모델은 이론적으로 깊은 reasoning이 가능하지만:
    • 학습 중 조기 수렴(early convergence) 으로 연산이 멈춤
    • BPTT (Backpropagation Through Time) 는 메모리·계산비용이 너무 큼
    • 생물학적으로도 비현실적.

Figure 2: The necessity of depth for complex reasoning. Left: On Sudoku-Extreme Full, which require extensive tree-search and backtracking, increasing a Transformer’s width yields no performance gain, while increasing depth is critical. Right: Standard architectures saturates, failing to benefit from increased depth. HRM overcomes this fundamental limitation, effectively using its computational depth to achieve near-perfect accuracy.

 

depth를 늘릴 수록 성능 향상에 유의미 함

Recursive 할 수록 성능 향상

 

 

Proposal — Hierarchical Reasoning Model (HRM)

두 개의 recurrent module로 구성:

  • H (High-level): 느린 추상적 계획(reasoning)
  • L (Low-level): 빠른 세밀한 계산(fine computation)

계층적 수렴(hierarchical convergence) 개념:

  • L-module이 여러 step 동안 빠르게 계산하여 local equilibrium에 도달하면→ L을 reset하고 새로운 phase로 진입
  • → H-module이 한 번 느리게 업데이트

즉, “빠른 내적 반복 + 느린 전역 갱신”을 통해 한 번의 forward pass에서도 깊은 sequential computation을 수행.

 

 

One-step Gradient Approximation

기존 recurrent network는 BPTT를 통해 시간 전 단계까지 역전파해야 하지만, HRM은 one-step gradient approximation으로 학습.

  • 메모리 사용량 O(1) (vs. BPTT: O(T))
  • 생물학적으로 더 타당
  • 장기 reasoning 학습에 안정적

 

2 Hierarchical Reasoning Model

설계 영감

  • Hierarchical processing
  • Temporal Separation
  • Recurrent Connectivity

구성 요소

  • 세부 모듈 : 입력 임베더 $f_I(\cdot;\theta_I)$, 저수준 RNN $f_L(\cdot;\theta_L)$, 고수준 RNN $f_H(\cdot;\theta_H)$, 출력 헤드 $f_O(\cdot;\theta_O)$.
  • 시간 전개: 고수준 N 사이클, 각 사이클마다 저수준 T 스텝 → 총 스텝 $N\times T$.
  • 은닉상태: $z^L_i, z^H_i$ (초기 $z^L_0, z^H_0$).
  • 입력 임베딩: $\tilde{x}=f_I(x)$.
  • 업데이트 규칙
    • $L: z^L_i = f_L(z^L_{i-1}, z^H_{i-1}, \tilde{x};\theta_L)$
    • $H: i \equiv 0 \ (\mathrm{mod}\ T)$일 때만 업데이트
    • $z^H_i=
      \begin{cases}
      f_H(z^H_{i-1}, z^L_{i-1};\theta_H) & \text{(사이클 끝)}\
      z^H_{i-1} & \text{(그 외)}
      \end{cases}$
  • 출력: $\hat{y}=f_O(z^H_{NT};\theta_O)$.
  • 헬팅: 필요 시 조기 종료(아래 ACT 참고) 또는 추가 세그먼트 진행.

 

Hierarchical convergence

Figure 3: Comparison of forward residuals and PCA trajectories. HRM shows hierarchical convergence: the H-module steadily converges, while the L-module repeatedly converges within cycles before being reset by H, resulting in residual spikes. The recurrent neural network exhibits rapid convergence with residuals quickly approaching zero. In contrast, the deep neural network experiences vanishing gradients, with significant residuals primarily in the initial (input) and final layers.

 

Problem : 표준 RNN은 고정점으로 너무 빨리 수렴 → 업데이트가 미소해져 실질 깊이가 얕아짐.

fixed point : RNN의 반복 연산을 충분히 진행하면 상태가 더 이상 크게 변하지 않는 점에 도달

$h^* = f(h^*, x; \theta)$, $|h_t - h_{t-1}| \to 0$ 이렇게 되면 내부 계산이 멈춘 것과 동일

identity mapping 처럼 동작

  • $h_t \approx h^*$
  • $f(h_t) \approx f(h) = h$

RNN의 계산적 깊이(computational depth) 는 “몇 단계 동안 의미 있는 업데이트가 일어나는가”로 결정

 

  1. Jacobian(야코비안)의 고유값(spectral radius)이 < 1
  2. 활성함수의 포화(saturation)
    • tanh, sigmoid는 입력이 크면 gradient가 0 근처.
    • 몇 번의 업데이트 후 hidden이 포화 구간으로 들어가면 변화가 멈춤.
  3. 안정성 설계 (spectral clipping, orthogonal init 등)
    • Exploading를 막기 위해 안정성을 높이면 반대로 너무 안정(=빠른 수렴)해짐.
    • 이게 “너무 빨리 equilibrium에 도달”하는 상태.
 

[CS182] Lecture 10 Recurrent Neural Networks

이번 강의는 "Recurrent Neural Networks"에 대한 강의이다. 이름에서 알 수 있듯이 recurrent 무언가 반복되는 network라는 것을 알 수 있다. Recurrent Neural Network 첫 번째로 던지는 화두는 "만약 입력 데이터의

velog.io

 

위 문제를 해결하기 위해 다음 두 단계로 나눠 계산

  1. L-module (low-level): 빠르게 local equilibrium으로 수렴 (T step)
  2. H-module (high-level): 그 결과를 받아 “context”를 업데이트 → 새로운 equilibrium으로 재시작

한 번의 수렴이 끝나면 새로운 고정점 근처에서 다시 탐색

 

 

1-step Gradient Approximation

BPTT (Backpropagation Through Time) 는 메모리 O(T) 필요.

T개의 hidden state를 전부 저장해야 역전파 가능. 길이가 길면 메모리 폭발

본 논문에서는 시간을 따라 펼쳐서(backprop through time) 계산하지 않고,
마지막 상태(final state)만 이용해서 근사적인 gradient를 구함

RNN이 충분히 수렴했다면, 마지막 상태에서의 국소 변화만으로도 전체 시간 전개에 대한 기울기를 근사

DEQ (Deep Equilibrium Model)Implicit Function Theorem (IFT) 기반의 접근 방법

Figure 4: Top: Diagram of HRM with approximate gradient. Bottom: Pseudocode of HRM with deep supervision training in PyTorch.

 

 

Implicit Function Theorem (IFT)

https://en.wikipedia.org/wiki/Implicit_function_theorem

음함수 정리(IFT) 식 속에서 암시적으로 정의, 그 근처에서는 y를 x의 함수로 간주할 수 있고 심지어 미분까지 가능

DEQ (Deep Equilibrium Model)

foward pass : $z^* = f_\theta(z^*, x)$

“이 $z^*$를 찾아라!”

 

즉, forward는 고정점 찾기 문제(root-finding)로 바뀐다:

$\text{Find } z^* \text{ such that } g(z) = f_\theta(z, x) - z = 0$

  • Newton, Broyden, Anderson acceleration 같은 방법으로 g(z)=0을 푼다.
  • 보통 몇 번의 반복(iteration)으로 수렴.
  • 한 번 수렴하면 “무한히 깊은 네트워크의 최종 상태”와 동일한 표현을 얻는다.

 

이게 DEQ의 Forward pass다.

Backward process

보통 RNN/ResNet을 시간/깊이 방향으로 전개하려면 BPTT처럼

모든 중간 상태를 저장해야 해. → 메모리 O(T).

하지만 DEQ에서는 최종 평형점만 있으면 된다.

왜냐하면:

고정점 식

$z^* = f_\theta(z^, x)$

을 미분하면,

$dz^{d\theta} = (I - J_f)^{-1}\frac{\partial f_\theta}{\partial \theta}$

(여기서 $J_f = \frac{\partial f_\theta}{\partial z}$)

이건 암시적 함수 정리(IFT) 로부터 온 식이다.

즉, 중간 단계가 없어도,

평형점 근처에서 암시적으로 미분을 계산할 수 있다.

이 덕분에 Backpropagation Through Time (BPTT)처럼

수많은 hidden state를 저장할 필요가 없다.

O(1) 메모리

 

 

Deep Supervision

segment 단위로 피드백

  • 하나의 샘플 (x,y)에 대해 세그먼트 m을 반복한다. 각 세그먼트는 HRM의 정방향(= $N\times T$ 스텝)을 한 번 돌린 것과 같다.
  • 세그먼트 m이 끝나면 은닉 $z_m=(z^{H}{mNT}, z^{L}{mNT})$와 예측 $\hat y_m$를 얻는다.
  • 즉시 $\mathcal L_m=\mathrm{LOSS}(\hat y_m,y)$로 한 번의 역전파(1-step 근사)를 하고,
  • 이어서 $z_m$를 detach 해서 다음 세그먼트 입력으로 넘긴다 → 세그먼트 간 그래프가 끊긴다.

 

ACT(Adaptive Computational Time)

쉬운 문제는 짧게 생각해도 되고, 어려운 문제는 더 길게 생각해야 한다.

따라서 HRM은 세그먼트 루프에서 언제 멈출지를 스스로 결정한다(halting).

  • 세그먼트 m이 끝나면 H의 최종 상태 $z^{H}_{mNT}$를 Q-head에 넣어
  • $\hat Q_m=(\hat Q^{\text{halt}}_m,\hat Q^{\text{cont}}m)=\sigma(\theta_Q^\top z^{H}{mNT})$ 를 예측한다.
  • 정책:
    • 최소 세그먼트 $M_{\min}$은 $\varepsilon$ 확률로 ${2,\dots,M_{\max}}$에서 샘플(탐험), 아니면 1로 설정(탐욕).
    • $m\ge M_{\min}$이고 $\hat Q^{\text{halt}}_m > \hat Q^{\text{cont}}_m$ 이면 정지, 아니면 계속.
    • $m>M_{\max}$는 강제 정지(상한).

 

 

Stability of Q-learning in ACT

기존 Deep Q-learning(DQN) 문제점

  • divergence
  • 학습 불안정성
  • 필요: target network, replay buffer, gradient clipping 등 복잡한 안정화 장치

논문에서 인용한 Gallici et al. (2024) 의 이론 결과:

Q-learning은 다음 세 조건이 만족되면 안정적으로 수렴할 수 있다.

  • bounded (제한된 크기) → AdamW 옵티마이저 사용
  • weight decay → AdamW의 weight decay 항
  • Post-Norm → 모든 Transformer block이 RMSNorm(Post-Norm) 형태

 

Limitations & My Thoughts

한계점 (저자 관점)

  • 계산량이 많고 수렴이 느림 (특히 H,L 반복 구조)
  • 수렴 안정성 확보에 하이퍼파라미터 감도 높음
  • 입력-출력 매핑이 해석 가능성이 낮음 (내부 reasoning 해석 어려움)
  • 학습 중 비선형 Jacobian 근사가 불안정할 수 있음

비판적 고찰 (내 견해)

  • Deep이라는 의미가 단순 architectural depth를 넘어서 computational depth가 증가해야 함을 배움.
  • 최종 평형점, 결과를 학습한다는 것이, 마치 Diffusion model의 consistency model을 보는 것 같았다.
  • 이후에 이어지는 논문에 대한 평가를 팔로업 해보면 좋을 것 같다