Skip to main navigation Skip to search Skip to main content

QuAInth: A Code Comment Approach for Application-Oriented Quantum Programs via N-Version LLMs

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

Quantum computing has recently experienced rapid advancements and promised transformative applications across many fields. To promote the real-world applications of quantum computing, application-oriented quantum programs (AQPs) are designed to explore quantum hardware in performing substantial computational tasks and promote practical use cases for quantum computing. The complexity and scalability of AQPs, along with their dependence on advanced quantum algorithms, make them particularly challenging to understand and maintain. Clear comments offer an effective means of elucidating core logic and filling the knowledge gap for developers unfamiliar with quantum mechanics. Research on code comment for QPs remains scarce, highlighting the need for further investigation into effective comment methods for these complex programs. Given the potential advantages of large language models (LLMs), including their contextual understanding and language generation capabilities, LLMs can significantly reduce the cost of manual comment. Thus, this paper proposes a framework called QuAInth, which utilizes LLMs to annotate AQPs. This framework begins by preprocessing AQPs and segmenting them based on functional signatures. It then employs prompts (i.e., textual instructions carefully structured and given to LLMs) of varying granularity to guide comment generation. Aside from two existing text-based metrics, QuAInth newly adopts a quantum-specific metric that considers 8 indicators to evaluate the domainrelated correctness and clarity of the generated comments. Finally, with the understanding that an individual LLM may produce wrong outputs, QuAInth proposes a vote-enhanced fusion scheme inspired by N-version programming, in which distinct comments output from multiple LLMs are fused into a more reliable and comprehensive comment. Empirical studies are conducted with 4 AQPs written by Qiskit and 3 prevailing open-source LLMs (i.e., Qwen, DeepSeek-Coder, and Llama). The empirical results demonstrate the effectiveness of QuAInth, showing that the fused comments outperform those generated by individual models in the vast majority of cases.

Original languageEnglish
Title of host publicationProceedings - 2025 25th International Conference on Software Quality, Reliability and Security, QRS 2025
PublisherInstitute of Electrical and Electronics Engineers
Pages13-24
Number of pages12
ISBN (Electronic)9781665477710
DOIs
StatePublished - 2025
Event25th International Conference on Software Quality, Reliability and Security, QRS 2025 - Hangzhou, China
Duration: 16 Jul 202520 Jul 2025

Publication series

NameIEEE International Conference on Software Quality, Reliability and Security, QRS
ISSN (Print)2693-9177

Conference

Conference25th International Conference on Software Quality, Reliability and Security, QRS 2025
Country/TerritoryChina
CityHangzhou
Period16/07/2520/07/25

Keywords

  • Code Comment
  • Large Language Models
  • N-version Programming
  • Quantum Software Engineering

Fingerprint

Dive into the research topics of 'QuAInth: A Code Comment Approach for Application-Oriented Quantum Programs via N-Version LLMs'. Together they form a unique fingerprint.

Cite this