Selecting Demonstrations for Many-Shot In-Context Learning via Gradient Matching
School of Computer Science and Engineering, Beihang University, China(北京航空航天大学计算机科学与工程学院);Meituan, Inc.(美团公司);Beijing Institute for General Artificial Intelligence, China(北京通用人工智能研究院);Ping An Technology, China(平安科技);Department of Computer Science, University of Manchester, UK(曼彻斯特大学计算机科学系)
Jianfei Zhang, Bei Li, Jun Bai, Rumei Li, Yanmeng Wang, Chenghua Lin, Wenge Rong
In-Context Learning (ICL) empowers Large Language Models (LLMs) for rapid task adaptation without Fine-Tuning (FT), but its reliance on demonstration selection remains a critical challenge. While many-shot ICL shows promising performance through scaled demonstrations, the selection method for many-shot demonstrations remains limited to random selection in existing work. Since the conventional instance-level retrieval is not suitable for many-shot scenarios, we hypothesize that the data requirements for in-context learning and fine-tuning are analogous. To this end, we introduce a novel gradient matching approach that selects demonstrations by aligning fine-tuning gradients between the entire training set of the target task and the selected examples, so as to approach the learning effect on the entire training set within the selected examples. Through gradient matching on relatively small models, e.g., Qwen2.5-3B or Llama3-8B, our method consistently outperforms random selection on larger LLMs from 4-shot to 128-shot scenarios across 9 diverse datasets. For instance, it surpasses random selection by 4% on Qwen2.5-72B and Llama3-70B, and by around 2% on 5 closed-source LLMs. This work unlocks more reliable and effective many-shot ICL, paving the way for its broader application.
Demonstration Augmentation for Zero-shot In-context Learning
School of Computer Science and Technology, Soochow University(苏州大学计算机科学与技术学院);Department of Computer Science and Technology, Tsinghua University(清华大学计算机科学与技术系)
LLM-based MOFs Synthesis Condition Extraction using Few-Shot Demonstrations
School of Computer Science, Beihang University(北京航空航天大学计算机学院);School of Materials Science & Engineering, University of Science and Technology Beijing(北京科技大学材料科学与工程学院);Westlake University(西湖大学)
Beyond Many-Shot Translation: Scaling In-Context Demonstrations For Low-Resource Machine Translation
Institute of Information Science, Academia Sinica(台湾“中央研究院”信息科学研究所);National Taiwan University of Science and Technology(台湾科技大学);Ecole Centrale de Marseille(马赛中央理工学院);National University of Singapore(新加坡国立大学)
PANDAS: Improving Many-shot Jailbreaking via Positive Affirmation, Negative Demonstration, and Adaptive Sampling
University of Toronto, Vector Institute(多伦多大学,向量研究所);University of Oxford(牛津大学);Polytechnique Montréal, Mila - Quebec AI Institute, University of Toronto(蒙特利尔理工学院,魁北克人工智能研究所,多伦多大学)
Metacognition-Enhanced Few-Shot Prompting With Positive Reinforcement
Institute of AI for Education, East China Normal University(华东师范大学教育人工智能研究院);School of Computer Science and Technology, East China Normal University(华东师范大学计算机科学与技术学院);Shanghai Changning Mental Health Center(上海市长宁区精神卫生中心)
What Makes In-context Learning Effective for Mathematical Reasoning: A Theoretical Analysis
University of Science and Technology of China(中国科学技术大学);State Key Laboratory of Cognitive Intelligence(认知智能国家重点实验室);Hong Kong University of Science and Technology(香港科技大学);University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)
TEGEE: Task dEfinition Guided Expert Ensembling for Generalizable and Few-shot Learning
HKUST(香港科技大学);University of Manchester(曼彻斯特大学);Institute of Automation, CAS(中国科学院自动化研究所);University of Chinese Academy of Sciences(中国科学院大学);M-A-P;Beijing University of Posts and Telecommunications(北京邮电大学);Ohio State University(俄亥俄州立大学);University of Waterloo(滑铁卢大学);Peking University(北京大学);BAAI(北京智源人工智能研究院)
DemoShapley: Valuation of Demonstrations for In-Context Learning
Department of Mathematics and Computer Science(数学与计算机科学系);Eindhoven University of Technology(埃因霍温理工大学);Intel Lab(英特尔实验室);Department of Psychology(心理学系);University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Department of Data Science(数据科学系);New Jersey Institute of Technology(新泽西理工学院);Department of Computer Science(计算机科学系);University of Illinois Chicago(伊利诺伊大学芝加哥分校)
Adaptive Cross-lingual Text Classification through In-Context One-Shot Demonstrations
Mathematics Research Center (CIMAT)(数学研究中心(CIMAT));Mohamed bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学);Consejo Nacional de Humanidades, Ciencias y Tecnologías(国家人文科学技术委员会);University of Houston(休斯顿大学)