victor-villar
commited on
Commit
·
99571af
1
Parent(s):
541fb52
Address team comments
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- README.md +60 -5
- model_data/images/linear_function_10qL_topology.svg +33 -0
- model_data/images/linear_function_2qL_topology.svg +9 -0
- model_data/images/linear_function_3qL_topology.svg +12 -0
- model_data/images/linear_function_4qL_topology.svg +15 -0
- model_data/images/linear_function_4qY_topology.svg +15 -0
- model_data/images/linear_function_5qL_topology.svg +18 -0
- model_data/images/linear_function_5qT_topology.svg +18 -0
- model_data/images/linear_function_6qL_topology.svg +21 -0
- model_data/images/linear_function_6qT_topology.svg +21 -0
- model_data/images/linear_function_6qY_topology.svg +21 -0
- model_data/images/linear_function_7qF_topology.svg +24 -0
- model_data/images/linear_function_7qH_topology.svg +24 -0
- model_data/images/linear_function_7qL_topology.svg +24 -0
- model_data/images/linear_function_7qT_topology.svg +24 -0
- model_data/images/linear_function_7qY_topology.svg +24 -0
- model_data/images/linear_function_8qF_topology.svg +27 -0
- model_data/images/linear_function_8qJ_topology.svg +27 -0
- model_data/images/linear_function_8qL_topology.svg +27 -0
- model_data/images/linear_function_8qT1_topology.svg +27 -0
- model_data/images/linear_function_8qT2_topology.svg +27 -0
- model_data/images/linear_function_8qY_topology.svg +27 -0
- model_data/images/linear_function_9qF1_topology.svg +30 -0
- model_data/images/linear_function_9qF2_topology.svg +30 -0
- model_data/images/linear_function_9qH1_topology.svg +30 -0
- model_data/images/linear_function_9qH2_topology.svg +30 -0
- model_data/images/linear_function_9qH3_topology.svg +30 -0
- model_data/images/linear_function_9qJ_topology.svg +30 -0
- model_data/images/linear_function_9qL_topology.svg +30 -0
- model_data/images/linear_function_9qT1_topology.svg +30 -0
- model_data/images/linear_function_9qT2_topology.svg +30 -0
- model_data/images/linear_function_9qY_topology.svg +30 -0
- model_data/linear_function_10qL.md +8 -0
- model_data/linear_function_2qL.md +8 -0
- model_data/linear_function_3qL.md +8 -0
- model_data/linear_function_4qL.md +8 -0
- model_data/linear_function_4qY.md +8 -0
- model_data/linear_function_5qL.md +8 -0
- model_data/linear_function_5qT.md +8 -0
- model_data/linear_function_6qL.md +8 -0
- model_data/linear_function_6qT.md +8 -0
- model_data/linear_function_6qY.md +8 -0
- model_data/linear_function_7qF.md +8 -0
- model_data/linear_function_7qH.md +8 -0
- model_data/linear_function_7qL.md +8 -0
- model_data/linear_function_7qT.md +8 -0
- model_data/linear_function_7qY.md +8 -0
- model_data/linear_function_8qF.md +8 -0
- model_data/linear_function_8qJ.md +8 -0
- model_data/linear_function_8qL.md +8 -0
README.md
CHANGED
|
@@ -4,11 +4,11 @@ license: apache-2.0
|
|
| 4 |
# Linear Function Quantum Synthesis Circuit Models
|
| 5 |
|
| 6 |
## Introduction
|
| 7 |
-
This
|
| 8 |
|
| 9 |
A linear function over n qubits is an n×n binary transformation on X/Z operators (the reversible linear part of a Clifford). Implementing it means finding CX/SWAP-based circuits whose action matches that binary map.
|
| 10 |
|
| 11 |
-
For each model, there is the environment configs (`.json`) and the trained policy weights (`.
|
| 12 |
|
| 13 |
|
| 14 |
## Scope
|
|
@@ -17,7 +17,19 @@ For each model, there is the environment configs (`.json`) and the trained polic
|
|
| 17 |
|
| 18 |
## Contents
|
| 19 |
- `linear_function_*.json`: model configs for a given qubit count/topology.
|
| 20 |
-
- Matching `.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
## Usage example
|
| 23 |
|
|
@@ -44,7 +56,50 @@ if not local_path:
|
|
| 44 |
num_qubits = 10
|
| 45 |
matrix = random_invertible_binary_matrix(num_qubits, seed=42)
|
| 46 |
input_lf = LinearFunction(matrix)
|
| 47 |
-
rls = RLSynthesis.from_config_json(f"{local_path}/linear_function_10qL.json", f"{local_path}/linear_function_10qL.
|
| 48 |
qc_lf_output = rls.synth(input_lf, num_searches=10, num_mcts_searches=0, deterministic=False)
|
| 49 |
print(qc_lf_output)
|
| 50 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
# Linear Function Quantum Synthesis Circuit Models
|
| 5 |
|
| 6 |
## Introduction
|
| 7 |
+
This repository hosts models for linear function synthesis in quantum circuits trained with RL techniques. The models are specialized for different topologies up to 10 qubits.
|
| 8 |
|
| 9 |
A linear function over n qubits is an n×n binary transformation on X/Z operators (the reversible linear part of a Clifford). Implementing it means finding CX/SWAP-based circuits whose action matches that binary map.
|
| 10 |
|
| 11 |
+
For each model, there is the environment configs (`.json`) and the trained policy weights (`.safetensors`).
|
| 12 |
|
| 13 |
|
| 14 |
## Scope
|
|
|
|
| 17 |
|
| 18 |
## Contents
|
| 19 |
- `linear_function_*.json`: model configs for a given qubit count/topology.
|
| 20 |
+
- Matching `.safetensors` files: trained policies for each JSON (same filename stem).
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
## Training
|
| 24 |
+
|
| 25 |
+
Training data is entirely synthetic and generated internally at IBM Quantum using custom reinforcement learning environments built on [Qiskit-Gym](https://github.com/AI4quantum/qiskit-gym).
|
| 26 |
+
|
| 27 |
+
**Data Collection:** Target operators are generated by sampling random linear-reversible circuits with CNOT gates consistent with the target coupling map. The number of gates scales with the difficulty, which increase when the model learns to solve circuits at that difficulty. No external datasets or third-party circuit repositories are used.
|
| 28 |
+
|
| 29 |
+
**PII:** No personal or sensitive data is present or used in any phase of training, as all data is synthetic and generated algorithmically.
|
| 30 |
+
|
| 31 |
+
**Infrastructure:** We train the models using IBM's Cognitive Computing Cluster (CCC) using NVIDIA A100 40GB GPUs. The cluster provides a scalable and efficient infrastructure for training.
|
| 32 |
+
|
| 33 |
|
| 34 |
## Usage example
|
| 35 |
|
|
|
|
| 56 |
num_qubits = 10
|
| 57 |
matrix = random_invertible_binary_matrix(num_qubits, seed=42)
|
| 58 |
input_lf = LinearFunction(matrix)
|
| 59 |
+
rls = RLSynthesis.from_config_json(f"{local_path}/linear_function_10qL.json", f"{local_path}/linear_function_10qL.safetensors")
|
| 60 |
qc_lf_output = rls.synth(input_lf, num_searches=10, num_mcts_searches=0, deterministic=False)
|
| 61 |
print(qc_lf_output)
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
<!-- MODEL_INDEX_START -->
|
| 65 |
+
## Models
|
| 66 |
+
|
| 67 |
+
Below is the list of available models with qubit counts and topologies:
|
| 68 |
+
|
| 69 |
+
| Model | Qubits | Topology |
|
| 70 |
+
| --- | --- | --- |
|
| 71 |
+
| [`linear_function_2qL`](linear_function_2qL.md) | 2 | L |
|
| 72 |
+
| [`linear_function_3qL`](linear_function_3qL.md) | 3 | L |
|
| 73 |
+
| [`linear_function_4qL`](linear_function_4qL.md) | 4 | L |
|
| 74 |
+
| [`linear_function_4qY`](linear_function_4qY.md) | 4 | Y |
|
| 75 |
+
| [`linear_function_5qL`](linear_function_5qL.md) | 5 | L |
|
| 76 |
+
| [`linear_function_5qT`](linear_function_5qT.md) | 5 | T |
|
| 77 |
+
| [`linear_function_6qL`](linear_function_6qL.md) | 6 | L |
|
| 78 |
+
| [`linear_function_6qT`](linear_function_6qT.md) | 6 | T |
|
| 79 |
+
| [`linear_function_6qY`](linear_function_6qY.md) | 6 | Y |
|
| 80 |
+
| [`linear_function_7qF`](linear_function_7qF.md) | 7 | F |
|
| 81 |
+
| [`linear_function_7qH`](linear_function_7qH.md) | 7 | H |
|
| 82 |
+
| [`linear_function_7qL`](linear_function_7qL.md) | 7 | L |
|
| 83 |
+
| [`linear_function_7qT`](linear_function_7qT.md) | 7 | T |
|
| 84 |
+
| [`linear_function_7qY`](linear_function_7qY.md) | 7 | Y |
|
| 85 |
+
| [`linear_function_8qF`](linear_function_8qF.md) | 8 | F |
|
| 86 |
+
| [`linear_function_8qJ`](linear_function_8qJ.md) | 8 | J |
|
| 87 |
+
| [`linear_function_8qL`](linear_function_8qL.md) | 8 | L |
|
| 88 |
+
| [`linear_function_8qT1`](linear_function_8qT1.md) | 8 | T1 |
|
| 89 |
+
| [`linear_function_8qT2`](linear_function_8qT2.md) | 8 | T2 |
|
| 90 |
+
| [`linear_function_8qY`](linear_function_8qY.md) | 8 | Y |
|
| 91 |
+
| [`linear_function_9qF1`](linear_function_9qF1.md) | 9 | F1 |
|
| 92 |
+
| [`linear_function_9qF2`](linear_function_9qF2.md) | 9 | F2 |
|
| 93 |
+
| [`linear_function_9qH1`](linear_function_9qH1.md) | 9 | H1 |
|
| 94 |
+
| [`linear_function_9qH2`](linear_function_9qH2.md) | 9 | H2 |
|
| 95 |
+
| [`linear_function_9qH3`](linear_function_9qH3.md) | 9 | H3 |
|
| 96 |
+
| [`linear_function_9qJ`](linear_function_9qJ.md) | 9 | J |
|
| 97 |
+
| [`linear_function_9qL`](linear_function_9qL.md) | 9 | L |
|
| 98 |
+
| [`linear_function_9qT1`](linear_function_9qT1.md) | 9 | T1 |
|
| 99 |
+
| [`linear_function_9qT2`](linear_function_9qT2.md) | 9 | T2 |
|
| 100 |
+
| [`linear_function_9qY`](linear_function_9qY.md) | 9 | Y |
|
| 101 |
+
| [`linear_function_10qL`](linear_function_10qL.md) | 10 | L |
|
| 102 |
+
<!-- MODEL_INDEX_END -->
|
| 103 |
+
|
| 104 |
+
## Acknowledgements
|
| 105 |
+
The authors acknowledge the IBM Research CCC Service for providing resources that have contributed to the production or processing of the data contained within this data collection.
|
model_data/images/linear_function_10qL_topology.svg
ADDED
|
|
model_data/images/linear_function_2qL_topology.svg
ADDED
|
|
model_data/images/linear_function_3qL_topology.svg
ADDED
|
|
model_data/images/linear_function_4qL_topology.svg
ADDED
|
|
model_data/images/linear_function_4qY_topology.svg
ADDED
|
|
model_data/images/linear_function_5qL_topology.svg
ADDED
|
|
model_data/images/linear_function_5qT_topology.svg
ADDED
|
|
model_data/images/linear_function_6qL_topology.svg
ADDED
|
|
model_data/images/linear_function_6qT_topology.svg
ADDED
|
|
model_data/images/linear_function_6qY_topology.svg
ADDED
|
|
model_data/images/linear_function_7qF_topology.svg
ADDED
|
|
model_data/images/linear_function_7qH_topology.svg
ADDED
|
|
model_data/images/linear_function_7qL_topology.svg
ADDED
|
|
model_data/images/linear_function_7qT_topology.svg
ADDED
|
|
model_data/images/linear_function_7qY_topology.svg
ADDED
|
|
model_data/images/linear_function_8qF_topology.svg
ADDED
|
|
model_data/images/linear_function_8qJ_topology.svg
ADDED
|
|
model_data/images/linear_function_8qL_topology.svg
ADDED
|
|
model_data/images/linear_function_8qT1_topology.svg
ADDED
|
|
model_data/images/linear_function_8qT2_topology.svg
ADDED
|
|
model_data/images/linear_function_8qY_topology.svg
ADDED
|
|
model_data/images/linear_function_9qF1_topology.svg
ADDED
|
|
model_data/images/linear_function_9qF2_topology.svg
ADDED
|
|
model_data/images/linear_function_9qH1_topology.svg
ADDED
|
|
model_data/images/linear_function_9qH2_topology.svg
ADDED
|
|
model_data/images/linear_function_9qH3_topology.svg
ADDED
|
|
model_data/images/linear_function_9qJ_topology.svg
ADDED
|
|
model_data/images/linear_function_9qL_topology.svg
ADDED
|
|
model_data/images/linear_function_9qT1_topology.svg
ADDED
|
|
model_data/images/linear_function_9qT2_topology.svg
ADDED
|
|
model_data/images/linear_function_9qY_topology.svg
ADDED
|
|
model_data/linear_function_10qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_10qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 10
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_10qL.json`
|
| 6 |
+
- Weights: `linear_function_10qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_2qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_2qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 2
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_2qL.json`
|
| 6 |
+
- Weights: `linear_function_2qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_3qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_3qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 3
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_3qL.json`
|
| 6 |
+
- Weights: `linear_function_3qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_4qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_4qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 4
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_4qL.json`
|
| 6 |
+
- Weights: `linear_function_4qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_4qY.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_4qY
|
| 2 |
+
|
| 3 |
+
- Qubits: 4
|
| 4 |
+
- Topology: Y
|
| 5 |
+
- Config: `linear_function_4qY.json`
|
| 6 |
+
- Weights: `linear_function_4qY.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_5qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_5qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 5
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_5qL.json`
|
| 6 |
+
- Weights: `linear_function_5qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_5qT.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_5qT
|
| 2 |
+
|
| 3 |
+
- Qubits: 5
|
| 4 |
+
- Topology: T
|
| 5 |
+
- Config: `linear_function_5qT.json`
|
| 6 |
+
- Weights: `linear_function_5qT.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_6qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_6qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 6
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_6qL.json`
|
| 6 |
+
- Weights: `linear_function_6qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_6qT.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_6qT
|
| 2 |
+
|
| 3 |
+
- Qubits: 6
|
| 4 |
+
- Topology: T
|
| 5 |
+
- Config: `linear_function_6qT.json`
|
| 6 |
+
- Weights: `linear_function_6qT.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_6qY.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_6qY
|
| 2 |
+
|
| 3 |
+
- Qubits: 6
|
| 4 |
+
- Topology: Y
|
| 5 |
+
- Config: `linear_function_6qY.json`
|
| 6 |
+
- Weights: `linear_function_6qY.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_7qF.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_7qF
|
| 2 |
+
|
| 3 |
+
- Qubits: 7
|
| 4 |
+
- Topology: F
|
| 5 |
+
- Config: `linear_function_7qF.json`
|
| 6 |
+
- Weights: `linear_function_7qF.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_7qH.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_7qH
|
| 2 |
+
|
| 3 |
+
- Qubits: 7
|
| 4 |
+
- Topology: H
|
| 5 |
+
- Config: `linear_function_7qH.json`
|
| 6 |
+
- Weights: `linear_function_7qH.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_7qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_7qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 7
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_7qL.json`
|
| 6 |
+
- Weights: `linear_function_7qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_7qT.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_7qT
|
| 2 |
+
|
| 3 |
+
- Qubits: 7
|
| 4 |
+
- Topology: T
|
| 5 |
+
- Config: `linear_function_7qT.json`
|
| 6 |
+
- Weights: `linear_function_7qT.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_7qY.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_7qY
|
| 2 |
+
|
| 3 |
+
- Qubits: 7
|
| 4 |
+
- Topology: Y
|
| 5 |
+
- Config: `linear_function_7qY.json`
|
| 6 |
+
- Weights: `linear_function_7qY.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_8qF.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_8qF
|
| 2 |
+
|
| 3 |
+
- Qubits: 8
|
| 4 |
+
- Topology: F
|
| 5 |
+
- Config: `linear_function_8qF.json`
|
| 6 |
+
- Weights: `linear_function_8qF.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_8qJ.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_8qJ
|
| 2 |
+
|
| 3 |
+
- Qubits: 8
|
| 4 |
+
- Topology: J
|
| 5 |
+
- Config: `linear_function_8qJ.json`
|
| 6 |
+
- Weights: `linear_function_8qJ.safetensors`
|
| 7 |
+
|
| 8 |
+

|
model_data/linear_function_8qL.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# linear_function_8qL
|
| 2 |
+
|
| 3 |
+
- Qubits: 8
|
| 4 |
+
- Topology: L
|
| 5 |
+
- Config: `linear_function_8qL.json`
|
| 6 |
+
- Weights: `linear_function_8qL.safetensors`
|
| 7 |
+
|
| 8 |
+

|