PennyCoder: Efficient Domain-Specific LLMs for PennyLane-Based Quantum Code Generation

📅 2025-07-25
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing quantum code assistants heavily rely on remote large language model (LLM) APIs, raising privacy concerns, incurring high latency, and imposing significant usage costs. This paper introduces PennyCoder, a lightweight, fully local framework enabling domain-specific LLM inference for PennyLane directly on end devices. Built upon LLaMA 3.1-8B, it employs LoRA-based parameter-efficient fine-tuning jointly optimized with a quantum programming instruction set and syntactic constraints—eliminating dependence on external APIs. Evaluated on standard quantum programming benchmarks, PennyCoder achieves 44.3% functional correctness, substantially outperforming baseline models (33.7%) and RAG-enhanced variants (40.1%). Its core contributions are threefold: (1) the first locally deployable, PennyLane-specialized code generation framework; (2) a novel instruction-tuning paradigm integrating domain-aware syntactic modeling; and (3) a lightweight adaptation strategy tailored to quantum programming constraints.

Technology Category

Application Category

📝 Abstract
The growing demand for robust quantum programming frameworks has unveiled a critical limitation: current large language model (LLM) based quantum code assistants heavily rely on remote APIs, introducing challenges related to privacy, latency, and excessive usage costs. Addressing this gap, we propose PennyCoder, a novel lightweight framework for quantum code generation, explicitly designed for local and embedded deployment to enable on-device quantum programming assistance without external API dependence. PennyCoder leverages a fine-tuned version of the LLaMA 3.1-8B model, adapted through parameter-efficient Low-Rank Adaptation (LoRA) techniques combined with domain-specific instruction tuning optimized for the specialized syntax and computational logic of quantum programming in PennyLane, including tasks in quantum machine learning and quantum reinforcement learning. Unlike prior work focused on cloud-based quantum code generation, our approach emphasizes device-native operability while maintaining high model efficacy. We rigorously evaluated PennyCoder over a comprehensive quantum programming dataset, achieving 44.3% accuracy with our fine-tuned model (compared to 33.7% for the base LLaMA 3.1-8B and 40.1% for the RAG-augmented baseline), demonstrating a significant improvement in functional correctness.
Problem

Research questions and friction points this paper is trying to address.

Reducing reliance on remote APIs for quantum code generation
Enabling local deployment of efficient quantum programming assistants
Improving accuracy in domain-specific quantum code generation
Innovation

Methods, ideas, or system contributions that make the work stand out.

Local lightweight framework for quantum code generation
Fine-tuned LLaMA 3.1-8B with LoRA techniques
Domain-specific instruction tuning for PennyLane
🔎 Similar Papers
No similar papers found.
A
Abdul Basit
eBRAIN Lab, Division of Engineering New York University (NYU) Abu Dhabi , Abu Dhabi, UAE
M
Minghao Shao
eBRAIN Lab, Division of Engineering New York University (NYU) Abu Dhabi , Abu Dhabi, UAE
M
Muhammad Haider Asif
eBRAIN Lab, Division of Engineering New York University (NYU) Abu Dhabi , Abu Dhabi, UAE; Center for Quantum and Topological Systems (CQTS), NYUAD Research Institute, New York University Abu Dhabi , UAE
Nouhaila Innan
Nouhaila Innan
Research Team Lead @ eBRAIN Lab, Post-Doctoral Associate, New York University Abu Dhabi
Quantum Machine LearningQuantum AlgorithmsQuantum Computing
M
Muhammad Kashif
eBRAIN Lab, Division of Engineering New York University (NYU) Abu Dhabi , Abu Dhabi, UAE; Center for Quantum and Topological Systems (CQTS), NYUAD Research Institute, New York University Abu Dhabi , UAE
Alberto Marchisio
Alberto Marchisio
Research Team Lead @ eBRAIN Lab | Post-Doctoral Associate, New York University Abu Dhabi, UAE
machine learninghardware designneuromorphic computingquantum computing
Muhammad Shafique
Muhammad Shafique
Professor, ECE, New York University (AD-UAE, Tandon-USA), Director eBRAIN Lab
Embedded Machine LearningBrain-Inspired ComputingRobust & Energy-Efficient System DesignSmart