A Differentiable Quantum Noise Simulator powered by the QNaF 7D Manifold
Project description
QtorchX: High-Fidelity Quantum Simulation Engine
Direct-to-Hardware Digital Twin Calibration via the QNaF Formalism
QtorchX is a research-grade quantum simulation framework engineered to bridge the gap between ideal computational models and the stochastic realities of physical hardware.
Instead of injecting memoryless noise as independent coin flips, QtorchX models the quantum processor as a dynamical physical environment governed by a hidden 7D noise manifold. Built entirely on PyTorch, the platform provides a fully differentiable pipeline from gate execution to measurement statistics.
In short:
QtorchX doesn’t sprinkle noise on circuits. It evolves it.
This enables a powerful inverse workflow: backtracking from empirical hardware histograms to the latent physical parameters of the noise field—creating a high-precision Digital Twin of the quantum device.
The QNaF Physical Formalism
At the core of QtorchX lies the QNaF (Quantum Noise as Fields) Framework. Rather than assigning static Pauli error probabilities, QNaF defines a structured, time-evolving manifold:
$$\Phi(t) \in \mathbb{R}^{7 \times Q \times T}$$
Where:
- $Q$ = number of qubits
- $T$ = circuit depth
- $7$ = independent decoherence channels
The manifold evolves according to a nonlinear, topology-aware dynamical system:
$$\Phi(t+1) = \tanh\Big( \mathcal{M}\Phi(t) + \beta L \Phi(t) + \kappa L D(t) + \mathcal{N}(\Phi(t)) + \Sigma(t) \Big)$$
Where:
- $L$ = graph Laplacian derived from circuit connectivity
- $D(t)$ = gate-induced disturbance field
- $\mathcal{M}$ = temporal memory operator
- $\mathcal{N}$ = nonlinear coupling term
- $\Sigma(t)$ = stochastic environmental fluctuations
The $\tanh$ activation ensures bounded thermodynamic stability: $\Phi \in [-1, 1]$. Noise is no longer independent per gate—it diffuses, accumulates, saturates, and interacts across qubits and time.
Learnable Decoherence Projections
The hidden manifold is projected into Pauli error space via two trainable tensors:
$$P(t) = W \Phi(t) + B$$
Where:
- $W \in \mathbb{R}^{3 \times 7}$ → Decoherence Projection Matrix (DPM)
- $B \in \mathbb{R}^{3}$ → Baseline Pauli Offset (BPO)
The resulting Pauli channel strengths are mapped via a sigmoid function: $p_{X,Y,Z}(q,t) = \sigma(P_{X,Y,Z}(q,t))$. Both DPM and BPO are fully differentiable, enabling hardware fingerprint discovery and device-specific dephasing modeling.
Technical Architecture
QtorchX is structured into three execution layers optimized for GPU-native performance and zero-copy tensor flow.
1️⃣ Core Simulation Engine (qtorchx.core)
The backend is a statevector engine designed to avoid the $2^n \times 2^n$ matrix expansion bottleneck. By utilizing a path of $|\psi\rangle \rightarrow \text{reshape} \rightarrow \text{permute} \rightarrow U \rightarrow \text{inverse-permute}$, the system guarantees:
- $O(2^n)$ memory scaling
- Linear depth scaling
- Native GPU acceleration via PyTorch
Intelligent Caching
- Static gates: $O(1)$ fixed lookup.
- Parametric gates: LRU cache with angle quantization to maximize hit rates.
2️⃣ Physics Layer (qtorchx.noise)
The PhiManifoldExtractor evolves the hidden noise field at each time slice. Each gate modifies the disturbance field $D_i(t) = a G_i(t) + b M_i(t)$, where $G_i(t)$ represents gate activity and $M_i(t)$ represents measurement activity. Noise becomes a direct function of the circuit's spatio-temporal structure.
3️⃣ Calibration Layer (qtorchx.noise.calibrator)
The NoiseCalibrator utilizes the PyTorch autograd engine to minimize the loss between simulation and hardware:
$$\mathcal{L} = \text{MSE}(p_{\text{sim}}, \hat{p}) + \lambda \cdot \text{StabilityPenalty}$$
Gradients flow back to the DPM ($W$) and BPO ($B$) tensors, enabling direct-to-hardware calibration.
🛠 API Implementation Guide
High-Fidelity Simulation
import qtorchx as qtx
circ = qtx.Circuit(num_qubits=5)
circ.add('H', [0]).add('CNOT', [0, 1])
# Fetch pre-calibrated hardware preset
preset = qtx.PresetManager.fetch("qtorch_local")
backend = qtx.QtorchBackend(circuit=circ, simulate_with_noise=True)
results = backend.get_histogram_data(shots=1000)
Real Hardware Calibration
# Backtrack from empirical bitstring probabilities
calibrator = qtx.NoiseCalibrator(circ, preset_name="qtorch_standard")
history = calibrator.calibrate(target_data, epochs=100)
# Export the Digital Twin
calibrator.export_qnaf("calibrated_twin_v1")
Deployment & Credits
Version: 1.0.0
Lead Engineer: Phani Kumar
Status: Stable Release (Patent Pending)
Installation:
pip install qtorchx
QtorchX is licensed under the MIT License. The QNaF formalism and associated differentiable architectures are protected research assets.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qtorchx-0.0.0.tar.gz.
File metadata
- Download URL: qtorchx-0.0.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
065f5505c40bd2caa7e86a0ecfa5f5e1d5f848c61c4382650fa166241e6c70a9
|
|
| MD5 |
66b85d01202c475c12c7a60b1c456313
|
|
| BLAKE2b-256 |
ced0835e3dfa740383d58b571e04491fd18d0a24d4fecfa93b2d01bbae0d23d3
|
File details
Details for the file qtorchx-0.0.0-py3-none-any.whl.
File metadata
- Download URL: qtorchx-0.0.0-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49327f0fb7dfaaeeafaf7d2b6048363b246983f14be3e0491b2ddcf3e40fdcd9
|
|
| MD5 |
4ab550c059608a3f7a31bcaa5bdd3e73
|
|
| BLAKE2b-256 |
bfc6eab9b17de921bb9ec4b710eae7a4e93a5632bca45b09995cb16da9a35ff9
|