ParaICL: Towards Parallel In-Context Learning

Xingxuan Li, Xuan-Phi Nguyen, Shafiq Joty, Lidong Bing

TL;DR

ParaICL (Parallel In-Context Learning) is a new method that allows Large Language Models (LLMs) to learn from more demonstration examples without getting "lost" in long input contexts. By splitting examples into small, semantically sorted batches and processing them in parallel, ParaICL combines their insights through a weighted token ensemble to achieve more accurate and robust results across reasoning, coding, and language tasks.

What Problem Does This Paper Address?

In-Context Learning (ICL)—the ability of LLMs to perform tasks simply by seeing a few examples in the prompt—is powerful but fragile. Researchers face two main hurdles:

  1. The Context Ceiling: Simply adding more examples doesn't always help. As shown in Figure 1, performance often plateaus or even drops as the prompt gets longer, likely because models struggle to attend to relevant information in massive contexts.
  2. Selection Sensitivity: Not all examples are created equal. A set of examples that helps the model solve one math problem might fail on another (see Figure 2).

Existing methods try to pick the "best" few examples, but this leaves valuable information on the table. The authors of ParaICL ask: How can we use all available examples effectively without overwhelming the model's context window?

Figure 1: Results of Mistral-7B-Instruct-v0.2 on 100 test samples from GSM8K and WinoGrande using dif- ferent numbers of few-shot demonstration examples. Increasing the number of demonstration examples does not necessarily improve the performance consistently.

Methods

ParaICL moves away from the "one long prompt" approach in favor of a parallelized ensemble strategy. The workflow consists of three main steps:

  1. Semantic Sorting & Batching: Instead of random selection, ParaICL ranks all available demonstration examples by how semantically similar they are to the current test question. These are then grouped into small, manageable batches (e.g., 3-5 examples each).
  2. Parallel Inference: Each batch, paired with the test question, is fed into the LLM simultaneously. This keeps the input length short for each individual pass, avoiding the performance degradation seen with long contexts.
  3. Parallel Semantic Decoding: This is the "secret sauce." The model doesn't just pick one answer. Instead, it looks at the predicted next-token distributions from all batches and combines them using:
  4. Weighted Average Semantic (WAS) Objective: Batches that are more similar to the test question get a higher "vote" in determining the next token.
  5. Adaptive Plausibility Constraint: To prevent the ensemble from generating nonsense, a filtering step ensures the final chosen token is considered highly probable by the most relevant batch.
Figure 3: Our proposed parallel in-context learning (ParaICL) method. Colored squares with black borders denote demonstration samples. Squares filled in grey with matching borders denote test sample ˆxi.

Datasets

The authors evaluated ParaICL across five diverse benchmarks to test different capabilities:

  • Reasoning: GSM8K (grade school math), WinoGrande (commonsense reasoning), and ARC-Challenge (science questions).
  • Natural Language Inference (NLI): HellaSwag (predicting the next event in a story).
  • Coding: MBPP (entry-level Python programming problems).

Key Insights and Ideas

  • More is Better (If Done Right): Unlike standard ICL, where adding examples can hurt, ParaICL's performance generally improves or stays stable as you add more batches (Figure 4).
  • Similarity is the Best Weight: The paper proves that weighting the ensemble by semantic similarity (WAS) significantly outperforms simple majority voting or standard averaging.
  • The "Safety Net" of Plausibility: The adaptive plausibility constraint is critical. Without it, the weighted average can sometimes favor tokens that don't make sense in the local context of the prompt, leading to a total collapse in accuracy.
  • Model Agnostic: The method works across different architectures (Llama, Mistral, Mixtral) and even on closed-source models like GPT-3.5, where only limited probability data (top-5 logprobs) is available.
Figure 4: Accuracy vs. Number of Batches

Key Results

ParaICL consistently outperformed standard few-shot learning and other state-of-the-art selection methods (like LENS or PCW) across almost all tested scenarios.

  • Reasoning Gains: On the GSM8K math dataset, ParaICL improved Llama-2-7B's accuracy by up to 3.7% compared to standard 15-shot learning.
  • Consistency: As seen in Table 1 (Figure 6), ParaICL achieved the highest scores (underlined) in nearly every category for both Llama and Mistral models.
  • Efficiency: While it requires multiple passes, these can be done in parallel. The additional overhead for calculating embeddings is minimal (roughly 5 seconds across an entire dataset).
Table 1: Main Experimental Results

Limitations and Future Work

  • Architecture Scope: The study focused exclusively on decoder-only models. The authors plan to test the method on encoder-only and encoder-decoder structures in the future.
  • Integration: While they showed ParaICL works well with "Contrastive Decoding," they haven't yet explored its synergy with Retrieval-Augmented Generation (RAG), which could provide even more high-quality examples to batch.
  • Computational Cost: Although parallelizable, running multiple batches naturally consumes more compute/memory than a single short prompt. Future work could look at optimizing this tradeoff.

Summary updated

BibTeX
@inproceedings{li2025paraicl,
  author = {Xingxuan Li and Xuan-Phi Nguyen and Shafiq Joty and Lidong Bing},
  title = {{ParaICL: Towards Parallel In-Context Learning}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-long.621},
}
Figure