Researchers Develop QAgent, an LLM System Automating OpenQASM Programming for Complex Problems

Programming quantum computers currently presents a significant barrier to wider adoption, despite emerging evidence that these devices excel at specific, challenging calculations. Zhenxiao Fu, Fan Chen, and Lei Jiang from Indiana University Bloomington address this issue by introducing QAgent, a novel system that automates the complex process of writing programs in OpenQASM, the standard language for quantum computers. QAgent leverages the power of large language models, but goes beyond simple code generation by employing a multi-agent approach that combines task planning, knowledge retrieval, and logical reasoning. The team demonstrates that QAgent substantially improves the accuracy of quantum code, achieving a 71.6% increase in performance compared to existing methods, and represents a crucial step towards making quantum computing accessible to a broader range of researchers and developers.

LLMs Generate Quantum Code with QAgent

This text details a research effort focused on using Large Language Models (LLMs) to automatically generate OpenQASM code, the standard language for describing quantum circuits. The core of this work is QAgent, a framework designed to enhance the LLM’s ability to create functional quantum programs. QAgent employs a multi-stage system that combines dynamic learning from examples with the use of predefined tools for quantum simulation and manipulation. This approach allows the system to both generate code and reason about its correctness, a crucial step for complex quantum circuit design. The integration of external tools enables QAgent to leverage existing quantum computing libraries and APIs, expanding its capabilities.

The research team demonstrated QAgent’s effectiveness by applying it to two specific quantum algorithms, Grover’s search and Phase Estimation. In Grover’s search, the system successfully identified and corrected a syntax error, while in Phase Estimation, it utilized predefined functions and debugging to generate accurate code. Analysis of common errors revealed that LLMs often struggle with incorrect gate definitions, repetition schedules, qubit assignments, and precise numeric constants. These findings highlight the challenges of automating quantum programming and the importance of addressing these specific error types.

 

Fig. 1: (a) the overall workflow for QAgent. (b) the detailed design of Dynamic-fewshot Coder. (c) the detailed design of Tool-augmented Coder.
Fig. 1: (a) the overall workflow for QAgent. (b) the detailed design of Dynamic-fewshot Coder. (c) the detailed design of Tool-augmented Coder.

Automated Quantum Programming with Multi-Agent Systems

Researchers developed QAgent, a multi-agent system that fully automates the programming of quantum computers using OpenQASM, addressing a significant obstacle to wider adoption of the technology. The system begins by planning tasks, breaking down complex problems into manageable steps, and then utilizes in-context learning, where it learns from a limited number of examples. To improve its knowledge and reasoning, QAgent employs retrieval-augmented generation, accessing relevant information to inform code creation, and chain-of-thought reasoning to systematically improve both the compilation and functional correctness of the generated code. This comprehensive approach allows QAgent to tackle increasingly complex quantum programming challenges.

QAgent Automates Quantum Programming with High Accuracy

Researchers have developed QAgent, a groundbreaking multi-agent system that fully automates the programming of quantum computers using OpenQASM code, significantly lowering the barrier to entry for non-experts. This innovative system integrates task planning, in-context learning, retrieval-augmented generation, and chain-of-thought reasoning to systematically improve both the compilation and functional correctness of quantum programs. Experiments demonstrate that QAgent enhances the accuracy of QASM code generation by an impressive 71. 6% compared to previous static approaches that rely on simple example-based prompting.

The team designed QAgent with two distinct coding strategies: a Dynamic-few-shot Coder that excels at pattern imitation and a Tools-augmented Coder that focuses on analytical planning. The Dynamic Coder is particularly effective on well-structured tasks, while the Tools Coder handles more complex problems requiring parameter tuning and intricate quantum gate compositions. By combining these strengths in a hybrid strategy, QAgent first attempts to solve a task with the Dynamic Coder and seamlessly switches to the Tools Coder if needed, ensuring robustness and versatility across a wide range of quantum programming challenges. Evaluations on single-algorithm tasks, including Bernstein-Vazirani, Deutsch-Jozsa, Grover’s search, Phase-Estimation, and W-state Preparation, reveal substantial performance gains. Compared to static prompting methods, QAgent’s Dynamic and Tools Coders demonstrate significantly improved success rates in generating syntactically and functionally correct code. Furthermore, tests across different language models, ranging in size from 7 billion to 235 billion parameters, show consistent improvements, highlighting the scalability and adaptability of the system.

QAgent Boosts Quantum Code Accuracy Significantly

QAgent, a new multi-agent system powered by large language models, significantly improves the automation of quantum programming using OpenQASM. The system integrates task planning, retrieval-augmented generation, and chain-of-thought reasoning to enhance both the compilation and functional correctness of generated quantum code. Evaluations demonstrate that QAgent improves accuracy in QASM code generation by 71. 6% compared to previous static approaches, proving effective across various large language model base models. This advancement lowers the barrier to entry for quantum programming, potentially enabling a wider range of researchers and developers to utilise near-term quantum computers. While QAgent performs well on individual quantum algorithms, its performance diminishes when tackling problems involving three or more algorithms, suggesting a need for improved decomposition of complex user requirements into manageable subtasks. Future work will likely focus on enhancing the system’s ability to accurately break down these complex tasks, thereby improving its robustness and scalability for highly composite quantum programming challenges.

👉 More information
🗞 QAgent: An LLM-based Multi-Agent System for Autonomous OpenQASM programming
🧠 ArXiv: https://arxiv.org/abs/2508.20134

Quantum News

Quantum News

As the Official Quantum Dog (or hound) by role is to dig out the latest nuggets of quantum goodness. There is so much happening right now in the field of technology, whether AI or the march of robots. But Quantum occupies a special space. Quite literally a special space. A Hilbert space infact, haha! Here I try to provide some of the news that might be considered breaking news in the Quantum Computing space.

Latest Posts by Quantum News:

IBM Remembers Lou Gerstner, CEO Who Reshaped Company in the 1990s

IBM Remembers Lou Gerstner, CEO Who Reshaped Company in the 1990s

December 29, 2025
Optical Tweezers Scale to 6,100 Qubits with 99.99% Imaging Survival

Optical Tweezers Scale to 6,100 Qubits with 99.99% Imaging Survival

December 28, 2025
Rosatom & Moscow State University Develop 72-Qubit Quantum Computer Prototype

Rosatom & Moscow State University Develop 72-Qubit Quantum Computer Prototype

December 27, 2025