Spaces:
Sleeping
Sleeping
Create GUIDE.md
Browse files
GUIDE.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# π CNOT Count Regression Guide
|
| 2 |
+
|
| 3 |
+
Welcome to the **CNOT Count Regression Hub**.
|
| 4 |
+
This tool demonstrates how Machine Learning can predict the number of **CNOT (CX) gates** β the most noise-prone two-qubit operations β using only structural features of quantum circuits.
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
## β οΈ Important: Demo Dataset Notice
|
| 9 |
+
The datasets used here are **v1.0.0-demo** shards.
|
| 10 |
+
|
| 11 |
+
* **Constraint:** Reduced dataset size.
|
| 12 |
+
* **Impact:** Model accuracy may fluctuate depending on split and features.
|
| 13 |
+
* **Goal:** Demonstrate how circuit topology correlates with entangling gate usage.
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## π― 1. What is Being Predicted?
|
| 18 |
+
|
| 19 |
+
The model predicts:
|
| 20 |
+
|
| 21 |
+
### `cx_count`
|
| 22 |
+
The total number of **CNOT gates** in a circuit.
|
| 23 |
+
|
| 24 |
+
Why this matters:
|
| 25 |
+
|
| 26 |
+
* CNOT gates are the **main source of noise** in NISQ devices
|
| 27 |
+
* They dominate **error rates and decoherence**
|
| 28 |
+
* Reducing them is key to **hardware-efficient quantum algorithms**
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## π§ 2. How the Model Works
|
| 33 |
+
|
| 34 |
+
We train a **Random Forest Regressor** to map circuit features β `cx_count`.
|
| 35 |
+
|
| 36 |
+
### Input Features (examples):
|
| 37 |
+
|
| 38 |
+
* **Topology:**
|
| 39 |
+
* `adj_density` β connectivity density
|
| 40 |
+
* `adj_degree_mean` β average qubit interaction
|
| 41 |
+
* **Complexity:**
|
| 42 |
+
* `depth` β circuit depth
|
| 43 |
+
* `total_gates` β total number of operations
|
| 44 |
+
* **Structure:**
|
| 45 |
+
* `gate_entropy` β randomness vs regularity
|
| 46 |
+
* **QASM-derived:**
|
| 47 |
+
* `qasm_length`, `qasm_line_count`
|
| 48 |
+
* `qasm_gate_keyword_count`
|
| 49 |
+
|
| 50 |
+
The model learns how **structural patterns imply entangling cost**.
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## π 3. Understanding the Output
|
| 55 |
+
|
| 56 |
+
After training, youβll see:
|
| 57 |
+
|
| 58 |
+
### A. Actual vs Predicted Plot
|
| 59 |
+
|
| 60 |
+
* Each point = one circuit
|
| 61 |
+
* Diagonal line = perfect prediction
|
| 62 |
+
* Spread = prediction error
|
| 63 |
+
|
| 64 |
+
π Tight clustering = good model
|
| 65 |
+
|
| 66 |
+
---
|
| 67 |
+
|
| 68 |
+
### B. Residual Distribution
|
| 69 |
+
|
| 70 |
+
* Shows prediction errors (`actual - predicted`)
|
| 71 |
+
* Centered around 0 = unbiased model
|
| 72 |
+
* Wide spread = instability
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
### C. Feature Importance
|
| 77 |
+
|
| 78 |
+
Top features driving predictions:
|
| 79 |
+
|
| 80 |
+
* High importance = strong influence on `cx_count`
|
| 81 |
+
* Helps identify:
|
| 82 |
+
* what increases entanglement cost
|
| 83 |
+
* which metrics matter most
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
## π 4. Explorer Tab
|
| 88 |
+
|
| 89 |
+
Inspect real circuits:
|
| 90 |
+
|
| 91 |
+
* View dataset slices (`train`, etc.)
|
| 92 |
+
* See raw and transpiled QASM
|
| 93 |
+
* Understand how circuits differ structurally
|
| 94 |
+
|
| 95 |
+
---
|
| 96 |
+
|
| 97 |
+
## βοΈ 5. Tips for Better Results
|
| 98 |
+
|
| 99 |
+
* Use **diverse features** (topology + QASM)
|
| 100 |
+
* Avoid too small datasets after filtering
|
| 101 |
+
* Tune:
|
| 102 |
+
* `max_depth`
|
| 103 |
+
* `n_estimators`
|
| 104 |
+
* Try different datasets:
|
| 105 |
+
* Noise changes structure β changes predictions
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## π 6. Why This Matters
|
| 110 |
+
|
| 111 |
+
This tool helps answer:
|
| 112 |
+
|
| 113 |
+
* How expensive is a circuit in terms of **entangling operations**?
|
| 114 |
+
* Can we estimate noise **before execution**?
|
| 115 |
+
* Which designs are more **hardware-friendly**?
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## π 7. Project Resources
|
| 120 |
+
|
| 121 |
+
* π€ [Hugging Face](https://huggingface.co/QSBench)
|
| 122 |
+
* π» [GitHub](https://github.com/QSBench)
|
| 123 |
+
* π [Website](https://qsbench.github.io)
|