Nearest Neighbor Speculative Decoding for LLM Generation and Attribution
On the map: Efficient LLM inference and serving → Speculative decoding
Abstract (arXiv)
Large language models (LLMs) often hallucinate and lack the ability to provide attribution for their generations. Semi-parametric LMs, such as kNN-LM, approach these limitations by refining the output of an LM for a given prompt using its nearest neighbor matches in a non-parametric data store. However, these models often exhibit slow inference speeds and produce non-fluent texts. In this paper, we introduce Nearest Neighbor Speculative Decoding (NEST), a novel semi-parametric language modeling approach that is capable of incorporating real-world text spans of arbitrary length into the LM generations and providing attribution to their sources. NEST performs token-level retrieval at each inference step to compute a semi-parametric mixture distribution and identify promising span continuations in a corpus. It then uses an approximate speculative decoding procedure that accepts a prefix of the retrieved span or generates a new token. NEST significantly enhances the generation quality and attribution rate of the base LM across a variety of knowledge-intensive tasks, surpassing the conventional kNN-LM method and performing competitively with in-context retrieval augmentation. In addition, NEST substantially improves the generation speed, achieving a 1.8x speedup in inference time when applied to Llama-2-Chat 70B. Code will be released at https://github.com/facebookresearch/NEST/tree/main.
Key facts. Cited by 25 papers in the map (data through 14 Oct 2026). Placed in Speculative decoding, one of 12 directions in Efficient LLM inference and serving. Builds on 52 of its 61 references that are in the map. First posted on arXiv 29 May 2024.
Builds on
52 of 61 references.
Closest ancestors · 4
Same direction, newest first
- 2023REST: Retrieval-Based Speculative Decoding14 Nov
- 2023Accelerating LLM Inference with Staged Speculative Decoding8 Aug
- 2023Accelerating Large Language Model Decoding with Speculative Sampling2 Feb
- 2022Fast Inference from Transformers via Speculative Decoding30 Nov
Other references · 48
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2020Measuring Massive Multitask Language Understandingcited by 7,963
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,824
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,754
- 2016Pointer Sentinel Mixture Modelscited by 3,096
- 2021TruthfulQA: Measuring How Models Mimic Human Falsehoodscited by 2,975
36 more
- 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,955
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,141
- 2023Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflectioncited by 1,839
- 2021Improving language models by retrieving from trillions of tokenscited by 1,293
- 2023FActScore: Fine-grained Atomic Evaluation of Factual Precision in Long Form Text Generationcited by 1,282
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,210
- 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 952
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 800
- 2023REPLUG: Retrieval-Augmented Black-Box Language Modelscited by 792
- 2017Reading Wikipedia to Answer Open-Domain Questionscited by 777
- 2023In-Context Retrieval-Augmented Language Modelscited by 702
- 2022MedMCQA : A Large-scale Multi-Subject Multi-Choice Dataset for Medical domain Question Answeringcited by 543
- 2021MAUVE: Measuring the Gap Between Neural Text and Human Text using Divergence Frontierscited by 470
- 2022Large Language Models Struggle to Learn Long-Tail Knowledgecited by 458
- 2023Trusting Your Evidence: Hallucinate Less with Context-aware Decodingcited by 327
- 2022RARR: Researching and Revising What Language Models Say, Using Language Modelscited by 287
- 2023RA-DIT: Retrieval-Augmented Dual Instruction Tuningcited by 195
- 2022Revisiting the Gold Standard: Grounding Summarization Evaluation with Robust Human Evaluationcited by 142
- 2021Simple Entity-Centric Questions Challenge Dense Retrieverscited by 140
- 2023How to Train Your DRAGON: Diverse Augmentation Towards Generalizable Dense Retrievalcited by 118
- 2022Pile of Law: Learning Responsible Data Filtering from the Law and a 256GB Open-Source Legal Datasetcited by 113
- 2023ExpertQA: Expert-Curated Questions and Attributed Answerscited by 97
- 2021Efficient Nearest Neighbor Language Modelscited by 93
- 2022PEER: A Collaborative Language Modelcited by 86
- 2024Reliable, Adaptable, and Attributable Language Models with Retrievalcited by 73
- 2022Generating Literal and Implied Subquestions to Fact-check Complex Claimscited by 66
- 2023Inference with Reference: Lossless Acceleration of Large Language Modelscited by 65
- 2023Shall We Pretrain Autoregressive Language Models with Retrieval? A Comprehensive Studycited by 63
- 2023InstructRetro: Instruction Tuning post Retrieval-Augmented Pretrainingcited by 53
- 2021FRUIT: Faithfully Reflecting Updated Information in Textcited by 39
- 2023Copy Is All You Needcited by 27
- 2022Chunk-based Nearest Neighbor Machine Translationcited by 21
- 2022You can't pick your neighbors, or can you? When and how to rely on retrieval in the kNN-LMcited by 18
- 2023KNN-LM Does Not Improve Open-ended Text Generationcited by 10
- 2024Retrieval is Accurate Generationcited by 10
- 2022Adaptation Approaches for Nearest Neighbor Language Modelscited by 6
Built on by
Citing papers per year: 2024: 7; 2025: 12; 2026: 6.
25 papers.
Sort:
By area:
- 2024EAGLE-2: Faster Inference of Language Models with Dynamic Draft Treescited by 370
- 2025EAGLE-3: Scaling up Inference Acceleration of Large Language Models via Training-Time Testcited by 331
- 2024Multi-Layer Transformers Gradient Can be Approximated in Almost Linear Timecited by 22
- 2024A Tighter Complexity Analysis of SparseGPTcited by 19
- 2024Mixture of Attentions For Speculative Decodingcited by 17
- 2024Retrofitting Large Language Models with Dynamic Tokenizationcited by 16
- 2025TokenShapley: Token Level Context Attribution with Shapley Valuecited by 15
- 2024Improving Factuality with Explicit Working Memorycited by 10
- 2025Speculate, then Collaborate: Fusing Knowledge of Language Models during Decodingcited by 8
- 2025Attribution, Citation, and Quotation: A Survey of Evidence-based Text Generation with Large Language Modelscited by 7
- 2025DReSD: Dense Retrieval for Speculative Decodingcited by 6
- 2025VIBE: Vector Index Benchmark for Embeddingscited by 6
13 more
- 2025A Survey on Proactive Defense Strategies Against Misinformation in Large Language Modelscited by 6
- 2025Large Language Model Sourcing: A Surveycited by 5
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generationcited by 4
- 2025Advancing Decoding Strategies: Enhancements in Locally Typical Sampling for LLMscited by 4
- 2025OmniDraft: A Cross-vocabulary, Online Adaptive Drafter for On-device Speculative Decodingcited by 4
- 2025Yggdrasil: Bridging Dynamic Speculation and Static Runtime for Latency-Optimal Tree-Based LLM Decodingcited by 4
- 2026DIVERSED: Relaxed Speculative Decoding via Dynamic Ensemble Verificationcited by 4
- 2024Breaking the Attention Bottleneckcited by 1
- 2026Flow of Spans: Generalizing Language Models to Dynamic Span-Vocabulary via GFlowNetscited by 0
- 2026CATS: Cascaded Adaptive Tree Speculation for Memory-Limited LLM Inference Accelerationcited by 0
- 2026Near-Exponential Convergence Rates for kNN Classification based on Boltzmann Margincited by 0
- 2026Oilbird: Training-Free Speculative Decoding with Keys the Verifier Already Computescited by 0
- 2026Guaranteeing Faithful Evidence Extraction in Speculative Retrieval-Augmented Generationcited by 0
- 2026Guaranteeing Faithful Evidence Extraction in Speculative Retrieval-Augmented Generation9 Sep 2026
- 2026Oilbird: Training-Free Speculative Decoding with Keys the Verifier Already Computes4 Aug 2026
- 2026Near-Exponential Convergence Rates for kNN Classification based on Boltzmann Margin9 Jun 2026
- 2026CATS: Cascaded Adaptive Tree Speculation for Memory-Limited LLM Inference Acceleration11 May 2026
- 2026DIVERSED: Relaxed Speculative Decoding via Dynamic Ensemble Verification8 Apr 2026
- 2026Flow of Spans: Generalizing Language Models to Dynamic Span-Vocabulary via GFlowNets11 Feb 2026
- 2025Yggdrasil: Bridging Dynamic Speculation and Static Runtime for Latency-Optimal Tree-Based LLM Decoding29 Dec 2025
- 2025Large Language Model Sourcing: A Survey11 Oct 2025
- 2025Attribution, Citation, and Quotation: A Survey of Evidence-based Text Generation with Large Language Models21 Aug 2025
- 2025A Survey on Proactive Defense Strategies Against Misinformation in Large Language Models5 Jul 2025
- 2025OmniDraft: A Cross-vocabulary, Online Adaptive Drafter for On-device Speculative Decoding3 Jul 2025
- 2025TokenShapley: Token Level Context Attribution with Shapley Value18 Jun 2025
13 more
- 2025Advancing Decoding Strategies: Enhancements in Locally Typical Sampling for LLMs3 Jun 2025
- 2025VIBE: Vector Index Benchmark for Embeddings23 May 2025
- 2025EAGLE-3: Scaling up Inference Acceleration of Large Language Models via Training-Time Test3 Mar 2025
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation26 Feb 2025
- 2025DReSD: Dense Retrieval for Speculative Decoding21 Feb 2025
- 2025Speculate, then Collaborate: Fusing Knowledge of Language Models during Decoding11 Feb 2025
- 2024Improving Factuality with Explicit Working Memory24 Dec 2024
- 2024Retrofitting Large Language Models with Dynamic Tokenization27 Nov 2024
- 2024Mixture of Attentions For Speculative Decoding4 Oct 2024
- 2024Multi-Layer Transformers Gradient Can be Approximated in Almost Linear Time23 Aug 2024
- 2024A Tighter Complexity Analysis of SparseGPT22 Aug 2024
- 2024EAGLE-2: Faster Inference of Language Models with Dynamic Draft Trees24 Jun 2024
- 2024Breaking the Attention Bottleneck16 Jun 2024
- 2024EAGLE-2: Faster Inference of Language Models with Dynamic Draft Treescited by 370
- 2025EAGLE-3: Scaling up Inference Acceleration of Large Language Models via Training-Time Testcited by 331
- 2024Mixture of Attentions For Speculative Decodingcited by 17
- 2025DReSD: Dense Retrieval for Speculative Decodingcited by 6
- 2025OmniDraft: A Cross-vocabulary, Online Adaptive Drafter for On-device Speculative Decodingcited by 4
- 2025Yggdrasil: Bridging Dynamic Speculation and Static Runtime for Latency-Optimal Tree-Based LLM Decodingcited by 4
- 2026DIVERSED: Relaxed Speculative Decoding via Dynamic Ensemble Verificationcited by 4
- 2026CATS: Cascaded Adaptive Tree Speculation for Memory-Limited LLM Inference Accelerationcited by 0
- 2026Oilbird: Training-Free Speculative Decoding with Keys the Verifier Already Computescited by 0
- 2026Oilbird: Training-Free Speculative Decoding with Keys the Verifier Already Computes4 Aug 2026
- 2026CATS: Cascaded Adaptive Tree Speculation for Memory-Limited LLM Inference Acceleration11 May 2026
- 2026DIVERSED: Relaxed Speculative Decoding via Dynamic Ensemble Verification8 Apr 2026
- 2025Yggdrasil: Bridging Dynamic Speculation and Static Runtime for Latency-Optimal Tree-Based LLM Decoding29 Dec 2025
- 2025OmniDraft: A Cross-vocabulary, Online Adaptive Drafter for On-device Speculative Decoding3 Jul 2025
- 2025EAGLE-3: Scaling up Inference Acceleration of Large Language Models via Training-Time Test3 Mar 2025
- 2025DReSD: Dense Retrieval for Speculative Decoding21 Feb 2025
- 2024Mixture of Attentions For Speculative Decoding4 Oct 2024
- 2024EAGLE-2: Faster Inference of Language Models with Dynamic Draft Trees24 Jun 2024
- 2024Multi-Layer Transformers Gradient Can be Approximated in Almost Linear Timecited by 22
- 2024A Tighter Complexity Analysis of SparseGPTcited by 19
- 2024Retrofitting Large Language Models with Dynamic Tokenizationcited by 16
- 2025TokenShapley: Token Level Context Attribution with Shapley Valuecited by 15
- 2024Improving Factuality with Explicit Working Memorycited by 10
- 2025Speculate, then Collaborate: Fusing Knowledge of Language Models during Decodingcited by 8
- 2025Attribution, Citation, and Quotation: A Survey of Evidence-based Text Generation with Large Language Modelscited by 7
- 2025VIBE: Vector Index Benchmark for Embeddingscited by 6
- 2025A Survey on Proactive Defense Strategies Against Misinformation in Large Language Modelscited by 6
- 2025Large Language Model Sourcing: A Surveycited by 5
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generationcited by 4
- 2025Advancing Decoding Strategies: Enhancements in Locally Typical Sampling for LLMscited by 4
12 most cited of 15 All 15 (JSON)
- 2026Near-Exponential Convergence Rates for kNN Classification based on Boltzmann Margin9 Jun 2026
- 2026Flow of Spans: Generalizing Language Models to Dynamic Span-Vocabulary via GFlowNets11 Feb 2026
- 2025Large Language Model Sourcing: A Survey11 Oct 2025
- 2025Attribution, Citation, and Quotation: A Survey of Evidence-based Text Generation with Large Language Models21 Aug 2025
- 2025A Survey on Proactive Defense Strategies Against Misinformation in Large Language Models5 Jul 2025
- 2025TokenShapley: Token Level Context Attribution with Shapley Value18 Jun 2025
- 2025Advancing Decoding Strategies: Enhancements in Locally Typical Sampling for LLMs3 Jun 2025
- 2025VIBE: Vector Index Benchmark for Embeddings23 May 2025
- 2025TokenSwift: Lossless Acceleration of Ultra Long Sequence Generation26 Feb 2025
- 2025Speculate, then Collaborate: Fusing Knowledge of Language Models during Decoding11 Feb 2025
- 2024Improving Factuality with Explicit Working Memory24 Dec 2024
- 2024Retrofitting Large Language Models with Dynamic Tokenization27 Nov 2024
12 newest of 15 All 15 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2024Closer Look at Efficient Inference Methods: A Survey of Speculative Decoding
- 2025Accelerating LLM Inference with Lossless Speculative Decoding Algorithms for Heterogeneous Vocabularies
- 2024Unlocking Efficiency in Large Language Model Inference: A Comprehensive Survey of Speculative Decoding
- 2025RAPID: Long-Context Inference with Retrieval-Augmented Speculative Decoding
- 2024Towards Fast Multilingual LLM Inference: Speculative Decoding and Specialized Drafters
- 2024Recursive Speculative Decoding: Accelerating LLM Inference via Sampling Without Replacement
- 2025READER: Retrieval-Assisted Drafter for Efficient LLM Inference
- 2024Minions: Accelerating Large Language Model Inference with Aggregated Speculative Execution