Saved in:
Bibliographic Details
Main Authors: d'Aloisio, Giordano, Fortz, Sophie, Hanna, Carol, Fortunato, Daniel, Bensoussan, Avner, Usandizaga, Eñaut Mendiluze, Sarro, Federica
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2409.19028
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909328395468800
author d'Aloisio, Giordano
Fortz, Sophie
Hanna, Carol
Fortunato, Daniel
Bensoussan, Avner
Usandizaga, Eñaut Mendiluze
Sarro, Federica
author_facet d'Aloisio, Giordano
Fortz, Sophie
Hanna, Carol
Fortunato, Daniel
Bensoussan, Avner
Usandizaga, Eñaut Mendiluze
Sarro, Federica
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2409_19028
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Exploring LLM-Driven Explanations for Quantum Algorithms
d'Aloisio, Giordano
Fortz, Sophie
Hanna, Carol
Fortunato, Daniel
Bensoussan, Avner
Usandizaga, Eñaut Mendiluze
Sarro, Federica
Computation and Language
Software Engineering
Quantum Physics
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.
title Exploring LLM-Driven Explanations for Quantum Algorithms
topic Computation and Language
Software Engineering
Quantum Physics
url https://arxiv.org/abs/2409.19028