QASM-Eval / README.md
AnonymousUser01's picture
Update README.md
1c4b337 verified
|
Raw History Blame Contribute Delete
5.06 kB
# QASM-Eval
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.
This Hugging Face dataset release contains the benchmark data itself, a lightweight evaluation entry point, and the scripts needed for local checking:
- `data/`
- `scripts/`
- `run_test.py`
For the full project repository, documentation, and broader codebase, see the GitHub repo: [AnonymousUser-01/QASM-Eval](https://github.com/AnonymousUser-01/QASM-Eval).
Two models fine-tuned on QASM-Eval are also available on Hugging Face:
- [Llama-3.1-8B-Instruct-QASM-Eval](https://huggingface.co/AnonymousORG01/Llama-3.1-8B-Instruct-QASM-Eval)
- [Llama-3.3-70B-Instruct-QASM-Eval](https://huggingface.co/AnonymousORG01/Llama-3.3-70B-Instruct-QASM-Eval)
## Dataset Summary
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.
The dataset covers four domains:
- `timing`: delays, durations, and schedule-sensitive behavior
- `classical`: measurement, registers, conditionals, and classical control
- `pulse`: frames, waveforms, `defcal`, and pulse-level calibration logic
- `complex`: mixed tasks combining quantum, timing, pulse, and classical behavior
## Splits
| split | records | composition |
| --- | ---: | --- |
| `train` | 4,000 | 1,000 timing, 1,000 classical, 1,000 pulse, 1,000 complex |
| `test` | 100 | 25 timing, 25 classical, 25 pulse, 25 complex |
Files are provided in both JSONL and Parquet format:
- `data/train.jsonl`
- `data/test.jsonl`
- `data/train.parquet`
- `data/test.parquet`
## Data Fields
Each record contains the following fields:
| field | description |
| --- | --- |
| `task_id` | Stable task identifier |
| `domain` | One of `timing`, `classical`, `pulse`, or `complex` |
| `prompt` | OpenQASM 3 program with the target core block replaced by a natural-language TODO |
| `completion` | Reference answer for the missing core block only |
| `canonical_solution` | Full reference OpenQASM 3 program |
| `test` | Minimal evaluation snippet showing how the completion is checked |
The central prompt structure looks like:
```qasm
// === CORE_TASK_START ===
// TODO(core task): natural-language description of the missing QASM behavior
// === CORE_TASK_END ===
```
Models should output only the code that belongs between these two markers.
## Quick Start:
### 1. Evaluate an LLM on QASM-Eval
Use `run_test.py` for end-to-end model benchmarking on the released test split.
The script is configured directly at the top of the file rather than through command-line arguments.
Important configuration fields include:
- `RUN_MODE`: choose `"random_sample"` or `"all"`
- `NUM_RANDOM_SAMPLES`: total number of randomly selected test tasks when using random mode
- `PASS_AT_K`: number of model samples generated per task, and the maximum `k` reported in pass@k
- `LLM_CHOICE`: model name
- `LLM_PROVIDER`: backend provider such as `nebius`, `openai`, `nscale`, or `huggingface`
- `LLM_KEY`: API key for the chosen provider
- `LLM_TEMPERATURE`: generation temperature
- `LLM_MAX_TOKENS`: max response length
The script reads `data/test.jsonl`, queries the model repeatedly for each selected task, evaluates every generated answer, and writes run artifacts into `test_runs/`.
To launch an evaluation run:
```bash
python3 run_test.py
```
The output includes a detailed report with the overall pass@k metric and pass rates for each task category. Per-sample error types is also available, the scripts in ./scripts contain the full simulator implementations and the associated evaluation logic.
### 2. Use QASM-Eval as a training dataset
Load the released JSONL or Parquet files directly for supervised fine-tuning, analysis, or prompt construction. Typical field usage:
- `prompt`: model input
- `completion`: target core block only
- `canonical_solution`: full reference program
You can also load the Parquet files if that better fits your training stack.
## How To Load Separately
Using the Hugging Face `datasets` library:
```python
from datasets import load_dataset
dataset = load_dataset("AnonymousORG01/QASM-Eval")
train_data = dataset["train"]
test_data = dataset["test"]
print(train_data[0].keys())
print(train_data[0]["domain"])
print(train_data[0]["prompt"][:300])
```
If you prefer to work with the local files directly:
```python
import json
with open("data/train.jsonl", "r", encoding="utf-8") as f:
first_record = json.loads(next(f))
print(first_record["task_id"])
print(first_record["completion"])
```
## Citation
This project is currently maintained in anonymous form for review purposes. A finalized citation will be added after the review process.