Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learning

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Wang, Xinyi, Zhu, Wanrong, Saxon, Michael, Steyvers, Mark, Wang, William Yang
Format: Preprint
Published: 2023
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914676557742080
author Wang, Xinyi
Zhu, Wanrong
Saxon, Michael
Steyvers, Mark
Wang, William Yang
author_facet Wang, Xinyi
Zhu, Wanrong
Saxon, Michael
Steyvers, Mark
Wang, William Yang
contents In recent years, pre-trained large language models (LLMs) have demonstrated remarkable efficiency in achieving an inference-time few-shot learning capability known as in-context learning. However, existing literature has highlighted the sensitivity of this capability to the selection of few-shot demonstrations. Current understandings of the underlying mechanisms by which this capability arises from regular language model pretraining objectives remain disconnected from the real-world LLMs. This study aims to examine the in-context learning phenomenon through a Bayesian lens, viewing real-world LLMs as latent variable models. On this premise, we propose an algorithm to select optimal demonstrations from a set of annotated data with a small LM, and then directly generalize the selected demonstrations to larger LMs. We demonstrate significant improvement over baselines, averaged over eight GPT models on eight real-world text classification datasets. We also demonstrate the real-world usefulness of our algorithm on GSM8K, a math word problem dataset. Our empirical findings support our hypothesis that LLMs implicitly infer a latent variable containing task information.
format Preprint
id arxiv_https___arxiv_org_abs_2301_11916
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learning
Wang, Xinyi
Zhu, Wanrong
Saxon, Michael
Steyvers, Mark
Wang, William Yang
Computation and Language
Artificial Intelligence
Machine Learning
In recent years, pre-trained large language models (LLMs) have demonstrated remarkable efficiency in achieving an inference-time few-shot learning capability known as in-context learning. However, existing literature has highlighted the sensitivity of this capability to the selection of few-shot demonstrations. Current understandings of the underlying mechanisms by which this capability arises from regular language model pretraining objectives remain disconnected from the real-world LLMs. This study aims to examine the in-context learning phenomenon through a Bayesian lens, viewing real-world LLMs as latent variable models. On this premise, we propose an algorithm to select optimal demonstrations from a set of annotated data with a small LM, and then directly generalize the selected demonstrations to larger LMs. We demonstrate significant improvement over baselines, averaged over eight GPT models on eight real-world text classification datasets. We also demonstrate the real-world usefulness of our algorithm on GSM8K, a math word problem dataset. Our empirical findings support our hypothesis that LLMs implicitly infer a latent variable containing task information.
title Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learning
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2301.11916