You can't pick your neighbors, or can you? When and how to rely on retrieval in the $k$NN-LM
Drozdov, Andrew, Wang, Shufan, Rahimi, Razieh, McCallum, Andrew, Zamani, Hamed, Iyyer, Mohit
–arXiv.org Artificial Intelligence
Retrieval-enhanced language models (LMs), which condition their predictions on text retrieved from large external datastores, have recently shown significant perplexity improvements compared to standard LMs. One such approach, the $k$NN-LM, interpolates any existing LM's predictions with the output of a $k$-nearest neighbors model and requires no additional training. In this paper, we explore the importance of lexical and semantic matching in the context of items retrieved by $k$NN-LM. We find two trends: (1) the presence of large overlapping $n$-grams between the datastore and evaluation set plays an important factor in strong performance, even when the datastore is derived from the training data; and (2) the $k$NN-LM is most beneficial when retrieved items have high semantic similarity with the query. Based on our analysis, we define a new formulation of the $k$NN-LM that uses retrieval quality to assign the interpolation coefficient. We empirically measure the effectiveness of our approach on two English language modeling datasets, Wikitext-103 and PG-19. Our re-formulation of the $k$NN-LM is beneficial in both cases, and leads to nearly 4% improvement in perplexity on the Wikitext-103 test set.
arXiv.org Artificial Intelligence
Oct-27-2022
- Country:
- North America
- Dominican Republic (0.04)
- United States
- California (0.14)
- Illinois (0.04)
- Hawaii (0.04)
- Massachusetts > Hampshire County
- Amherst (0.04)
- Europe
- France (0.04)
- Italy > Calabria
- Catanzaro Province > Catanzaro (0.04)
- Ireland > Leinster
- County Dublin > Dublin (0.04)
- Denmark > Capital Region
- Copenhagen (0.04)
- Asia > Middle East
- Jordan (0.04)
- North America
- Genre:
- Research Report (0.64)
- Technology: