Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

Quantum distributional semantics: Quantum algorithms applied to natural language processing

Adriana D. Correia

Published Aug 30, 2022• 0 citations
Publisher

Abstract

The fundamental question that this thesis tries to contribute to is thus: is it possible to code and compute the meaning of phrases, such as "fluffy dog", in a way that encodes not only logical reasoning, but provides a way to return our (possibly multiple) common understanding(s) of such a phrase? We rely on a compositional approach: the grammar rules act as the "computational rules", and the meanings of the individual words compose with each other following those same rules, in a way that is consistent with the type of meaning that we wish to assign to each word. To use the grammar rules in this way, we rely on Lambek types. In this framework, a common noun is represented by a Lambek type n and an adjective is represented by a type n/n. Following the appropriate type composition rules, we can show that these two types can be mapped to the type n. This means that an adjective applied on a noun gives something that can be used in the same place on a sentence. This is very intuitive: "fluffy dog" could always be used in the place of "dog". The meanings must compose in a way that is homomorphic to the grammar composition. Additionally, it is convenient that these individual meanings have a format that a computer can understand. The choice made here comes from an approach to NLP called "distributional" semantics, that is able to extract vector representations of words by looking at the other words that usually appear next to it: "You shall know a word by the company it keeps". Each Lambek type is assigned a vector space, and so the composition takes place using operations in vector spaces. Then, each word of a certain type is assigned an element of the correct vector space, a vector. The vector space associated with the Lambek type n is N, which means that a word like "dog" is represented by a vector in the noun space. In its turn, the vector space associated with the Lambek type n/n is N⊗N, which describe maps between vectors. The elements of this space can be represented as matrices, and so an adjective such as "fluffy" is also represented by a matrix. The composition of the adjective and the noun, thus, is automatically computed by a computer as the application of the respective matrix to the respective vector, which in turn results in a vector in the space N, consistent with the resulting Lambek type n of grammar composition. This framework can be extend to more complex types and grammar formulations, which can get rather computationally heavy. One possibility to make these calculations more computationally efficient is to resort to quantum computation, by having each vector component as a quantum state and by performing the contractions using a quantum circuit. In this thesis we explore those avenues, with special focus on ambiguities that appear due to different possible readings of the same phrase, as is the case of the scope in "old men and women", or relative clauses in Dutch, where "man die de hond bijt" can translate either to "man that bites the dog" or "man that the dog bites". For these, the different possible contractions represent different readings, and they can exist simultaneously in quantum superposition. In the process, we explore ways of improving cosine similarity calculations using a metric tensor, and we develop a quantum computation algorithm that is capable to speed up the process of finding an answer to an open multiple choice question.

DOI
10.33540/631

Related papers

A gentle introduction to Quantum Natural Language Processing

Shervin Le Du, Senaida Hernández Santana, Scarpa, Giannicola

The main goal of this master's thesis is to introduce Quantum Natural Language Processing (QNLP) in a way understandable by both the NLP engineer and the quantum computing practitioner. QNLP is a recent application of quantum computing that aims at representing sentences' meaning as vectors encoded into quantum computers. To achieve this, the distributional meaning of words is extended by the compositional meaning of sentences (DisCoCat model) : the vectors representing words' meanings are composed through the syntactic structure of the sentence. This is done using an algorithm based on tensor products. We see that this algorithm is inefficient on classical computers but scales well using quantum circuits. After exposing the practical details of its implementation, we go through three use-cases.

arXiv:2202.11766•Feb 23, 2022•9 citations

Quantum Natural Language Processing on Near-Term Quantum Computers

Konstantinos Meichanetzidis, Stefano Gogioso, Giovanni de Felice +3 more

In this work, we describe a full-stack pipeline for natural language processing on near-term quantum computers, aka QNLP. The language-modelling framework we employ is that of compositional distributional semantics (DisCoCat), which extends and complements the compositional structure of pregroup grammars. Within this model, the grammatical reduction of a sentence is interpreted as a diagram, encoding a specific interaction of words according to the grammar. It is this interaction which, together with a specific choice of word embedding, realises the meaning (or "semantics") of a sentence. Building on the formal quantum-like nature of such interactions, we present a method for mapping DisCoCat diagrams to quantum circuits. Our methodology is compatible both with NISQ devices and with established Quantum Machine Learning techniques, paving the way to near-term applications of quantum technology to natural language processing.

arXiv:2005.04147•Electronic Proceedings in Theoretical Computer Science•Sep 6, 2021•131 citations

Semantic Analysis of Auto-Generated Sentences Using Quantum Natural Language Processing

J. Kavya, K. Krishnaveni, K. Namratha +2 more

Abstract: Quantum Natural Language Processing (QNLP) represents a pioneering approach to understanding and analyzing natural language by leveraging the principles of quantum computing. This project aims to explore the semantic analysis of autogenerated sentences using QNLP techniques. Traditional Natural Language Processing (NLP) methods have achieved significant milestones in language understanding and generation; however, they often struggle with the intricacies of context, ambiguity, and the vast computational resources required for complex tasks. QNLP offers a novel paradigm by utilizing the superposition and entanglement properties of quantum states, potentially revolutionizing how semantic meaning is extracted and processed. The primary objective of this project is to develop a QNLP framework capable of performing semantic analysis on autogenerated sentences. We will investigate the application of quantum algorithms and quantum machine learning models to decode the semantic structure and context of sentences generated by language models. This involves encoding textual data into quantum states, applying quantum gates and circuits to manipulate these states, and measuring the outcomes to interpret semantic information. By integrating quantum computing with NLP, this project seeks to achieve higher accuracy and efficiency in understanding complex language patterns. The anticipated outcomes include a comprehensive evaluation of QNLP's performance in semantic analysis, a comparison with classical NLP methods, and potential advancements in language processing tasks such as sentiment analysis, language translation, and text summarization. This project will contribute to the growing body of research at the intersection of quantum computing and artificial intelligence, paving the way for innovative solutions in the field of natural language processing.

International Journal for Research in Applied Science and Engineering Technology•Nov 24, 2024•0 citations

Category Theory for Quantum Natural Language Processing

Alexis Toumi

This thesis introduces quantum natural language processing (QNLP) models based on a simple yet powerful analogy between computational linguistics and quantum mechanics: grammar as entanglement. The grammatical structure of text and sentences connects the meaning of words in the same way that entanglement structure connects the states of quantum systems. Category theory allows to make this language-to-qubit analogy formal: it is a monoidal functor from grammar to vector spaces. We turn this abstract analogy into a concrete algorithm that translates the grammatical structure onto the architecture of parameterised quantum circuits. We then use a hybrid classical-quantum algorithm to train the model so that evaluating the circuits computes the meaning of sentences in data-driven tasks. The implementation of QNLP models motivated the development of DisCoPy (Distributional Compositional Python), the toolkit for applied category theory of which the first chapter gives a comprehensive overview. String diagrams are the core data structure of DisCoPy, they allow to reason about computation at a high level of abstraction. We show how they can encode both grammatical structures and quantum circuits, but also logical formulae, neural networks or arbitrary Python code. Monoidal functors allow to translate these abstract diagrams into concrete computation, interfacing with optimised task-specific libraries. The second chapter uses DisCopy to implement QNLP models as parameterised functors from grammar to quantum circuits. It gives a first proof-of-concept for the more general concept of functorial learning: generalising machine learning from functions to functors by learning from diagram-like data. In order to learn optimal functor parameters via gradient descent, we introduce the notion of diagrammatic differentiation: a graphical calculus for computing the gradients of parameterised diagrams.

arXiv:2212.06615•Dec 13, 2022•9 citations

Quantum methods for managing ambiguity in natural language processing

Jurek Eisinger, Ward Gauderis, Lin de Huybrecht +1 more

The Categorical Compositional Distributional (DisCoCat) framework models meaning in natural language using the mathematical framework of quantum theory, expressed as formal diagrams. DisCoCat diagrams can be associated with tensor networks and quantum circuits. DisCoCat diagrams have been connected to density matrices in various contexts in Quantum Natural Language Processing (QNLP). Previous use of density matrices in QNLP entails modelling ambiguous words as probability distributions over basic words (e.g., the word queen might mean the reigning queen or the chess piece). In this article, we investigate the use of probability distributions over processes to account for syntactic ambiguity in sentences. The meanings of these sentences are represented by density matrices. We show how to create probability distributions on quantum circuits that represent the meanings of sentences and explain how this approach generalises tasks from the literature. We report on a proof-of-concept experiment to demonstrate the proposed theory.

arXiv:2504.00040•Quantum Machine Intelligence•Aug 3, 2026•2 citations

IXPUG 2019 Annual Conference at CERN

Myles Doyle

<!--HTML-->Natural language processing (NLP) is often used to perform tasks like sentiment analysis, relationship extraction and word sense disambiguation. Most traditional NLP algorithms operate over strings of words and are limited since they analyse meanings of the component words in a corpus without information about grammatical rules of the language. Consequently, the qualities of results of these traditional algorithms are often unsatisfactory with increase in problem complexity. An alternate approach called “compositional semantics” incorporates the grammatical structure of sentences in a language into the analysis algorithms. One such model is “distributional compositional semantics” (DisCo) which gives grammatically informed algorithms that compute the meaning of sentences. This algorithm has been noted to offer significant improvements to the quality of results. However, the main challenge in its implementation is the need for large classical computational resources. The DisCo model was developed by its authors with direct inspiration from quantum theory, and presents two quantum algorithms: the “closest vector problem” algorithm and the “CSC sentence similarity” algorithm. Their quantum implementation lowers storage and compute requirements compared to a classic HPC implementation. In this project, the Irish Centre for High-End Computing collaborates with Intel Corporation to implement the two DisCo model quantum algorithms on the Intel Quantum Simulator (Intel-QS) deployed on the Irish national supercomputer. The Intel-QS performs a number of single- and multi-node optimizations, including vectorization, multi-threading, cache blocking, as well as overlapping computation with communication. In this project, we target improving the scalability of Intel-QS beyond the limitations imposed by standard MPI implementations and target corpuses with ~1000 most common words using up to 36 qubits simulation. The implemented solution will be able to compute the meanings of two sentences (built from words in the corpus) and decide if their meanings match.

•Jan 1, 2019•0 citations
The fundamental question that this thesis tries to contribute to is thus: is it possible to code and compute the meaning of phrases, such as "fluffy dog", in a way that encodes not only logical reasoning, but provides a way to return our (possibly multiple) common understanding(s) of such a phrase? We rely on a compositional approach: the grammar rules act as the "computational rules", and the meanings of the individual words compose with each other following those same rules, in a way that is consistent with the type of meaning that we wish to assign to each word. To use the grammar rules in this way, we rely on Lambek types. In this framework, a common noun is represented by a Lambek type n and an adjective is represented by a type n/n. Following the appropriate type composition rules, we can show that these two types can be mapped to the type n. This means that an adjective applied on a noun gives something that can be used in the same place on a sentence. This is very intuitive: "fluffy dog" could always be used in the place of "dog". The meanings must compose in a way that is homomorphic to the grammar composition. Additionally, it is convenient that these individual meanings have a format that a computer can understand. The choice made here comes from an approach to NLP called "distributional" semantics, that is able to extract vector representations of words by looking at the other words that usually appear next to it: "You shall know a word by the company it keeps". Each Lambek type is assigned a vector space, and so the composition takes place using operations in vector spaces. Then, each word of a certain type is assigned an element of the correct vector space, a vector. The vector space associated with the Lambek type n is N, which means that a word like "dog" is represented by a vector in the noun space. In its turn, the vector space associated with the Lambek type n/n is N⊗N, which describe maps between vectors. The elements of this space can be represented as matrices, and so an adjective such as "fluffy" is also represented by a matrix. The composition of the adjective and the noun, thus, is automatically computed by a computer as the application of the respective matrix to the respective vector, which in turn results in a vector in the space N, consistent with the resulting Lambek type n of grammar composition. This framework can be extend to more complex types and grammar formulations, which can get rather computationally heavy. One possibility to make these calculations more computationally efficient is to resort to quantum computation, by having each vector component as a quantum state and by performing the contractions using a quantum circuit. In this thesis we explore those avenues, with special focus on ambiguities that appear due to different possible readings of the same phrase, as is the case of the scope in "old men and women", or relative clauses in Dutch, where "man die de hond bijt" can translate either to "man that bites the dog" or "man that the dog bites". For these, the different possible contractions represent different readings, and they can exist simultaneously in quantum superposition. In the process, we explore ways of improving cosine similarity calculations using a metric tensor, and we develop a quantum computation algorithm that is capable to speed up the process of finding an answer to an open multiple choice question.
The main goal of this master's thesis is to introduce Quantum Natural Language Processing (QNLP) in a way understandable by both the NLP engineer and the quantum computing practitioner. QNLP is a recent application of quantum computing that aims at representing sentences' meaning as vectors encoded into quantum computers. To achieve this, the distributional meaning of words is extended by the compositional meaning of sentences (DisCoCat model) : the vectors representing words' meanings are composed through the syntactic structure of the sentence. This is done using an algorithm based on tensor products. We see that this algorithm is inefficient on classical computers but scales well using quantum circuits. After exposing the practical details of its implementation, we go through three use-cases.
In this work, we describe a full-stack pipeline for natural language processing on near-term quantum computers, aka QNLP. The language-modelling framework we employ is that of compositional distributional semantics (DisCoCat), which extends and complements the compositional structure of pregroup grammars. Within this model, the grammatical reduction of a sentence is interpreted as a diagram, encoding a specific interaction of words according to the grammar. It is this interaction which, together with a specific choice of word embedding, realises the meaning (or "semantics") of a sentence. Building on the formal quantum-like nature of such interactions, we present a method for mapping DisCoCat diagrams to quantum circuits. Our methodology is compatible both with NISQ devices and with established Quantum Machine Learning techniques, paving the way to near-term applications of quantum technology to natural language processing.
Abstract: Quantum Natural Language Processing (QNLP) represents a pioneering approach to understanding and analyzing natural language by leveraging the principles of quantum computing. This project aims to explore the semantic analysis of autogenerated sentences using QNLP techniques. Traditional Natural Language Processing (NLP) methods have achieved significant milestones in language understanding and generation; however, they often struggle with the intricacies of context, ambiguity, and the vast computational resources required for complex tasks. QNLP offers a novel paradigm by utilizing the superposition and entanglement properties of quantum states, potentially revolutionizing how semantic meaning is extracted and processed. The primary objective of this project is to develop a QNLP framework capable of performing semantic analysis on autogenerated sentences. We will investigate the application of quantum algorithms and quantum machine learning models to decode the semantic structure and context of sentences generated by language models. This involves encoding textual data into quantum states, applying quantum gates and circuits to manipulate these states, and measuring the outcomes to interpret semantic information. By integrating quantum computing with NLP, this project seeks to achieve higher accuracy and efficiency in understanding complex language patterns. The anticipated outcomes include a comprehensive evaluation of QNLP's performance in semantic analysis, a comparison with classical NLP methods, and potential advancements in language processing tasks such as sentiment analysis, language translation, and text summarization. This project will contribute to the growing body of research at the intersection of quantum computing and artificial intelligence, paving the way for innovative solutions in the field of natural language processing.
This thesis introduces quantum natural language processing (QNLP) models based on a simple yet powerful analogy between computational linguistics and quantum mechanics: grammar as entanglement. The grammatical structure of text and sentences connects the meaning of words in the same way that entanglement structure connects the states of quantum systems. Category theory allows to make this language-to-qubit analogy formal: it is a monoidal functor from grammar to vector spaces. We turn this abstract analogy into a concrete algorithm that translates the grammatical structure onto the architecture of parameterised quantum circuits. We then use a hybrid classical-quantum algorithm to train the model so that evaluating the circuits computes the meaning of sentences in data-driven tasks. The implementation of QNLP models motivated the development of DisCoPy (Distributional Compositional Python), the toolkit for applied category theory of which the first chapter gives a comprehensive overview. String diagrams are the core data structure of DisCoPy, they allow to reason about computation at a high level of abstraction. We show how they can encode both grammatical structures and quantum circuits, but also logical formulae, neural networks or arbitrary Python code. Monoidal functors allow to translate these abstract diagrams into concrete computation, interfacing with optimised task-specific libraries. The second chapter uses DisCopy to implement QNLP models as parameterised functors from grammar to quantum circuits. It gives a first proof-of-concept for the more general concept of functorial learning: generalising machine learning from functions to functors by learning from diagram-like data. In order to learn optimal functor parameters via gradient descent, we introduce the notion of diagrammatic differentiation: a graphical calculus for computing the gradients of parameterised diagrams.
The Categorical Compositional Distributional (DisCoCat) framework models meaning in natural language using the mathematical framework of quantum theory, expressed as formal diagrams. DisCoCat diagrams can be associated with tensor networks and quantum circuits. DisCoCat diagrams have been connected to density matrices in various contexts in Quantum Natural Language Processing (QNLP). Previous use of density matrices in QNLP entails modelling ambiguous words as probability distributions over basic words (e.g., the word queen might mean the reigning queen or the chess piece). In this article, we investigate the use of probability distributions over processes to account for syntactic ambiguity in sentences. The meanings of these sentences are represented by density matrices. We show how to create probability distributions on quantum circuits that represent the meanings of sentences and explain how this approach generalises tasks from the literature. We report on a proof-of-concept experiment to demonstrate the proposed theory.
<!--HTML-->Natural language processing (NLP) is often used to perform tasks like sentiment analysis, relationship extraction and word sense disambiguation. Most traditional NLP algorithms operate over strings of words and are limited since they analyse meanings of the component words in a corpus without information about grammatical rules of the language. Consequently, the qualities of results of these traditional algorithms are often unsatisfactory with increase in problem complexity. An alternate approach called “compositional semantics” incorporates the grammatical structure of sentences in a language into the analysis algorithms. One such model is “distributional compositional semantics” (DisCo) which gives grammatically informed algorithms that compute the meaning of sentences. This algorithm has been noted to offer significant improvements to the quality of results. However, the main challenge in its implementation is the need for large classical computational resources. The DisCo model was developed by its authors with direct inspiration from quantum theory, and presents two quantum algorithms: the “closest vector problem” algorithm and the “CSC sentence similarity” algorithm. Their quantum implementation lowers storage and compute requirements compared to a classic HPC implementation. In this project, the Irish Centre for High-End Computing collaborates with Intel Corporation to implement the two DisCo model quantum algorithms on the Intel Quantum Simulator (Intel-QS) deployed on the Irish national supercomputer. The Intel-QS performs a number of single- and multi-node optimizations, including vectorization, multi-threading, cache blocking, as well as overlapping computation with communication. In this project, we target improving the scalability of Intel-QS beyond the limitations imposed by standard MPI implementations and target corpuses with ~1000 most common words using up to 36 qubits simulation. The implemented solution will be able to compute the meanings of two sentences (built from words in the corpus) and decide if their meanings match.