Great Memory, Shallow Reasoning: Limits of kNN-LMs

Shangyi Geng, Wenting Zhao, Alexander M Rush
8/21/2024
cs.CLcs.AI

Official code: GSYfate/knnlm-limits (24 stars, last commit 2025-04-30).

Abstract

$K$-nearest neighbor language models ($k$NN-LMs), which integrate retrieval with next-word prediction, have demonstrated strong performance in language modeling as well as downstream NLP benchmarks. These results have led researchers to argue that models trained on poor quality or outdated data could perform well by employing a $k$NN extension that has access to a higher-quality datastore. In this work, we ask whether this improved ability to recall information really translates into downstream abilities. We extensively evaluate $k$NN-LMs on a diverse set of tasks, ranging from sentiment classification and commonsense reasoning to multi-hop reasoning. Results show that $k$NN-LMs excel at memory-intensive tasks, where utilizing the patterns in the input is sufficient for determining the output, but struggle with reasoning tasks that require integrating multiple pieces of information to derive new knowledge. We further demonstrate through oracle experiments and qualitative analysis that even with perfect retrieval, $k$NN-LMs still fail to determine the correct answers, placing an upper bound on their reasoning performance. Code and datastores are released at https://github.com/GSYfate/knnlm-limits/.

View on arXivView PDF

Code Implementations(1)

Official code repo for paper "Great Memory, Shallow Reasoning: Limits of kNN-LMs"

241Shell, PythonApr 22, 20241 years ago

Similar Papers

Cite this paper

@article{geng2024great,
  title  = {Great Memory, Shallow Reasoning: Limits of kNN-LMs},
  author = {Shangyi Geng and Wenting Zhao and Alexander M Rush},
  year   = {2024},
  eprint = {2408.11815},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.11815v1}
}

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/2408.11815.svg)](https://codeofpaper.com/paper/2408.11815)

Discussion