summerMC commited on
Commit
de44a45
·
verified ·
1 Parent(s): 46c3d88

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +144 -89
README.md CHANGED
@@ -1,95 +1,117 @@
1
- # TRM-HRM
2
 
3
- Attention-free Hierarchical Recursive Model (TRM-HRM)
4
 
5
- TRM-HRM is an experimental language model architecture that completely removes self-attention and replaces it with recursive hierarchical computation using dilated depthwise convolutions.
6
 
7
- The model is inspired by Hierarchical Reasoning Models (HRM) and Tiny Recursive Models (TRM), while remaining fully autoregressive and compatible with the Hugging Face ecosystem.
8
 
9
- ## Architecture
10
 
11
- TRM-HRM consists of three recursive processing levels:
12
 
13
- * Low-level reasoning module
14
- * Mid-level reasoning module
15
- * High-level reasoning module
16
 
17
- Each level is implemented using:
18
 
19
- * RMSNorm
 
 
 
 
 
20
  * RoPE positional encoding
21
- * Causal dilated depthwise convolutions
22
- * SwiGLU feed-forward layers
23
- * Recursive parameter reuse
24
 
25
- No attention layers are used anywhere in the network.
26
 
27
- ### Hierarchical Loop
28
 
29
  ```text
30
- Input Tokens
31
-
32
- Low TRM
33
-
34
- Mid TRM
35
-
36
- High TRM
37
-
38
- Feedback
39
-
40
- Repeat N cycles
41
-
 
 
 
 
 
 
42
  LM Head
43
  ```
44
 
45
- The hierarchy exchanges information through learned projection layers:
46
-
47
- ```text
48
- Low → Mid
49
- Mid → High
50
- High → Mid
51
- Mid → Low
52
- ```
53
 
54
- allowing iterative refinement of latent representations.
 
 
 
 
55
 
56
- ## Key Features
57
 
58
- * 100% attention-free
59
- * Autoregressive language modeling
60
- * Hierarchical recursive reasoning
61
- * RoPE positional encoding
62
- * Dilated depthwise convolution mixer
63
- * Hugging Face compatible
64
- * safetensors support
65
- * Efficient on consumer GPUs
66
 
67
- ## Model Configuration
68
 
69
- Current released checkpoint:
70
 
71
  ```text
72
  Parameters: ~15M
73
 
74
- dim = 256
75
- hidden_dim = 512
76
 
77
- low_steps = 6
78
- mid_steps = 3
79
- high_steps = 2
80
 
81
- cycles = 3
82
 
83
- kernel_size = 5
84
 
85
  low_dilations = [1,2,4,8]
86
  mid_dilations = [2,4,8,16]
87
  high_dilations = [4,8,16,32]
88
  ```
89
 
90
- ## Training
 
 
 
 
 
 
 
 
 
 
91
 
92
- ### Base Pretraining
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  Dataset:
95
 
@@ -109,7 +131,9 @@ Objective:
109
  Causal Language Modeling
110
  ```
111
 
112
- ### SFT
 
 
113
 
114
  Dataset:
115
 
@@ -127,36 +151,40 @@ Format:
127
  ...
128
  ```
129
 
130
- ## Loading
 
 
131
 
132
  ```python
133
  from transformers import AutoTokenizer
134
  from transformers import AutoModelForCausalLM
135
 
136
  tokenizer = AutoTokenizer.from_pretrained(
137
- "your-org/trm-hrm",
138
- trust_remote_code=True,
139
  )
140
 
141
  model = AutoModelForCausalLM.from_pretrained(
142
- "your-org/trm-hrm",
143
- trust_remote_code=True,
144
  )
145
  ```
146
 
147
- ## Generation
 
 
148
 
149
  ```python
150
  prompt = """
151
  ### Instruction:
152
- Explain artificial intelligence.
153
 
154
  ### Response:
155
  """
156
 
157
  inputs = tokenizer(
158
  prompt,
159
- return_tensors="pt",
160
  )
161
 
162
  outputs = model.generate(
@@ -164,51 +192,78 @@ outputs = model.generate(
164
  max_new_tokens=128,
165
  do_sample=True,
166
  temperature=0.7,
167
- top_k=40,
168
  )
169
 
170
  print(
171
  tokenizer.decode(
172
  outputs[0],
173
- skip_special_tokens=True,
174
  )
175
  )
176
  ```
177
 
178
- ## Research Goals
 
 
179
 
180
- TRM-HRM explores whether hierarchical recursive computation can replace self-attention in language modeling while maintaining competitive reasoning capability and improved efficiency.
181
 
182
- The project investigates:
183
 
184
- * Recursive reasoning
185
- * Multi-timescale computation
186
- * Hierarchical latent processing
187
- * Attention-free language models
188
- * Efficient inference architectures
189
 
190
- ## Limitations
191
 
192
- Current release is an early experimental checkpoint.
 
 
193
 
194
  Known limitations:
195
 
196
- * Small parameter count (~15M)
197
- * Limited instruction tuning
198
- * Lower benchmark performance than modern LLMs
199
- * Experimental Hugging Face integration
200
- * Research-only release
 
 
 
 
 
 
 
 
 
 
 
201
 
202
- ## License
 
 
 
 
 
 
 
 
 
203
 
204
  Apache-2.0
205
 
206
- ## Citation
 
 
207
 
208
  ```bibtex
209
- @software{trm_hrm,
210
- title={TRM-HRM: Attention-Free Hierarchical Recursive Language Model},
211
- author={Your Name},
212
- year={2026}
 
213
  }
214
  ```
 
1
+ # TRM-text
2
 
3
+ TRM-text is an attention-free language model based on a Tiny Recursive Model (TRM) architecture.
4
 
5
+ Unlike Transformer-based language models, TRM-text removes self-attention entirely and replaces it with recursive computation built from causal dilated depthwise convolutions, hierarchical latent refinement, and parameter reuse.
6
 
7
+ The goal of TRM-text is to investigate whether recursive neural computation can provide competitive language modeling performance while dramatically reducing computational cost.
8
 
9
+ ---
10
 
11
+ # Overview
12
 
13
+ TRM-text explores a different scaling path from Transformers.
 
 
14
 
15
+ Instead of increasing attention heads and context interactions, TRM-text repeatedly refines hidden representations using a hierarchy of recursive processing blocks.
16
 
17
+ Key properties:
18
+
19
+ * Attention-free
20
+ * Autoregressive language modeling
21
+ * Recursive computation
22
+ * Hierarchical latent refinement
23
  * RoPE positional encoding
24
+ * Dilated depthwise convolution mixer
25
+ * Hugging Face compatible
26
+ * safetensors support
27
 
28
+ ---
29
 
30
+ # Architecture
31
 
32
  ```text
33
+ Tokens
34
+
35
+
36
+ Embedding
37
+
38
+
39
+ Low-Level TRM
40
+
41
+
42
+ Mid-Level TRM
43
+
44
+
45
+ High-Level TRM
46
+
47
+
48
+ Recursive Feedback
49
+
50
+
51
  LM Head
52
  ```
53
 
54
+ Each recursive block contains:
 
 
 
 
 
 
 
55
 
56
+ * RMSNorm
57
+ * RoPE
58
+ * Causal Dilated Depthwise Convolution
59
+ * SwiGLU Feed Forward Network
60
+ * Residual Recurrence
61
 
62
+ No self-attention layers are used.
63
 
64
+ ---
 
 
 
 
 
 
 
65
 
66
+ # Model Configuration
67
 
68
+ Current release:
69
 
70
  ```text
71
  Parameters: ~15M
72
 
73
+ dim = 256
74
+ hidden_dim = 512
75
 
76
+ low_steps = 6
77
+ mid_steps = 3
78
+ high_steps = 2
79
 
80
+ cycles = 3
81
 
82
+ kernel_size = 5
83
 
84
  low_dilations = [1,2,4,8]
85
  mid_dilations = [2,4,8,16]
86
  high_dilations = [4,8,16,32]
87
  ```
88
 
89
+ ---
90
+
91
+ # Compute Efficiency
92
+
93
+ Relative training cost:
94
+
95
+ | Architecture | Relative Cost |
96
+ | ------------ | ------------: |
97
+ | Transformer | 1200 |
98
+ | HRM | 100 |
99
+ | TRM-text | 1 |
100
 
101
+ These values represent relative compute requirements under the experimental scaling assumptions used during development.
102
+
103
+ The objective of TRM-text is to maximize efficiency through:
104
+
105
+ * parameter reuse
106
+ * recursive computation
107
+ * hierarchical refinement
108
+ * elimination of attention operations
109
+
110
+ ---
111
+
112
+ # Training
113
+
114
+ ## Base Pretraining
115
 
116
  Dataset:
117
 
 
131
  Causal Language Modeling
132
  ```
133
 
134
+ ---
135
+
136
+ # Instruction Tuning
137
 
138
  Dataset:
139
 
 
151
  ...
152
  ```
153
 
154
+ ---
155
+
156
+ # Loading
157
 
158
  ```python
159
  from transformers import AutoTokenizer
160
  from transformers import AutoModelForCausalLM
161
 
162
  tokenizer = AutoTokenizer.from_pretrained(
163
+ "summerMC/TRM-text",
164
+ trust_remote_code=True
165
  )
166
 
167
  model = AutoModelForCausalLM.from_pretrained(
168
+ "summerMC/TRM-text",
169
+ trust_remote_code=True
170
  )
171
  ```
172
 
173
+ ---
174
+
175
+ # Inference
176
 
177
  ```python
178
  prompt = """
179
  ### Instruction:
180
+ Explain artificial intelligence in simple terms.
181
 
182
  ### Response:
183
  """
184
 
185
  inputs = tokenizer(
186
  prompt,
187
+ return_tensors="pt"
188
  )
189
 
190
  outputs = model.generate(
 
192
  max_new_tokens=128,
193
  do_sample=True,
194
  temperature=0.7,
195
+ top_k=40
196
  )
197
 
198
  print(
199
  tokenizer.decode(
200
  outputs[0],
201
+ skip_special_tokens=True
202
  )
203
  )
204
  ```
205
 
206
+ ---
207
+
208
+ # Research Motivation
209
 
210
+ TRM-text investigates whether recursive neural systems can replace attention mechanisms in language modeling.
211
 
212
+ Research directions:
213
 
214
+ * recursive reasoning
215
+ * hierarchical computation
216
+ * efficient language models
217
+ * attention-free architectures
218
+ * low-cost scaling laws
219
 
220
+ ---
221
 
222
+ # Limitations
223
+
224
+ Current checkpoint is experimental.
225
 
226
  Known limitations:
227
 
228
+ * small parameter count
229
+ * limited instruction tuning
230
+ * lower capability than modern frontier models
231
+ * research-focused implementation
232
+ * benchmark coverage still limited
233
+
234
+ ---
235
+
236
+ # Intended Use
237
+
238
+ TRM-text is intended for:
239
+
240
+ * language model research
241
+ * efficient architecture experimentation
242
+ * recursive computation studies
243
+ * attention-free modeling research
244
 
245
+ Not intended for:
246
+
247
+ * safety-critical systems
248
+ * medical decision making
249
+ * legal advice
250
+ * financial advice
251
+
252
+ ---
253
+
254
+ # License
255
 
256
  Apache-2.0
257
 
258
+ ---
259
+
260
+ # Citation
261
 
262
  ```bibtex
263
+ @software{trm_text_2026,
264
+ title={TRM-text: Attention-Free Recursive Language Modeling},
265
+ author={summerMC},
266
+ year={2026},
267
+ url={https://huggingface.co/summerMC/TRM-text}
268
  }
269
  ```