The Role of Diversity in In-Context Learning for Large Language Models

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Xiao, Wenyang, Zhao, Haoyu, Huang, Lingxiao
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866910988461146112
author Xiao, Wenyang
Zhao, Haoyu
Huang, Lingxiao
author_facet Xiao, Wenyang
Zhao, Haoyu
Huang, Lingxiao
contents In-context learning (ICL) is a crucial capability of current large language models (LLMs), where the selection of examples plays a key role in performance. While most existing approaches focus on selecting the most similar examples to the query, the impact of diversity in example selection remains underexplored. We systematically investigate the role of diversity in in-context example selection through experiments across a range of tasks, from sentiment classification to more challenging math and code problems. Experiments on Llama-3.1, Gemma-2, and Mistral-v0.3 families of models show that diversity-aware selection methods improve performance, particularly on complex tasks like math and code, and enhance robustness to out-of-distribution queries. To support these findings, we introduce a theoretical framework that explains the benefits of incorporating diversity in in-context example selection.
format Preprint
id arxiv_https___arxiv_org_abs_2505_19426
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle The Role of Diversity in In-Context Learning for Large Language Models
Xiao, Wenyang
Zhao, Haoyu
Huang, Lingxiao
Computation and Language
Artificial Intelligence
Machine Learning
In-context learning (ICL) is a crucial capability of current large language models (LLMs), where the selection of examples plays a key role in performance. While most existing approaches focus on selecting the most similar examples to the query, the impact of diversity in example selection remains underexplored. We systematically investigate the role of diversity in in-context example selection through experiments across a range of tasks, from sentiment classification to more challenging math and code problems. Experiments on Llama-3.1, Gemma-2, and Mistral-v0.3 families of models show that diversity-aware selection methods improve performance, particularly on complex tasks like math and code, and enhance robustness to out-of-distribution queries. To support these findings, we introduce a theoretical framework that explains the benefits of incorporating diversity in in-context example selection.
title The Role of Diversity in In-Context Learning for Large Language Models
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2505.19426