Project 08AI engineering · Quant

QNN forecasting

BSc thesis, graded 1: quantum neural networks in Qiskit and PyTorch that forecast next-day returns and covariances of five assets, with a reproducible pipeline benchmarked on 121 held-out days against classical baselines.

Status
Public repo · MIT
Role
Solo: BSc thesis in Mathematics, University of Vienna (written within the Bachelor seminar, graded 1)
Period
2026
Stack
Python · Qiskit and Qiskit Aer · PyTorch · Optuna · pytest
Method
Parametrized quantum circuits trained through PyTorch, 32 Optuna trials per target, exact and noisy Aer simulation

The problem

Can a small quantum neural network forecast financial time series better than the naive baselines a forecaster has to beat anyway? My BSc thesis in Mathematics at the University of Vienna tested this on five assets, and the case study grew out of a WUTIS team project I led.

What I built

  • Targets. Next-day log returns of BNDX, GLD, IBM, NVDA and USO (5 outputs), and the upper triangle of their 4-day rolling covariance matrix one day ahead (15 outputs).
  • Models. A ZZ feature map or RX-RZ data re-uploading, a RealAmplitudes ansatz and one Pauli-Z observable per target, run as a Qiskit EstimatorQNN inside a PyTorch TorchConnector with parameter-shift gradients and Adam.
  • Search. 32 Optuna trials per target over qubits, layers, encoding, entanglement, angle scale, learning rate and more.
  • Backends. Exact Aer simulation, Aer with noise models, and a Qiskit Runtime EstimatorV2 path that is unit-tested but was not used for the reported results.
  • Reproduction. One command retrains the published best configurations and reproduces the thesis test RMSEs bit for bit on the original data.

Results

outcome
Grade 1BSc thesis, University of Vienna (the best Austrian grade)
count
121held-out test days, benchmarked against classical baselines
evidence
Bit for bitone command retrains the published configurations and reproduces the thesis test RMSEs

The pipeline is benchmarked on the untouched 121-day test split, with exact Aer simulation, against two classical baselines: a zero-return forecast for returns and the previous covariance matrix for covariances.

While preparing the repository I found that the local simulator path dropped the noise model, so the thesis’s noisy rerun had sampling noise but no gate noise. I fixed it: with the noise model applied, a test-only evaluation of the trained checkpoints moves the test RMSE by +0.023% (returns) and +0.002% (covariance), and the README documents the correction. A full noisy retraining has not been rerun. No quantum-hardware result is reported.

Notes

Research only; not investment advice.