Website and live Bloch-sphere playground · Documentation (user guide, example gallery, API reference)
Three pillars · Bloch viewer · Quick start · Catalogue · Examples · Hardware · Status · Notebooks · API · Concepts
Quantum Mind (pip install quantum-mind, import quantum_mind) is one library for the three ways
"quantum" enters modelling today:
- quantum-like models of how people judge, decide and trust, each paired with the classical models it must beat;
- quantum machine learning and algorithms as Qiskit circuits;
- quantum-inspired classical optimisers and tensor networks.
All three share one problem format, one fitting and comparison workflow, and one 3D Bloch-sphere viewer. Every circuit runs on Aer, IBM Quantum and Amazon Braket. The library was built for robots and AI agents that work with people, and it applies equally to surveys, finance, medicine, consumer research, physics and operations research.
Quantum-like models use the mathematics of quantum probability to describe judgements. They run on ordinary computers and do not claim that the brain is a quantum computer. Quantum models are circuits for quantum hardware. Quantum-inspired models are classical algorithms. The concepts page explains the difference and how to test each.
Three pillars
| Quantum-like | Quantum | Quantum-inspired |
|---|---|---|
|
Models of human judgement, decision and trust in quantum probability. Each comes with its classical baselines and distinctive tests.
|
Gate-model machine learning and algorithms. They train on a fast built-in simulator and export to Qiskit.
|
Classical algorithms that borrow quantum ideas. No quantum computer is needed.
|
Shared layers: quantum_mind.core (fitting, BIC/AIC comparison, model recovery), quantum_mind.problems (QUBO
builders for MaxCut, knapsack, multi-robot task allocation, portfolio and Ising problems) and
quantum_mind.viz (the 3D Bloch-sphere viewer).
See the qubits
A Qiskit circuit, gate by gate. While the qubits are entangled, their vectors leave the sphere. circuit_trajectory(qc) → animate_trajectory / animate_bloch |
Trust in a robot as a qubit, over successes and failures, with dephasing. belief_trajectory(OpenSystemBelief(), events) |
from qiskit import QuantumCircuit
from quantum_mind.viz import circuit_trajectory, animate_bloch, save_html, LiveBloch, bloch_tomography
qc = QuantumCircuit(2); qc.h(0); qc.cx(0, 1); qc.ry(0.6, 1)
traj = circuit_trajectory(qc, steps=15)
save_html(animate_bloch(traj), 'bell.html') # interactive: rotate, zoom, play, slider
LiveBloch(2).show().play(traj) # real time in Jupyter or a Matplotlib window
bloch_tomography(qc, 'aer:FakeTorino') # Bloch vectors measured under IBM device noise
traj.concurrence(0, 1) # entanglement of the pair along the circuit
The same circuit as a timeline: plot_entanglement(traj) shows each qubit's Bloch-vector length and the pair's concurrence (Wootters); plot_qsphere(state) draws the Q-sphere.
Interactive versions of both animations (rotate, zoom, play, slider) are written by
examples/19 and examples/20,
and shown inline in the notebooks. The viewer README covers everything else.
Quick start
pip install "quantum-mind[all]"
Quantum-like: is there a question-order effect, and which model explains it?
import numpy as np
from quantum_mind.core import compare
from quantum_mind.families.order_effects import QuantumOrderModel4D, BayesOrderModel, AnchoringOrderModel, qq_test
counts = {'AB': np.array([212, 48, 61, 179]), # A asked first: yes-yes, yes-no, no-yes, no-no
'BA': np.array([240, 33, 52, 175])} # B asked first
print(qq_test(counts)) # parameter-free test of the quantum-like prediction
for r in compare([QuantumOrderModel4D, BayesOrderModel, AnchoringOrderModel], counts):
print(type(r.model).__name__, round(r.bic, 1))
Quantum: classify with a circuit, then run it under IBM device noise
from quantum_mind.quantum import VariationalClassifier
from quantum_mind.circuits import run
clf = VariationalClassifier(layers=3).fit(X_train, y_train)
print(clf.score(X_test, y_test))
counts = run(clf.to_qiskit(X_test[0]), 'aer:FakeTorino', shots=4000)
Quantum-inspired: one robot task-allocation problem, three kinds of solver
from quantum_mind.problems import task_allocation
from quantum_mind.quantum import QAOA
from quantum_mind.inspired import SQA, QIEA, simulated_annealing
q = task_allocation(costs) # costs[robot, task]
print(q.brute_force()[1], # exact
QAOA(q, p=3).run().energy, # quantum
SQA(q).run().value, QIEA(q).run().value, # quantum-inspired
simulated_annealing(q).value) # classical baseline
Robotics: a human model with uncertainty, for a planner or a ROS 2 system
from quantum_mind.applications.robotics import HumanModelService
svc = HumanModelService() # wraps HumanModelEnsemble + ask_or_act
svc.add_answer({'order': 'AB', 'answers': [1, 0]}) # one person's two answers (1 = yes)
svc.query({'order': 'AB', 'ask_cost': 1.0, 'error_cost': 3.0})
# -> prediction, uncertainty (entropy, model disagreement in bits), ensemble weights, 'ask' or 'act'
The same service runs as a ROS 2 node with standard std_msgs/String JSON topics:
integrations/ros2.
Generated by docs/make_assets.py from the package itself (simulated data).
Model catalogue
Quantum-like families: 11 families, each with classical baselines and a README
| Family | Phenomenon | Quantum-like model(s) | Classical baselines | Circuit | README |
|---|---|---|---|---|---|
order_effects |
Answers depend on question order | QuantumOrderModel4D (nests Bayes), QuantumOrderModel (3D, ranks) |
Bayes, anchoring, saturated | yes | link |
conjunction |
Conjunction and disjunction fallacies | QuantumConjunctionModel |
classical joint, averaging, probability theory plus noise | yes | link |
interference |
Disjunction effect, sure-thing violations | InterferenceModel (normalised or not) |
classical mixture | yes | link |
qlbn |
Inference with unresolved hidden causes | quantum-like Bayesian network | classical Bayesian network | yes | link |
dynamics |
Belief change over time; judgements that change later judgements | QuantumWalk, OpenSystemWalk, OpenSystemBelief |
MarkovWalk, MarkovBelief |
yes | link |
decision |
Risky choice | QDTModel (quantum decision theory) |
expected utility, prospect theory | no | link |
contextuality |
Is there one joint distribution? | CHSH, Contextuality-by-Default criterion | classical bounds | yes | link |
similarity |
Asymmetric similarity | QuantumSimilarityModel |
biased geometric (Nosofsky), geometric | yes | link |
game_theory |
Strategic choice with shared quantum resources | EWLGame (Eisert–Wilkens–Lewenstein), best responses, Nash checks |
classical Nash equilibria | no | link |
memory |
Episodic overdistribution in recall | QuantumEpisodicModel (Brainerd) |
additive (verbatim + gist) | no | link |
concepts |
Overextension in concept combination ("pet fish") | FockSpaceConceptModel (Aerts) |
product, minimum (fuzzy), weighted average | no | link |
Robotics application (README): question domains (object
clarification, trust and hand-over, preference elicitation), questioning designs (fixed, probe,
split), a trust protocol, HumanModelEnsemble, and Bayesian and quantum-like intent resolvers
(applications.intent) for ambiguous commands.
Quantum models: QML and algorithms (README)
| Model | Use | Reference |
|---|---|---|
VariationalClassifier |
multi-class classification with data re-uploading | Pérez-Salinas et al., Quantum 2020 |
QuantumKernel, QuantumKernelClassifier |
fidelity kernel (ZZ map), kernel ridge; works with scikit-learn | Havlíček et al., Nature 2019 |
QAOA |
any Qubo: allocation, scheduling, MaxCut, portfolios |
Farhi et al., 2014 |
VQE, Hamiltonian |
ground states of Pauli Hamiltonians or QUBOs | Peruzzo et al., Nat. Commun. 2014 |
grover |
search with an oracle from a list or a predicate | Grover, 1996 |
VariationalRegressor |
regression and forecasting (⟨Z⟩ readout, adjoint gradients) | Mitarai et al., PRA 2018 |
QuantumKernelAnomalyDetector, QuantumKernelClustering |
one-class anomaly scores and spectral clustering, quantum or RBF kernel | Liu and Rebentrost, PRA 2018 |
qft_circuit, find_period |
quantum Fourier transform and period finding | Coppersmith, 1994; Shor, 1994 |
AmplitudeEstimation |
expected values (risk, pricing) with maximum-likelihood amplitude estimation | Suzuki et al., QIP 2020 |
ctqw_probabilities, quantum_walk_centrality |
continuous-time quantum walks on graphs; node centrality | Farhi and Gutmann, PRA 1998 |
quantum_mind.circuits |
circuits of the quantum-like families; run() on any backend |
circuits README |
Quantum-inspired models: optimisers, tensor networks, learning and ranking (README)
| Model | Problem | Reference |
|---|---|---|
QIEA |
binary optimisation (Han and Kim's rotation table) | Han and Kim, IEEE TEVC 2002 |
QPSO |
continuous optimisation | Sun, Feng and Xu, CEC 2004 |
SQA |
Ising / QUBO by path-integral Monte Carlo | Martoňák, Santoro and Tosatti, PRB 2002 |
MPSClassifier |
supervised classification with a matrix product state; DMRG-style sweeps or Adam | Stoudenmire and Schwab, NeurIPS 2016 |
QuantumInspiredQLearning |
reinforcement learning with action amplitudes (baseline: QLearning) |
Dong et al., IEEE TSMC-B 2008 |
QuantumLanguageModel |
document ranking with density matrices (baseline: QueryLikelihoodModel) |
Sordoni, Nie and Bengio, SIGIR 2013 |
simulated_annealing |
classical baseline | Kirkpatrick et al., Science 1983 |
Architecture
flowchart TB
core["quantum_mind.core<br/>Model · Param · fit · compare · recovery"]
fam["quantum_mind.families<br/>11 quantum-like families"]
app["quantum_mind.applications<br/>robotics"]
prob["quantum_mind.problems<br/>QUBO builders"]
qm["quantum_mind.quantum<br/>VQC · kernels · QAOA · VQE · Grover · QFT · QAE · walks"]
ins["quantum_mind.inspired<br/>QIEA · QPSO · SQA · MPS · QRL · QLM"]
circ["quantum_mind.circuits<br/>circuits + run()"]
viz["quantum_mind.viz<br/>Bloch-sphere viewer"]
hw[("Aer · IBM Quantum · Amazon Braket")]
core --> fam --> app
fam --> circ
prob --> qm
prob --> ins
qm --> circ
circ --> hw
fam --> viz
qm --> viz
circ --> viz
src/quantum_mind/
├── core/ Lüders rule, density matrices, Lindblad · Model/Param · fit, compare, recovery
├── families/ order_effects · conjunction · interference · qlbn · dynamics · decision · contextuality · similarity · game_theory · memory · concepts
├── applications/ robotics: question domains, questioning designs, trust, intent resolution, human-model ensemble, ask_or_act, HumanModelService
├── quantum/ statevector simulator · ansatz · classifiers · QAOA · VQE · Grover · QFT · amplitude estimation · walks
├── inspired/ QIEA · QPSO · SQA · simulated annealing · MPS classifier · QRL · quantum language model
├── problems/ QUBO builders shared by quantum and quantum-inspired solvers
├── circuits/ Qiskit circuits of the families · run() on Aer, IBM Quantum, Amazon Braket
├── viz/ Bloch vectors, trajectories, tomography · Matplotlib and Plotly viewers · LiveBloch
└── data/ published aggregate data sets
examples/ 31 scripts across domains docs/ Sphinx documentation, concepts, assets
notebooks/ 2 Jupyter notebooks tests/ 63 tests
integrations/ros2/ ROS 2 node (quantum_mind_ros)
site/ project website (built and deployed to GitHub Pages by CI)
.github/ CI, release, website, CODEOWNERS, issue and pull-request templates
Examples across domains
Pillar: QL quantum-like, Q quantum, QI quantum-inspired, viz Bloch-sphere viewer.
Notebooks: 01_bloch_sphere_live (interactive and live spheres,
tomography under device noise) and 02_robot_questioning_and_trust
(order effects, ensemble, ask-or-act, trust on the sphere). Both run in CI.
Results printed by the examples (simulated data, this version). They illustrate the methods on small problems; they are not a benchmark, and on classification, forecasting, anomaly detection and clustering a well-specified classical model wins (bold):
| Task | Result |
|---|---|
| Triage classification, test accuracy, mean ± sd over 10 seeds | classical logistic regression on quadratic features 0.926 ± 0.016 · MPS 0.915 ± 0.015 · VQC 0.870 ± 0.033 · linear logistic regression 0.814 ± 0.041 · quantum kernel 0.781 ± 0.040 |
| Robot task allocation (3 × 3) | QAOA, SQA, QIEA and SA all reach the optimum; QAOA P(optimal) 0.04 ideal, 0.03 under FakeTorino noise (sampled), against 0.002 uniform |
| Portfolio, 3 of 8 assets | QAOA (p = 2), SQA, QIEA and SA all optimal; QAOA P(optimal) 0.014 against 0.004 uniform |
| VQE, 4-spin Ising chain | error below 1e-8 against exact diagonalisation |
| Grover, 9 of 32 schedules valid | P(valid) 0.99 after one iteration (random 0.28) |
| Trust qubit | P(trust) from the Bloch vector equals the model's prediction (0.7247) |
| Expected payoff, 6,800 oracle calls | amplitude estimation RMSE 0.0014, Monte Carlo 0.0049 (ideal simulator, no noise) |
| Forecasting, held-out R² | linear autoregression 0.984 · variational quantum regressor 0.962 |
| Anomaly detection, AUC | RBF kernel 1.000 · quantum kernel 0.905 (angle encoding is periodic, so far-out points wrap around) |
| Clustering, accuracy | RBF kernel 1.000 · quantum kernel 0.931 |
| Grid navigation (shortest path 10) | QRL 10.0 steps per episode after training, Q-learning 10.6; QRL slower in the first 20 episodes |
| Concept combination ("pet and fish") | Fock-space SSE 0.001 · weighted average 0.054 · minimum 0.328 · product 0.388 |
Running on quantum hardware
python3 examples/11_cloud_run.py --dry-run # local, no account
python3 examples/11_cloud_run.py --backend ibm:least_busy --shots 4000 # IBM Quantum
python3 examples/11_cloud_run.py --backend braket:arn:aws:braket:us-east-1::device/qpu/ionq/Forte-1 --shots 1000
run(circuit, backend) accepts aer, aer:<FakeBackend>, braket_local, braket_dm:<p>,
ibm:<device> and braket:<ARN>. Every to_qiskit() circuit in quantum_mind.quantum and every builder
in quantum_mind.circuits works with it. Hardware runs cost queue time or money. Report their results
exactly as measured, with backend, date and job identifier.
| Backend | Status |
|---|---|
| Aer (ideal), Aer with IBM device noise models, Braket local and density-matrix simulators | tested in CI |
IBM Quantum hardware (ibm:<device>) |
submission code tested in CI against a fake IBM device (same transpilation, SamplerV2 call and result parsing); not yet run on hardware |
Amazon Braket QPUs (braket:<ARN>) |
submission code tested in CI with the local simulator as the device (same OpenQASM 3 program and device.run call); not yet run on hardware |
No hardware results are included in the package. IBM jobs use the client-side Qiskit Runtime
Sampler (qiskit_ibm_runtime.executor_sampler), falling back to SamplerV2 on releases before 0.50.
Status and scope
| Area | What exists | What does not (yet) |
|---|---|---|
| Quantum-like models | 11 families with classical baselines, fitting, BIC/AIC, recovery studies, per-person fitting and comparison (fit_individuals, compare_individuals); published aggregate data |
hierarchical (partial-pooling) models |
| Robotics | simulated human populations for three question domains, questioning designs, trust protocol, intent resolution, HumanModelEnsemble, ask_or_act, HumanModelService, a ROS 2 node (integrations/ros2) |
a run of the ROS 2 node inside a ROS 2 installation (its callbacks are tested with stand-in modules); data from human–robot studies |
| Quantum models | VQC, regressor, quantum kernel (classification, anomalies, clustering), QAOA, VQE, Grover, QFT, amplitude estimation, quantum walks on an exact simulator with adjoint gradients; Qiskit export; IBM submission through the current Qiskit Runtime Sampler | quantum advantage (none claimed); noise-aware training; runs on hardware |
| Quantum-inspired | QIEA with Han and Kim's rotation table (or a simplified rule), QPSO, SQA, simulated-annealing baseline, MPS classifier with DMRG-style sweeps or Adam, quantum reinforcement learning, quantum language model | – |
| Viewer | trajectories, animations, interactive HTML, live widget, tomography, pairwise concurrence and entanglement timeline, Q-sphere | – |
Sizes. The simulator holds 2ⁿ amplitudes per sample, at most 22 qubits. Measured on a laptop CPU: the variational classifier trains 8 features × 400 samples in about 80 s (151 L-BFGS steps, 85 MB); QAOA on 9 variables takes seconds; brute-force QUBO solutions are limited to 22 variables. Grover's gate-level export needs about 360 CNOTs per iteration at 8 qubits and 660 at 10, against 510 and 2,040 for the diagonal-gate export, which grows exponentially.
Name. Quantum Mind began as qlcog, the quantum-like cognition library (renamed in 2.0); the
quantum and quantum-inspired toolkits sit beside it so that all three can be compared on the same
problems. The repository name reflects the main application, robots that work with people.
Installation
pip install quantum-mind # core: numpy, scipy
pip install "quantum-mind[all]" # everything (Qiskit, cloud back ends, viewer)
pip install "quantum-mind[all] @ git+https://github.com/yeshwanthguru/quantum-mind" # latest development version
| Extra | Adds | For |
|---|---|---|
| (core) | numpy, scipy | quantum-like families, quantum simulator, quantum-inspired solvers, problems |
[qiskit] |
qiskit, qiskit-aer, qiskit-ibm-runtime | circuits, Aer, IBM fake-backend noise, circuit_trajectory |
[cloud] |
qiskit-ibm-runtime, amazon-braket-sdk | IBM Quantum and Amazon Braket hardware |
[viz] |
matplotlib, plotly, ipywidgets, anywidget, seaborn | Bloch-sphere viewer, animations, live widget |
[all] |
all of the above | |
[dev] |
pytest, pytest-cov, ruff, nbclient, build, twine | tests, coverage, linting, notebooks, packaging |
From a clone: pip install -e ".[all,dev]". Python 3.10 or later. Examples and tests also run
without installing, because they add src/ to the path.
Choosing and testing a model
- Check the phenomenon first. Look for an order effect, a violation of total probability, or asymmetric similarity. If there is none, a classical model is enough.
- Fit quantum-like models and classical baselines together with
compare. Report all of them. - Use each family's distinctive test: the QQ equality, total-probability bounds, Contextuality-by-Default, or the effect of an intermediate judgement.
- Run a recovery study (
quantum_mind.core.recovery) at the planned sample size before collecting data. - For quantum and quantum-inspired solvers, always print the exact or classical baseline, as every example does.
python3 -m pytest -q --cov=quantum_mind # 63 tests, about 90% line coverage (CI requires at least 80%)
The tests check the simulator against Qiskit gate by gate, adjoint and parameter-shift gradients against finite differences, exported circuits against simulation, circuit builders against the analytic models, the IBM and Braket submission code against local stand-ins, Bloch trajectories against Qiskit's partial trace and the trust model, input validation and size limits. CI also lints, checks that the API reference is current, runs the docstring examples, the examples and the notebooks, builds the Sphinx documentation with warnings as errors, and builds the wheel.
Limitations
- Fitting aggregate counts assumes a homogeneous population. Individual differences can hide or mimic
quantum-like structure: in example 22 a pooled fit picks the quantum-like model for a population that
is half anchoring. Per-person comparison (
compare_individuals) needs many answers per person (there, about 3,000) to tell the models apart. - Several quantum-like models have been challenged by further tests, for example the Grand Reciprocity equations and conjunction-fallacy tests. The family READMEs list these.
- The quantum models are small and exactly simulable. No quantum advantage is claimed: on the example classification task a classical model with quadratic features is the most accurate. Shallow QAOA concentrates little probability on the optimum (a few percent on 9-variable problems).
- "Quantum-inspired" names where an idea came from, not a speed-up. Compare against the classical baseline.
- Hardware noise distorts circuits by a few percent of total variation for small circuits, and more for deep ones.
Data
quantum_mind.data contains the only human data in the package. All of it is published aggregate data:
- the Clinton–Gore order effect (Moore, 2002);
- the Prisoner's Dilemma disjunction effect (Shafir and Tversky, 1992);
- the two-stage gamble (Tversky and Shafir, 1992);
- the Linda problem (Tversky and Kahneman, 1983).
Every other data set in the examples is simulated and labelled as such.
Citing and licence
To cite Quantum Mind, use CITATION.cff (GitHub's "Cite this repository" button), together with the
original papers of the models used, which are listed in each README. The package is released under the
Apache License 2.0 (see also NOTICE). The licence permits commercial and research
use and includes an explicit patent grant. For contributing, see CONTRIBUTING.md;
for release history, see CHANGELOG.md.
Author and maintainer: Yeshwanth Guru (yeshwanth445@gmail.com; ORCID 0009-0007-6353-4033). Security reports: see SECURITY.md.
Companion manuscripts (in preparation): a systematic review of quantum-like cognition for autonomous agents, a systematic review of meta-learning orchestration on resource-constrained robots, and "Order-Aware Human Models for Robot Questioning and Trust", whose simulations use the robotics application of this library.
Metadata
Release files for quantum-mind 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| quantum_mind-2.0.0.tar.gz | 217.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| quantum_mind-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 435.0 kB
Release files / quantum_mind-2.0.0.tar.gz
| Download URL | quantum_mind-2.0.0.tar.gz |
|---|---|
| Size | 217.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27f1748b76a9d231376b89710e7cdeb5f3c300c60ae17bc1f8a723c79f462118
|
|
BLAKE2b-256 checksum How to use checksums |
55b6a6f189701e5158ead4ddb0f4e05df39867825c47ed3e026ff60bf3a5ba29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency logRelease files / quantum_mind-2.0.0-py3-none-any.whl
| Download URL | quantum_mind-2.0.0-py3-none-any.whl |
|---|---|
| Size | 217.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b48d1b89add052f70fb8ec5394350efe543560ec4ff3c0207d9187f28e8616d8
|
|
BLAKE2b-256 checksum How to use checksums |
54d169e5cc63affc82faf65a4d80c015ec137fbcf4c2cfe295440835ce6432c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency log