PennySynth: RAG-Driven Data Synthesis for Automated Quantum Code Generation
- URL: http://arxiv.org/abs/2605.25572v1
- Date: Mon, 25 May 2026 08:26:43 GMT
- Title: PennySynth: RAG-Driven Data Synthesis for Automated Quantum Code Generation
- Abstract summary: We present Penny Synth, a retrieval-augmented generation framework for quantum code assistants.<n>It builds on a curated knowledge base of 13,389 PennyLane instruction-code pairs.<n>It achieves 64%, 68%, and 52% pass@5 on 74 challenges spanning three years of the QHack competition.
- Score: 3.5252595463686274
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: 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.
Related papers
- Feature Encoding in Quantum Machine Learning: A Survey and Practical Guidelines [0.0]
The encoding of classical data into quantum states constitutes the primary performance bottleneck in Quantum Machine Learning.<n>No existing framework jointly characterises resource robustness, expressivity and noise robustness.<n>A five-regime decision framework maps (D, n, p, tau) feature dimension, qubit budget, error rate, and task type to a hardware-grounded encoding recommendation.
arXiv Detail & Related papers (2026-06-03T19:46:35Z) - Synthesis and Optimization of Encoding Circuits for Fault-Tolerant Quantum Computation [4.561664406615985]
We develop methods for synthesizing efficient encoders for arbitrary stabilizer codes.<n>For families with a modular structure, such as tableaud and holographic codes, we show how large encoders can be assembled from optimized local constituent encoders.<n>We obtain improvements of up to 43% in two-qubit gate count and up to 70% in depth.
arXiv Detail & Related papers (2026-05-14T18:00:01Z) - Quantum-Safe Code Auditing: LLM-Assisted Static Analysis and Quantum-Aware Risk Scoring for Post-Quantum Cryptography Migration [0.0]
Quantum-Safe Code is a quantum-aware static analysis framework.<n>It uses 15 classes of quantum-vulnerable primitives and a Variational Bouncysolver (VQE) model.<n>On a sample of 602 labelled instances, we achieve 71.98% precision, 100% recall, and an F1 score of 83.71%.
arXiv Detail & Related papers (2026-04-01T07:10:17Z) - Continual Quantum Architecture Search with Tensor-Train Encoding: Theory and Applications to Signal Processing [68.35481158940401]
CL-QAS is a continual quantum architecture search framework.<n>It mitigates challenges of costly encoding amplitude and forgetting in variational quantum circuits.<n>It achieves controllable robustness expressivity, sample-efficient generalization, and smooth convergence without barren plateaus.
arXiv Detail & Related papers (2026-01-10T02:36:03Z) - From Memorization to Creativity: LLM as a Designer of Novel Neural-Architectures [48.83701310501069]
Large language models (LLMs) excel in program synthesis, yet their ability to autonomously navigate neural architecture design-balancing reliability, performance, and structural novelty--remains underexplored.<n>We address this by placing a code-oriented LLM within a closed-loop synthesis framework, analyzing its evolution over 22 supervised fine-tuning cycles.
arXiv Detail & Related papers (2026-01-06T13:20:28Z) - Game-Theoretic Discovery of Quantum Error-Correcting Codes Through Nash Equilibria [0.0]
We recast code optimization as strategic interactions between competing objectives, where equilibria generates codes with desired properties.<n>We validate the framework by demonstrating it rediscovers the optimal $[![15,7,3]!]$Cal quantum Hamming code.<n>This work opens research avenues at the intersection of game theory and quantum information, providing systematic, interpretable frameworks for quantum system design.
arXiv Detail & Related papers (2025-10-17T01:11:32Z) - An Efficient Quantum Classifier Based on Hamiltonian Representations [50.467930253994155]
Quantum machine learning (QML) is a discipline that seeks to transfer the advantages of quantum computing to data-driven tasks.<n>We propose an efficient approach that circumvents the costs associated with data encoding by mapping inputs to a finite set of Pauli strings.<n>We evaluate our approach on text and image classification tasks, against well-established classical and quantum models.
arXiv Detail & Related papers (2025-04-13T11:49:53Z) - KodCode: A Diverse, Challenging, and Verifiable Synthetic Dataset for Coding [49.56049319037421]
KodCode is a synthetic dataset that addresses the persistent challenge of acquiring high-quality, verifiable training data.<n>It comprises question-solution-test triplets that are systematically validated via a self-verification procedure.<n>This pipeline yields a large-scale, robust and diverse coding dataset.
arXiv Detail & Related papers (2025-03-04T19:17:36Z) - PennyLang: Pioneering LLM-Based Quantum Code Generation with a Novel PennyLane-Centric Dataset [4.826802034066811]
PennyLang is an off-the-shelf, high-quality dataset of 3,347 PennyLane-specific quantum code samples.<n>Our contributions are threefold: (1) the creation and open-source release of PennyLang; (2) a framework for automated quantum code dataset construction; and (3) a baseline evaluation of the dataset.<n>Moving beyond Qiskit-focused studies, we bring LLM-based tools and reproducible methods to PennyLane for advancing AI-assisted quantum development.
arXiv Detail & Related papers (2025-03-04T11:04:35Z) - Majorization-based benchmark of the complexity of quantum processors [105.54048699217668]
We numerically simulate and characterize the operation of various quantum processors.
We identify and assess quantum complexity by comparing the performance of each device against benchmark lines.
We find that the majorization-based benchmark holds as long as the circuits' output states have, on average, high purity.
arXiv Detail & Related papers (2023-04-10T23:01:10Z) - Realization of arbitrary doubly-controlled quantum phase gates [62.997667081978825]
We introduce a high-fidelity gate set inspired by a proposal for near-term quantum advantage in optimization problems.
By orchestrating coherent, multi-level control over three transmon qutrits, we synthesize a family of deterministic, continuous-angle quantum phase gates acting in the natural three-qubit computational basis.
arXiv Detail & Related papers (2021-08-03T17:49:09Z) - Trellis Decoding For Qudit Stabilizer Codes And Its Application To Qubit
Topological Codes [3.9962751777898955]
We show that trellis decoders have strong structure, extend the results using classical coding theory as a guide, and demonstrate a canonical form from which the structural properties of the decoding graph may be computed.
The modified decoder works for any stabilizer code $S$ and separates into two parts: a one-time, offline which builds a compact, graphical representation of the normalizer of the code, $Sperp$, and a quick, parallel, online computation using the Viterbi algorithm.
arXiv Detail & Related papers (2021-06-15T16:01:42Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.