The book & Python companion

Programming
Consciousness?

Models, Experiments, and Exercises with Python

Explore consciousness through computational models you can inspect, change and test.

Release 2026.11.03 Python 3.12 Runs locally

Forthcoming from World Scientific
Series on Machine Consciousness

THE EXPERIMENTAL APPROACH
Compare a mechanism under matched inputs The same observations go to a reference model and a model with one mechanism changed. Each produces an outcome. Comparing the outcomes tests the contribution of the changed mechanism within this experiment. Same observations Reference model Mechanism intact Intervention One mechanism changed Outcome A Outcome B What changed — and why?
A mechanism earns its explanatory role through a comparison.
Chapters
18
Notebooks
23
Exercises
444
Selected solutions
150

The question behind the code

From ideas
to experiments.

What does a machine do, and what would justify saying more?

How does a system select information, remember an instruction or assess its own uncertainty?

Programming Consciousness? approaches these questions through small Python models, controlled interventions and comparisons with rival explanations. Eighteen chapters connect perception, attention, memory and self-modeling with cognitive architectures, contemporary AI and responsible research.

Predict an outcome, inspect the mechanism, change an assumption and explain what the result supports. Most laboratories are controlled simulations; two analyse published human decisions and recorded software-agent runs.

Who this is for

Advanced undergraduate and graduate students in engineering and related fields who already know Python. Basic NumPy, probability, statistics and matrix operations are useful; no prior course in philosophy of mind or neuroscience is required.

A path through the subject

Explore the book

From a first inspectable model to an integrated architecture. Open a chapter to see its focus.

Questions and experimental methods

01Python as an Experimental Language

Use explicit state, preserved traces and controlled changes to turn a Python program into an inspectable experiment.

02What It Means to Model Consciousness

Distinguish access, report and subjective experience, and clarify what a computational model can claim about each.

03From Theory to Experiment

Translate theoretical questions into predictions, controls and planned analyses while examining assumptions built into synthetic data.

Perception, attention and memory

04Perception and Decision Making Under Uncertainty

Use signal detection and psychometric models to separate sensory evidence, response criterion, decisions and visibility reports.

05Attention Selection and Competition

Compare selection mechanisms on shared inputs to examine competition, capacity and the difference between priority and task success.

06Feedforward and Recurrent Processing

Investigate recurrent dynamics and compare them with feedforward alternatives that receive the same observation history.

07Global Workspace and Broadcasting

Build a limited workspace and compare broadcasting, selective routing and local communication under explicit delivery budgets.

08Working Memory and Temporal Integration

Model admission, maintenance and retrieval in working memory, and test how interference and decision rules affect delayed performance.

Monitoring, causality and models

09Metacognition and Higher Order Representations

Separate decisions, confidence and control through synthetic experiments and held-out analyses of published human confidence reports.

10Information Integration and Causal Structure

Enumerate small Boolean networks to distinguish entropy, dependence, causal influence and a precisely defined partition-loss statistic.

11Prediction and World Models

Build a Bayesian filter, compare predictive baselines and examine how assumptions and information leakage change apparent forecasting success.

12Self Models and Attention Schema Theory

Test when a model of a selector’s errors changes action, using matched sensing budgets and a simpler rival controller.

Embodied agents, language and AI

13Embodiment Motivation and Affect

Model a situated agent whose resource needs guide action, and examine the functional roles of regulation and affect-like signals.

14Artificial Inner Speech

Compare verbal and nonverbal representations to test when an internal trace contributes to action and when it merely records it.

15Neural Networks Generative AI and Agentic Systems

Explore neural computation, attention and agent boundaries through small programs, recorded software-agent runs and an optional pretrained-model probe.

Comparison, responsibility and integration

16Comparing Competing Theories

Compare explicit models through predictions, selective interventions and independent synthetic observations, allowing ties and shared failures.

17Ethics and Responsible Research

Examine human responsibility, research safeguards and uncertainty about artificial welfare through an inspectable teaching protocol.

18A Theory Inspired Architecture and Bounded Self Modification

Integrate mechanisms in a seven-module architecture, test a viable rival and evaluate bounded policy revision under distribution shift.

The five themes above are a browsing guide. Chapter titles follow the book.

Teaching a course? Appendix E provides a twelve-week route with 36 core tasks.

Bring the laboratory with you

Download the companion materials

Release 2026.11.03
Choose the complete package, or the interface you prefer.

Scripts ZIP · 1.93 MB

Python laboratories

Runnable Python modules, required data and helpers, plus teaching materials. A direct route from the terminal.

Download Python package

Interactive records ZIP · 2.85 MB

Jupyter notebooks

All 23 notebooks with the code and data they need. Inspect a run, restart the kernel and make your own experiment.

Download notebook package

Required calculations run locally with Python and NumPy on ordinary CPU hardware. No paid service, GPU or physical robot is required. The optional pretrained-model probe uses separate dependencies and a weights download; saved outputs are included. Source conditions and data attribution accompany the materials.

A first experiment

Run your first experiment

Use Python 3.12 and the companion release that matches your edition. Extract the archive, keep its folder structure intact and open a terminal in the extracted companion directory.

Begin with the release README. A virtual environment keeps the laboratory dependencies together.

Use python3 instead of python if that is how Python 3.12 is installed on your system.

01

Create and activate an environment

Create the environment
python -m venv .venv
macOS / Linux
Activate
source .venv/bin/activate
Windows PowerShell
Activate
.venv\Scripts\Activate.ps1

If your system prevents script activation, use .venv\Scripts\python.exe in place of python in the commands below.

02

Install the core dependencies

Python + NumPy
python -m pip install -r requirements.txt
03

Run, inspect, then change one thing

First chapter / all chapter laboratories
python ch01.py
python run_all.py

Compare the trace with your prediction. Preserve the original result before changing a model, and record the release and environment used.

Prefer working in Jupyter?

Install the notebook dependencies in the same environment:

Optional notebook interface
python -m pip install -r requirements-notebooks.txt

Use the Jupyter interface adopted by your course and select this Python environment. Open chapter notebooks from the companion directory and extension notebooks from their own folder. Restart the kernel and run cells in order.

Keep the record clear

Errata &
release notes.

No errata entries recorded yet for release 2026.11.03.

Check corrections against the edition and companion release you are using. The downloadable register provides a consistent place to track confirmed corrections.

Found something to correct?

Include the chapter and section or exercise number, the companion release, and a minimal example. For code, include the Python version, expected result and observed output.

Email Antonio Chella

About the author

Antonio Chella

University of Palermo

Antonio Chella works on cognitive robotics and artificial consciousness. He approaches the subject as a roboticist, using models and experiments to examine what systems do and what their behaviour allows us to conclude.

Official university profile