QUASAR: Quantum Assembly Code Generation Using Tool-Augmented LLMs via
  Agentic RL
Designing and optimizing task-specific quantum circuits are crucial to
leverage the advantage of quantum computing. Recent large language model
(LLM)-based quantum circuit generation has emerged as a promising automatic
solution. However, the fundamental challenges remain unaddressed: (i)
parameterized quantum gates require precise numerical values for optimal
performance, which also depend on multiple aspects, including the number of
quantum gates, their parameters, and the layout/depth of the circuits. (ii)
LLMs often generate low-quality or incorrect quantum circuits due to the lack
of quantum domain-specific knowledge. We propose QUASAR, an agentic
reinforcement learning (RL) framework for quantum circuits generation and
optimization based on tool-augmented LLMs. To align the LLM with
quantum-specific knowledge and improve the generated quantum circuits, QUASAR
designs (i) a quantum circuit verification approach with external quantum
simulators and (ii) a sophisticated hierarchical reward mechanism in RL
training. Extensive evaluation shows improvements in both syntax and semantic
performance of the generated quantum circuits. When augmenting a 4B LLM, QUASAR
has achieved the validity of 99.31% in Pass@1 and 100% in Pass@10,
outperforming industrial LLMs of GPT-4o, GPT-5 and DeepSeek-V3 and several
supervised-fine-tuning (SFT)-only and RL-only baselines.
68de29c1a9129e507bf4a427
Cong Yu
claimed_verified
2025-10-02T13:54:35.852Z
64d476faf41bdb1e2f88416e
https://cdn-avatars.huggingface.co/v1/production/uploads/64d476faf41bdb1e2f88416e/60Ax_bkHK8aF7bhS3kfDY.jpeg
Cong Yu
user
Benyucong
68de29c1a9129e507bf4a428
Valter Uotila
68de29c1a9129e507bf4a429
Shilong Deng
claimed_verified
2025-10-02T13:54:30.080Z
63dd3f4ea8877129a15a66d1
/avatars/5410233517f4bcfae827094dc1fb7bcf.svg
SHILONG DENG
user
zczlsde
68de29c1a9129e507bf4a42a
Qingyuan Wu
claimed_verified
2025-10-03T12:54:19.541Z
65d61e7888196f05410f3aa3
/avatars/fef0b581472b045bd46323916dd80300.svg
qy
user
qingyuanwu
68de29c1a9129e507bf4a42b
Tuo Shi
68de29c1a9129e507bf4a42c
Songlin Jiang
claimed_verified
2025-10-02T13:54:32.885Z
661d8018ba7a3d451862aff2
/avatars/572c757e18dc11437ca1ffd0d1a9e9d1.svg
Songlin Jiang
user
HollowMan6
68de29c1a9129e507bf4a42d
Lei You
68de29c1a9129e507bf4a42e
Bo Zhao
QUASAR: Quantum Assembly Code Generation Using Tool-Augmented LLMs via
  Agentic RL
Designing and optimizing task-specific quantum circuits are crucial to
leverage the advantage of quantum computing. Recent large language model
(LLM)-based quantum circuit generation has emerged as a promising automatic
solution. However, the fundamental challenges remain unaddressed: (i)
parameterized quantum gates require precise numerical values for optimal
performance, which also depend on multiple aspects, including the number of
quantum gates, their parameters, and the layout/depth of the circuits. (ii)
LLMs often generate low-quality or incorrect quantum circuits due to the lack
of quantum domain-specific knowledge. We propose QUASAR, an agentic
reinforcement learning (RL) framework for quantum circuits generation and
optimization based on tool-augmented LLMs. To align the LLM with
quantum-specific knowledge and improve the generated quantum circuits, QUASAR
designs (i) a quantum circuit verification approach with external quantum
simulators and (ii) a sophisticated hierarchical reward mechanism in RL
training. Extensive evaluation shows improvements in both syntax and semantic
performance of the generated quantum circuits. When augmenting a 4B LLM, QUASAR
has achieved the validity of 99.31% in Pass@1 and 100% in Pass@10,
outperforming industrial LLMs of GPT-4o, GPT-5 and DeepSeek-V3 and several
supervised-fine-tuning (SFT)-only and RL-only baselines.
QUASAR, an RL framework using tool-augmented LLMs, improves quantum circuit generation and optimization through verification and hierarchical rewards, achieving high validity compared to industrial LLMs.
quantum circuits parameterized quantum gates large language model reinforcement learning quantum circuit verification hierarchical reward mechanism Pass@1 Pass@10 GPT-4o GPT-5 DeepSeek-V3 supervised-fine-tuning RL-only