arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.19028cs.CLcs.SEquant-ph
收藏

探索LLM驱动的量子算法解释

Exploring LLM-Driven Explanations for Quantum Algorithms

University College London(伦敦大学学院);University of Porto(波尔图大学);Simula Research Laboratory(西穆拉研究院)

Giordano d'Aloisio, Sophie Fortz, Carol Hanna, Daniel Fortunato, Avner Bensoussan, Eñaut Mendiluze Usandizaga, Federica Sarro

AI总结:

本文首次实证比较Gpt3.5、Llama2和Tinyllama对七种量子算法代码的解释质量,发现Llama2从零生成最佳、Gpt3.5最擅改进现有解释,且少量上下文提示能显著提升解释质量。

摘要:

背景:量子计算是一种快速发展的新型编程范式,给算法的设计与实现带来了重大变化。理解量子算法需要具备物理学和数学知识,这对软件开发人员来说可能具有挑战性。目的:在这项工作中,我们首次分析了LLM如何支持开发人员理解量子代码。方法:我们使用两种不同的人工编写提示风格,针对七种最先进的量子算法,实证分析并比较了三种广泛采用的LLM(Gpt3.5、Llama2和Tinyllama)所提供解释的质量。我们还分析了LLM解释在多轮中的一致性,以及LLM如何改进现有的量子算法描述。结果:Llama2从零开始提供的解释质量最高,而Gpt3.5则成为最适合改进现有解释的LLM。此外,我们表明,在提示中添加少量上下文可以显著提高解释质量。最后,我们观察到解释在多轮中在定性和句法上保持一致。结论:这项工作突出了有前景的结果,并为LLM用于量子代码解释领域的未来研究提出了挑战。未来工作包括通过提示优化和量子代码解释的解析来改进方法,以及对解释质量进行系统性评估。

英文摘要:

Background: Quantum computing is a rapidly growing new programming paradigm that brings significant changes to the design and implementation of algorithms. Understanding quantum algorithms requires knowledge of physics and mathematics, which can be challenging for software developers. Aims: In this work, we provide a first analysis of how LLMs can support developers' understanding of quantum code. Method: We empirically analyse and compare the quality of explanations provided by three widely adopted LLMs (Gpt3.5, Llama2, and Tinyllama) using two different human-written prompt styles for seven state-of-the-art quantum algorithms. We also analyse how consistent LLM explanations are over multiple rounds and how LLMs can improve existing descriptions of quantum algorithms. Results: Llama2 provides the highest quality explanations from scratch, while Gpt3.5 emerged as the LLM best suited to improve existing explanations. In addition, we show that adding a small amount of context to the prompt significantly improves the quality of explanations. Finally, we observe how explanations are qualitatively and syntactically consistent over multiple rounds. Conclusions: This work highlights promising results, and opens challenges for future research in the field of LLMs for quantum code explanation. Future work includes refining the methods through prompt optimisation and parsing of quantum code explanations, as well as carrying out a systematic assessment of the quality of explanations.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑