Naive Bayes-based Context Extension for Large Language Models
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) have shown promising in-context learning abilities. However, conventional In-Context Learning (ICL) approaches are often impeded by length limitations of transformer architecture, which pose challenges when attempting to effectively integrate supervision from a substantial number of demonstration examples. In this paper, we introduce a novel framework, called Naive Bayes-based Context Extension (NBCE), to enable existing LLMs to perform ICL with an increased number of demonstrations by significantly expanding their context size. Importantly, this expansion does not require fine-tuning or dependence on particular model architectures, all the while preserving linear efficiency. NBCE initially splits the context into equal-sized windows fitting the target LLM's maximum length. Then, it introduces a voting mechanism to select the most relevant window, regarded as the posterior context. Finally, it employs Bayes' theorem to generate the test task. Our experimental results demonstrate that NBCE substantially enhances performance, particularly as the number of demonstration examples increases, consistently outperforming alternative methods. The NBCE code will be made publicly accessible. The code NBCE is available at: https://github.com/amurtadha/NBCE-master
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 34 of its 47 references that are in the map. First posted on arXiv 26 Mar 2024.
Builds on
34 of 47 references.
References · 34
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2020Measuring Massive Multitask Language Understandingcited by 7,768
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,018
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2018Can a Suit of Armor Conduct Electricity? A New Dataset for Open Book Question Answeringcited by 2,114
- 2019SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systemscited by 1,718
- 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,371
- 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
22 more
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2021Learning To Retrieve Prompts for In-Context Learningcited by 641
- 2020Pre-trained Models for Natural Language Processing: A Surveycited by 504
- 2021MetaICL: Learning to Learn In Contextcited by 450
- 2020Efficient Intent Detection with Dual Sentence Encoderscited by 419
- 2019An Evaluation Dataset for Intent Classification and Out-of-Scope Predictioncited by 378
- 2021Pre-Trained Models: Past, Present and Futurecited by 319
- 2023Trusting Your Evidence: Hallucinate Less with Context-aware Decodingcited by 319
- 2021LongT5: Efficient Text-To-Text Transformer for Long Sequencescited by 232
- 2019Benchmarking Natural Language Understanding Services for building Conversational Agentscited by 166
- 2021Noisy Channel Language Model Prompting for Few-Shot Text Classificationcited by 163
- 2021Meta-learning via Language Model In-context Tuningcited by 163
- 2022Structured Prompting: Scaling In-Context Learning to 1,000 Examplescited by 81
- 2021Think you have Solved Direct-Answer Question Answering? Try ARC-DA, the Direct-Answer AI2 Reasoning Challengecited by 79
- 2022Efficient Long-Text Understanding with Short-Text Modelscited by 71
- 2022Prototypical Calibration for Few-shot Learning of Language Modelscited by 58
- 2023Pre-Training to Learn in Contextcited by 41
- 2023In-Context Learning with Many Demonstration Examplescited by 39
- 2022BERT-ASC: Auxiliary-Sentence Construction for Implicit Aspect Learning in Sentiment Analysiscited by 4
- 2023Rank-Aware Negative Training for Semi-Supervised Text Classificationcited by 3
Built on by
Citing papers per year: 2024: 4; 2025: 1.
5 papers.
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 30
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
- 2025MateICL: Mitigating Attention Dispersion in Large-Scale In-Context Learningcited by 2
- 2024Logit Separability-Driven Samples and Multiple Class-Related Words Selection for Advancing In-Context Learningcited by 0
- 2024Dehallucinating Parallel Context Extension for Retrieval-Augmented Generationcited by 0
- 2025MateICL: Mitigating Attention Dispersion in Large-Scale In-Context Learning2 May 2025
- 2024Dehallucinating Parallel Context Extension for Retrieval-Augmented Generation19 Dec 2024
- 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolation7 Oct 2024
- 2024Logit Separability-Driven Samples and Multiple Class-Related Words Selection for Advancing In-Context Learning16 Jun 2024
- 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolation23 May 2024