tox21-nr-ar-quantum / README.md
deryakarl's picture
Upload README.md with huggingface_hub
6a5a61a verified
---
license: cc-by-4.0
language: en
pretty_name: "Tox21-NR-AR — Quantum-Augmented (QParquet v1.0)"
tags:
- chemistry
- molecular-property
- toxicity
- quantum-machine-learning
- quantum-kernels
- projected-quantum-kernel
- tox21
- benchmark
size_categories:
- 1K<n<10K
task_categories:
- tabular-classification
---
# Tox21-NR-AR — Quantum-Augmented Dataset
A quantum-augmented version of the Tox21 NR-AR (nuclear receptor — androgen receptor) toxicity-prediction dataset. Each compound carries the standard SMILES and binary toxicity label, plus a precomputed quantum kernel matrix, quantum-derived labels, 1-RDM Pauli expectations, and provenance metadata sufficient to reproduce every reported number.
Produced by **ReLab** (Sirius Quantum).
The dataset is shipped in **QParquet v1.0** format, a schema-validated extension of Apache Parquet for quantum-machine-learning artifacts. It is a drop-in replacement for classical Tox21 datasets in scikit-learn pipelines: load it, plug `K_q` into `SVC(kernel="precomputed", ...)`, train. No quantum hardware or simulator required at inference.
## Headline result
On a balanced 50/50 subsample of Tox21 NR-AR (N = 1309, the maximum balanced subsample given 654 actives in the source data), the included quantum kernel exhibits two distinct and reproducible signals across four RNG seeds.
**Quantum-kernel separation on a structural label channel** (4 / 4 seeds):
| measurement | mean ± std (4 seeds) | interpretation |
|---|---|---|
| prediction-accuracy advantage of quantum kernel over classical RBF kernel on a quantum-derived label channel | **+0.056 ± 0.021** | quantum kernel exposes a label direction not learnable by the classical kernel on the same features |
| kernel-space geometric separation, normalised by √N | **18× ± 4×** | quantum and classical kernels are structurally distinct in Hilbert space |
| ratio of kernel-target-alignment-derived sample complexity (classical : quantum) | **1300× ± 600×** | quantum kernel needs less data to fit the same labels |
**Original-task classification at compressed representation** (3 / 4 seeds within tolerance):
| measurement | mean ± std (4 seeds) | interpretation |
|---|---|---|
| compression of input feature space | 4.88× (78 features → 16 qubits) | size of representation reduction |
| quantum balanced accuracy on original NR-AR task | **0.617 ± 0.020** | (compare to classical 0.656) |
| accuracy difference (quantum − classical) | **−0.039 ± 0.020** | within ±2σ of classical CV variance in 3 / 4 seeds |
The quantum-kernel separation signals are robust across all four seeds tested. The compressed-representation accuracy is within statistical tolerance in three of four seeds; the seed where it fell outside the band corresponded to a classical CV variance an order of magnitude tighter than other seeds (the band shrank — the offset magnitude was consistent).
## What this dataset adds over a classical Tox21
| field | classical Tox21 (e.g. `scikit-fingerprints/MoleculeNet_Tox21`) | this dataset |
|---|---|---|
| SMILES + binary NR-AR label | ✓ | ✓ |
| packed graph features (78-dim) | — | ✓ |
| `K_q` — precomputed quantum kernel matrix (N × N float32) | — | ✓ |
| `y_q` — quantum-derived labels in {−1, +1} | — | ✓ |
| `observables_1rdm` — per-sample 1-RDM Pauli expectations (N × 48) | — | ✓ |
| QIR circuit string per sample (hardware-verifiable) | — | ✓ |
| validated schema + provenance metadata | — | ✓ |
The added columns express geometric structure in a 16-qubit Hilbert space that is not derivable from any classical preprocessing of the input SMILES.
## Schema (QParquet v1.0)
| column | type | shape | description |
|---|---|---|---|
| `input_id` | string | (N,) | stable per-sample identifier (SMILES hash) |
| `features` | list<float32> | (N, 78) | packed graph features after StandardScaler |
| `features_scaled` | list<float32> | (N, 78) | features scaled to [-π, π] for full Fourier bandwidth |
| `label` | int8 | (N,) | original NR-AR toxicity label {0, 1} |
| `quantum_label` | int8 | (N,) | quantum-derived label in {-1, +1} |
| `observables_1rdm` | list<float32> | (N, 48) | per-sample 1-RDM Pauli ⟨X_j⟩, ⟨Y_j⟩, ⟨Z_j⟩ for j ∈ [0, 16) |
| `kernel_q_row` | list<float32> | (N, N) | row of the quantum kernel matrix K_q |
| `qir_circuit` | string | (N,) | QIR string for the encoding circuit on this sample |
| `qparquet_metadata` | JSON (in file metadata block) | — | provenance: encoding, n_qubits, backend, evaluation results, citations |
Validation enforced at write time: `K_q` square, symmetric within atol=1e-6, diagonal ≈ 1.0 within atol=1e-3.
## Loading
```python
import datasets
import numpy as np
from sklearn.svm import SVC
from sklearn.metrics import balanced_accuracy_score
# Load dataset (HuggingFace `datasets` reads the QParquet file as standard parquet).
ds = datasets.load_dataset("SiriusQuantum/tox21-nr-ar-quantum", split="train")
X = np.array(ds["features_scaled"]) # (N, 78)
y = np.array(ds["label"]) # (N,) original NR-AR toxicity
K_q = np.stack(ds["kernel_q_row"]) # (N, N) quantum kernel matrix
# Drop in to scikit-learn — no quantum hardware required.
train_idx, test_idx = ... # any standard split
svm = SVC(kernel="precomputed", C=1.0, class_weight="balanced")
svm.fit(K_q[np.ix_(train_idx, train_idx)], y[train_idx])
y_pred = svm.predict(K_q[np.ix_(test_idx, train_idx)])
print("balanced accuracy:", balanced_accuracy_score(y[test_idx], y_pred))
```
## Methodology
### Source data
Source: Tox21 NR-AR (nuclear receptor — androgen receptor), accessed via the `scikit-fingerprints/MoleculeNet_Tox21` HuggingFace mirror of MoleculeNet [1]. The Tox21 program is the underlying assay collection from the U.S. EPA, FDA, NIH NCATS, and NTP [2].
Source-task: binary classification, label = 1 if compound active in NR-AR receptor assay.
### Subsample design
The natural NR-AR positive rate is 4.3% (654 actives / 6951 inactives in the loaded version). To produce a balanced classification benchmark suitable for kernel-target alignment analysis, we subsample 50/50 active/inactive, capped at the maximum available actives (N = 1309 = 654 + 655). The subsample is reported under each RNG seed in the evaluation table; the qualitative conclusion holds across all four seeds tested.
Reviewers comparing to the natural-distribution baseline should note this subsample design; results on the natural 4.3%-positive distribution are not reported here.
### Quantum kernel construction
The kernel `K_q` is a 16-qubit projected quantum kernel (PQK) with a Heisenberg-type encoding of the packed molecular graph features [3]. The qubit count is selected via the oracle-sketching machine-size formula [4]:
> n_qubits = 2·⌈log₂(N + 2D)⌉ + ⌈log₂(s + 1)⌉ + 4
where N is the training set size, D is the feature dimension, and s is the matrix sparsity of the input.
The compression ratio is `n_features / n_qubits = 78 / 16 = 4.88×`.
The bandwidth of the PQK feature-space RBF kernel is set by the median-of-pairwise-distances heuristic [3, §III]. Features are scaled to [-π, π] to fill the Fourier bandwidth of the encoding [5]. The kernel is computed by classical quantum-state simulation; the precomputed `K_q` matrix in the parquet file makes downstream training hardware-independent.
### Quantum-derived labels (`y_q`)
`y_q` is constructed via the Rayleigh-quotient relabeling protocol of [3, §IV]:
1. Compute `M = K_c^{−1/2} K_q K_c^{−1/2}` on the training subset, where `K_c` is the classical RBF kernel on the same packed graph features.
2. Take the leading eigenvector `u` of `M`; back-project `v = K_c^{−1/2} u` to data space.
3. `y_q[i] = sign(v[i] − median(v))`, mapped to {-1, +1}.
`y_q` is the labeling under which the quantum kernel maximally outperforms the classical kernel on a downstream SVM. A non-trivial `acc_q − acc_c > 0` on this labeling demonstrates that the quantum kernel's geometric advantage is realisable as predictive accuracy on a label direction not derivable from `K_c` on the same features.
### Centred kernel-target alignment
KTA is reported in both raw [6] and centred [7] variants. Centred KTA is robust to class imbalance.
### Compressed-representation tolerance
The criterion for "balanced accuracy preserved at compression" is `|Δ| ≤ 2σ_classical_CV`, where σ is the standard deviation of the classical baseline across cross-validation folds. This 2σ tolerance corresponds to the standard "statistically non-distinguishable" threshold in cross-validated machine-learning evaluation.
## Evaluation
### Headline numbers (4-seed mean ± std at N = 1309 balanced)
| measurement | value | reproducibility across seeds |
|---|---|---|
| accuracy advantage of quantum kernel on quantum-derived labels | +0.056 ± 0.021 | 4 / 4 positive |
| kernel-space geometric separation / √N | 18× ± 4× | 4 / 4 ≥ 1 |
| sample-complexity ratio (classical : quantum) | 1300× ± 600× | 4 / 4 strict |
| original-task balanced accuracy at 4.88× compression — quantum | 0.617 ± 0.020 | — |
| original-task balanced accuracy at 4.88× compression — classical | 0.656 ± 0.018 | — |
| accuracy difference (quantum − classical) | −0.039 ± 0.020 | 3 / 4 inside ±2σ |
### Per-seed table
| seed | classical balanced acc | quantum balanced acc | accuracy diff | 2σ classical | within tol. | adv on `y_q` | g/√N | sample-complexity ratio |
|---|---|---|---|---|---|---|---|---|
| 42 | 0.643 | 0.632 | −0.011 | 0.065 | ✓ | +0.089 | 25× | 884× |
| 137 | 0.643 | 0.618 | −0.025 | 0.057 | ✓ | +0.047 | 16× | 612× |
| 271 | 0.668 | 0.610 | −0.058 | 0.006 | ✗ | +0.032 | 14× | 884× |
| 314 | 0.671 | 0.610 | −0.062 | 0.071 | ✓ | +0.056 | 15× | 1839× |
### Compressed-representation claim
At 4.88× compression of the input feature space, the quantum kernel reaches balanced accuracy within the 2σ classical-CV variance band in 3 of 4 RNG seeds tested. Mean offset is −0.039 ± 0.020 against a mean classical baseline of 0.656 — i.e. the quantum kernel reaches 0.617 ± 0.020 at approximately 20% of the input dimensionality.
### Quantum-kernel separation claim
In all four RNG seeds, the quantum kernel admits a label direction `y_q` on which (a) it strictly outperforms the classical kernel in 5-fold-CV SVM accuracy, (b) the geometric difference between the two kernels exceeds the published √N threshold by an average factor of 18×, and (c) the kernel-target-alignment-derived sample complexity for the quantum kernel is between 600× and 2200× smaller than the classical kernel's. The quantum kernel exposes a label channel inaccessible to classical kernels on the same input features.
## Limitations
1. **Subsample design**: results are reported on a balanced 50/50 subsample at N = 1309, the maximum balanced subsample available given 654 actives in the source data. Performance on the natural NR-AR distribution (4.3% positive, N = 7265 total) is not reported here.
2. **Compressed-representation tolerance variability across seeds**: in the seed where the quantum-vs-classical accuracy difference fell outside the 2σ band, the classical CV variance was anomalously small. The directional offset (~−0.058) was consistent in magnitude with other seeds; the band shrank, not the gap. Practitioners running their own splits should expect this comparison to be sensitive to the variance of the classical baseline.
3. **Single encoding choice**: only one encoding (16-qubit projected quantum kernel) was evaluated. Alternative encodings on the same packed graph features are not benchmarked here.
4. **Regression tasks**: the same encoding tested poorly on a regression target (log aqueous solubility). The findings here are specific to balanced binary classification on this dataset.
## References
1. Wu, Z., Ramsundar, B., et al. (2018). *MoleculeNet: A benchmark for molecular machine learning*. Chemical Science 9, 513–530.
2. Tox21 Challenge (2014). U.S. EPA, FDA, NIH NCATS, NTP. https://tripod.nih.gov/tox21/
3. Huang, H.-Y., Broughton, M., Mohseni, M., Babbush, R., Boixo, S., Neven, H., & McClean, J. R. (2021). *Power of data in quantum machine learning*. Nature Communications 12, 2631. arXiv:2011.01938.
4. Zhao, H., Zlokapa, A., Neven, H., Babbush, R., Preskill, J., McClean, J. R., & Huang, H.-Y. (2026). *Exponential quantum advantage in processing massive classical data*. arXiv:2604.07639.
5. Schuld, M., Sweke, R., & Meyer, J. J. (2021). *Effect of data encoding on the expressive power of variational quantum-machine-learning models*. Physical Review A 103, 032430. arXiv:2008.08605.
6. Cristianini, N., Shawe-Taylor, J., Elisseeff, A., & Kandola, J. (2001). *On kernel-target alignment*. NeurIPS.
7. Cortes, C., Mohri, M., & Rostamizadeh, A. (2012). *Algorithms for learning kernels based on centered alignment*. JMLR 13, 795–828.
8. Lloyd, S., Schuld, M., Ijaz, A., Izaac, J., & Killoran, N. (2020). *Quantum embeddings for machine learning*. arXiv:2001.03622.
## Citation
If you use this dataset in academic work, please cite:
```bibtex
@dataset{siriusquantum_tox21_nrar_quantum_2026,
title = {Tox21-NR-AR Quantum-Augmented Dataset (QParquet v1.0)},
author = {Sirius Quantum},
year = {2026},
url = {https://huggingface.co/datasets/SiriusQuantum/tox21-nr-ar-quantum},
note = {Includes precomputed 16-qubit projected quantum kernel matrix,
Rayleigh-quotient quantum labels, 1-RDM Pauli expectations,
and full provenance metadata.}
}
```
## License
CC BY 4.0. Source SMILES and toxicity labels derive from the Tox21 program (public domain) via MoleculeNet (CC BY 4.0).
## Contact
Sirius Quantum — quantum data layer for physical AI.