Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

A Survey on In-context Learning

Survey maps how in-context learning works and where it still falls short

  • Problem In-context learning shifts with the prompt template, the chosen demonstrations and their order. The mechanism behind these swings is unclear, so results are hard to predict.
  • Method The authors survey in-context learning by training, prompt design and analysis.
  • Results The top demonstration selector depends on the model. On GPT2, mdl averages 54.4 against 49.5 for topk, but on Llama3 topk leads with 71.5 against 70.9.

Why ICL needs a shared map

In-context learning lets a language model handle a new task from a few examples placed in its prompt. The weights stay fixed, so the adaptation cost is a prompt rather than a training run. That convenience has a catch, because the prediction can swing with the template, the chosen demonstrations and their order. The mechanism behind those swings is also unclear, which makes them hard to predict.

The authors respond with one map of the field that covers training, prompt design and analysis.

The formal setup starts from a query x and a set of candidate answers Y. A demonstration set C holds an optional instruction I and k demonstrations, each written in natural language. Each candidate y_j gets the score \( P(y_j \mid x) \) defined as \( f_M(y_j, C, x) \), and the prediction is the candidate with the highest score. ICL sits inside prompt tuning, since its demonstrations form part of the prompt.

Few-shot learning differs because it updates parameters, while ICL doesn't.

Training before inference

Some gains come from training before inference, and the authors split this into pretraining and warmup. Pretraining reorganizes corpora by grouping related contexts, so the model learns to reason across earlier examples. Warmup is a later, optional stage that changes parameters before inference. Symbol tuning, one warmup method, swaps labels such as positive and negative for arbitrary symbols, so the model must learn the mapping from context.

Instruction tuning is another warmup route, and FLAN tuned a 137B LaMDA-PT model on over 60 datasets written as instructions. That tuning raised both zero-shot and few-shot ICL performance. Because every warmup method updates parameters, the authors read this as room for the original model to improve, and they recommend warmup even though ICL doesn't strictly need it.

How demonstrations are picked and scored

Unsupervised selectors score candidate demonstrations with a fixed rule, and supervised selectors learn that rule from data. The simplest rule is nearest neighbors: KATE retrieves similar examples using a distance such as L2 or cosine similarity on sentence embeddings. Other unsupervised rules need no labelled data, such as mutual information, perplexity, or the LLM's own output scores.

mdl picks the best subset permutation of kNN examples by the code length needed to transmit the label given the input and the demonstrations.

Fixed rules are heuristic, so supervised methods learn the selection instead. EPR recalls similar candidates with an unsupervised method such as BM25, then trains a dense retriever on them. Zhang et al. (2022a) treat selection as a Markov decision process and use Q-learning, with validation accuracy as the reward.

Once demonstrations are chosen, a scoring function turns model outputs into answer likelihoods. The Direct method uses the conditional probability of answer tokens, but it requires those tokens to sit at the end of the input, which limits template design. PPL scores the whole sequence, including demonstrations, query and label, which removes the position limit but adds computation.

Channel reverses the direction and estimates the query given the label, which the authors expect to help under imbalanced training data.

Which selector wins across models

The authors compared topk, votek and mdl on SST5, SST2, CommonsenseQA, SNLI and AG News. Each input got 8 demonstrations, and inference used the PPL-based approach. For SNLI and AG News, retrieval drew on 1000 training items and testing used the first 1000 test items. The four models were GPT2, GPT-J, Qwen2 and Llama3.

The winning selector changes with the model, and that is the core result here. On GPT2, mdl reaches an average of 54.4, compared to 49.5 for topk. On GPT-J, topk averages 63.9, compared to 63.5 for mdl. On Llama3, topk reaches 71.5, compared to 70.9 for mdl. So the authors read selector effectiveness as model-dependent, with mdl leading only on GPT2.

This check covers three selectors and one inference route, so it can't rank the other methods in the survey.

Latency and stability of the scoring functions

PPL and Channel cost more time than Direct, because they score more of the input. Averaged over four models with 8 in-context examples, the latency ratio relative to Direct is 2.61 for PPL and 2.90 for Channel.

Stability asks whether scores move when the demonstrations change. The authors used a test set of size 10k, five random seeds, and 8 examples drawn from 5k training examples each time. Averaged over the four models, variance is 0.93 for Direct, 0.78 for PPL and 3.03 for Channel. Lower variance means steadier scores, so Channel is the least stable of the three here.

The takeaway favors Channel for imbalanced data, but these runs don't measure imbalance. The efficiency and stability runs are separate measurements, so their settings should be read separately.

What the analyses say about the mechanism

Attention is the module that most studies of the ICL mechanism focus on. Olsson et al. (2022) identified induction heads, which copy earlier patterns to predict the next token, and the authors link them to ICL ability. Wang et al. (2023b) found that demonstration label words act as anchors that gather and spread information for the final prediction.

The Bayesian view treats ICL as identifying a shared latent concept among the examples. The gradient descent view finds that Transformer attention has a dual form with gradient descent, so GPT-based ICL resembles explicit fine-tuning. These links come from simplified regression settings, and their fit to real contexts is still debated.

On the factor side, Liu et al. (2022) found that demonstrations whose embeddings sit closer to the query usually perform better. Most analytical work, though, stays with simple tasks and small models.

Limits of the survey and open problems

The survey admits it may have missed equally valuable contributions in demonstration design and analysis. Many covered papers used models that were not the newest, and the authors call for up-to-date work.

Efficiency and scalability remain open, since more demonstrations raise cost and use up the input length. Compressing demonstrations into vectors trades away performance or needs model parameters, which closed models like ChatGPT and Claude don't expose. Long-context ICL is also open, since more demonstrations don't always help and can even hurt.

LongICLBench reveals further weaknesses in how LLMs read extended demonstrations.

Paper info

Authors
Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Jingyuan Ma, Rui Li, Heming Xia, Jingjing Xu, Zhiyong Wu, Tianyu Liu, Baobao Chang, Xu Sun, Lei Li, Zhifang Sui
Venue
arXiv · Preprint
First published
2022-12-31
Added
2026-11-12
Updated
2024-10-5
Version
v6
arXiv
2301.00234
Category
cs.CL · cs.AI
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Jingyuan Ma, Rui Li, Heming Xia, Jingjing Xu, Zhiyong Wu, Tianyu Liu, Baobao Chang, Xu Sun, Lei Li, Zhifang Sui (2022). A Survey on In-context Learning. arXiv:2301.00234v6. https://arxiv.org/abs/2301.00234v6

BibTeX
@misc{dong2022survey,
  title = {{A Survey on In-context Learning}},
  author = {Qingxiu Dong and Lei Li and Damai Dai and Ce Zheng and Jingyuan Ma and Rui Li and Heming Xia and Jingjing Xu and Zhiyong Wu and Tianyu Liu and Baobao Chang and Xu Sun and Lei Li and Zhifang Sui},
  year = {2022},
  eprint = {2301.00234},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2301.00234v6}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up