Lune

EMNLP2021Top-tier venue

Efficient Nearest Neighbor Language Models

Junxian He, Graham Neubig, Taylor Berg-Kirkpatrick

Abstract

Non-parametric neural language models (NLMs) learn predictive distributions of text utilizing an external datastore, which allows them to learn through explicitly memorizing the training datapoints. While effective, these models often require retrieval from a large datastore at test time, significantly increasing the inference overhead and thus limiting the deployment of non-parametric NLMs in practical applications. In this paper, we take the recently proposed k-nearest neighbors language model (Khandelwal et al., 2019) as an example, exploring methods to improve its efficiency along various dimensions. Experiments on the standard WikiText-103 benchmark and domain-adaptation datasets show that our methods are able to achieve up to a 6x speed-up in inference speed while retaining comparable performance. The empirical analysis we present may provide guidelines for future research seeking to develop or deploy more efficient non-parametric NLMs. 1

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

47 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Learning Sparse Prototypes for Text Generation cites Generalization through Memorization: Nearest Neighbor Language Models
  • Learning Sparse Prototypes for Text Generation cites Nearest Neighbor Machine Translation
  • Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval cites Learning Sparse Prototypes for Text Generation
  • Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval cites Generalization through Memorization: Nearest Neighbor Language Models
  • Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval cites Accelerating Large-Scale Inference with Anisotropic Vector Quantization
  • Neuro-Symbolic Language Modeling with Automaton-augmented Retrieval cites Nearest Neighbor Machine Translation
  • RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective Augmentation cites Generalization through Memorization: Nearest Neighbor Language Models
  • When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memories cites Generalization through Memorization: Nearest Neighbor Language Models
  • When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memories cites Language Models are Few-Shot Learners
  • SILO Language Models: Isolating Legal Risk In a Nonparametric Datastore cites Generalization through Memorization: Nearest Neighbor Language Models
  • SILO Language Models: Isolating Legal Risk In a Nonparametric Datastore cites Language Models are Few-Shot Learners
  • Nearest Neighbor Machine Translation cites Generalization through Memorization: Nearest Neighbor Language Models
  • Nearest Neighbor Machine Translation cites Accelerating Large-Scale Inference with Anisotropic Vector Quantization
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers47

  1. RECOMP: Improving Retrieval-Augmented LMs with Context Compression and Selective AugmentationFangyuan Xu, Weijia Shi, Eunsol ChoiICLR 2024 · 260 citations
  2. When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric MemoriesAlex Mallen, Akari Asai, Victor Zhong, Rajarshi Das et al.ACL 2023 · 233 citations
  3. The Efficiency MisnomerMostafa Dehghani, Yi Tay, Anurag Arnab, Lucas Beyer et al.ICLR 2022 · 116 citations
  4. SILO Language Models: Isolating Legal Risk In a Nonparametric DatastoreSewon Min, Suchin Gururangan, Eric Wallace, Weijia Shi et al.ICLR 2024 · 91 citations
  5. Neuro-Symbolic Language Modeling with Automaton-augmented RetrievalUri Alon, Frank F. Xu, Junxian He, Sudipta Sengupta et al.ICML 2022 · 79 citations

Builds on6

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Generalization through Memorization: Nearest Neighbor Language ModelsUrvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer et al.ICLR 2020 · 1,038 citations
  3. Accelerating Large-Scale Inference with Anisotropic Vector QuantizationRuiqi Guo, Philip Sun, Erik Lindgren, Quan Geng et al.ICML 2020 · 539 citations
  4. Nearest Neighbor Machine TranslationUrvashi Khandelwal, Angela Fan, Dan Jurafsky, Luke Zettlemoyer et al.ICLR 2021 · 323 citations
  5. Learning Sparse Prototypes for Text GenerationJunxian He, Taylor Berg-Kirkpatrick, Graham NeubigNeurIPS 2020 · 26 citations

Related papers

  1. Adaptation Approaches for Nearest Neighbor Language ModelsRishabh Bhardwaj, George Polovets, Monica SunkaraACL Findings 2023 · 7 citations
  2. You can't pick your neighbors, or can you? When and How to Rely on Retrieval in the kNN-LMAndrew Drozdov, Shufan Wang, Razieh Rahimi, Andrew McCallum et al.EMNLP Findings 2022 · 10 citations
  3. Why do Nearest Neighbor Language Models Work?Frank F. Xu, Uri Alon, Graham NeubigICML 2023 · 33 citations
  4. Simple and Scalable Nearest Neighbor Machine TranslationYuhan Dai, Zhirui Zhang, Qiuzhi Liu, Qu Cui et al.ICLR 2023 · 9 citations
  5. Efficient Cluster-Based k-Nearest-Neighbor Machine TranslationDexin Wang, Kai Fan, Boxing Chen, Deyi XiongACL 2022 · 35 citations
Dusk over the sea between two cliffs drawn in fine vertical lines