AnonymousUser01 commited on
Commit
3ce552a
·
verified ·
1 Parent(s): b17781a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +87 -110
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 targets the capabilities that are especially important in the NISQ era, where improving program reliability often requires more than static circuit specification: mid-circuit measurement, precise timing control, and pulse-level waveform access. The dataset supports OpenQASM 3 generation, fine-tuning, and benchmark evaluation.
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
- - `timing`: QASM tasks involving delays, durations, and timeline-sensitive operations.
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
- This repository contains the released dataset and evaluation-related code only. Dataset-generation scripts are maintained separately at: https://github.com/AnonymousUser-01/QASM-Eval
18
- The released dataset is stored in `data/` as both Parquet and JSONL files:
19
 
20
- | split | records | domains |
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
- Each task follows a HumanEval-like shape. The prompt contains a full OpenQASM program with one marked core block:
27
 
28
- ```qasm
29
- // === CORE_TASK_START ===
 
 
30
 
31
- // TODO(core task): natural-language description of the missing QASM behavior
32
 
33
- // === CORE_TASK_END ===
34
- ```
35
-
36
- ## Repository Layout
37
 
38
- ```text
39
- data/
40
- train.parquet
41
- test.parquet
42
- train.jsonl
43
- test.jsonl
44
 
45
- scripts/
46
- evaluator.py
47
- QASM_simulator.py
48
- pulse_simulator.py
49
- judge.py
50
- ```
51
 
52
- ## Data Format
53
 
54
- Each record contains:
55
 
56
- | field | meaning |
57
  | --- | --- |
58
- | `task_id` | Stable task identifier, usually derived from the original QASM source path. |
59
- | `domain` | One of `timing`, `classical`, `pulse`, or `complex`. |
60
- | `prompt` | OpenQASM 3 context with the missing core block replaced by a TODO description. |
61
- | `canonical_solution` | Full reference OpenQASM program with the correct core block filled in. |
62
- | `completion` | Reference answer for the missing core block only. |
63
- | `test` | A lightweight evaluation-spec string showing how to call the evaluator. |
64
-
65
 
66
- ## Loading the Dataset
67
 
68
- ### JSONL
69
-
70
- JSONL is the easiest format for inspection and custom analysis:
71
-
72
- ```python
73
- import json
74
 
75
- def load_jsonl(path):
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
- train_records = list(load_jsonl("data/train.jsonl"))
82
- test_records = list(load_jsonl("data/test.jsonl"))
83
  ```
84
 
85
- ### Parquet
 
 
86
 
87
- Parquet is smaller and convenient for dataset libraries:
88
 
89
  ```python
90
- import pyarrow.parquet as pq
91
 
92
- train = pq.read_table("data/train.parquet").to_pylist()
93
- test = pq.read_table("data/test.parquet").to_pylist()
 
 
 
 
 
94
  ```
95
 
96
- With Hugging Face `datasets`:
97
 
98
  ```python
99
- from datasets import load_dataset
 
 
 
100
 
101
- dataset = load_dataset(
102
- "parquet",
103
- data_files={
104
- "train": "data/train.parquet",
105
- "test": "data/test.parquet",
106
- },
107
- )
108
  ```
109
 
110
- ## Testing / Training
111
 
112
- For testing, use the examples in `data/test.jsonl` or `data/test.parquet` and follow the corresponding fields to construct model inputs and run evaluation. A typical setup is:
113
 
114
- - input: `prompt`
115
- - evaluation: call `scripts/evaluator.py` to test the LLM output
 
116
 
117
- For training (supervised fine-tuning), a typical setup is:
118
 
119
- - input: `prompt`
120
- - target: `completion` or `canonical_solution`
121
 
122
- Depending on the training framework, these fields can also be wrapped into a chat-style format, for example by placing `input` in a `user` message and `target` in an `assistant` message.
123
 
124
  ## Evaluation
125
 
126
- ### Evaluate One Model Completion
127
 
128
- `scripts/evaluator.py` exposes `evaluate_qasm_completion`, which accepts either a full OpenQASM program or only the core snippet returned by a model. The function determines correctness through quantum-program simulation; see the detailed comments in the script for the exact evaluation criteria.
 
 
 
 
129
 
130
- If the LLM response to `prompt` is stored as `model_output`, the evaluator can be used as follows:
131
 
132
- ```python
133
- result = evaluate_qasm_completion(
134
- golden_code=record["canonical_solution"],
135
- returned_code=model_output,
136
- domain=record["domain"],
137
- )
138
- print(result.ok)
139
- print(result.to_dict())
140
  ```
141
 
142
- `scripts/judge.py` provides the lower-level foundation for the evaluator and contains more detailed simulation and evaluation logic.
 
 
143
 
144
- `scripts/pulse_simulator.py` is a QuTiP-based waveform simulator for modeling the effect of microwave signals on qubits.
145
 
146
- `scripts/QASM_simulator.py` is a quantum-state simulator built on top of `pulse_simulator` and Qiskit Statevector. It accepts valid OpenQASM 3 programs, returns the gate timeline and quantum state. The simulator has been extended to support newer OpenQASM 3 features.
 
 
147
 
148
- Important:
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
- ## Dependencies
153
 
154
- Core libraries used by this project:
155
 
156
- | library | version | used for |
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.