Reproduce “Improving Few-Shot Performance of Language Models via Nearest Neighbor Calibration” on OpenResearch

Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Feng Nie, Meixi Chen, Zhirui Zhang, Xu Cheng

The paper from Tencent and the University of Cambridge introduces Nearest Neighbor Calibration (KNN-C) to enhance the few-shot performance of in-context learning (ICL) in language models. KNN-C consistently improves average accuracy by up to 12.8% on single-sentence tasks and reduces performance variance, often matching or exceeding state-of-the-art fine-tuning methods while using significantly fewer computational resources.

Key insights

  • The "contradictory prediction" phenomenon, where PLMs misclassify their own few-shot examples in-context, can be leveraged as a supervised signal to calibrate and refine the model's decision boundary.
  • Vertically retrieving small, similar support samples from the training data offers an "orthogonal perspective" to correct the PLM's implicit decision boundary, rather than solely relying on horizontal demonstration concatenation.
  • Combining efficient kNN retrieval with the intrinsic prediction capabilities of PLMs can substantially bridge the performance gap between in-context learning and more resource-intensive fine-tuning methods.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.