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

Abdul Basit, Minghao Shao, Muhammad Haider Asif, Nouhaila Innan, Muhammad Kashif +2 more
7/25/2025
quant-phcs.AI

No confident code implementation found for this paper.

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{basit2025pennycoder,
  title  = {PennyCoder: Efficient Domain-Specific LLMs for PennyLane-Based Quantum Code Generation},
  author = {Abdul Basit and Minghao Shao and Muhammad Haider Asif and Nouhaila Innan and Muhammad Kashif and Alberto Marchisio and Muhammad Shafique},
  year   = {2025},
  eprint = {2507.19562},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.19562v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.19562.svg)](https://codeofpaper.com/paper/2507.19562)

Discussion