Generalization through Memorization: Nearest Neighbor Language Models

11/01/2019
by   Urvashi Khandelwal, et al.
0

We introduce kNN-LMs, which extend a pre-trained neural language model (LM) by linearly interpolating it with a k-nearest neighbors (kNN) model. The nearest neighbors are computed according to distance in the pre-trained LM embedding space, and can be drawn from any text collection, including the original LM training data. Applying this augmentation to a strong Wikitext-103 LM, with neighbors drawn from the original training set, our kNN-LM achieves a new state-of-the-art perplexity of 15.79 - a 2.9 point improvement with no additional training. We also show that this approach has implications for efficiently scaling up to larger training sets and allows for effective domain adaptation, by simply varying the nearest neighbor datastore, again without further training. Qualitatively, the model is particularly helpful in predicting rare patterns, such as factual knowledge. Together, these results strongly suggest that learning similarity between sequences of text is easier than predicting the next word, and that nearest neighbor search is an effective approach for language modeling in the long tail.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/21/2022

Rescue Implicit and Long-tail Cases: Nearest Neighbor Relation Extraction

Relation extraction (RE) has achieved remarkable progress with the help ...
research
09/16/2021

Regularized Training of Nearest Neighbor Language Models

Including memory banks in a natural language processing architecture inc...
research
11/16/2021

ShapeY: Measuring Shape Recognition Capacity Using Nearest Neighbor Matching

Object recognition in humans depends primarily on shape cues. We have de...
research
01/07/2023

Why do Nearest Neighbor Language Models Work?

Language models (LMs) compute the probability of a text by sequentially ...
research
06/25/2023

A Self-Encoder for Learning Nearest Neighbors

We present the self-encoder, a neural network trained to guess the ident...
research
09/24/2019

Situating Sentence Embedders with Nearest Neighbor Overlap

As distributed approaches to natural language semantics have developed a...
research
10/28/2022

You can't pick your neighbors, or can you? When and how to rely on retrieval in the kNN-LM

Retrieval-enhanced language models (LMs), which condition their predicti...

Please sign up or login with your details

Forgot password? Click here to reset