---
title: 'Quantum AIXI: A Feasible RL Framework'
url: https://www.emergentmind.com/topics/quantum-aixi
type: topic
---

# Quantum AIXI: A Feasible RL Framework

MC-AIXI-CTW is a computationally feasible, general reinforcement learning agent that directly approximates the AIXI model, which is a Bayesian optimality notion for reinforcement learning in arbitrary computable environments. The MC-AIXI-CTW agent employs a synergy of Monte Carlo Tree Search (MCTS), specifically a history-based variant of UCT ("ρ-UCT"), and an agent-specific extension of the Context Tree Weighting (CTW) algorithm to approximate the expectimax value function and the Solomonoff mixture, respectively. This architecture enables the agent to achieve strong empirical performance in a variety of partially observable, stochastic, and unknown domains, while maintaining polynomial resource usage in tree depth, planning horizon, and number of simulations [1007.2049][0909.0801].

## 1. AIXI Background and Motivation

AIXI formalizes the reinforcement learning problem as a sequential decision process where, at each time step, the agent selects an action $a_t \in \mathcal{A}$, receives a percept $x_t = (o_t, r_t)$ with observation $o_t$ and reward $r_t$, and seeks to maximize total future reward. AIXI defines the optimal policy by a Bayesian expectimax over all computable environment models, using Solomonoff's universal prior:
$$
a_t^* = \arg\max_{a_t} \sum_{x_t} \dots \max_{a_{t+m}} \sum_{x_{t+m}} \left[ \sum_{i=1}^m r_{t+i} \right] \cdot \xi_U(x_{1:t+m} | a_{1:t+m})
$$
where
$$
\xi_U(x_{1:n} | a_{1:n}) = \sum_\nu 2^{-K(\nu)} \nu(x_{1:n} | a_{1:n})
$$
with the sum over all computable semimeasures $\nu$ and $K(\nu)$ the Kolmogorov complexity. This ideal is computationally infeasible due to the incomputability of Solomonoff induction and the exponential complexity of expectimax planning [0909.0801].

## 2. Algorithmic Structure: ρ-UCT Planning

MC-AIXI-CTW approximates the AIXI expectimax with ρ-UCT, a MCTS variant operating on histories rather than state space. The core simulation loop includes selection, expansion, simulation (rollout), and backpropagation:

- **Selection:** From the current history $h$, select actions recursively using the UCB1 formula:
  $$
  a^* = \arg\max_{a \in \mathcal{A}} \left[ \frac{1}{m(\beta - \alpha)} \hat{V}(ha) + C \sqrt{\frac{\ln T(h)}{T(ha)}} \right]
  $$
  where $\hat{V}(ha)$ is the current value estimate, $T(h)$ is the visit count of node $h$, $[\alpha, \beta]$ normalizes the reward, $C$ is the exploration coefficient, and $m$ is the planning horizon [1007.2049][0909.0801].

- **Expansion:** On reaching an unvisited node or a chance node (after an action), sample a percept and expand the tree.

- **Simulation (Rollout):** From a new decision node or at horizon, select a random policy (typically uniform random), execute to terminal depth, and accumulate rewards.

- **Backpropagation:** After each simulation, propagate the sampled reward up the visited path:
  $$
  \hat{V}(h) \leftarrow \frac{\hat{V}(h) \cdot (T(h) - 1) + R}{T(h)}
  $$
  $$
  T(h) \leftarrow T(h) + 1
  $$
This anytime planner enables MC-AIXI-CTW to concentrate computational effort on the most promising parts of the search tree [1007.2049][0909.0801].

## 3. Environment Modelling: Action-Conditional Context Tree Weighting

MC-AIXI-CTW approximates the Bayesian mixture over all computable models by restricting to prediction suffix trees (PSTs) of bounded depth $D$, employing Context Tree Weighting (CTW) with Krichevsky-Trofimov (KT) estimators. The input stream is constructed via bit-encoding of actions and percepts:

- **KT Estimator:** For context $\ell$, with $a$ zeros and $b$ ones observed, the KT predictive probability is
  $$
  Pr_{kt}(1 | \ell) = \frac{b+1/2}{a+b+1}
  $$
- **PST Update:** Actions are encoded and appended to a bit-buffer, with percept bits following. For each new percept bit, descend the context tree of depth $D$, updating node counts via KT.

- **CTW Mixture Weight:** Each node $n$ maintains a weighted probability $P_w^n$, recursively defined as:
  $$
  P_w^n = 
  \begin{cases}
    Pr_{kt}(bits \text{ at } n), & \text{if } n \text{ is a leaf}\\
    \frac{1}{2} Pr_{kt}(bits \text{ at } n) + \frac{1}{2} P_w^{n_0} P_w^{n_1}, &\text{otherwise}
  \end{cases}
  $$
  At the root, $P_w^\epsilon$ yields the total Bayesian mixture over all PSTs up to depth $D$ with code-length penalization $\Gamma(M)$ [1007.2049][0909.0801].

- **Factored Action-Conditional CTW (FAC-CTW):** For multi-bit actions/percepts, maintain separate context trees for each factor, increasing context depth for successive bits, and compose the product mixture.

## 4. Integration and Agent Cycle

The MC-AIXI-CTW agent integrates learning and planning as follows:

1. At time $t$, select action $\hat{a}_t$ using ρ-UCT with the current FAC-CTW model as the generative environment.
2. (Optionally) Apply an outer exploration policy (e.g., $\epsilon$-greedy).
3. Execute $\hat{a}_t$, observe $x_t = (o_t, r_t)$.
4. Update FAC-CTW: Append action bits (no KT update), then for each percept bit apply KT update in context tree, updating $P_w^\epsilon$.
5. Extend history with $a_t o_t r_t$ and increment $t$ [0909.0801].

This tight coupling allows for online Bayesian-sequence prediction and decision-making under unknown, partially observable, and non-Markovian environments.

## 5. Computational Complexity and Resource Profile

The computational cost and scalability of MC-AIXI-CTW are characterized by:

- **CTW Update:** $O(D)$ per new bit, independent of total cycles.
- **CTW Sampling (for rollouts):** $O(l_X D)$ for each percept of $l_X$ bits.
- **ρ-UCT Simulation:** $O(m D \log|\mathcal{A}||\mathcal{O}|)$ per trajectory to depth $m$.
- **Per-Action Cost:** $O(N m D \log|\mathcal{A}||\mathcal{O}|)$ for $N$ simulations per real decision.
- **Memory:** Context tree occupies at most $O((l_A + l_X) D)$ nodes; UCT search tree up to $O(N m)$ nodes [1007.2049][0909.0801].

Parallelization of simulations is direct due to the Monte Carlo nature of tree search. The approach is practical for moderate domain sizes, with rollouts performed at interactive rates on a single CPU core.

## 6. Empirical Evaluation

MC-AIXI-CTW was empirically validated on diverse environments, including:

| Domain                      | Simulations | Cycles        | Search/Cycle     |
|-----------------------------|-------------|-------------- |------------------|
| Cheese Maze (POMDP)         | 500         | $5{\times}10^4$ | $\sim 0.9$s      |
| Tiger (POMDP)               | 10,000      | $5{\times}10^4$ | $\sim 10.8$s     |
| TicTacToe                   | 5,000       | $5{\times}10^5$ | $\sim 8.4$s      |
| Kuhn Poker                  | 3,000       | $5{\times}10^6$ | $\sim 1.5$s      |

In domains with known optima, the agent converged to near-optimal average reward within $10^4$–$10^6$ cycles. In Biased Rock-Paper-Scissors, MC-AIXI-CTW reached optimality by $10^6$ cycles, while competitors such as Active-LZ remained suboptimal after $10^8$ cycles. In all domains, learning was smoother and more reliable compared to U-Tree and BLHT baselines. In partially observable Pacman, performance scaled well with experience despite the absence of known optimal policy [1007.2049][0909.0801].

## 7. Limitations and Future Directions

MC-AIXI-CTW's main limitations stem from its model class and planning resources:

- **Model Class:** Restriction to bounded-depth PSTs limits ability to capture rich or hierarchical perceptual structures (e.g., raw visual input).
- **Planning Horizon:** Optimal planning is limited by feasible horizon $m$; planning over long-term deferred rewards may be ineffective without heuristic exploration (e.g., $\epsilon$-greedy).
- **Improvement Directions:** Prospective work includes accommodating richer context representations (predicate-based, hashed), mixture with alternative model classes (e.g., Lempel-Ziv), rollout policy learning, continuous observation extension (quantization/Gaussian mixtures), and hardware-scale parallelism [0909.0801].

MC-AIXI-CTW remains the first agent to combine Bayesian sequence prediction (via FAC-CTW) with UCT-based planning, achieving provable sample efficiency and scalability in stationary finite-memory environments, and providing a design foundation for further advances in universally intelligent agents [1007.2049][0909.0801].

Source: https://www.emergentmind.com/topics/quantum-aixi