Results
Programs are run through reference checks and simulation; a prompt passes when its program is semantically correct. Decoding is greedy with at most 4,096 new tokens. All evaluation prompts are in English. Neither set is used in training.
Table with columns: Set, Prompts, Base model, This adapter| Set | Prompts | Base model | This adapter |
|---|
| Test | 2494 | not run | 93.9% |
| Validation | 2479 | 9.5% | 93.2% |
The base model is Qwen3.8-27B without the adapter, given the same prompts. Outputs cut off at the token limit fall from 4.0% to 0.3% on validation.
Prompts the checker could not score count as not passed (2 in validation, 6 in test; 26 for the base model in validation).
Validation

Table with columns: Split, Prompts, Base model, This adapter| Split | Prompts | Base model | This adapter |
|---|
| Core | 1999 | 7.1% | 96.8% |
| Advanced | 480 | 19.4% | 78.1% |
Table with columns: Task, Prompts, Base model, This adapter| Task | Prompts | Base model | This adapter |
|---|
| QAOA | 348 | 12.9% | 98.0% |
| Product RY | 345 | 0.0% | 99.1% |
| Gate sequence | 275 | 0.0% | 100.0% |
| Agent-Q QAOA | 201 | 0.5% | 93.0% |
| Teleportation | 199 | 0.0% | 98.5% |
| Graph state | 193 | 2.1% | 100.0% |
| Reset and feedback | 171 | 0.0% | 98.2% |
| QASM translation | 125 | 74.4% | 92.0% |
| GHZ | 116 | 0.0% | 98.3% |
| QASM-Eval timing | 93 | 63.4% | 94.6% |
| QASM-Eval complex | 93 | 0.0% | 34.4% |
| Phase oracle | 69 | 0.0% | 94.2% |
| QASM-Eval classical | 62 | 38.7% | 62.9% |
| QFT | 59 | 0.0% | 100.0% |
| Basis state | 58 | 0.0% | 100.0% |
| QASM-Eval pulse | 31 | 29.0% | 93.5% |
| MQT QFT | 15 | 0.0% | 46.7% |
| MQT half adder | 12 | 0.0% | 0.0% |
| MQT full adder | 12 | 0.0% | 0.0% |
| MQT modular adder | 2 | 0.0% | 100.0% |
Test

Table with columns: Split, Prompts, This adapter| Split | Prompts | This adapter |
|---|
| Core | 2092 | 95.5% |
| Advanced | 402 | 85.6% |
Table with columns: Task, Prompts, This adapter| Task | Prompts | This adapter |
|---|
| QAOA | 347 | 95.7% |
| Product RY | 312 | 99.4% |
| Gate sequence | 299 | 100.0% |
| Agent-Q QAOA | 281 | 93.2% |
| Teleportation | 198 | 95.5% |
| Reset and feedback | 184 | 97.8% |
| Graph state | 180 | 100.0% |
| GHZ | 149 | 96.6% |
| QASM translation | 139 | 97.1% |
| Basis state | 77 | 100.0% |
| QFT | 74 | 98.6% |
| Phase oracle | 66 | 92.4% |
| MQT QFT | 38 | 44.7% |
| QASM-Eval timing | 31 | 87.1% |
| QASM-Eval classical | 31 | 80.6% |
| QASM-Eval complex | 31 | 6.5% |
| QASM-Eval pulse | 28 | 100.0% |
| MQT modular adder | 12 | 0.0% |
| MQT full adder | 12 | 0.0% |
| MQT half adder | 5 | 0.0% |
The same numbers are in eval_results.json.
Usage
import torchfrom peft import PeftModelfrom transformers import AutoTokenizer, Qwen3_5ForConditionalGeneration base = "Qwen/Qwen3.8-27B"rev = "1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0"tok = AutoTokenizer.from_pretrained(base, revision=rev)model = Qwen3_5ForConditionalGeneration.from_pretrained(base, revision=rev, dtype=torch.bfloat16, device_map="cuda:0")model = PeftModel.from_pretrained(model, "LeonaQuantum/leona-qasm-1.0-beta").eval() messages = [{"role": "user", "content": "Write a complete OpenQASM 3.0 program that prepares a 3-qubit GHZ state and measures all qubits."}]prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)inputs = tok(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")out = model.generate(**inputs, do_sample=False, max_new_tokens=4096)print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Tested with Transformers 5.22.1, PEFT 0.21.2, PyTorch 2.8.0.
Training
- LoRA rank 16, alpha 32, dropout 0; 1,000 steps; effective batch 16; peak learning rate 5e-5; sequence length 4,096.
- 22,260 training examples (22,123 within the length limit): about 58% generated by the project's own circuit generators, the rest from QCircuitBench, Agent-Q, QASM-Eval, MQT Bench, QASMBench, Qly verified OpenQASM circuits and quantum-circuits-21k. Training batches were sampled 70% from public sources and 30% from generated ones.
- The datasets are not redistributed; each keeps its own license.
Checkpoints
main is step 1,000. Earlier checkpoints are tagged clean-v12-step-200, -400, -600, -800 and -1000.