mlsanityData to 14 Oct 2026

PennySynth: RAG-Driven Data Synthesis for Automated Quantum Code Generation

arXiv 2605.25572 ↗First posted 25 May 2026cs.CL cs.AIcited by 1

On the map: Synthetic data and self-improvement for LLMs → Code and instruction data synthesis

Abstract (arXiv)

The growing complexity of quantum programming frameworks has exposed a critical limitation in existing large language model (LLM)-based code assistants: general-purpose models hallucinate PennyLane-specific gate names, misplace device configurations, and produce structurally invalid circuits when faced with specialized quantum coding challenges. We present PennySynth, a retrieval-augmented generation framework that addresses this gap by conditioning LLM inference on a curated knowledge base of 13,389 PennyLane instruction-code pairs, built via a three-stage extraction, verification, and deduplication pipeline over official PennyLane repositories, community GitHub sources, and QHack competition archives. PennySynth introduces a code-aware embedding strategy using st-codesearch-distilroberta-base, trained for natural-language-to-code retrieval, increasing average retrieval cosine similarity from 0.45 to 0.726 compared to a general-purpose baseline. Evaluated across 74 challenges spanning three years of the QHack competition (2022, 2023, 2024), PennySynth achieves 64%, 68%, and 52% pass@5 on QHack 2022, 2023, and 2024, respectively, improving over Claude Sonnet 4.6 without retrieval by +28, +25, and +28 percentage points. We further introduce a quantum-adapted CodeBLEU metric that upweights qml.* token patterns and show that structural code similarity and functional correctness capture distinct aspects of quantum code quality. Controlled ablations reveal that code-aware embeddings are the primary driver of retrieval performance, while dataset expansion and source composition provide additional gains when retrieval quality is sufficiently precise.

Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Placed in Code and instruction data synthesis, one of 13 directions in Synthetic data and self-improvement for LLMs. Builds on 17 of its 29 references that are in the map. First posted on arXiv 25 May 2026.

Builds on

17 of 29 references.

References · 17

  1. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
  2. 2025Qwen3 Technical Reportcited by 8,820
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2025Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilitiescited by 3,796
  5. 2024From Local to Global: A Graph RAG Approach to Query-Focused Summarizationcited by 1,453
  6. 2019Passage Re-ranking with BERTcited by 645
  7. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  8. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
  9. 2021Retrieval Augmented Code Generation and Summarizationcited by 149
  10. 2023Query2doc: Query Expansion with Large Language Modelscited by 149
  11. 2024Qiskit HumanEval: An Evaluation Benchmark For Quantum Code Generative Modelscited by 30
  12. 2023A Survey on Quantum Machine Learning: Current Trends, Challenges, Opportunities, and the Road Aheadcited by 29
5 more
  1. 2024Qiskit Code Assistant: Training LLMs for generating Quantum Computing Codecited by 25
  2. 2025QuanBench: Benchmarking Quantum Code Generation with Large Language Modelscited by 12
  3. 2025A PennyLane-Centric Dataset to Enhance LLM-based Quantum Code Generation using RAGcited by 9
  4. 2025QHackBench: Benchmarking Large Language Models for Quantum Code Generation Using PennyLane Hackathon Challengescited by 8
  5. 2025PennyCoder: Efficient Domain-Specific LLMs for PennyLane-Based Quantum Code Generationcited by 6

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2025Model-Driven Quantum Code Generation Using Large Language Models and Retrieval-Augmented Generation
  2. 2025Enhancing LLM-based Quantum Code Generation with Multi-Agent Optimization and Quantum Error Correction
  3. 2026Revisiting Quantum Code Generation: Where Should Domain Knowledge Live?
  4. 2026Generative AI for Quantum Circuits and Quantum Code: A Technical Review and Taxonomy
  5. 2026Beyond Rules: LLM-Powered Linting for Quantum Programs ↗
  6. 2025QAgent: An LLM-based Multi-Agent System for Autonomous OpenQASM programming
  7. 2025QUASAR: Quantum Assembly Code Generation Using Tool-Augmented LLMs via Agentic RL
  8. 2025LLM-Powered Quantum Code Transpilation