Skip to content

danielabrahamx/zeropointai

Repository files navigation

ZeroPointAI (0.ai)

Goal-Anchored Recursive Reasoning for ARC-AGI

A fork of Samsung's Tiny Recursive Model (TRM) modified with goal-anchored recursive refinement and triple-layer coherence halting.

What's New

ZeroPointAI adds three modifications to TRM's 7M-parameter recursive architecture:

1. Goal Encoder

Encodes ARC-AGI demonstration output grids into a fixed goal tensor g ∈ R^512 using TRM's existing embed_tokens (shared weights — zero new embedding parameters). The goal is computed once per task and held fixed throughout all recursive steps.

2. Goal Injection

g is injected as an additive residual into input embeddings at every recursive step — the same pattern TRM uses for puzzle identity tokens. The purpose is always present.

3. Triple-Layer Coherence Halting

Replaces TRM's eval-time "always run to max steps" with a coherence-based halt:

coherence = 0.6 × formal + 0.3 × semantic + 0.1 × entropy_reduction
  • Formal — predicted tokens fall within valid ARC-AGI grid range (0-9)
  • Semantic — cosine similarity between latent state and goal tensor
  • Info-theoretic — relative entropy reduction vs. previous step

Active at both training and evaluation. The model stops when coherence > τ (default τ = 0.7).

Architecture

                    ┌──────────────────────┐
                    │   Demo Output Grids  │
                    └──────────┬───────────┘
                               │
                    ┌──────────▼───────────┐
                    │    GoalEncoder        │
                    │  embed → pool → proj  │
                    └──────────┬───────────┘
                               │ g [B, 512]
                    ┌──────────▼───────────────────────┐
                    │     TRM Recursive Loop            │
                    │  ┌─────────────────────────────┐  │
                    │  │ input_emb = input_emb + g   │  │
                    │  │ z_H, z_L = L_level(z_H, z_L)│  │
                    │  │ coherence = triple_layer(    │  │
                    │  │   z_H[:,0], g, logits, ent) │  │
                    │  │ if coherence > τ: halt      │  │
                    │  └─────────────────────────────┘  │
                    │         ↻ up to 16 steps          │
                    └──────────────────────────────────┘

Training

Loss function:

  • Task loss: stablemax_cross_entropy (unchanged from TRM)
  • Coherence calibration: BCE(triple_layer_coherence, exact_match_label) — trains coherence to be high when the task is solved, low otherwise
  • Total: L_task + λ × L_coherence (λ = 0.1 default)

Config flags (Hydra):

python pretrain.py \
  use_goal_encoder=true \
  coherence_tau=0.7 \
  lambda_coherence=0.1 \
  checkpoint_every=50

Set use_goal_encoder=false to reproduce vanilla TRM (ablation baseline).

Quick Start (Google Colab)

  1. Upload zeropointai_colab.ipynb to Google Colab
  2. Select T4 GPU (or better) under Runtime → Change runtime type
  3. Run all cells — trains ZeroPointAI + baseline TRM, evaluates both, reports comparison
  4. Checkpoints auto-save to Google Drive; sessions are resumable after Colab timeouts

Local Development

git clone https://github.com/danielabrahamx/0.ai.git
cd 0.ai
pip install -r requirements.txt -r specific_requirements.txt

# Run tests
python -m pytest tests/ -v

# Smoke test
python smoke_test.py

Dataset Preparation

python -m dataset.build_arc_dataset \
  --input-file-prefix kaggle/combined/arc-agi \
  --output-dir data/arc1concept-aug-1000 \
  --subsets training evaluation concept \
  --test-set-name evaluation

Results

Training pending — results will be updated after first Colab run.

Target: Beat TRM's 44.6% on ARC-AGI-1.

Success criteria:

  1. ZeroPointAI accuracy > TRM baseline on ARC-AGI-1
  2. Coherence scores meaningfully higher on correct predictions than incorrect (proves the architecture works, not luck)

Theoretical Foundation

  • Triple-layer coherence: Formal × semantic × info-theoretic as the quality measure for halting — the model stops when it's actually solved the task, not when a step counter runs out.
  • Base model: TRM by Jolicoeur-Martineau (Samsung SAIL Montreal) — proving recursive reasoning works with tiny networks.

Project Structure

models/recursive_reasoning/trm.py  — GoalEncoder, triple_layer_coherence, goal injection, coherence halt
models/losses.py                   — coherence_bce_loss (in ACTLossHead)
pretrain.py                        — training loop with ZPA config flags
puzzle_dataset.py                  — demo_output_tokens pipeline
evaluators/arc.py                  — ARC-AGI evaluation
zeropointai_colab.ipynb            — primary deliverable (Colab notebook)
tests/                             — unit tests for GoalEncoder + coherence
smoke_test.py                      — local verification script

Citation

If you use ZeroPointAI, please cite both this work and the original TRM:

@misc{abraham2026zeropointai,
  title={ZeroPointAI: Goal-Anchored Recursive Reasoning with Coherence Halting},
  author={Daniel Abraham},
  year={2026},
  url={https://github.com/danielabrahamx/0.ai}
}
@misc{jolicoeurmartineau2025morerecursivereasoningtiny,
  title={Less is More: Recursive Reasoning with Tiny Networks},
  author={Alexia Jolicoeur-Martineau},
  year={2025},
  eprint={2510.04871},
  archivePrefix={arXiv},
  primaryClass={cs.LG},
  url={https://arxiv.org/abs/2510.04871}
}

License

Based on TinyRecursiveModels. See LICENSE for details.

About

Recursive transformer with goal-conditioned training

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors