lambeq: An Efficient High-Level Python Library for Quantum NLP

We present lambeq, the first high-level Python library for Quantum Natural Language Processing (QNLP). The open-source toolkit offers a detailed hierarchy of modules and classes implementing all stages of a pipeline for converting sentences to string diagrams, tensor networks, and quantum circuits ready to be used on a quantum computer. lambeq supports syntactic parsing, rewriting and simplification of string diagrams, ansatz creation and manipulation, as well as a number of compositional models for preparing quantum-friendly representations of sentences, employing various degrees of syntax sensitivity. We present the generic architecture and describe the most important modules in detail, demonstrating the usage with illustrative examples. Further, we test the toolkit in practice by using it to perform a number of experiments on simple NLP tasks, implementing both classical and quantum pipelines.

[1]  Seungjin Choi,et al.  Supervised Learning , 2009, Encyclopedia of Biometrics.

[2]  Nathan Wiebe,et al.  Quantum Language Processing , 2019, 1902.05162.

[3]  Ángel J. Gallego,et al.  Language Design as Information Renormalization , 2017, SN Computer Science.

[4]  J. Spall Multivariate stochastic approximation using a simultaneous perturbation gradient approximation , 1992 .

[5]  John C. Baez,et al.  Physics, Topology, Logic and Computation: A Rosetta Stone , 2009, 0903.0340.

[6]  Bob Coecke,et al.  DisCoPy: Monoidal Categories in Python , 2021, Electronic Proceedings in Theoretical Computer Science.

[7]  Kristan Temme,et al.  Supervised learning with quantum-enhanced feature spaces , 2018, Nature.

[8]  Dimitri Kartsaklis,et al.  QNLP in Practice: Running Compositional Models of Meaning on a Quantum Computer , 2021, ArXiv.

[9]  Roman Orus,et al.  A Practical Introduction to Tensor Networks: Matrix Product States and Projected Entangled Pair States , 2013, 1306.2164.

[10]  Dimitri Kartsaklis,et al.  A CCG-Based Version of the DisCoCat Framework , 2021, SEMSPACE.

[11]  Daoyi Dong,et al.  Quantum Language Model With Entanglement Embedding for Question Answering , 2020, IEEE Transactions on Cybernetics.

[12]  Dimitri Kartsaklis,et al.  Reasoning about Meaning in Natural Language with Compact Closed Categories and Frobenius Algebras , 2014, ArXiv.

[13]  Mark Steedman,et al.  CCGbank: A Corpus of CCG Derivations and Dependency Structures Extracted from the Penn Treebank , 2007, CL.

[14]  Yuji Matsumoto,et al.  A* CCG Parsing with a Supertag and Dependency Factored Model , 2017, ACL.

[15]  Nathan Killoran,et al.  PennyLane: Automatic differentiation of hybrid quantum-classical computations , 2018, ArXiv.

[16]  Stephen Piddock,et al.  A quantum search decoder for natural language processing , 2019, Quantum Mach. Intell..

[17]  Maria Schuld,et al.  Supervised Learning with Quantum Computers , 2018 .

[18]  Fabio Tamburini,et al.  Towards Quantum Language Models , 2017, EMNLP.

[19]  Alán Aspuru-Guzik,et al.  Quantum Chemistry in the Age of Quantum Computing. , 2018, Chemical reviews.

[20]  Bob Coecke,et al.  Grammar-Aware Question-Answering on Quantum Computers , 2020, ArXiv.

[21]  Stephen Clark,et al.  Something Old, Something New: Grammar-based CCG Parsing with Transformer Models , 2021, ArXiv.

[22]  Bob Coecke,et al.  The Mathematics of Text Structure , 2019, Joachim Lambek: The Interplay of Mathematics, Logic, and Linguistics.

[23]  B. Coecke,et al.  Quantum Natural Language Processing on Near-Term Quantum Computers , 2020, QPL.

[24]  Aleks Kissinger,et al.  Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning , 2017 .

[25]  James R. Curran,et al.  Wide-Coverage Efficient Statistical Parsing with CCG and Log-Linear Models , 2007, Computational Linguistics.

[26]  Martin Kay,et al.  Syntactic Process , 1979, ACL.

[27]  Tobias J. Osborne,et al.  Training deep quantum neural networks , 2020, Nature Communications.

[28]  Alán Aspuru-Guzik,et al.  Potential of quantum computing for drug discovery , 2018, IBM J. Res. Dev..

[29]  Dan Ventura,et al.  Quantum Neural Networks , 2000 .

[30]  Giovanni de Felice,et al.  Diagrammatic Differentiation for Quantum Machine Learning , 2021, Electronic Proceedings in Theoretical Computer Science.

[31]  Bob Coecke,et al.  Quantum Algorithms for Compositional Natural Language Processing , 2016, SLPCS@QPL.

[32]  Samson Abramsky,et al.  A categorical semantics of quantum protocols , 2004, Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science, 2004..

[33]  J. S. Shaari,et al.  Advances in Quantum Cryptography , 2019, 1906.01645.

[34]  David Von Dollen,et al.  TensorFlow Quantum: A Software Framework for Quantum Machine Learning , 2020, ArXiv.

[35]  Stephen Clark,et al.  Mathematical Foundations for a Compositional Distributional Model of Meaning , 2010, ArXiv.