Red Hat’s Ana Paula Appel reports that translating quantum code from Qiskit to NVIDIA CUDA-Q is a practical challenge now being addressed by language models. The work introduces a 640-task benchmark to assess whether a small open model can learn this translation, and how to reliably measure its success.
A key aspect of the evaluation is that a translated kernel is considered correct only if it prepares the same quantum state as the Qiskit reference, with a fidelity of at least 0.999. The research demonstrates that whether fine-tuning outperforms prompting depends on the base model used.
LoRA and Prompting Performance on Qiskit-to-CUDA-Q Translation
This approach avoids the pitfalls of simply verifying a circuit’s operation post-translation, and instead focuses on the model’s ability to accurately interpret and rewrite the quantum code itself. Measurement counts, the researchers found, would have accepted incorrect phase errors, highlighting the need for careful evaluation metrics. This suggests that while fine-tuning can match prompting performance on familiar code, it may not always improve the ability to adapt to new or varied coding conventions.
The QuantumKatas regression probe revealed a further trade-off, with LoRA reducing performance from 23.8% to 8.9% on this specific task, indicating a loss of proficiency in certain areas. This outcome, replicated on a 1.5B model, confirms that the effectiveness of fine-tuning is dependent on the base model used, and is not a guaranteed improvement. These results, obtained through an evaluation method tested before training, provide a robust and trustworthy assessment of the translation capabilities of these language models.
Execution-Verified Benchmark for Quantum Code Translation
A circuit-level converter successfully translated all 640 tasks in the new benchmark by executing the Qiskit input and mapping the resulting circuit, demonstrating the test specifically measures source-level translation rather than functional equivalence after execution. The benchmark incorporates three distinct test sets, larger circuits, an unseen circuit family, and an unseen Qiskit coding style, to rigorously evaluate the translation capabilities of the models.
On Nemotron 3 Nano 4B, LoRA reaches 83.9%, tying a 4-shot prompt (83.1%), but generalizes worse to unseen style (48.5% vs. 65.5%) and cuts QuantumKatas from 23.8% to 8.9%; on Qwen2.5-Coder 7B, LoRA beats the prompt overall (92.0% vs. 82.8%) and on unseen style (78.5% vs. 65.0%). The study found that language models struggle with real quantum kernels, scoring zero on 27 such examples, while they can translate simple parametric code, reaching up to 83% on 48 parametric functions.
Fidelity Threshold and Verifier Testing Methodology
The evaluation methodology employed in this work prioritizes rigorous verification of translated quantum code, going beyond simple syntactic correctness. The team established a fidelity threshold of 0.999, meaning a translated CUDA-Q kernel is only considered accurate if it prepares a quantum state indistinguishable from the original Qiskit circuit.
The researchers use this to fine-tune NVIDIA Nemotron 3 Nano 4B with LoRA on a single L4 GPU and to compare it with a 4-shot prompt of the same model, under an evaluation that was itself tested before any model was trained. A key element of this approach is the exclusion of text matching and the avoidance of human judgment, relying instead on automated state vector comparison.
To ensure the reliability of the evaluation process itself, the verifier underwent extensive testing before any models were trained. A negative control experiment involved deliberately corrupting 600 correct translations with errors like altered phases or deleted gates. The verifier successfully rejected 500 of the 503 mutated circuits that demonstrably changed the quantum state, with the remaining few exhibiting near-perfect fidelity scores. The system does not rely on bitstring histograms, recognizing that a correct translation may yield the same result without necessarily being structurally equivalent.
LoRA fine-tuning and 4-example prompting achieved comparable overall accuracy, 83.9% versus 83.1%. Mixing two replay formats is the best mitigation trade-off (84.4% translation, Katas 21.5%). Auxiliary training data, while improving performance on the imitated task, could inadvertently leak its format into other tasks.
Performance on Parametric Functions and Real QED-C Kernels
The ability to translate quantum code between frameworks remains a critical bottleneck, and recent work demonstrates a clear distinction in where language models succeed and fail. While models can achieve up to 83% accuracy translating parametric Qiskit functions into CUDA-Q kernels, they consistently score 0% on translating 27 real QED-C kernels, highlighting a limitation in handling more complex, functional code.
This discrepancy indicates that current language models excel at source-level translation of simpler parametric code but have not yet mastered the translation of complete programs. 82.8%) and on unseen style (78.5% vs. 65.0%), and on the 1.5B model as well.
Mitigation of Regression with Replay Format Mixing
Mixing two replay formats is the best mitigation trade-off (84.4% translation, Katas 21.5%). The study revealed a trade-off inherent in mitigation strategies; while auxiliary datasets can address specific weaknesses, they often introduce their own format biases into neighboring tasks. On 48 parametric functions that must become kernels with arguments, where executing the input cannot yield a parametric kernel, models reach up to 83%; on 27 real QED-C kernels, every model scores 0%.
QuantumKatas Regression Probe and Syntax Interference
A 640-task benchmark was created to assess translation capabilities, incorporating tests for larger circuits, unfamiliar circuit families and previously unseen Qiskit coding styles, and all tasks were verified to a fidelity of 0.999 compared to the original Qiskit reference, with no reliance on textual matching or human judgment. A dedicated QuantumKatas regression probe was also integrated into the evaluation process, with the evaluator’s performance assessed before any training occurred.
An audit of the 350 tasks within the QuantumKatas suite revealed a specific issue; one test, Teleportation/1.7, incorrectly passed when presented with an empty code skeleton because the test only verified the return value, not the underlying circuit construction. This highlights the importance of comprehensive testing and the potential for subtle flaws in evaluation metrics.
Further analysis showed that specializing a 4 billion parameter model on Qiskit-to-CUDA-Q translation resulted in a loss of approximately two-thirds of its QuantumKatas score, demonstrating a significant regression in performance. The source of this regression was traced to the model generating CUDA-Q syntax within Qiskit functions, indicating a failure to maintain code separation. However, the Qiskit regression appeared consistently across all fine-tuned models, suggesting that the issue is not specific to a particular architecture or training method.
👉 More information
🗞 When Does Fine-Tuning Beat Prompting for Qiskit-to-CUDA-Q Translation? An Execution-Verified Study
✍️ Ana Paula Appel (Red Hat)
🧠 ArXiv: https://arxiv.org/html/2611.29793v1




See today’s quantum computing news on Quantum Zeitgeist for the latest breakthroughs in qubits, hardware, algorithms, and industry deals.
