Interactive Implicit In-context Learning

Bin Shi, Hao Wu, Kai Sun, Aoxiang Zhou, Ziqi Liu, Zhiqiang Zhang, Jun Zhou, Jingyao Zhang, Peng Liu, Bo DongOpenReview 2026 · Submission to ICLR 2026 · Rejected

TL;DR

Standard In-Context Learning (ICL) is powerful but computationally expensive, while "Implicit" ICL methods are fast but often sacrifice reasoning quality. This paper introduces Interactive Implicit In-Context Learning ($I^3CL$), a framework that restores the "interactive" reasoning of standard ICL—allowing demonstrations to talk to each other and to the query—while maintaining the lightning-fast inference speeds of implicit methods.

What Problem Does This Paper Address?

Large Language Models (LLMs) are famous for In-Context Learning (ICL): give them a few examples (demonstrations) in a prompt, and they can perform a new task without any weight updates. However, standard ICL has two major headaches:

  1. Efficiency: Computational costs grow quadratically with the number of demonstrations.
  2. Instability: Performance changes wildly based on the order or format of those examples.

To solve this, researchers previously developed Implicit ICL ($I^2CL$). This approach compresses demonstrations into a single "task vector" that is injected into the model's latent space. While $I^2CL$ is incredibly fast and order-invariant, it has a "reasoning gap." It treats every demonstration as an independent island and averages them together. In contrast, standard ICL uses self-attention, which allows demonstrations to interact and allows the specific test query to "pick" which examples are most relevant. By ignoring these interactions, previous implicit methods struggled with complex reasoning tasks.

Methods

The authors propose $I^3CL$, which adds two lightweight "interactive" modules to the implicit ICL pipeline:

  1. Inter-demonstration Interaction: Instead of encoding each example in isolation, $I^3CL$ uses a self-attention mechanism between the demonstration vectors. This allows the examples to "exchange information," helping the model identify global task regularities rather than just local patterns.
  2. Demonstration-to-query Interaction: Instead of a simple average of all examples, $I^3CL$ uses cross-attention. The model looks at the specific test query and dynamically weights the demonstrations, focusing on the examples most relevant to the current input.
  3. Dual-Token Representation: To avoid the "positional bias" where models focus too much on the very last token, they represent each demonstration using an average of the "Prompt Last Token" and the "Label Last Token."

The framework uses a small amount of Parameter-Efficient Fine-Tuning (PEFT) to calibrate these interaction modules, but the LLM's core weights remain frozen.

Datasets

The researchers evaluated $I^3CL$ across nine diverse tasks using four different LLM backbones (LLaMA2-7B, LLaMA3-8B, GLM4-9B, and DeepSeek-R1):

  • Classification: SST-2 & SST-5 (Sentiment), TREC (Question type), AGNews & DBPedia (Topic), MR (Movie reviews), Subj (Subjectivity), and HateSpeech18.
  • Text Generation: ParaDetox (Style transfer/detoxification), which requires rewriting toxic sentences into neutral ones while preserving meaning.

Key Insights and Ideas

  • The "Entropy" of Averaging: The authors argue that simple average pooling (used in prior SOTA) leads to "high entropy loss." It flattens the information, treating a highly relevant example the same as a mediocre one. $I^3CL$ proves that selective attention is the "secret sauce" of ICL's success.
  • Discriminative Task Vectors: One of the most striking findings is that prior implicit methods produced task vectors that looked very similar across different tasks (e.g., a sentiment task vector looked 85% similar to a question classification vector). $I^3CL$ produces vectors that are much more distinct and "task-aware."
  • Scalability without the Crash: Standard ICL often hits "Out-Of-Memory" (OOM) errors when you try to give it 100 examples. Because $I^3CL$ compresses these into vectors, it can handle 100-shot learning with only a tiny increase in memory and latency.

Key Results

  • Performance Boost: $I^3CL$ achieved an average accuracy improvement of 7.26% over the previous state-of-the-art implicit method ($I^2CL$).
  • Beating Fine-Tuning: On several tasks, $I^3CL$ actually outperformed LoRA fine-tuning, despite being much lighter to implement.
  • Generative Success: In the ParaDetox task, $I^3CL$ reduced toxicity to 24.80%, significantly better than the 39.54% achieved by previous implicit methods, proving it works for more than just simple classification.
  • Efficiency: While adding interactions increases overhead slightly, the inference speed remains nearly "zero-shot" (only ~1.3% slower than the non-interactive version), making it viable for real-world deployment.

Limitations and Future Work

While $I^3CL$ is a major step forward, the authors note a few areas for growth:

  • Offline Calibration: The method still requires an offline "bootstrapping" or calibration stage to tune the interaction coefficients for a specific task.
  • Diversity in Selection: The current demonstration-to-query interaction focuses on similarity. The authors suggest that future versions could incorporate "diversity-aware" strategies to ensure the model sees a wide range of relevant examples rather than just the most similar ones.
  • Long-form Generation: While tested on style transfer, more research is needed to see how these injected vectors hold up over very long, multi-paragraph generations.

Summary updated

Abstract

In-context learning (ICL) empowers large language models (LLMs) to generalize from few-shot demonstrations but faces challenges with quadratic computational complexity and unstable performance as demonstration counts increase. Implicit ICL (I$^2$CL) addresses these limitations by encoding demonstrations into a unified task vector injected during inference, achieving significant efficiency gains and order invariance. However, existing approaches prioritize inference efficiency, sacrificing interactive capabilities crucial to standard ICL—inter-demonstration and demonstration-query interactions. Substantial research underscores that these interactions are fundamental for strong reasoning performance. To bridge this critical gap, we propose Interactive Implicit In-Context Learning (I$^3$CL), a simple yet effective framework that restores such essential capabilities of standard ICL. I$^3$CL integrates only two lightweight interactive modules, preserving I$^2$CL's core efficiency with minimal computational overhead. Experimental evaluation across nine diverse tasks using four LLMs show that I$^3$CL delivers a significant average performance gain of 7.26\% over prior I$^2$CL baselines. This substantial improvement strongly indicates that restoring interactive capabilities is essential for advancing the effectiveness of implicit ICL methods.
BibTeX
@misc{shi2026interactive,
  author = {Bin Shi and Hao Wu and Kai Sun and Aoxiang Zhou and Ziqi Liu and Zhiqiang Zhang and JUN ZHOU and Jingyao Zhang and Peng Liu and Bo Dong},
  title = {{Interactive Implicit In-context Learning}},
  year = {2026},
  url = {https://openreview.net/forum?id=MW7eI7oPeI},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2026},
}

Loading related content...

Figure