Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval

Uri Alon, Frank F. Xu, Junxian He, Sudipta Sengupta, Dan Roth +1 more
1/28/2022
84 citations
cs.CLcs.LG

Official code: neulab/retomaton (77 stars, Python, MIT, PyTorch, last commit 2022-07-16). Most starred: neulab/knn-transformers, a community implementation (287 stars, Python, MIT, PyTorch, last commit 2022-10-20, 3.7× the official stars). 1 more implementation below.

Abstract

Retrieval-based language models (R-LM) model the probability of natural language text by combining a standard language model (LM) with examples retrieved from an external datastore at test time. While effective, a major bottleneck of using these models in practice is the computationally costly datastore search, which can be performed as frequently as every time step.

Show full abstract

In this paper, we present RetoMaton - retrieval automaton - which approximates the datastore search, based on (1) saving pointers between consecutive datastore entries, and (2) clustering of entries into "states". This effectively results in a weighted finite automaton built on top of the datastore, instead of representing the datastore as a flat list. The creation of the automaton is unsupervised, and a RetoMaton can be constructed from any text collection: either the original training corpus or from another domain. Traversing this automaton at inference time, in parallel to the LM inference, reduces its perplexity by up to 1.85, or alternatively saves up to 83% of the nearest neighbor searches over $k$NN-LM (Khandelwal et al., 2020) without hurting perplexity. Our code and trained models are available at https://github.com/neulab/retomaton .

View on arXivView PDF

Code Implementations(2)

Code implementations of this paper
RepositoryTypeStarsLanguageLicenseLast commit
neulab/retomatonOfficial77PythonMIT2022-07-16
neulab/knn-transformersCommunity287PythonMIT2022-10-20
neulab/retomatonOfficial100%
PyTorchMIT

PyTorch code for the RetoMaton paper: "Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval" (ICML 2022)

774Python, CudaMay 17, 20224 years agoMIT
icml-2022knnknn-lmlanguagemodeling+7 more
PyTorchMIT

PyTorch + HuggingFace code for RetoMaton: "Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval" (ICML 2022), including an implementation of kNN-LM and kNN-MT

28723PythonJul 6, 20224 years agoMIT
huggingfaceknnknn-lmknn-mtknn-transformers+14 more

Similar Papers

Cite this paper

@article{alon2022neurosymbolic,
  title  = {Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval},
  author = {Uri Alon and Frank F. Xu and Junxian He and Sudipta Sengupta and Dan Roth and Graham Neubig},
  year   = {2022},
  eprint = {2201.12431},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2201.12431}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2201.12431.svg)](https://codeofpaper.com/paper/2201.12431)

Discussion