Table of Contents
Fetching ...

GroverGPT-2: Simulating Grover's Algorithm via Chain-of-Thought Reasoning and Quantum-Native Tokenization

Min Chen, Jinglei Cheng, Pingzhi Li, Haoran Wang, Tianlong Chen, Junyu Liu

TL;DR

This work tackles the boundary of quantum advantage by enabling a classical LLM to learn and simulate Grover's algorithm directly from OpenQASM circuits. It introduces GroverGPT-2, an 8B parameter model fine-tuned with LoRA and equipped with quantum-native tokenization and explicit Chain-of-Thought supervision, enabling interpretable, circuit-aware simulations. Empirical results show near-perfect SA and fidelity across small to moderate qubit counts, strong generalization to larger circuits, shorter CoT sequences than baselines, and favorable scalability relative to classical simulators. These findings demonstrate that classical models can internalize quantum circuit logic and offer a scalable, educational, and research-friendly tool for simulating quantum algorithms, while opening avenues for extending such approaches to broader quantum computing tasks and higher-fidelity, noisy scenarios.

Abstract

Quantum computing offers theoretical advantages over classical computing for specific tasks, yet the boundary of practical quantum advantage remains an open question. To investigate this boundary, it is crucial to understand whether, and how, classical machines can learn and simulate quantum algorithms. Recent progress in large language models (LLMs) has demonstrated strong reasoning abilities, prompting exploration into their potential for this challenge. In this work, we introduce GroverGPT-2, an LLM-based method for simulating Grover's algorithm using Chain-of-Thought (CoT) reasoning and quantum-native tokenization. Building on its predecessor, GroverGPT-2 performs simulation directly from quantum circuit representations while producing logically structured and interpretable outputs. Our results show that GroverGPT-2 can learn and internalize quantum circuit logic through efficient processing of quantum-native tokens, providing direct evidence that classical models like LLMs can capture the structure of quantum algorithms. Furthermore, GroverGPT-2 outputs interleave circuit data with natural language, embedding explicit reasoning into the simulation. This dual capability positions GroverGPT-2 as a prototype for advancing machine understanding of quantum algorithms and modeling quantum circuit logic. We also identify an empirical scaling law for GroverGPT-2 with increasing qubit numbers, suggesting a path toward scalable classical simulation. These findings open new directions for exploring the limits of classical simulatability, enhancing quantum education and research, and laying groundwork for future foundation models in quantum computing.

GroverGPT-2: Simulating Grover's Algorithm via Chain-of-Thought Reasoning and Quantum-Native Tokenization

TL;DR

This work tackles the boundary of quantum advantage by enabling a classical LLM to learn and simulate Grover's algorithm directly from OpenQASM circuits. It introduces GroverGPT-2, an 8B parameter model fine-tuned with LoRA and equipped with quantum-native tokenization and explicit Chain-of-Thought supervision, enabling interpretable, circuit-aware simulations. Empirical results show near-perfect SA and fidelity across small to moderate qubit counts, strong generalization to larger circuits, shorter CoT sequences than baselines, and favorable scalability relative to classical simulators. These findings demonstrate that classical models can internalize quantum circuit logic and offer a scalable, educational, and research-friendly tool for simulating quantum algorithms, while opening avenues for extending such approaches to broader quantum computing tasks and higher-fidelity, noisy scenarios.

Abstract

Quantum computing offers theoretical advantages over classical computing for specific tasks, yet the boundary of practical quantum advantage remains an open question. To investigate this boundary, it is crucial to understand whether, and how, classical machines can learn and simulate quantum algorithms. Recent progress in large language models (LLMs) has demonstrated strong reasoning abilities, prompting exploration into their potential for this challenge. In this work, we introduce GroverGPT-2, an LLM-based method for simulating Grover's algorithm using Chain-of-Thought (CoT) reasoning and quantum-native tokenization. Building on its predecessor, GroverGPT-2 performs simulation directly from quantum circuit representations while producing logically structured and interpretable outputs. Our results show that GroverGPT-2 can learn and internalize quantum circuit logic through efficient processing of quantum-native tokens, providing direct evidence that classical models like LLMs can capture the structure of quantum algorithms. Furthermore, GroverGPT-2 outputs interleave circuit data with natural language, embedding explicit reasoning into the simulation. This dual capability positions GroverGPT-2 as a prototype for advancing machine understanding of quantum algorithms and modeling quantum circuit logic. We also identify an empirical scaling law for GroverGPT-2 with increasing qubit numbers, suggesting a path toward scalable classical simulation. These findings open new directions for exploring the limits of classical simulatability, enhancing quantum education and research, and laying groundwork for future foundation models in quantum computing.
Paper Structure (23 sections, 15 equations, 12 figures, 1 table)

This paper contains 23 sections, 15 equations, 12 figures, 1 table.

Figures (12)

  • Figure 1: Classical simulation of Grover's algorithm involves parsing quantum circuits represented in QASM and outputting the probability amplitudes. In this task, GroverGPT-2 shares an identical task setting with classical simulators such as State-Vector, Density-Matrix, Unitary. The difference between these techniques only lies in their computational representations and techniques.
  • Figure 2: The overall framework of GroverGPT-2 and its application in simulating Grover's algorithm consists of three stages. Stage 1: We initiate by collecting high-quality CoT data tailored for Grover’s algorithm. This involves generating Grover’s QASM circuits, performing classical simulations via the state-vector simulation method, and labeling the output distributions along with marked states as CoT supervision targets. Stage 2: The collected QASM-CoT pairs are tokenized using our QASM-native tokenizer. We then adopt PEFT using the LoRA technique to specialize the base LLM toward quantum simulation tasks while maintaining training efficiency. Stage 3: GroverGPT-2 can now serve as a classical simulation tool: given a Grover's QASM circuit, it outputs state probability amplitudes through CoT reasoning.
  • Figure 3: Performance of GroverGPT-2 against baseline LLMs on simulating Grover's algorithm in terms of (a) SA and (b) fidelity, across varying numbers of qubits.
  • Figure 4: Generalization performance of GroverGPT-2 when scaling up to 8 and 9 qubits (beyond the training range). Both the SA (a) and fidelity (b) serve as the evaluation metrics.
  • Figure 5: The performance of GroverGPT-2 under the Oracle-only input setting with the number of qubits $n = \{2, 3, ..., 13\}$. Both the SA (a) and the fidelity (b) serve as the evaluation metrics.
  • ...and 7 more figures