This repository simulates hybrid quantum-classical scheduling strategies for iterative variational workloads using a SimPy discrete-event model.
Implemented modes:
SBQ(Standard Batch-Queue)PF(Pure FaaS)SR(Static Reservation)PQ(Pilot-Quantum)EFaaS(Entangled-FaaS)
The simulator runs these modes across multiple circuit complexity levels, produces JSON metrics, computes per-circuit and averaged improvements, and generates publication-style plots.
The current setup is configured to stay grounded in realistic execution assumptions:
- Real variational ansatz families from Qiskit (
EfficientSU2,RealAmplitudes,TwoLocal). - Drift-aware noisy QPU estimation through Aer noise models.
- Multi-tenant contention via Poisson background arrivals.
- Queueing delays sampled from a high-variance lognormal distribution.
- Physics-based fallback for expectation values using statevector expectation (not synthetic decay curves).
- Pilot-Quantum modeled as one pilot startup followed by warm task dispatch overhead.
The simulator and paper evaluation use the same three-band circuit stratification. The table below lists the exact benchmark circuits together with their qubit counts and measured depths.
| Band | Circuit | Qubits | Depth |
|---|---|---|---|
| Simple | std_twolocal_3q_r1_cx_linear | 3 | 6 |
| Simple | std_efficientsu2_3q_r2_linear | 3 | 10 |
| Simple | std_realamplitudes_3q_r3_full | 3 | 13 |
| Simple | std_twolocal_4q_r2_cz_linear | 4 | 11 |
| Simple | std_efficientsu2_4q_r3_full | 4 | 21 |
| Simple | std_realamplitudes_4q_r4_linear | 4 | 14 |
| Simple | std_twolocal_5q_r3_cx_linear | 5 | 16 |
| Simple | std_efficientsu2_5q_r4_full | 5 | 32 |
| Medium | std_efficientsu2_6q_r2_linear | 6 | 13 |
| Medium | std_realamplitudes_6q_r3_linear | 6 | 13 |
| Medium | std_twolocal_6q_r3_cx_linear | 6 | 17 |
| Medium | std_efficientsu2_7q_r3_full | 7 | 33 |
| Medium | std_realamplitudes_7q_r4_linear | 7 | 17 |
| Medium | std_twolocal_8q_r3_cz_full | 8 | 37 |
| Medium | std_efficientsu2_8q_r4_full | 8 | 47 |
| Medium | std_realamplitudes_9q_r4_linear | 9 | 19 |
| Medium | std_twolocal_10q_r4_cx_linear | 10 | 25 |
| Medium | std_efficientsu2_10q_r5_full | 10 | 69 |
| Complex | std_efficientsu2_10q_r6_linear | 10 | 33 |
| Complex | std_realamplitudes_10q_r6_full | 10 | 74 |
| Complex | std_twolocal_11q_r7_cx_linear | 11 | 38 |
| Complex | std_efficientsu2_11q_r7_full | 11 | 101 |
| Complex | std_realamplitudes_12q_r5_full | 12 | 75 |
| Complex | std_twolocal_12q_r6_cz_full | 12 | 95 |
| Complex | std_efficientsu2_13q_r6_full | 13 | 102 |
| Complex | std_realamplitudes_13q_r7_full | 13 | 109 |
| Complex | std_twolocal_14q_r7_cx_full | 14 | 125 |
| Complex | std_efficientsu2_14q_r8_full | 14 | 141 |
This table is the basis for the evaluation-phase discussion in the paper and matches the benchmark list used by the simulator.
entangled_faas/main.py: Main entrypoint for all runs, comparisons, and plots.entangled_faas/config.py: Central configuration for modes, timings, resources, levels, and sensitivity grids.entangled_faas/scheduler.py: Mode-specific scheduler logic.entangled_faas/workload.py: VQE loop, circuit construction, energy evaluation, background traffic.entangled_faas/plotter.py: Figure generation.output/: JSON outputs.figures/: Generated plots (.pngand.pdf).circuits/: Exported circuit QASM files.
Install dependencies:
pip install -r requirements.txtIf your system has multiple Python versions, use:
python3 -m pip install -r requirements.txtRun the full simulation suite:
cd entangled_faas
python main.pyWhat this does:
- Runs all modes in
config.ALL_MODESacross all levels inconfig.ALL_LEVELS. - Writes per-mode/per-level JSON files to
output/. - Writes aggregate cross-level report to
output/results_by_circuit_and_average.json. - Runs sensitivity sweeps (
alpha,beta,gamma,tau_drift). - Generates plots in
figures/.
Per-level mode results:
output/results_sbq_<level>.jsonoutput/results_pf_<level>.jsonoutput/results_sr_<level>.jsonoutput/results_pq_<level>.jsonoutput/results_efaas_<level>.json
Cross-level summary:
output/results_by_circuit_and_average.json
Sensitivity:
output/sensitivity_alpha.jsonoutput/sensitivity_beta.jsonoutput/sensitivity_gamma.jsonoutput/sensitivity_tau_drift.jsonoutput/sensitivity_combined.json
Per-circuit and average plots:
figures/entangled_faas_circuit_avg_L_ttns.pngfigures/entangled_faas_circuit_avg_M_qdc.pngfigures/entangled_faas_circuit_avg_N_improvement_ttns.png
Edit entangled_faas/config.py.
Most useful settings:
ALL_LEVELS: choose which circuit levels are executed.max_iter: number of VQE iterations.SIM_TIME: total simulated time budget.N_QPU,N_classical: infrastructure size.bg_job_arrival_rate,bg_t_qpu_mean: background traffic intensity.alpha,beta,gamma,tau_drift: scheduler and drift controls.QUANTUM_BACKEND: choose the quantum execution path.SENSITIVITY_GRIDS: parameter ranges for sweeps.
Quantum backend options:
aer: local noisy Qiskit Aer estimator. This is the default and works without IBM credentials.statevector: exact noiseless fallback for debugging or baseline comparisons.ibm_runtime: IBM Quantum Runtime EstimatorV2 using a saved IBM account or token.fake_nighthawk: IBM fake backend with 120 qubits. Best fit here for a 100-qubit-scale test.fake_washington: IBM fake backend with 127 qubits. Good for large-device testing.fake_sherbrooke: IBM fake backend with 127 qubits. Also good for large-device testing.fake_toronto: IBM fake backend with 27 qubits. Good for smaller circuits.
IBM Runtime setup:
- Install the extra dependency with
pip install -r requirements.txt. - Save your IBM account once with Qiskit Runtime, or provide the usual IBM credentials.
- Set
QUANTUM_BACKEND = "ibm_runtime"inentangled_faas/config.py. - Optionally set
IBM_BACKEND_NAMEto a specific backend, or leave it empty to use the least busy IBM hardware backend with enough qubits. - Optionally tune
IBM_PRECISIONandIBM_RESILIENCE_LEVELfor runtime execution.
Fake backend setup:
- Set
QUANTUM_BACKEND = "fake_nighthawk"for a 100-qubit-scale local test. - Use
fake_washingtonorfake_sherbrookeif you want a 127-qubit fake IBM device. - Use
fake_torontofor smaller circuits or faster tests. - If you want to override the backend name explicitly, set
FAKE_BACKEND_NAMEtoo.
How to use IBM Runtime:
- Set
QUANTUM_BACKEND = "ibm_runtime". - Make sure
qiskit-ibm-runtimeis installed. - Save your IBM credentials with Qiskit Runtime so the service can load your account.
- Optionally set
IBM_BACKEND_NAMEto the exact hardware backend you want. - Run the simulator from the
entangled_faas/directory withpython3 main.py.
Example changes:
- Run faster local experiments:
max_iter = 150
SIM_TIME = 1200.0- Increase contention realism:
bg_job_arrival_rate = 0.12- Limit to a subset of levels:
ALL_LEVELS = [
LEVEL_SIMPLE,
LEVEL_COMPLEX,
]- Tune Entangled-FaaS urgency behavior:
alpha = 120.0
beta = 8.0
gamma = 1.0
tau_drift = 240.0- Run on IBM Runtime:
QUANTUM_BACKEND = "ibm_runtime"
IBM_BACKEND_NAME = None
IBM_PRECISION = 0.1
IBM_RESILIENCE_LEVEL = 1After changing config, rerun:
cd entangled_faas
python main.pyTo generate 5 additional complex circuits (with printed names and depths):
cd entangled_faas
python generate_extra_complex_circuits.pyQASM files are written into circuits/.
- Filenames for output JSONs include sanitized level names.
- Some Qiskit classes may emit deprecation warnings depending on installed version; these warnings do not stop simulation execution.