atlas

Research map / Large language models / Language, safety and interpretability

Implicit In-context Learning

ICLR 2025 · Large language models › Language, safety and interpretability · approach: In-context learning analysis · 1 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes Implicit In-context Learning (I2CL), which compresses demonstrations into a context vector and injects a learned linear combination of it into residual streams, giving few-shot-level accuracy at zero-shot inference cost.

Problem

In-context learning adds large compute and KV-cache memory overhead proportional to demonstration length and is sensitive to demonstration choice and order; zero-shot inference is cheap but weak.

Approach

Extract per-demonstration MHA and MLP activations at the end token across layers, average them into a permutation-invariant context vector, and inject a learned linear combination (scalars per layer, calibrated with noisy self-calibration on the same few-shot examples) into the residual stream of the query, replacing attention to demonstration tokens.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Replace zero-shot inference with I2CL context vectorization and injectionLlama2-7b · Nine-task averageaccuracy: 58.13 -> 75.12Helped
Replace standard few-shot ICL with I2CLLlama2-7b · Nine-task averageaccuracy: 76.37 -> 75.12Hurt
Replace random noise with demonstration-derived context vectorsI2CL · Llama2-7b, nine-task averageaccuracy: 34.61 -> 75.12Helped
Transfer similar-task context vectors and coefficientsI2CL · SST-5accuracy: 39.12 -> 43.24Helped
Transfer similar-task context vectors and coefficientsI2CL · MRaccuracy: 87.68 -> 89.99Helped
Add I2CL while retaining the ICL demonstration tokensICL · Nine-task averageaccuracy: 75.21 -> 81.96Helped
Use MHA+MLP activations rather than MHA alone (ablation)I2CL · Llama2-7b, nine-task averageaccuracy: 66.97 -> 75.12Helped
Use MHA+MLP activations rather than MLP alone (ablation)I2CL · Llama2-7b, nine-task averageaccuracy: 70.27 -> 75.12Helped
Use MHA+MLP activations rather than hidden states (ablation)I2CL · Llama2-7b, nine-task averageaccuracy: 56.80 -> 75.12Helped
Inject into all layers rather than early layers only (ablation)I2CL · Llama2-7b, nine-task averageaccuracy: 58.18 -> 75.12Helped
Inject into all layers rather than middle layers only (ablation)I2CL · Llama2-7b, nine-task averageaccuracy: 64.07 -> 75.12Helped
Inject into all layers rather than late layers only (ablation)I2CL · Llama2-7b, nine-task averageaccuracy: 64.03 -> 75.12Helped

Surprising findings

Limitations

Experimental setup

Datasets: SST-2 SST-5 EmoC TREC AGNews MR DBPedia Subj hate_speech18

Benchmarks: SST-2 SST-5 TREC AGNews Subj HateSpeech18 DBPedia EmoC MR

Metrics: macro-average accuracy inference speed cached memory cached parameter count

Baselines: Zero-shot Few-shot (ICL) Noise vector Label-anchor Task-vector ICV AutoCompressors ICAE CEPE Prompt-tuning LoRA IA3

Builds on: in-context vector task vector label words are anchors linear representation hypothesis IA3

Closest papers by meaning

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.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy