Computable approximations to universal reinforcement learning: finite environment classes, budgeted planning, explicit revert/replay. The goal is long-horizon AGI research under resource bounds we can actually pay for. Full Solomonoff optimality is out of reach and everyone involved knows it.
AIXI is a Bayes-optimal reinforcement learner under a mixture prior over environments. At history (h_{<t}) the agent maintains a posterior over models (\nu) and acts to maximize expected discounted return with discount (\gamma \in (0,1)). Writing (\xi(\cdot \mid h_{<t})) for the Bayes mixture over a countable or finite class (\mathcal{M}) of environment hypotheses,
The AIXI policy is (\pi_\xi^\ast) when (\xi) is a universal semimeasure over computable environments. That construction does not terminate, so this codebase implements finite (\mathcal{M}), budgeted planning, and explicit revert/replay contracts, keeping every (\xi) update an ordinary Turing-bounded operation. See IMPLEMENTATION_PLAN.md and SUPERTASK_BOUNDARY.md.
The implementation is the Rust crate at the repository root. The Python prototype has been deleted; git history has it if you ever feel nostalgic. Its load-bearing contracts survived the port: the six-method MixtureEnvModel interface, the FAC learn/append split, and the revert invariant, which the Rust version tightens from a 1e-8 drift tolerance to bit-exact restoration, because chasing float drift through an MCTS at 2am stops being fun quickly.
Contents: ρUCT expectimax search over a Bayes mixture (\xi) of FAC-CTW models plus a Qwen3.8-2B that was taken apart down to raw GGUF tensors. Own container parser, own GGML quantization kernels, own hybrid Gated-DeltaNet/attention forward pass. Zero inference frameworks in the dependency tree. The recurrent state is exactly revertible through a checkpoint stack, and the forward pass agrees with a llama.cpp oracle to 9e-4 on an f32 graph, which is about as much external validation as one can extract from this universe. Also five JAIR domains and an exact enumerated expectimax as ground truth. Details, measured numbers, and the list of things that don't work yet: RUST_IMPLEMENTATION.md.
| Area | Status | Where |
|---|---|---|
| Model class (\xi) | Bayes mixture with exact weight undo and dominance tests. Components: FAC-CTW (per-percept-bit trees, JAIR §5.4), single-tree AC-CTW, order-0 KT, uniform floor | src/models/ |
| CTW correctness | Root log-probability equals a brute-force mixture over every depth ≤ D suffix tree (2^(−Γ) prior) to 1e-12, FAC interleavings included | tests/ctw_brute_force.rs |
| Planning (Family A) | Full ρUCT tree (JAIR Alg. 1-4) with per-simulation bit-exact revert of (\xi), checked against exact enumerated expectimax | src/planning/, tests/rho_uct_expectimax.rs |
| The dissected base model | Qwen3.8-2B (qwen35 hybrid) reduced to a 2-logit conditional probability engine. 508.6M vocabulary params never leave the file, MTP block amputated, recurrent state checkpointed for exact revert | src/llm/ |
| Oracle validation | Exact-graph parity with llama.cpp (9e-4, synthetic f32 hybrid) plus bounded evaluator noise on the real Q4_K_M | scripts/oracle_check.sh |
| Environments | CoinFlip, Biased RPS, Cheese Maze, Tiger, Kuhn Poker, with the JAIR §7 bit layouts | src/env/ |
| Agent + CLI | act/perceive loop, per-cycle metrics including the mixture posterior trajectory, CSV output | src/agent.rs, src/bin/aixi.rs |
| Smoke suite | Five offline PASS/FAIL invariants behind an exit code | src/bin/smoke.rs |
Smoke entrypoint:
cargo test # 62 tests. They pass.
cargo run --release --bin smoke # PASS/FAIL lines, exit 0 when greenSource analyses and paper-to-module mapping live under analyses/ and modules/. The consolidated design doc is IMPLEMENTATION_PLAN.md.
- Phase 0, correctness baseline: done. The pyaixi parity target got replaced by something stricter, a from-first-principles brute-force suffix-tree mixture for CTW and exact expectimax for the search.
- Phase 1, unified (\xi) API: done. The
EnvModeltrait (src/models/mod.rs) serves CTW, the mixture, and the dissected LLM under one bit-exact revert contract. - Phase 2, Self-AIXI v0 (Family B): open. A
MixturePolicy/ (Q_{\zeta\xi}) head on top of the same trait. The substrate is there, someone just has to write it. - Phase 3+, scale and AIQI (Family C): open. Return-mixture induction with explicit on-policy training assumptions.
- Later: empowerment / FEP regularizers, joint prediction interfaces, classical simulators of quantum toys. All gated behind research review.
The ordering keeps regression baselines and computable interfaces ahead of the speculative stuff. Timelines are whatever they turn out to be.
A stable Rust toolchain. That's it. The dependency tree is memmap2, half, rand, rand_chacha, rayon.
git clone https://github.com/Euroswarms-Institute/Self-AIXI
cd Self-AIXI
cargo test
cargo run --release --bin smokeThe base model for the llm / full-mix catalogs is a separate 1.31 GB download (sha256-checked). CTW modes and the entire test suite run without it.
bash scripts/fetch_model.sh
cargo run --release --bin inspect_model -- --gguf models/Qwen3.8-2B-Q4_K_M.gguf| Task | Command |
|---|---|
| Correctness spine | cargo test |
| Smoke invariants | cargo run --release --bin smoke |
| Run the agent | cargo run --release --bin aixi -- --env coin_flip --cycles 400 |
| LLM demo | cargo run --release --bin aixi -- --env coin_flip --model full-mix --ct-depths 4,8 --cycles 12 --mc-simulations 10 --horizon 2 (about 30 s per cycle on 4 CPU cores; budget accordingly) |
| Forward-pass ground truth | bash scripts/oracle_check.sh (dev-only, wants a llama.cpp build, see the script header) |
| Format / lint | cargo fmt / cargo clippy --all-targets -- -D warnings |
Pull requests should keep finite-model and budget assumptions explicit in new code paths. For LaTeX-heavy README or plan changes, pair with Math & CS Wizard for notation consistency before merge.
- M. Hutter, Universal Artificial Intelligence: Sequential Decisions Based on Algorithmic Probability, Springer, 2005. (AIXI definition & Bayes mixture)
- J. Veness et al., A Monte-Carlo AIXI Approximation, JAIR 2011 (the MC-AIXI / CTW line; implementation lineage via
pyaixi). - J. Veness et al., Practical Monte Carlo AIXI with Context Tree Weighting, and related CTW literature referenced in
pyaixi. - E. Catt et al., Self-Predictive Universal AI, NeurIPS 2023 (PDF), the Self-AIXI / (Q_{\zeta\xi}) line; see
analyses/01-neurips-2023.md. - M. Hutter & coauthors on AIQI / return-induction; see
analyses/02-arxiv-2602-23242.mdfor this repo's working notes.
- Per paper: structured notes in
analyses/(problem, definitions, main theorems/algorithms, notation, what is implementable and what stays idealized). - Synthesis:
IMPLEMENTATION_PLAN.mdis updated after analyses and supplementary modules land.