Update README.md
Browse files
README.md
CHANGED
|
@@ -1,163 +1,140 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-4.0
|
| 3 |
-
---
|
| 4 |
-
|
| 5 |
# QASM-Eval
|
| 6 |
|
| 7 |
-
QASM-Eval is an OpenQASM 3 dataset for training and evaluating language models on hardware-facing quantum programming tasks. It
|
| 8 |
-
|
| 9 |
-
QASM-Eval is designed specifically for LLM code generation over advanced OpenQASM 3 features. Each task provides a complete OpenQASM program with a missing core region described by a natural-language TODO comment, and asks the model to reconstruct the corresponding OpenQASM statements. The dataset covers classical logic, timing scheduling, pulse control, and complex workflows that combine these features in realistic quantum-programming scenarios.
|
| 10 |
|
| 11 |
-
|
| 12 |
-
- `classical`: tasks involving classical control, measurements, bits, registers, and classical computation around quantum operations.
|
| 13 |
-
- `pulse`: pulse-level or calibration-style tasks involving frames, waveforms, `defcal`, and pulse operations.
|
| 14 |
-
- `complex`: mixed tasks that combine quantum gates, classical logic, timing, and/or pulse behavior.
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
The released dataset is stored in `data/` as both Parquet and JSONL files:
|
| 19 |
|
| 20 |
-
|
| 21 |
-
| --- | ---: | --- |
|
| 22 |
-
| train | 4,000 | 1,000 timing, 1,000 classical, 1,000 pulse, 1,000 complex |
|
| 23 |
-
| test | 100 | 25 timing, 25 classical, 25 pulse, 25 complex |
|
| 24 |
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
``
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
data/
|
| 40 |
-
train.parquet
|
| 41 |
-
test.parquet
|
| 42 |
-
train.jsonl
|
| 43 |
-
test.jsonl
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
judge.py
|
| 50 |
-
```
|
| 51 |
|
| 52 |
-
## Data
|
| 53 |
|
| 54 |
-
Each record contains:
|
| 55 |
|
| 56 |
-
| field |
|
| 57 |
| --- | --- |
|
| 58 |
-
| `task_id` | Stable task identifier
|
| 59 |
-
| `domain` | One of `timing`, `classical`, `pulse`, or `complex`
|
| 60 |
-
| `prompt` | OpenQASM 3
|
| 61 |
-
| `
|
| 62 |
-
| `
|
| 63 |
-
| `test` |
|
| 64 |
-
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
JSONL is the easiest format for inspection and custom analysis:
|
| 71 |
-
|
| 72 |
-
```python
|
| 73 |
-
import json
|
| 74 |
|
| 75 |
-
|
| 76 |
-
with open(path, "r", encoding="utf-8") as f:
|
| 77 |
-
for line in f:
|
| 78 |
-
if line.strip():
|
| 79 |
-
yield json.loads(line)
|
| 80 |
|
| 81 |
-
|
| 82 |
-
test_records = list(load_jsonl("data/test.jsonl"))
|
| 83 |
```
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
|
| 88 |
|
| 89 |
```python
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
```
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
```python
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
data_files={
|
| 104 |
-
"train": "data/train.parquet",
|
| 105 |
-
"test": "data/test.parquet",
|
| 106 |
-
},
|
| 107 |
-
)
|
| 108 |
```
|
| 109 |
|
| 110 |
-
##
|
| 111 |
|
| 112 |
-
|
| 113 |
|
| 114 |
-
-
|
| 115 |
-
-
|
|
|
|
| 116 |
|
| 117 |
-
|
| 118 |
|
| 119 |
-
-
|
| 120 |
-
-
|
| 121 |
|
| 122 |
-
|
| 123 |
|
| 124 |
## Evaluation
|
| 125 |
|
| 126 |
-
|
| 127 |
|
| 128 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
-
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
domain=record["domain"],
|
| 137 |
-
)
|
| 138 |
-
print(result.ok)
|
| 139 |
-
print(result.to_dict())
|
| 140 |
```
|
| 141 |
|
| 142 |
-
|
|
|
|
|
|
|
| 143 |
|
| 144 |
-
|
| 145 |
|
| 146 |
-
|
|
|
|
|
|
|
| 147 |
|
| 148 |
-
|
| 149 |
-
1. Quantum simulation is stochastic. For stable results, use enough shots or fixed seeds. The evaluator already sets fixed seeds internally for distribution and timeline checks.
|
| 150 |
-
2. Although `evaluator.py` cleans the LLM output before evaluation, it is still recommended to inspect the output format beforehand. Some LLMs may add fixed prefixes, suffixes, or other extraneous text that can cause simulation failures.
|
| 151 |
|
| 152 |
-
|
| 153 |
|
| 154 |
-
|
| 155 |
|
| 156 |
-
|
| 157 |
-
| --- | --- | --- |
|
| 158 |
-
| `numpy` | `2.2.4` | numerical arrays, state vectors, sampling, simulator internals |
|
| 159 |
-
| `scipy` | `1.15.2` | matrix exponential and numerical routines in pulse simulation |
|
| 160 |
-
| `openqasm3` | `1.0.1` | OpenQASM 3 parsing |
|
| 161 |
-
| `qiskit` | `2.0.2` | gate matrices, operators, and Statevector-based simulation |
|
| 162 |
-
| `qutip` | `5.2.2` | waveform / Hamiltonian-style pulse simulation support |
|
| 163 |
-
| `pyarrow` | `22.0.0` | reading and writing Parquet dataset files |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# QASM-Eval
|
| 2 |
|
| 3 |
+
QASM-Eval is an OpenQASM 3 dataset for training and evaluating language models on hardware-facing quantum programming tasks. It focuses on capabilities that matter in near-term quantum workflows, including timing-aware programming, classical control, pulse-level operations, and mixed workflows that combine these elements in a single program.
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
This Hugging Face dataset release contains the benchmark data itself, a lightweight evaluation entry point, and the scripts needed for local checking:
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
- `data/`
|
| 8 |
+
- `scripts/`
|
| 9 |
+
- `run_test.py`
|
| 10 |
|
| 11 |
+
For the full project repository, documentation, and broader codebase, see the GitHub repo: [AnonymousUser-01/QASM-Eval](https://github.com/AnonymousUser-01/QASM-Eval).
|
|
|
|
| 12 |
|
| 13 |
+
## Dataset Summary
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
Each example is an OpenQASM 3 code-completion task. The prompt contains a full QASM program with one missing core region marked by a TODO-style description. The model is expected to generate only the missing block between the markers.
|
| 16 |
|
| 17 |
+
The dataset covers four domains:
|
| 18 |
|
| 19 |
+
- `timing`: delays, durations, and schedule-sensitive behavior
|
| 20 |
+
- `classical`: measurement, registers, conditionals, and classical control
|
| 21 |
+
- `pulse`: frames, waveforms, `defcal`, and pulse-level calibration logic
|
| 22 |
+
- `complex`: mixed tasks combining quantum, timing, pulse, and classical behavior
|
| 23 |
|
| 24 |
+
## Splits
|
| 25 |
|
| 26 |
+
| split | records | composition |
|
| 27 |
+
| --- | ---: | --- |
|
| 28 |
+
| `train` | 4,000 | 1,000 timing, 1,000 classical, 1,000 pulse, 1,000 complex |
|
| 29 |
+
| `test` | 100 | 25 timing, 25 classical, 25 pulse, 25 complex |
|
| 30 |
|
| 31 |
+
Files are provided in both JSONL and Parquet format:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
- `data/train.jsonl`
|
| 34 |
+
- `data/test.jsonl`
|
| 35 |
+
- `data/train.parquet`
|
| 36 |
+
- `data/test.parquet`
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
## Data Fields
|
| 39 |
|
| 40 |
+
Each record contains the following fields:
|
| 41 |
|
| 42 |
+
| field | description |
|
| 43 |
| --- | --- |
|
| 44 |
+
| `task_id` | Stable task identifier |
|
| 45 |
+
| `domain` | One of `timing`, `classical`, `pulse`, or `complex` |
|
| 46 |
+
| `prompt` | OpenQASM 3 program with the target core block replaced by a natural-language TODO |
|
| 47 |
+
| `completion` | Reference answer for the missing core block only |
|
| 48 |
+
| `canonical_solution` | Full reference OpenQASM 3 program |
|
| 49 |
+
| `test` | Minimal evaluation snippet showing how the completion is checked |
|
|
|
|
| 50 |
|
| 51 |
+
The central prompt structure looks like:
|
| 52 |
|
| 53 |
+
```qasm
|
| 54 |
+
// === CORE_TASK_START ===
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
// TODO(core task): natural-language description of the missing QASM behavior
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
// === CORE_TASK_END ===
|
|
|
|
| 59 |
```
|
| 60 |
|
| 61 |
+
Models should output only the code that belongs between these two markers.
|
| 62 |
+
|
| 63 |
+
## How To Load
|
| 64 |
|
| 65 |
+
Using the Hugging Face `datasets` library:
|
| 66 |
|
| 67 |
```python
|
| 68 |
+
from datasets import load_dataset
|
| 69 |
|
| 70 |
+
dataset = load_dataset("AnonymousORG01/QASM-Eval")
|
| 71 |
+
train_data = dataset["train"]
|
| 72 |
+
test_data = dataset["test"]
|
| 73 |
+
|
| 74 |
+
print(train_data[0].keys())
|
| 75 |
+
print(train_data[0]["domain"])
|
| 76 |
+
print(train_data[0]["prompt"][:300])
|
| 77 |
```
|
| 78 |
|
| 79 |
+
If you prefer to work with the local files directly:
|
| 80 |
|
| 81 |
```python
|
| 82 |
+
import json
|
| 83 |
+
|
| 84 |
+
with open("data/train.jsonl", "r", encoding="utf-8") as f:
|
| 85 |
+
first_record = json.loads(next(f))
|
| 86 |
|
| 87 |
+
print(first_record["task_id"])
|
| 88 |
+
print(first_record["completion"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
```
|
| 90 |
|
| 91 |
+
## Intended Use
|
| 92 |
|
| 93 |
+
QASM-Eval is intended for:
|
| 94 |
|
| 95 |
+
- supervised fine-tuning on advanced OpenQASM 3 completion tasks
|
| 96 |
+
- benchmarking LLMs on hardware-facing quantum code generation
|
| 97 |
+
- analysis of model behavior on timing, classical-control, and pulse-related QASM features
|
| 98 |
|
| 99 |
+
The typical training setup uses:
|
| 100 |
|
| 101 |
+
- `prompt` as model input
|
| 102 |
+
- `completion` as the target output
|
| 103 |
|
| 104 |
+
If full-program inspection is needed, `canonical_solution` provides the complete reference program.
|
| 105 |
|
| 106 |
## Evaluation
|
| 107 |
|
| 108 |
+
This release includes:
|
| 109 |
|
| 110 |
+
- `run_test.py`: an end-to-end benchmarking entry point
|
| 111 |
+
- `scripts/evaluator.py`
|
| 112 |
+
- `scripts/judge.py`
|
| 113 |
+
- `scripts/QASM_simulator.py`
|
| 114 |
+
- `scripts/pulse_simulator.py`
|
| 115 |
|
| 116 |
+
`run_test.py` reads the released test split, queries a model, evaluates generated completions, and reports benchmark results such as pass@k.
|
| 117 |
|
| 118 |
+
Example:
|
| 119 |
+
|
| 120 |
+
```bash
|
| 121 |
+
python3 run_test.py
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
```
|
| 123 |
|
| 124 |
+
The evaluation logic checks generated completions against the golden program using syntax validity and task-dependent semantic checks such as output distribution or timeline behavior.
|
| 125 |
+
|
| 126 |
+
## Repository Scope On Hugging Face
|
| 127 |
|
| 128 |
+
The Hugging Face dataset repository is intentionally lightweight. It includes only:
|
| 129 |
|
| 130 |
+
- the released dataset files in `data/`
|
| 131 |
+
- the evaluation scripts in `scripts/`
|
| 132 |
+
- `run_test.py`
|
| 133 |
|
| 134 |
+
For the complete repository, including additional documentation and the broader project context, visit:
|
|
|
|
|
|
|
| 135 |
|
| 136 |
+
- GitHub: [https://github.com/AnonymousUser-01/QASM-Eval](https://github.com/AnonymousUser-01/QASM-Eval)
|
| 137 |
|
| 138 |
+
## Citation
|
| 139 |
|
| 140 |
+
This project is currently maintained in anonymous form for review purposes. A finalized citation will be added after the review process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|