QACA explores a model-based cognitive agent architecture that learns a predictive world model of its environment and performs planning through internal simulation over learned dynamics.
The Quantum Assisted Cognitive Agent (QACA) is a model-based cognitive architecture composed of the following components:
- latent state representation
- world model
- prediction error monitoring
- value learning
- trajectory planning
- quantum-inspired optimization
The environment is modeled as a Markov Decision Process
where
-
$\mathcal{S}$ : state space -
$\mathcal{A}$ : action space -
$P(s'|s,a)$ : transition dynamics -
$R(s,a)$ : reward function
The agent maintains an internal latent state
State updates follow
where
-
$o_t$ : observation -
$a_{t-1}$ : previous action -
$f_\theta$ : state update network
The world model predicts the next latent state
Training minimizes prediction error
Prediction error measures the discrepancy between predicted and actual states
This signal is used as a meta-cognitive feedback signal.
The agent computes a meta-state
which represents internal uncertainty and model reliability.
The value function estimates expected discounted reward
Training uses temporal difference learning
Loss function
The planner evaluates action sequences
Future states are simulated using the world model
The trajectory value is
The optimal trajectory
Action trajectories are encoded as bitstrings
Each bit pair corresponds to one action.
The cost function is
A QAOA-style quantum circuit generates a probability distribution
The chosen trajectory is
The agent executes the first action of the trajectory.
environment/ GridWorld simulation used for experimentation.
agent/ Neural models representing internal state, world dynamics, value estimation, and meta-state monitoring.
quantum/ Quantum-inspired planner using a QAOA-style circuit.
training/ Training logic for world and value models.
simulation/ Training loop and evaluation.
- Predictive world modeling
- Internal state memory
- Meta-state monitoring via prediction error
- Value-based planning
- Quantum-inspired trajectory optimization
- Online training architecture
The repository also includes several experimental tools for analyzing the behavior of the cognitive agent and the learned world model.
Prediction error is tracked spatially across the environment to reveal regions where the learned world model is uncertain.
For each grid position
This produces a spatial uncertainty map of the environment.
Example visualization:
The evolution of the latent state
This produces a dynamical systems view of the agent’s internal representation:
Plotting the trajectory of
Example:
To evaluate the predictive quality of the learned world model, the agent performs imagination rollouts.
Starting from a real state, the agent simulates future states using only the learned dynamics model
The divergence between predicted and real trajectories is measured
This evaluates how far the model can accurately simulate the future.
Example:
During training the environment is occasionally perturbed (e.g., goal relocation).
This evaluates the stability of the learned policy under non-stationary dynamics.
The agent must adapt to sudden changes while maintaining a consistent world model.
The environment supports interacting agents:
- Agent A: controlled by the cognitive architecture
- Agent B: autonomous environmental agent
This creates a simple multi-agent dynamical system where the world model must learn transition dynamics influenced by other agents.
The transition function becomes
where
Across training runs the following behaviors consistently emerge:
- rapid convergence of the world model loss
- decreasing prediction error over time
- stable bounded latent state dynamics
- reliable goal-reaching behavior
- short-horizon accuracy in imagination rollouts
These observations suggest that the agent successfully learns a predictive model of environment dynamics and uses it for planning.
World model loss rapidly converges while prediction error decreases, demonstrating accurate learning of environment dynamics.
Example training curves:
The project now includes a governance layer inspired by Entropy Engine:
- CLF/CBF-QP controller for safety and stability (with slack/fallback behavior).
- Divergence functional + barrier checks to measure and bound drift.
- Dynamic regional complexity budgeting driven by prediction-error heatmaps.
- Mixed consistency overlays (CRDT-style overlays, ordered commits, causal commits).
- EPL (Entropy Programming Language) parser + runtime, wired into governance.
- Hybrid automaton with mode switching (normal/safe) based on divergence and barrier violations.
EPL examples live in epl/example.epl. Headless runs save plots to plots/runs/.
Install dependencies:
pip install -r requirements.txt
Run the simulation:
python -m simulation.run_episode
- richer multi-agent environments
- continuous control tasks
- hierarchical planning over latent state dynamics
- integration with real physics simulators
- evaluation on large-scale simulated environments




