TY - GEN
T1 - QuAInth
T2 - 25th International Conference on Software Quality, Reliability and Security, QRS 2025
AU - Yu, Xiaohan
AU - Li, Yuechen
AU - Wen, Jinlong
AU - Cai, Kai Yuan
AU - Yin, Beibei
N1 - Publisher Copyright:
© 2025 IEEE.
PY - 2025
Y1 - 2025
N2 - 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.
AB - 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.
KW - Code Comment
KW - Large Language Models
KW - N-version Programming
KW - Quantum Software Engineering
UR - https://www.scopus.com/pages/publications/105018798354
U2 - 10.1109/QRS65678.2025.00013
DO - 10.1109/QRS65678.2025.00013
M3 - 会议稿件
AN - SCOPUS:105018798354
T3 - IEEE International Conference on Software Quality, Reliability and Security, QRS
SP - 13
EP - 24
BT - Proceedings - 2025 25th International Conference on Software Quality, Reliability and Security, QRS 2025
PB - Institute of Electrical and Electronics Engineers
Y2 - 16 July 2025 through 20 July 2025
ER -