Quantum Large Language Model Fine-Tuning

Sang Hyub Kim, Jonathan Mei, Claudio Girotto, Masako Yamada, Martin RoettelerarXiv 2025 · DOI

Abstract

Researchers from IonQ have developed a hybrid quantum-classical architecture that replaces the standard classification head of a Large Language Model (LLM) with a parameterized quantum circuit (PQC). This "quantum head" achieved a 3.14% accuracy improvement over classical baselines in sentiment analysis tasks, demonstrating that quantum layers can better capture complex data correlations in low-data regimes. Additionally, the study identifies an energy-efficiency crossover point at 46 qubits, where physical quantum hardware begins to outperform classical GPU simulation.

Introduction

Fine-tuning is a cornerstone of modern Natural Language Processing (NLP), enabling general-purpose models like BERT or GPT to specialize in specific domains. However, classical fine-tuning often requires substantial data, and standard linear or Multi-Layer Perceptron (MLP) heads may fail to capture the complex, non-local correlations present in high-dimensional embeddings.

This research investigates whether Quantum Machine Learning (QML) can offer a more expressive alternative. Quantum circuits naturally operate in high-dimensional Hilbert spaces and utilize entanglement to handle non-local correlations, making them potentially superior for LLM heads when training data is scarce—a frequent challenge in specialized industrial and medical applications.

Methodology

The authors propose a hybrid pipeline that integrates a quantum classification head into a classical Sentence Transformer (SetFit) framework.

  1. Classical Embedding: A pre-trained Sentence Transformer converts input text into a 768-dimensional vector.
  2. Quantum-Inspired Encoder (sPQC): To bridge the dimensionality gap, a simulated quantum encoder (sQE) uses amplitude encoding and a parameterized circuit for dimensionality reduction, acting as a quantum autoencoder.
  3. Quantum Head (PQC): The reduced latent vector is processed by a module designed for a Quantum Processing Unit (QPU). This stage employs angle encoding and data re-uploading to maximize expressivity.
  4. Differentiable Sampling: To enable end-to-end training via backpropagation, the authors implemented a reparameterization trick for quantum measurements, allowing gradients to flow through the inherently non-differentiable sampling process.
Hybrid quantum-classical pipeline for LLM fine-tuning.

Experimental Setup

The study utilized the Stanford Sentiment Treebank (SST2) benchmark. To simulate a low-data regime, the training set was restricted to 512 samples (256 positive, 256 negative), while evaluation was conducted on a standard test set of 8,192 samples. The quantum circuit design (ansatz) was optimized for the long-range connectivity characteristic of trapped-ion hardware, such as IonQ’s QPUs.

Results and Discussion

The experimental results demonstrate several key advantages of the quantum head approach:

  • Performance Gains: The best-performing quantum model (Multi sQE 14Q) reached 92.70% accuracy, representing a 3.14% absolute improvement over the best classical baseline (Support Vector Classifier at 89.56%). It also outperformed various MLP configurations.
  • Scaling Trends: Accuracy generally improved with an increasing number of qubits, suggesting that the performance gap may widen as quantum hardware continues to scale.
  • Energy Efficiency: A comparative analysis of energy consumption reveals a "crossover point" at approximately 46 qubits. Beyond this threshold, running inference on a physical QPU is estimated to be more energy-efficient than simulating the same circuit on a high-end NVIDIA H100 GPU.
Energy consumption comparison highlighting the 46-qubit crossover point.
  • Noise Resilience: Noise-aware training allowed the models to maintain performance trends under simulated gate and shot noise, indicating viability for Near-Intermediate Scale Quantum (NISQ) devices.

Conclusion

The integration of quantum heads into LLMs provides a significant performance boost in low-data scenarios and offers a path toward more energy-efficient AI as quantum hardware matures. Future research will focus on "full fine-tuning"—simultaneously updating both classical transformer weights and quantum parameters—and validating these results on physical hardware at larger scales.

Summary updated

BibTeX
@misc{kim2025quantum,
  author = {Sang Hyub Kim and Jonathan Mei and Claudio Girotto and Masako Yamada and Martin Roetteler},
  title = {{Quantum Large Language Model Fine-Tuning}},
  year = {2025},
  eprint = {2504.08732},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.08732},
}
Figure