FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index latest AI news TRM - Radical improvement over Transformers !
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TRM - Radical improvement over Transformers !
Posted: Thu Oct 09, 2025 06:59 AM
https://youtu.be/f-rgCxoJCEY?si=8tiIs4zatIQBIq0t
A tiny 7 Million parameter model just beat DeepSeek-R1, Gemini 2.5 pro, and o3-mini at reasoning on both ARG-AGI 1 and ARC-AGI 2.

It's called Tiny Recursive Model (TRM) from Samsung.

How can a model 10,000x smaller be smarter?
https://x.com/i/grok/share/dCUMLcHGItu9CZMy5gjtQzcUK
it's a very tiny Transformer, but it loops over itself at two different frequencies, updating two latent variables: one for the proposed answer and one for the reasoning
https://github.com/SamsungSAILMontreal/TinyRecursiveModels
https://huggingface.co/posts/m-ric/175050207181959
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Thu Oct 09, 2025 08:07 AM
we might finally have a radical architecture improvement over Transformers!!! 🚨

A lone scientist just proposed Tiny Recursive Model (TRM), and it is literally the most impressive model that I've seen this year.

➡️ Tiny Recursive Model is 7M parameters
➡️ On ARC-AGI, it beats flagship models like Gemini-2.5-pro

Consider how wild this is: Gemini-2.5-pro must be over 10,000x bigger
and had 1,000 as many authors 😂 (Alexia is alone on the paper)

What's this sorcery?
In short: it's a very tiny Transformers, but it loops over itself at two different frequencies, updating two latent variables: one for the proposed answer and one for the reasoning.

@AlexiaJM started from the paper Hierarchical Reasoning Model, published a few months ago, that already showed breakthrough improvement on AGI for its small size (27M)

Hierarchical Reasoning Model had introduced one main feature:
🔎 Deep supervision
In their model, one part (here one layer) would run at high frequency, and another would be lower frequency, running only every n steps.

They had used a recurrent architecture, where these layers would repeat many times ; but to make it work they had to do many approximations, including not fully backpropagating the loss through all layers.

Alexia studied what was useful and what wasn't, and cleaned the architecture as follows :
Why use a recurrent architecture, when you can just make it a loop?
➡️ She made the network recursive, looping over itself

Why use 2 latent variables ?
➡️ She provides a crystal clear explanation : the one that changes frequently is the reasoning, the one that changes at low frequency is the proposed answer.
➡️ She runs ablation studies to validate that 2 is indeed optimal.

This new setup is a much more elegant way to process reasoning than generating huge chains of tokens as all flagship models currently do.

This might be the breakthrough we've been awaiting for so long!
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: TRM - Radical improvement over Transformers !
Posted: Thu Oct 09, 2025 05:45 PM
Question:
I’m a “simple” application developer and have a local Ollama server (unused for 2 months). The current architecture discussions (TRM, recursive reasoning) are beyond my capabilities. How can I get started practically and learn a bit along the way?

Answer:
Focus: local, small, useful — without rebuilding architectures.

1. Restart & models

ollama serve
ollama pull llama3.1:8b-instruct
ollama pull qwen2.5:7b-instruct
ollama pull phi3:3.8b

Smoke test:

ollama run llama3.1:8b-instruct "Explain in 2 sentences what recursive reasoning is."

2. “Two-track” prompt (TRM idea, pragmatic)

Track A: fast hypothesis check

Track B: infrequent updates to the Proposed Answer
See the compact template; save as prompt.txt and run with qwen/llama.

3. Second opinion in 3 runs
Collect multiple answers and take a majority vote (see Bash snippet).

4. Integrate via API

curl [http://localhost:11434/api/generate](http://localhost:11434/api/generate)
-d '{"model":"llama3.1:8b-instruct","prompt":"…"}'

5. Three immediately useful use cases

Log explainer: paste an error message → 3 bullet points: cause, impact, fix

DBF/SQL sketch: paste a field list → proposal for SQL/JSON with types/constraints

Form text generator: paste field names → labels + short tooltips (de/en)

6. Settings that help

temperature: 0.2–0.4 (precise), 0.7–0.9 (creative)

Limit num_predict/max tokens (e.g., 512)

Always specify the format (see template)

For disputed answers, test two models

Result:
Without a new architecture, you can get more robust reasoning today through two-track prompting + 2–3 votes. It’s lightweight, local, and hands-on — ideal for learning while delivering value right away.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Thu Oct 30, 2025 05:42 AM
Comando
ExplicaciĂłn
git clone https://github.com/SamsungSAILMontreal/TinyRecursiveModels
Clona (descarga) el repositorio completo de TinyRecursiveModels desde GitHub a tu máquina local. Crea una carpeta llamada
TinyRecursiveModels
con todos los archivos del proyecto, incluyendo cĂłdigo fuente (pretrain.py, datasets), configs de Hydra y scripts para entrenar modelos en puzzles como Sudoku o ARC-AGI. Requiere Git instalado; si no lo tienes, instala con
sudo apt install git
(Linux) o similar. DuraciĂłn: ~1-2 minutos dependiendo de tu conexiĂłn.
​
cd TinyRecursiveModels
Cambia el directorio actual de la terminal al recién clonado
TinyRecursiveModels
, para que estés dentro del proyecto. Esto es necesario para ejecutar comandos posteriores (como crear el entorno o correr pretrain.py) desde el directorio correcto, donde se encuentran los archivos YAML de config y scripts. Sin este paso, comandos como
python pretrain.py
fallarĂ­an al no encontrar los recursos locales.
​
python -m venv trm_env
Crea un entorno virtual Python llamado
trm_env
dentro del directorio del proyecto. Esto aísla las dependencias de TRM (como PyTorch nightly, Hydra y adam-atan2) de tu Python global, previniendo conflictos con otros proyectos (ej. versiones de Torch incompatibles). Usa el módulo estándar de Python 3.10+, sin necesidad de paquetes extra. El entorno se crea vacío, listo para instalar requirements.txt después.
​
source trm_env/bin/activate
(Linux/macOS)[br]
trm_env\Scripts\activate
(Windows)
Activa el entorno virtual recién creado, cargando su intérprete de Python y pip independientes. En Linux/macOS,
source
ejecuta el script de activación en el shell actual (bash/zsh); verás code[/code] en el prompt. En Windows, usa el path con backslashes. Esto asegura que instalaciones posteriores (ej.
pip install -r requirements.txt
) vayan solo al entorno aislado. Para desactivar después, usa
deactivate
.
​
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Thu Oct 30, 2025 05:51 AM
Comando
ExplicaciĂłn
pip install --upgrade pip wheel setuptools
Actualiza las herramientas básicas de Python (pip, wheel y setuptools) en tu entorno virtual trm_env. Esto asegura que las instalaciones posteriores de PyTorch y dependencias se hagan sin errores de versión, especialmente importante para builds desde fuente como adam-atan2. Es un paso de preparación recomendado antes de instalar paquetes grandes.​
pip install --pre --upgrade torch torchvision torchaudio --index-url
 https://download.pytorch.org/whl/nightly/cu126
Instala la versión nightly (pre-release) de PyTorch con soporte CUDA 12.6, optimizada para el repo de TRM. Incluye torchvision y torchaudio para visión y audio (aunque TRM usa más lo primero para datasets de puzzles). Usa el index URL específico para wheels compilados con CUDA—ideal para tu RTX 3060 si tienes CUDA 12.6; verifica con
nvidia-smi
. Esto toma ~5-10 min y ~2-3GB de espacio.
​
pip install -r requirements.txt
Instala todas las dependencias listadas en requirements.txt del repo TRM, como Hydra (para configs), wandb (para logging), flash-attn (para atención eficiente en GPU), y otras libs como numpy, omegaconf y einops. Estas son esenciales para correr pretrain.py sin errores de módulos faltantes. Si hay conflictos con nightly PyTorch, podría pedir re-instalar; ejecuta en orden después de Torch.​
pip install --no-cache-dir --no-build-isolation adam-atan2
Instala el optimizador custom AdamAtan2, clave para el entrenamiento recursivo en TRM (mejora la estabilidad de gradients en modelos tiny). Los flags
--no-cache-dir
evitan usar cache corrupto y
--no-build-isolation
permiten builds con dependencias globales si es necesario (Ăştil si hay issues de compilaciĂłn CUDA). Si falla el backend (como antes), usa la alternativa adam-atan2-pytorch que te sugerĂ­.
​
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Thu Oct 30, 2025 05:57 AM
Comando
ExplicaciĂłn
pip install wandb
Instala la librería Weights & Biases (wandb) para logging y tracking del entrenamiento de TRM. Permite monitorear métricas como loss, accuracy en Sudokus y uso de GPU en tiempo real vía dashboard web (wandb.ai). Es opcional pero recomendado por el repo para visualizar progreso en runs largos; si ya está en requirements.txt, este comando lo asegura. Toma ~1 min y requiere cuenta gratuita en wandb.ai.​
wandb login
Autentica tu cuenta de wandb en el entorno trm_env. Al ejecutarlo, te pide pegar tu API key (obténla gratis en wandb.ai/settings > API Keys). Esto sincroniza logs del entrenamiento (ej. +run_name=mi_primer_trm_sudoku) a la nube, permitiendo ver curves de loss y checkpoints remotos. Si no quieres wandb, omite este paso—TRM corre sin él, solo con prints locales.​
python -c "import torch; print(torch.cuda.is_available())"
Verifica que PyTorch esté correctamente instalado con soporte CUDA para tu RTX 3060. Este comando importa torch y chequea si CUDA está disponible—debe imprimir True si todo va bien (indica que el entrenamiento usará GPU). Si dice False, revisa tu versión de CUDA (nvidia-smi) y re-instala PyTorch con el index correcto (cu121 para CUDA 12.1). Es un test rápido antes de correr pretrain.py para evitar errores de device.​
python dataset/build_sudoku_dataset.py 
--output-dir data/sudoku-extreme-1k-aug-1000 
--subsample-size 1000 --num-aug 1000
Prepara el dataset de Sudokus extremos para entrenar TRM: genera 1000 muestras difíciles, cada una con 1000 augmentations (variaciones como rotaciones o flips), y los guarda en la carpeta data/sudoku-extreme-1k-aug-1000. Este script descarga o procesa Sudokus duros desde fuentes públicas y los formatea para el modelo (grids 9x9 como tensores). Toma ~5-10 min; asegúrate de que la carpeta data/ exista (crea con mkdir si no). Es el dataset usado en los experimentos del repo para benchmark de razonamiento.​
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Thu Oct 30, 2025 06:07 AM
Comando
ExplicaciĂłn
python pretrain.py arch=trm 
data_paths="[data/sudoku-extreme-1k-aug-1000]" evaluators="[]" 
epochs=60 eval_interval=20 lr=1e-4 puzzle_emb_lr=1e-4 
weight_decay=1.0 puzzle_emb_weight_decay=1.0 arch.mlp_t=True 
arch.pos_encodings=none 
arch.L_layers=2 arch.H_cycles=3 arch.L_cycles=4 +batch_size=128 
+run_name=mi_primer_trm_sudoku_test ema=True
Lanza el entrenamiento de TRM en tu RTX 3060 para el dataset de Sudoku: usa arquitectura TRM con MLP para transformaciones, sin positional encodings, 2 capas L, 3 ciclos H y 4 ciclos L. Corre 60 épocas (~1-2 horas) con batch_size=128, eval cada 20 épocas, LR=1e-4, weight decay=1.0 y EMA para estabilizar. Monitorea con nvidia-smi y wandb si logueado; si OOM, baja a +batch_size=64. Esto genera un modelo básico para resolver Sudokus recursivamente.​
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Thu Oct 30, 2025 07:36 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Sat Nov 01, 2025 10:00 AM
python pretrain.py \
arch=trm \
data_paths="[data/sudoku-extreme-1k-aug-1000]" \
evaluators="[]" \
epochs=10 eval_interval=5 \
lr=1e-4 puzzle_emb_lr=1e-4 weight_decay=1.0 puzzle_emb_weight_decay=1.0 \
arch.mlp_t=True arch.pos_encodings=none \
arch.L_layers=2 \
arch.H_cycles=3 arch.L_cycles=2 \
+batch_size=128 +eval.batch_size=32 \
+run_name=trm_test_run_quick_eval ema=True
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Fri Nov 07, 2025 05:47 PM

Reduced sudokus to 4x4, training time down to 5:15 on gtx3060:

https://github.com/olivkoch/TinyRecursiveModels

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Mon Nov 10, 2025 02:46 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TRM - Radical improvement over Transformers !
Posted: Wed Nov 12, 2025 09:54 PM

Added Sudoku 2x2 dataset and training:

Added Q&A language pairs dataset and training:

Q&A Dataset Sentences Used

The Q&A dataset was generated using 6 categories of templates with diverse factual knowledge, mathematical operations, and conceptual relationships. Here's the complete breakdown:

1. Factual Questions (Capitals)

Question templates:

"What is the capital of {country}?"
"What is {country}'s capital city?"
"Which city is the capital of {country}?"
Sample Q&A pairs:

"What is the capital of France?" → "Paris"
"What is the capital of Germany?" → "Berlin"
"What is the capital of Italy?" → "Rome"
"What is the capital of Spain?" → "Madrid"
"What is the capital of United Kingdom?" → "London"
(10 countries total)

2. Mathematical Questions

Question templates:

"What is {num1} plus {num2}?"
"What is the sum of {num1} and {num2}?"
"If you add {num1} and {num2}, what do you get?"
Sample Q&A pairs:

"What is 5 plus 3?" → "8"
"What is 10 plus 7?" → "17"
"What is 12 plus 8?" → "20"
"What is 15 plus 9?" → "24"
"What is 20 plus 5?" → "25"

3. Color Questions

Question templates:

"What color is a {fruit}?"
"What is the color of a {fruit}?"
"Which color does a {fruit} have?"
Sample Q&A pairs:

"What color is a banana?" → "yellow"
"What color is a apple?" → "red"
"What color is a orange?" → "orange"
"What color is a grape?" → "purple"
"What color is a lemon?" → "yellow"

4. Animal Questions

Question templates:

"What sound does a {animal} make?"
"What noise does a {animal} make?"
"How does a {animal} sound?"
Sample Q&A pairs:

"What sound does a dog make?" → "woof"
"What sound does a cat make?" → "meow"
"What sound does a cow make?" → "moo"
"What sound does a sheep make?" → "baa"
"What sound does a duck make?" → "quack"

5. Time Questions

Question templates:

"What day comes after {day}?"
"What is the day after {day}?"
"Which day follows {day}?"
Sample Q&A pairs:

"What day comes after Monday?" → "Tuesday"
"What day comes after Tuesday?" → "Wednesday"
"What day comes after Wednesday?" → "Thursday"
"What day comes after Thursday?" → "Friday"
"What day comes after Friday?" → "Saturday"
"What day comes after Saturday?" → "Sunday"
"What day comes after Sunday?" → "Monday"

6. Weather Questions

Question templates:

"What is the weather like when it {condition}?"
"What kind of weather is {condition}?"
"When it {condition}, what is the weather?"
Sample Q&A pairs:

"What is the weather like when it rains?" → "rainy"
"What is the weather like when it snows?" → "snowy"
"What is the weather like when it is sunny?" → "sunny"
"What is the weather like when it is cloudy?" → "cloudy"
"What is the weather like when it is windy?" → "windy"

Dataset Statistics

Total Categories: 6

Total Possible Unique Q&A Pairs: 111 (3 question variants Ă— data items per category)
Dataset Size: 10,000 training + 2,000 test examples
Generation Method: Random sampling with replacement from templates
Format: "Question: {question} Answer: {answer}" sequences

Training Performance

The TRM model achieved 93.25% exact accuracy on this Q&A dataset, demonstrating successful adaptation from structured puzzle-solving to natural language understanding tasks. This represents a significant expansion of TRM's capabilities beyond its original constraint satisfaction and spatial reasoning domains.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion