This repository contains notebook driven machine learning experiments for predicting Quantum Metal design parameters from target qubit, resonator, coupler, and Hamiltonian quantities.
- Features
- Contributions
- Quick Start
- Structure
- Experiment Scripts
- Completed Work
This repo has tools to experiment with different Multi Layer Perceptron configurations for Quantum Metal parameter prediction when given a desired set of Hamiltonian parameters. The notebooks cover the following options.
-
Hyperparameter optimization
Compare Keras Tuner searches with predefined hyperparameters.
-
Feature scaling
Choose whether to scale all features to the range
[0, 1]or leave them unscaled. Scaling is strongly recommended because the design parameters vary widely in magnitude. Scaling values are saved so predictions can be converted back to physical values later. -
Categorical data encoding
Compare one hot encoding with linear encoding for categorical Quantum Metal parameters. Initial experimentation indicates one hot encoding performs better across the board.
Please contact Olivia Seidel at olivias@fnal.gov with questions or comments.
Contributors
- Firas Abouzahr from Northwestern as code contributor and EM validation lead
- Sara Sussman from Fermilab for ideas and project guidence
- Abhishek Chakraborty from Chapman University for enabling SQuADDS + EM simulations on Linux to validate results
Do this first. See docs/environment_setup.md for setup notes.
Create the conda environment.
conda env create -f environment.yml
conda activate cryo-modelling-envThen launch JupyterLab from the repository root.
jupyter-labA GPU is recommended. If you have a Fermilab services account, you can run Jupyter notebooks on the EAF.
- Navigate to the Fermilab EAF docs and sign in with your credentials.
- Follow the three Quickstart steps. When the second step opens a new link, enter your credentials again.
- Click Add New Server.
- Scroll to the bottom of the server options and choose Fermilab generic notebooks.
- Select the middle GPU option. From the menu choose the largest slot.
- Clone this repo there.
- Create the GPU environment:
conda env create -f environment-eaf-gpu.yml
conda activate cryo-modelling-env-gpuPlease feel free to contribute instructions if you use a GPU somewhere else.
Two trained models for the transmon cross Hamiltonian experiment are committed here, since they are small.
best_keras_model_model2_surrogate.kerasis the forward surrogate, mapping cross claw geometry to(f_q, alpha).surrogate_loss_2in_3out_best_model.kerasis the combined inverse plus surrogate pipeline.
Both live in experiments/model_predict_qubit_TransmonCross_Hamiltonian_params/model.
Other models are too large to keep in git. Those live in the shared Google Drive folder instead:
Google Drive supplemental files
If you have access issues, please send a note to olivias@fnal.gov.
After setting up the environment and data, start with the data analysis notebook, then model training, then result inspection.
conda activate cryo-modelling-env
jupyter-labEach experiment folder has its own parameters*.py configuration file, one per training variant. Start with KERAS_TUNER=True. After the automated hyperparameter search finishes, copy the best values back into that same file. Then rerun with KERAS_TUNER=False to inspect how the model learns over the epoch count. You can also increase the number of epochs and fine tune the selected hyperparameters.
The main folders contain scripts and notebooks that use machine learning to predict Quantum Metal design parameters from target Hamiltonian or electromagnetic values.
experiments/model_predict_cavity_claw_RouteMeander_eigenmodeexperiments/model_predict_coupler_NCap_cap_matrixexperiments/model_predict_qubit_TransmonCross_cap_matrixexperiments/model_predict_qubit_TransmonCross_Hamiltonian_params
Supporting folders
figurescontains figure sources, generation scripts, and checked in outputs.docscontains setup notes and reference material.environment.ymldefines the conda environment.environment-eaf-gpu.ymldefines the GPU variant used on the Fermilab EAF.
More detailed folder guides live in experiments/README.md, figures/README.md, and docs/README.md.
Within each experiment folder, the common notebooks follow this pattern.
ml_00_data_analysisloads the data and parses it into a model ready format.ml_01_train_kerastrains the model using an MLP.ml_02_print_resultsloads a model and makes predictions with it.ml_03_hyperparameter_search_analysisplots the hyperparameter search results.ml_10throughml_22contain surrogate and defined loss variants.validationnotebooks contain EM simulation and downstream validation studies.
The transmon cross Hamiltonian experiment is the furthest developed and does not follow this numbering exactly. It begins at ml_10, since data preparation is shared with the capacitance matrix experiment, and continues past ml_22 with the runtime, sweep, and stress test studies.
ml_14runs the nearest neighbor surrogate stress test.ml_22prints results and writes the single call runtime benchmark.ml_30andml_31produce and plot the batch size runtime sweep.ml_32throughml_40cover training data amount sweeps, architecture sweeps, and multi seed diagnostics.
Each experiment directory also contains local parameters*.py configuration files plus generated CSV and plot outputs that stay next to the notebooks that produced them.
Three component level MLPs predict simulated electromagnetic behavior from Quantum Metal geometry. Each was trained with hyperparameters selected by a Keras Tuner search.
- Cavity claw resonator (
model_predict_cavity_claw_RouteMeander_eigenmode) predicts route meander eigenmode quantities for the readout resonator. - NCap coupler (
model_predict_coupler_NCap_cap_matrix) predicts the coupler capacitance matrix. - Transmon cross qubit is modeled in two target spaces.
model_predict_qubit_TransmonCross_cap_matrixpredicts the raw capacitance matrix, andmodel_predict_qubit_TransmonCross_Hamiltonian_paramspredicts the derived Hamiltonian parameters, qubit frequencyf_qand anharmonicityalpha.
The transmon cross Hamiltonian experiment adds the inverse direction. An inverse MLP maps a requested (f_q, alpha) pair to the three cross claw geometry parameters, namely claw length, ground spacing, and cross length. It is trained in tandem with the forward surrogate held frozen, so the predicted geometry is pushed back through the surrogate and the loss is evaluated in Hamiltonian space rather than in geometry space. Only the inverse model weights are updated. This sidesteps the one to many nature of the inverse problem, where different geometries can realize nearly the same Hamiltonian. Predicted designs are then rendered and validated with a conventional EM solver in the loop.
- Encoding values were tested and optimized for categorical output parameters.
- Scaling techniques were implemented for both inputs and outputs, with the scalers saved so predictions convert back to physical units.
- Training, validation, and test sets were explicitly separated.
- Training data amount sweeps, architecture sweeps, and a nearest neighbor stress test characterize where the surrogate stays reliable.