Focused Large Language Models are Stable Many-Shot Learners

Peiwen Yuan, Shaoxiong Feng, Yiwei Li, Xinglin Wang, Yueqi Zhang +5 more
8/26/2024
cs.CLcs.AI

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

In-Context Learning (ICL) enables large language models (LLMs) to achieve rapid task adaptation by learning from demonstrations. With the increase in available context length of LLMs, recent experiments have shown that the performance of ICL does not necessarily scale well in many-shot (demonstration) settings. We theoretically and experimentally confirm that the reason lies in more demonstrations dispersing the model attention from the query, hindering its understanding of key content. Inspired by how humans learn from examples, we propose a training-free method FocusICL, which conducts triviality filtering to avoid attention being diverted by unimportant contents at token-level and operates hierarchical attention to further ensure sufficient attention towards current query at demonstration-level. We also design an efficient hyperparameter searching strategy for FocusICL based on model perplexity of demonstrations. Comprehensive experiments validate that FocusICL achieves an average performance improvement of 5.2% over vanilla ICL and scales well with many-shot demonstrations.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 2 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{yuan2024focused,
  title  = {Focused Large Language Models are Stable Many-Shot Learners},
  author = {Peiwen Yuan and Shaoxiong Feng and Yiwei Li and Xinglin Wang and Yueqi Zhang and Chuyi Tan and Boyuan Pan and Heda Wang and Yao Hu and Kan Li},
  year   = {2024},
  eprint = {2408.13987},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.13987v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2408.13987.svg)](https://codeofpaper.com/paper/2408.13987)

Discussion