Enhancing LLM-based quantum code generation with multi-agent optimization and quantum error correction
File(s) 2504.14557v2.pdf (385.48 KB)
Accepted version
Author(s)
Campbell, Charlie
Chen, Hao Mark
Luk, Wayne
Fan, Hongxiang
Type
Conference Paper
Abstract
Multi-agent frameworks with Large Language Models (LLMs) have become promising tools for generating generalpurpose programming languages using test-driven development, allowing developers to create more accurate and robust code. However, their potential has not been fully unleashed for domainspecific programming languages, where specific domain exhibits unique optimization opportunities for customized improvement. In this paper, we take the first step in exploring multi-agent code generation for quantum programs. By identifying the unique optimizations in quantum designs such as quantum error correction, we introduce a novel multi-agent framework tailored to generating accurate, fault-tolerant quantum code. Each agent in the framework focuses on distinct optimizations, iteratively refining the code using a semantic analyzer with multi-pass inference, alongside an error correction code decoder. We also examine the effectiveness of traditional techniques, like Chain-ofThought (CoT) and Retrieval-Augmented Generation (RAG) in the context of quantum programming, uncovering observations that are different from general-purpose code generation. To evaluate our approach, we develop a test suite to measure the impact each optimization has on the accuracy of the generated code. Our findings indicate that techniques such as structured CoT significantly improve the generation of quantum algorithms by up to 50%. In contrast, we have also found that certain techniques such as RAG show limited improvement, yielding an accuracy increase of only 4%. Moreover, we showcase examples of AIassisted quantum error prediction and correction, demonstrating the effectiveness of our multi-agent framework in reducing the errors of generated quantum programs.
Date Issued
2025-09-15
Date Acceptance
2025-06-01
Citation
2025 62nd ACM/IEEE Design Automation Conference (DAC), 2025, pp.1-7
ISSN
0738-100X
Publisher
IEEE
Start Page
1
End Page
7
Journal / Book Title
2025 62nd ACM/IEEE Design Automation Conference (DAC)
Copyright Statement
Copyright © 2025, IEEE. This is the author’s accepted manuscript made available under a CC-BY licence in accordance with Imperial’s Research Publications Open Access policy (www.imperial.ac.uk/oa-policy)
License URL
Source
2025 62nd ACM/IEEE Design Automation Conference (DAC)
Subjects
Machine Learning
Quantum Code Generation
Quantum Computing
Multi-agent Large Language Models
Publication Status
Published
Start Date
2025-06-22
Finish Date
2025-06-25
Coverage Spatial
San Francisco, CA, USA
