An AI Kept Getting Quantum Code Wrong. Testing Its Work Changed That.
In a Red Hat researcher’s follow-up, one AI model went from zero correct translations in a single try to nearly 94% when it could run the code, check the result and try again.
Reading tools for text size, copying, printing and your reading list

A quantum program can run without an error message and still give the wrong answer. That distinction mattered in a new preprint by Red Hat researcher Ana Paula Appel, listed in arXiv’s December 4 issue. In a set of 640 tasks translating code from IBM’s Qiskit to NVIDIA’s CUDA-Q, one AI model got none right when given just one attempt. The same model reached 93.8% when it could consult documentation, run its code, compare the result with a reference and revise.[1][2]
Qiskit and CUDA-Q are two different toolkits for describing quantum computations. Getting a translation to run is like getting a recipe into another language without grammatical mistakes: it still might produce the wrong dish. Appel checked whether the rewritten program prepared the same quantum state as the original in a simulator. That was the final test even in the runs where the model itself was given less detailed feedback.[1]
The harder test was code people already use
In Appel’s earlier study, none of the four AI configurations correctly translated even one of 27 routines drawn from a Quantum Economic Development Consortium benchmark. This time, a model called Nemotron Cascade 2 got 17 of the 27 right with the full testing setup. A different model, GLM-5.3 Flash, got all 27 right with that setup, compared with 10 on its first try. Those are separate results on a small set of existing benchmark routines, not the denominator behind the 93.8% figure. Some other models did not improve when given the same tools.[1][3]
There was also a cheaper way to use the loop. On the 640-task set, Appel tried a fine-tuned model first and reserved the more expensive retry process for translations that failed the reference check. Only about 6% needed that second stage. The two-stage approach got 98.9% right and used roughly one-third of the estimated model compute of running the full loop every time. The compute figure is an estimate, not a cloud bill or a measurement of elapsed time.[1]
The preprint tested translations in a simulator, not on a quantum processor. It also relied on a reference program the researcher could already run. That makes the result most useful for moving existing code with a reliable way to check it, not for writing new quantum algorithms whose correct answers are unknown. The useful lesson is that a reliable test can do more for a translation than a more confident first answer.[1]