Research map / Large language models / Language, safety and interpretability
$k$NN Prompting: Beyond-Context Learning with Calibration-Free Nearest Neighbor Inference
Benfeng Xu, Quan Wang, Zhendong Mao, Yajuan Lyu, Qiaoqiao She, Yongdong Zhang
University of Science and Technology of China · Beijing University of Posts and Telecommunications
Read the paperPlace an idea next to itCheck your own paper ↗
AI-extracted. The measured effects below were read by AI from the paper's full text (no summary yet). Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Add kNN Prompting (anchor datastore + KL-based nearest neighbor prediction) instead of standard ICL | GPT2 XL, few-shot m=8 · 6 tasks, few-shot m=8 | AVG accuracy: +13.86 | Improved |
| Use kNN Prompting instead of Noisy Channel calibration | GPT2 XL, few-shot m=8 · 6 tasks, few-shot m=8 | AVG accuracy: +7.07 | Improved |
| Scale training data to 128 shots with kNN Prompting instead of ICL Ensemble | GPT2 0.8B, low resource m=128 · 10 tasks, m=128 | AVG accuracy: +16.08 | Improved |
| Increase model scale for kNN Prompting above 6B | kNN Prompting vs finetuning (GPT Large FT) · 10 tasks, m=128 | AVG accuracy | Improved |
| Scale demonstration/anchor data from 32 to 1024 shots with kNN Prompting | GPT2 0.8B to OPT 30B · 10 tasks, m=32 to m=1024 | AVG accuracy: +13.58 over ICL at 32 shots (0.8B) | Improved |
| Mask non-label words so only label-word probabilities are used (Partial) instead of full LM distribution (ablation) | kNN Prompting, GPT2 XL, few-shot · 6 tasks, m=8 | AVG accuracy: -4.21 | Hurt |
| Replace full LM distribution with contextual representation and L2 distance (ablation) | kNN Prompting, GPT2 XL, 10 tasks · 10 tasks, m=128 analysis | AVG accuracy: -1.57 | Hurt |
| Use averaged centered anchors per class (normalization trick) | kNN Prompting under imbalanced label scenario · SST2 imbalanced | accuracy | Mixed |
| Compare kNN Prompting against demonstration selection (PromptCompose) approaches | kNN Prompting vs retrieval-based prompt composition · full results | accuracy | Improved |
Later papers that compared with this method
1 later accepted paper reports kNN Prompting as a baseline in their results tables; 1 of them report a better number on most of the results they share with it.
- Tree Prompting: Efficient Task Adaptation without Fine-Tuning (EMNLP 2023 · better on 1 of 1 shared result)
Matched by method name in results tables read by AI. Authors' own tables tend to favour the newer method, and a comparison can be missed when a method is renamed.
Closest papers by meaning
- Batch Calibration: Rethinking Calibration for In-Context Learning and Prompt Engineering (ICLR 2024 · similarity 0.90)
- In-Context Principle Learning from Mistakes (ICML 2024 · similarity 0.89)
- In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering (ICML 2024 · similarity 0.89)
- Towards Auto-Regressive Next-Token Prediction: In-context Learning Emerges from Generalization (ICLR 2025 · similarity 0.88)
- Evolving Prompts In-Context: An Open-ended, Self-replicating Perspective (ICML 2025 · similarity 0.88)
- The Surprising Effectiveness of Test-Time Training for Few-Shot Learning (ICML 2025 · similarity 0.87)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
