Brazil Quantum Camp - Quantum Computing Solutions
Team Q-Trust AI
As AI-generated imagery becomes indistinguishable from real photographs, the need for robust detection methods is critical. Q-Trust AI presents a hybrid classical-quantum architecture that fuses deep visual features and spectral frequency signatures to classify images as real or synthetic.
Our key insight: generative models like GANs and Diffusion Models leave measurable spectral fingerprints - patterns invisible to the human eye but detectable in the frequency domain. By combining these spectral features with ResNet18 semantic embeddings inside a Variational Quantum Circuit (VQC), we exploit quantum entanglement to capture subtle cross-modal correlations.
Result: 90.75% accuracy and F1-Score of 0.9125 on the CIFAKE benchmark - operating in only 6 dimensions with 72 trainable quantum parameters, near-matching a classical SVM with 528 dimensions.
Input Image (32Γ32Γ3)
β
ββββΊ ResNet18 (ImageNet, frozen + fine-tuned layer4)
β ββββΊ 512D βββΊ Linear(512β6) βββΊ tanhΓ(Ο/2) βββΊ semantic_enc (6D)
β
ββββΊ Radial FFT Power Spectrum (16 bins)
ββββΊ Linear(16β6) βββΊ tanhΓ(Ο/2) βββΊ spectral_enc (6D)
β
βββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββ
β Variational Quantum Circuit β
β 6 qubits Β· 4 Re-Upload layers β
β β
β RY(semantic[i]) β RZ(spectral[i]) per qubit β
β CNOT ring entanglement β
ββββββββββββββββ¬βββββββββββββββββββ
β
β¨Zββ© ... β¨Zβ
β© (6 Pauli-Z expectation values)
β
Linear(6β2) βββΊ Softmax βββΊ P(fake)
| Component | Choice | Rationale |
|---|---|---|
| Visual Encoder | ResNet18 (partial fine-tuning) | Rich 512D semantic features; transfer learning from ImageNet |
| Spectral Encoder | Radial FFT (16 bins, 32Γ32 resolution) | Captures GAN/diffusion sampling artifacts with full frequency granularity |
| Embedding | Orthogonal Angle Embedding (RY + RZ) | Semantic and spectral features occupy separate Bloch sphere axes - no destructive interference |
| Entanglement | CNOT ring | Propagates cross-modal correlations across all qubits |
| Re-Uploading | 4 layers of Data Re-Uploading | Transforms shallow VQC into a universal function approximator |
| Optimizer | AdamW + Label Smoothing (Ξ΅=0.05) | Stabilizes classical-quantum gradient interface; prevents overconfidence |
| Model | Accuracy | F1-Score | AUC-ROC | Params (quantum) | Input Dim |
|---|---|---|---|---|---|
| VQC Dual-Input (ours) | 90.75% | 0.9125 | 0.9563 | 72 | 6 |
| MLP Equivalent (6D) | 90.75% | 0.9082 | - | ~50 | 6 |
| Logistic Regression | 90.25% | - | - | - | 528 |
| SVM RBF (upper bound) | 91.00% | 0.9167 | - | - | 528 |
The VQC with 6D input outperforms Logistic Regression trained on 528 dimensions, and ties the classical equivalent MLP on accuracy while surpassing it on F1-Score - suggesting the advantage comes from quantum expressivity via entanglement, not raw computational power.
- Synthetic recall: 96% - the model catches almost all fake images
- Real precision: 85% - conservative bias ideal for anti-fraud systems
- AUC-ROC of 0.9563 demonstrates robust discrimination across all thresholds
The 6 Pauli-Z observables produce clearer geometric separation between real and fake classes compared to the classical 6D equivalent, visually confirming the advantage of orthogonal multimodal encoding in quantum latent space.
q-trust-ai/
β
βββ README.md # This file
βββ LICENSE
β
βββ Q_Trust_AI_notebook.ipynb # Full experiment notebook (Google Colab)
β
βββ docs/
β βββ ARCHITECTURE.md # Detailed architecture walkthrough
β βββ EXPERIMENTS.md # Full experiment log (all tested architectures)
β βββ final_report.pdf # Official competition report (PT-BR)
β
βββ assets/
βββ architecture_diagram.png # Architecture overview figure
pip install pennylane pennylane-lightning scikit-learn matplotlib seaborn kagglehub tqdm
pip install torch torchvisionThe full experiment is contained in a single Google Colab notebook:
All global constants controlling the experiment are defined at the top of Section 1. Key reproducibility parameters:
SEED = 42 # Fixed across numpy, torch, random
N_QUBITS = 6 # Qubits in the VQC
N_LAYERS = 4 # Data Re-Uploading layers
TRAIN_SIZE = 2000 # Balanced: 1000 REAL + 1000 FAKE
VAL_SIZE = 400 # 200 + 200
TEST_SIZE = 400 # 200 + 200 (isolated)We use the CIFAKE benchmark (Bird & Lotfi, 2024), automatically downloaded via kagglehub:
import kagglehub
path = kagglehub.dataset_download("bird-j/cifake-real-and-ai-generated-synthetic-images")120,000 images of 32Γ32 pixels: CIFAR-10 real photographs vs. Stable Diffusion 1.4 synthetic counterparts.
| Section | Description |
|---|---|
| 1 - Setup & Imports | Dependencies, global constants, reproducibility seed |
| 2 - Dataset & FFT Features | CIFAKE loading, radial power spectrum extraction |
| 3 - Exploratory Analysis | Visual samples, spectral signature comparison (real vs. fake) |
| 4 - Architecture | VQC circuit definition, ResNet encoder, Angle Embedding |
| 5 - Hybrid Training | Data augmentation, AdamW, Label Smoothing, training loop |
| 6 - Test Evaluation | Accuracy, F1-Score, AUC-ROC, confusion matrix |
| 7 - Baseline Models | SVM RBF, Logistic Regression, MLP 6D |
| 8 - Comparative Analysis | ROC curves, precision-recall, probability distributions |
| 9 - Quantum Circuit Internals | Pauli-Z observables, t-SNE of quantum latent space |
| 10 - Computational Complexity | P vs NP-hard framing; motivation for hybrid QML |
| 11 - Conclusions & Next Steps | Full results table, lessons learned, future directions |
| Direction | Description | Expected Impact |
|---|---|---|
| More Re-Uploading layers | Increase N_LAYERS from 4 to 6β8 |
Higher accuracy |
| Strongly Entangling Layers | Replace CNOT ring with denser entanglement | Better multivariate correlation capture |
| Real quantum hardware | Run on IBM Quantum or IonQ with SPSA optimizer | Assess decoherence impact on accuracy |
| New generators | Test against Midjourney, Flux2 (not just Stable Diffusion) | Generalization evaluation |
| Quantum Natural Gradient | Replace AdamW with QNG optimizer | More stable quantum parameter updates |
| Larger datasets | Full CIFAKE (120K) + other benchmarks | Scalability assessment |
Q-Trust AI - Brazil Quantum Camp 2026
Amanda Arruda Β· Caio Silva Β· Diogo Lacerda Β· Eduarda Mendes Β· Igor Oliveira Β· Paulo Aquino Β· Rebeca VitΓ³ria TenΓ³rio Β· VinΓcius Leal
-
Bird, J. J., & Lotfi, A. (2023). CIFAKE: Image Classification and Explainable Identification of AI-Generated Synthetic Images. arXiv:2303.14126. https://arxiv.org/abs/2303.14126
-
Blum, A. L., & Rivest, R. L. (1992). Training a 3-node neural network is NP-complete. Neural Networks, 5(1), 117-127.
-
Citron, D. K., & Chesney, R. (2019). Deepfakes and the New Disinformation War. Boston University School of Law.
-
PΓ©rez-Salinas, A., Cervera-Lierta, A., Gil-Fuster, E., et al. (2020). Data re-uploading for a universal quantum classifier. Quantum, 4, 226. https://arxiv.org/abs/1907.02085
This project is released under the MIT License. See LICENSE for details.