QNLP in Practice: Running Compositional Models of Meaning on a Quantum Computer

Authors: Robin Lorenz, Anna Pearson, Konstantinos Meichanetzidis, Dimitri Kartsaklis, Bob Coecke

JAIR 2023 | Venue PDF | Archive PDF | Plain Text | LLM Run Details

Reproducibility Variable Result LLM Response
Research Type Experimental In this paper, we present results on the first NLP experiments conducted on Noisy Intermediate-Scale Quantum (NISQ) computers for datasets of size greater than 100 sentences. [...] We use these representations to implement and successfully train NLP models that solve simple sentence classification tasks on quantum hardware. We conduct quantum simulations that compare the syntax-sensitive model of Coecke et al. with two baselines that use less or no syntax; specifically, we implement the quantum analogues of a bag-of-words model, where syntax is not taken into account at all, and of a word-sequence model, where only word order is respected. We demonstrate that all models converge smoothly both in simulations and when run on quantum hardware, and that the results are the expected ones based on the nature of the tasks and the datasets used.
Researcher Affiliation Industry Robin Lorenz EMAIL Anna Pearson EMAIL Konstantinos Meichanetzidis EMAIL Dimitri Kartsaklis EMAIL Bob Coecke EMAIL Quantinuum LLC 17 Beaumont Street, Oxford, OX1 2NA, UK
Pseudocode No The paper describes a pipeline with numbered steps and provides diagrams (e.g., Figure 7) to illustrate processes, but it does not contain structured pseudocode or algorithm blocks with formal labels like "Algorithm 1" or a code-like format.
Open Source Code Yes The Python code and the datasets are available at https://github.com/CQCL/qnlp_lorenz_etal_2021_resources.
Open Datasets Yes For our experiments we use two different datasets. The first one (130 sentences) was generated automatically by a simple context-free grammar [...]. The other one (105 noun phrases) was extracted from the Rel Pron dataset (Rimell et al., 2016). [...] The Python code and the datasets are available at https://github.com/CQCL/qnlp_lorenz_etal_2021_resources.
Dataset Splits Yes The MC dataset was partitioned randomly into subsets T (training), D (development) and P (testing) with cardinalities |T | = 70, |D| = 30, |P| = 30. Similarly, for the RP task with |T | = 74, |P| = 31, but no development set D, since the ratio of the sizes of vocabulary and dataset did not allow for yet fewer training data, while the overall dataset of 105 phrases could not be easily changed. For the RP task the ratio between subject to object cases was 46/28 in the training subset and 19/12 in the test subset, which reflects the ratio between the two classes in the given overall dataset. For the MC task the ratio between food and IT related sentences was 39/31 in the training subset, 11/19 in the development subset and 15/15 in the test subset.
Hardware Specification Yes The experiments are performed on an IBM NISQ computer provided by the IBM Quantum platform. [...] all circuits (compiled with TKETTM) were run on IBM s machine ibmq bogota. This is a superconducting quantum computing device with 5 qubits and quantum volume 32.
Software Dependencies No Our Python implementation used lambeq and the Dis Co Py package (de Felice et al., 2020) to implement the model specific Steps 2-4, the Python interface of the quantum compiler TKETTM (Sivarajah et al., 2020) for Step 5, and the IBM device ibmq bogota for Step 6.
Experiment Setup Yes All appearing parameters are valued in [0, 2π]. [...] we set qn = 1 and qs = 1 for the MC task, but qs = 0 for the RP task [...]. We defined li Θ(P) := | i|P(Θ) |2 ϵ where i {0, 1} and ϵ is a small positive number, in our case set to ϵ = 10 9. The objective function used for the training is standard cross-entropy [...]. For the minimisation of C(Θ), the SPSA algorithm (Spall, 1998) is used [...]. The experiments involved one single run of minimising the cost over 100 iterations for the MC task and 130 iterations for the RP task, in each case with an initial parameter point that was chosen on the basis of simulated runs on the train (and dev) datasets.