Metadata-Version: 2.4
Name: tau-chrono
Version: 0.1.0
Summary: Bayesian noise tracking for quantum circuits via Petz recovery maps
Author-email: Sheng-Kai Huang <akai@fawstudio.com>
License: MIT
Project-URL: Homepage, https://tau-chrono.pages.dev
Project-URL: Repository, https://github.com/akaiHuang/tau-chrono
Project-URL: Bug Tracker, https://github.com/akaiHuang/tau-chrono/issues
Keywords: quantum,noise,petz,recovery,bayesian,NISQ
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: notebook; extra == "dev"
Requires-Dist: black; extra == "dev"
Provides-Extra: demo
Requires-Dist: streamlit>=1.20; extra == "demo"
Requires-Dist: plotly>=5.0; extra == "demo"
Dynamic: license-file

# tau-chrono

[![Tests](https://github.com/akaiHuang/tau-chrono/actions/workflows/test.yml/badge.svg)](https://github.com/akaiHuang/tau-chrono/actions/workflows/test.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

**Bayesian noise tracking for quantum circuits via Petz recovery maps.**
46% more accurate than independent gate models on real hardware.

**Author:** Sheng-Kai Huang (akai@fawstudio.com)
**Website:** [tau-chrono.pages.dev](https://tau-chrono.pages.dev)

## Quickstart

```bash
pip install tau-chrono
```

```python
import numpy as np
from tau_chrono import depolarizing, bayesian_compose

# Build a 20-gate circuit with 5% depolarizing noise per gate
gates = [depolarizing(0.05) for _ in range(20)]
rho = np.array([[1, 0], [0, 0]], dtype=complex)    # |0>
sigma = np.eye(2, dtype=complex) / 2                # maximally mixed

# Compare naive vs Bayesian noise prediction
result = bayesian_compose(gates, sigma_0=sigma, rho=rho)
print(f"Naive:    tau = {result.tau_multiplicative_total:.3f}")
print(f"Bayesian: tau = {result.tau_bayesian_total:.3f}")
print(f"Improvement: {result.improvement_percent:.1f}%")
```

## Key Results (QuTech Tuna-9 Hardware)

All results from real NISQ hardware experiments on the QuTech Tuna-9 superconducting processor (9 transmon qubits, 4096 shots).

| Experiment | Result |
|---|---|
| Depth scaling (depth 50) | 46% more accurate than independent model |
| Bernstein-Vazirani (4 qubits) | 60.4% improvement, 4 false failures avoided |
| H2 VQE | Bayesian keeps depth 4 viable (tau=0.49); naive says stop (tau=0.60) |
| Composition inequality | Verified across all 65 circuit configurations |

### Depth Scaling

![Depth scaling results](results/fig_depth_scaling.png)

Improvement grows monotonically with depth: 2.3% at depth 2, 46% at depth 50.

### Bernstein-Vazirani

![Bernstein-Vazirani results](results/fig_bernstein_vazirani.png)

The naive model falsely predicts failure at 3+ oracle repetitions. All circuits actually succeed with >83% probability.

### H2 VQE

![H2 VQE results](results/fig_h2_vqe.png)

Bayesian tracking doubles usable ansatz depth (2 to 4). At depth 4: naive tau=0.60 (STOP), Bayesian tau=0.49 (GO).

## Why It Works

Independent gate noise models assume each gate fails independently. In reality, noise saturates: a qubit that's already noisy can't get much noisier. The Petz recovery map (Petz, 1986) tracks this saturation through the circuit by propagating a Bayesian reference state alongside the signal state.

## Interactive Demo

```bash
pip install tau-chrono[demo]
streamlit run demo.py
```

Adjust noise type, error rate, and circuit depth interactively.

## Honest Limitations

1. **Small hardware only.** All results from QuTech Tuna-9 (5-9 qubits). Not tested on larger devices.
2. **Improvement is noise-dependent.** Large on noisy hardware, diminishes on low-noise hardware.
3. **Depolarizing approximation.** Structured noise (coherent errors, leakage) is not captured.
4. **Not tested on IBM or Google hardware.** Portability is plausible but unverified.

## Theoretical Foundation

All theoretical tools are due to their original authors:

- D. Petz, *Commun. Math. Phys.* **105**, 123 (1986) -- Petz recovery map
- A. J. Parzygnat and F. Buscemi, *Quantum* **7**, 1013 (2023) -- Unique retrodiction functor
- M. Junge et al., *Ann. Henri Poincare* **19**, 2955 (2018) -- Strengthened data processing inequality

## Development

```bash
git clone https://github.com/akaiHuang/tau-chrono.git
cd tau-chrono
pip install -e ".[dev]"
pytest tests/
```

## Citation

```bibtex
@software{Huang2026BayesianPetz,
  author  = {Huang, Sheng-Kai},
  title   = {Bayesian Noise Tracking via Petz Recovery Maps},
  year    = {2026},
  url     = {https://github.com/akaiHuang/tau-chrono}
}
```

## License

MIT License. See [LICENSE](LICENSE).
