PennySynth: RAG 기반 데이터 합성으로 자동 양자 코드 생성
PennySynth: RAG-Driven Data Synthesis for Automated Quantum Code Generation
양자 프로그래밍 프레임워크의 복잡성이 증가함에 따라, 기존의 대규모 언어 모델(LLM) 기반 코드 어시스턴트가 가진 중요한 한계점이 드러났습니다. 범용 모델은 특수한 양자 코딩 과제에 직면했을 때 PennyLane 관련 게이트 이름을 잘못 생성하거나, 장치 구성을 오르게 배치하고, 구조적으로 유효하지 않은 회로를 생성하는 경향이 있습니다. 본 논문에서는 이러한 문제를 해결하기 위해, 13,389개의 PennyLane 명령어-코드 쌍으로 구성된 선별된 지식 기반을 활용하여 LLM 추론을 조건부로 설정하는 검색 강화 생성(Retrieval-Augmented Generation, RAG) 프레임워크인 PennySynth를 제안합니다. 이 지식 기반은 공식 PennyLane 저장소, 커뮤니티 GitHub 소스 및 QHack 대회 아카이브를 통해 3단계 추출, 검증 및 중복 제거 파이프라인으로 구축되었습니다. PennySynth는 st-codesearch-distilroberta-base 모델을 사용하여 자연어에서 코드로의 검색에 특화된 코드 인식 임베딩 전략을 도입하여 평균 검색 코사인 유사도를 일반적인 기준선보다 0.45에서 0.726으로 향상시켰습니다. QHack 대회(2022, 2023, 2024)의 74개 과제를 대상으로 평가한 결과, PennySynth는 각각 QHack 2022, 2023, 2024에서 64%, 68%, 52%의 pass@5 성능을 달성하여 검색 기능을 사용하지 않은 Claude Sonnet 4.6보다 +28%, +25%, +28%의 성능 향상을 보였습니다. 또한, qml.* 토큰 패턴에 더 높은 가중치를 부여하는 양자 맞춤형 CodeBLEU 메트릭을 도입하고, 구조적 코드 유사성과 기능적 정확성이 양자 코드 품질의 서로 다른 측면을 나타냄을 보여줍니다. 통제된 분석 결과, 코드 인식 임베딩이 검색 성능 향상의 주요 요인이며, 데이터 세트 확장 및 소스 구성은 검색 품질이 충분히 높을 때 추가적인 이점을 제공하는 것으로 나타났습니다.
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.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.
Log in to request an AI analysis.