# Exploring LLM-Driven Explanations for Quantum Algorithms

arXiv: https://arxiv.org/abs/2409.19028 · HTML: https://mlsanity.com/paper/2409.19028/

## Key facts

- Cited by 7 papers in the map (data through 14 Oct 2026).
- Builds on 10 of its 44 references that are in the map.
- First posted on arXiv 26 Sep 2024.

## Builds on (most cited first, 10 of 10)

- [From Anecdotal Evidence to Quantitative Evaluation Methods: A Systematic Review on Evaluating Explainable AI](https://mlsanity.com/paper/2201.08164/) (2022)
- [Automatic Generation of Programming Exercises and Code Explanations using Large Language Models](https://mlsanity.com/paper/2206.11861/) (2022)
- [Using Large Language Models to Enhance Programming Error Messages](https://mlsanity.com/paper/2210.11630/) (2022)
- [Stochastic LLMs do not Understand Language: Towards Symbolic, Explainable and Ontologically Based LLMs](https://mlsanity.com/paper/2309.05918/) (2023)
- [Quantum Software Engineering: Roadmap and Challenges Ahead](https://mlsanity.com/paper/2404.06825/) (2024)
- [Testing and Debugging Quantum Programs: The Road to 2030](https://mlsanity.com/paper/2405.09178/) (2024)
- [Quantum Software Engineering: Landscapes and Horizons](https://mlsanity.com/paper/2007.07047/) (2020)
- [Understanding Quantum Software Engineering Challenges An Empirical Study on Stack Exchange Forums and GitHub Issues](https://mlsanity.com/paper/2205.03181/) (2022)
- [On Repairing Quantum Programs Using ChatGPT](https://mlsanity.com/paper/2401.14913/) (2024)
- [On Testing and Debugging Quantum Software](https://mlsanity.com/paper/2103.09172/) (2021)

## Built on by (most cited first, 7 of 7)

- [A Systematic Survey on Large Language Models for Algorithm Design](https://mlsanity.com/paper/2410.14716/) (2024)
- [QAgent: An LLM-based Multi-Agent System for Autonomous OpenQASM programming](https://mlsanity.com/paper/2508.20134/) (2025)
- [Automatic Qiskit Code Refactoring Using Large Language Models](https://mlsanity.com/paper/2506.14535/) (2025)
- [Q-Bridge: Code Translation for Quantum Machine Learning via LLMs](https://mlsanity.com/paper/2603.27836/) (2026)
- [Aligning Quantum Operators with Large Language Models](https://mlsanity.com/paper/2606.13811/) (2026)
- [SustainDiffusion: Optimising the Social and Environmental Sustainability of Stable Diffusion Models](https://mlsanity.com/paper/2507.15663/) (2025)
- [Who Does What? Archetypes of Roles Assigned to LLMs During Human-AI Decision-Making](https://mlsanity.com/paper/2602.11924/) (2026)

## Abstract (arXiv)

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.
