Downloads · 30 days
0
SmallAICreator/TRM-LM-v2-10M
TRM-LM-v2-10M is a machine learning model from SmallAICreator. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as apache-2.0.
A 9.8M-parameter language model that thinks in loops, by SmallAICreator / UltraLabs.
Downloads · 30 days
0
Access
Public
Updated Sep 24, 2026
Repo size
98.7 MB
Likes
0
Public
Click a slice to open those files.
.pt78.6 MB · 79%
From the Hugging Face model README
A 9.8M-parameter language model that thinks in loops, by SmallAICreator / UltraLabs.
It is an ordinary 7-layer transformer whose middle 5 layers are run several times per token
(prelude 1 → core 5 × r loops → coda 1). Same parameters, more thinking. With r = 1 it is a normal
7-layer model; every extra loop re-reads the context with the same weights.
Four 10M models trained on the exact same 602,144,768 tokens in the same order (FineWeb-Edu, Cosmopedia-v2, SlimPajama), same optimizer and schedule, same 16K tokenizer. Only the architecture differs.
| Base model (0-shot) | Same-shape 10M (2 layers) | TRM-LM v1 | Normal 10M (7 layers) | TRM-LM v2 (3 loops) |
|---|---|---|---|---|
| Parameters | 9.83M | 9.83M | 9.82M | 9.82M |
| LAMBADA | 8.2% | 12.6% | 13.6% | 18.7% |
| SciQ | 56.3% | 55.6% | 52.4% | 58.1% |
| ARC-Easy | 35.7% | 35.1% | 34.6% | 36.5% |
| WikiText bits/byte ↓ | 1.468 | 1.461 | 1.414 | 1.391 |
| HellaSwag (norm) | 26.9% | 26.6% | 26.9% | 27.0% |
| PIQA | 56.2% | 57.0% | 56.9% | 56.8% |
| Winogrande | 48.9% | 51.3% | 52.3% | 48.8% |
| Final training loss | 3.474 | 3.44 | 3.321 | 3.285 |
LAMBADA +38% over a normal model of the same size. For scale: Pythia-70M (7× the parameters, ~500× the data) scores 22.7%.
| Loops | 1 | 2 | 3 | 4 | 6 |
|---|---|---|---|---|---|
| LAMBADA | 13.6% | 17.6% | 18.7% | 18.9% | 18.7% |
| WikiText bits/byte | 1.436 | 1.397 | 1.391 | 1.392 | 1.408 |
It gains where the answer depends on using the context (LAMBADA, SciQ, perplexity) and ties where it depends on stored knowledge (HellaSwag, PIQA). Loops add computation, not memory. The cost: at 3 loops it runs ~17 layer passes per token versus 7, about 2.4× the compute of the normal model.
| File | What |
|---|---|
trm2.pt | base model (pretrained, the benchmark row above) |
trm2_sft.pt | chat model (fine-tuned on smol-smoltalk + everyday conversations) |
modeling_trm2.py | standalone PyTorch model + generate() |
tokenizer.json | 16,384-token byte-level BPE |
TRM-LM-v2-10M-chat.trm | the chat model packed for the TRM Chat Android app (format TRM2, fp16) |
results/ | raw training logs and benchmark JSON for all runs |
import torch
from tokenizers import Tokenizer
from modeling_trm2 import TRM2, generate
tok = Tokenizer.from_file("tokenizer.json")
model = TRM2()
model.load_state_dict(torch.load("trm2_sft.pt", map_location="cpu"))
model.eval()
print(generate(model, tok, "What is the capital of France?", loops=3))
# -> "The capital of France is Paris, ..."
Chat format: <|user|>message<|end|><|assistant|>reply<|end|> (ids 3, 5, 4, 5). generate(..., chat=False)
continues plain text with the base model.
It is 10M parameters. It greets you ("hi" → "Hello! How can I help you today?"), answers simple factual
questions ("The capital of France is Paris."), and says "You're welcome!" to thanks. It still drifts on
jokes, poems, arithmetic and questions about itself. Chat tuning also costs some of the base model's edge:
LAMBADA drops from 18.7% (base) to 13.1% at 3 loops / 13.4% at 4 loops. Use trm2.pt for text continuation
and benchmarks, trm2_sft.pt for chat. Held-out chat loss is lowest at 3 loops
(1: 2.305, 2: 2.143, 3: 2.118, 4: 2.123, 6: 2.175).
Why v1 lost and v2 wins. TRM-LM v1 followed the original Tiny Recursive Model recipe (two shared layers, answer/scratchpad states, detached carry between cycles, every cycle supervised). On text it learned to do all its work in the first cycle, and extra cycles made it slightly worse. v2 moves the parameters into depth, lets gradients cross loops, and supervises only the final output, and extra loops then help.
Made by SmallAICreator / UltraLabs.