Batch-ICL: Effective, Efficient, and Order-Agnostic In-Context Learning

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Zhang, Kaiyi, Lv, Ang, Chen, Yuhan, Ha, Hansen, Xu, Tao, Yan, Rui
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866909216903528448
author Zhang, Kaiyi
Lv, Ang
Chen, Yuhan
Ha, Hansen
Xu, Tao
Yan, Rui
author_facet Zhang, Kaiyi
Lv, Ang
Chen, Yuhan
Ha, Hansen
Xu, Tao
Yan, Rui
contents In this paper, by treating in-context learning (ICL) as a meta-optimization process, we explain why LLMs are sensitive to the order of ICL examples. This understanding leads us to the development of Batch-ICL, an effective, efficient, and order-agnostic inference algorithm for ICL. Differing from the standard N-shot learning approach, Batch-ICL employs $N$ separate 1-shot forward computations and aggregates the resulting meta-gradients. These aggregated meta-gradients are then applied to the forward computation of a zero-shot query to generate the final prediction. This batch processing approach renders the LLM agnostic to the order of ICL examples. Through extensive experiments and analysis, we demonstrate that Batch-ICL consistently outperforms most permutations of ICL examples. In some cases, it even exceeds the performance of the best order for standard ICL, all while reducing the computational resources required. Furthermore, we develop a novel variant of Batch-ICL featuring multiple "epochs" of meta-optimization. This variant implicitly explores permutations of ICL examples, further enhancing ICL performance.
format Preprint
id arxiv_https___arxiv_org_abs_2401_06469
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Batch-ICL: Effective, Efficient, and Order-Agnostic In-Context Learning
Zhang, Kaiyi
Lv, Ang
Chen, Yuhan
Ha, Hansen
Xu, Tao
Yan, Rui
Machine Learning
Computation and Language
In this paper, by treating in-context learning (ICL) as a meta-optimization process, we explain why LLMs are sensitive to the order of ICL examples. This understanding leads us to the development of Batch-ICL, an effective, efficient, and order-agnostic inference algorithm for ICL. Differing from the standard N-shot learning approach, Batch-ICL employs $N$ separate 1-shot forward computations and aggregates the resulting meta-gradients. These aggregated meta-gradients are then applied to the forward computation of a zero-shot query to generate the final prediction. This batch processing approach renders the LLM agnostic to the order of ICL examples. Through extensive experiments and analysis, we demonstrate that Batch-ICL consistently outperforms most permutations of ICL examples. In some cases, it even exceeds the performance of the best order for standard ICL, all while reducing the computational resources required. Furthermore, we develop a novel variant of Batch-ICL featuring multiple "epochs" of meta-optimization. This variant implicitly explores permutations of ICL examples, further enhancing ICL performance.
title Batch-ICL: Effective, Efficient, and Order-Agnostic In-Context Learning
topic Machine Learning
Computation and Language
url https://arxiv.org/abs/2401.06469