Assoc. Prof. Damir Ćavar, Ph. D.
Training Language Models and Embeddings for Hybrid Classical/Quantum Computing
Vector representations as embeddings of words, text, or images in n-dimensional semantic space are essential for neural models in state-of-the-art (SOTA) Natural Language Processing (NLP) and AI systems. Such embedding models are engineered and trained using classical computers and large amounts of data. Given the current technical limitations, we are unaware of a method to achieve the same task on a quantum computer alone. Embeddings trained on classical computers, however, can be used in quantum simulators and on existing cloud-based quantum computing hardware.
In previous work (Cavar et al., 2024, 2025, 2026), we discussed experimental results on hybrid systems that use classical models in quantum algorithms for common NLP and AI inference tasks, e.g., lexical and text similarity. Using SOTA GPT 4 and VoyageAI (Claude 4) embeddings, we demonstrated that word and text embeddings, as real-valued vectors, can be mapped to quantum states using log2(n) qubits. In subsequent experiments, we demonstrated how the same embeddings can be represented in log2(n/2) qubits with minimal information loss. The compression of dense vectors of 3072 real numbers in GPT-4 (text- embedding-3-large) to 12 qubits is significant. We used amplitude encoding of real and complex word embeddings into quantum state vectors.
We showed that the mapping of embeddings results in a linear number of circuit gates. We compared the similarity scores between the original embeddings of word pairs (Hill at al., 2015) on classical and quantum computers. The similarity scores were computed as inner products of the embeddings for a word pair. The high correlation between the classical and quantum embedding similarity scores indicates that there is no significant information loss affecting the semantic space distribution of words in the tested quantum encoding strategies. The results showed that existing NLP embedding models developed for classical computing environments can be efficiently deployed on quantum computers. Converting the dense real- valued vectors of SOTA models into complex-valued vectors reduced their length by 50%, thereby saving 1 qubit in the mapped quantum state representation. However, the more significant benefit was that the circuit depth of the resulting quantum circuit for encoding and computing with the embedding was reduced by 50%. The quantum circuit depth depends linearly on the length of the input vector, regardless of whether it is real- or complex-valued.
These mappings of embeddings from classical to quantum environments require manipulation and conversion of the embedding vectors. To map an embedding into a quantum state, the vector needs to be padded to a power-of-two length. It needs to be normalized to length 1. If a real-valued vector is mapped to the amplitudes of a quantum state, the imaginary part of the complex-valued amplitudes is ignored. In the method that converts embeddings to complex-valued vectors, prior to the mapping to quantum states, the full complex values of the amplitudes are used. However, using such a purely engineering-motivated approach, the nature of the vectors changes. The complex-valued nature of these converted embeddings does not reflect the true nature of complex-valued embeddings trained as such; in particular, the magnitude and phase information are not coherent.
In this paper, we present a detailed encoding and computation strategy for hybrid classical/quantum computing using LLMs and LM-based word and text embeddings. We describe a new, entirely complex- valued model architecture of the masked-language-model type, such as BERT (Devlin, et al., 2019), that uses various strategies to handle attention layers in a complex-valued transformer, as well as activation functions that preserve the phase of complex-valued tensors (Li et al., 2024). We evaluate the semantic properties of the resulting embedding model against those of a real-valued embedding model. The property of complex- valued embeddings to more adequately convey sequential or periodic information and capture oscillations or periodicity promises much better results in downstream tasks when processing speech and language. In classical computing environments, the architecture results in higher computational effort; however, the training and required training data volumes tend to be lower. The resulting models can also be used directly in quantum environments, without further conversion or manipulation of the complex vector models.
CV & Research Summary
Dr. Cavar is Associate Professor at Indiana University in Bloomington. He is an AI researcher specializing in Natural Language Processing, Machine Learning, Knowledge Graphs and Representations, and Quantum/Quantum-inspired Computing. He is an experienced academic leader and researcher, with a strong record of interdisciplinary work across cognitive science, linguistics, computer science, cybersecurity, and quantum technologies. (website: https://damir.cavar.me/)