Quantum Circuit Design Search
This repository contains the implementations of the reinforcement learning search strategy discussed in the paper, "Quantum Circuit Design Search." The archive version of the paper can be found at this link. This study explores search strategies for the design of the parameterized quantum circuits.
requirements:
Pytorch >= 1.4
PennyLane >= 0.10
To run the code with defualt arguments use
python main.py
The above code executes a classical controller (neural network) to find the whole design of the PQC. If you wish the controller to find only a repetitive layer of the PQC add the argument --small_design
. In addition, there can be an option of having hybrid quantum-classical controller to find a layer of PQC. For this use
python main.py --small_design --quantumController
If you wish to see the performance of a fixed design which can be one of the suggested designs of this study, runner.py
is useful. There are 6 selected designs used on Glass dataset in the paper plus the two benchmark designs (Ry-CNOT & Ry-CZ) and the two benchmark designs modified with ReUploading strategy. If you run
python runner.py --n_qubits=9 --n_output=6
it perfors the benchmark (Ry-CNOT) design on the Glass Dataset and uses saved weights. For all 6 selected designs and benchmark (Ry-CNOT) the saved weights are in the directory called, "quantumWeights" and are called by default. To change the design you can add --design_identifier
with possible values such as CZ, CZRU, CNOTRU, selected0, ..., selected5
. To start the learning process without saving wieghts for the 6 selected designs or (Ry-CNOT) you must add --from_scratch
argument. Please note that the selected design discovered by RL is selected0
.
For instance
python runner.py --n_qubits=9 --n_output=6 --design_identifier="selected0" --from_scratch
runs the RL discovered design from scratch on the glass dataset. Using the saved weights for the design selected1
should provide test accuracy of around 64% on the Glass dataset within few first epochs while considering the benchmark (Ry-CNOT) design (by not setting any design_identifier
) and using save weights should provide test accuracy of around 55% on the Glass dataset within few first epochs. Please cite our paper, if you use the code.
@article{pirhooshyaran2020quantum,
title={Quantum circuit design search},
author={Pirhooshyaran, Mohammad and Terlaky, Tamas},
journal={arXiv preprint arXiv:2012.04046},
year={2020}
}