Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-OptimizersDownload PDF

Published: 04 Mar 2023, Last Modified: 17 Nov 2024ME-FoMo 2023 PosterReaders: Everyone
Keywords: in-context learning, GPT
TL;DR: We figure out that Transformer attention has a dual form of gradient descent and understand in-context learning as implicit finetuning.
Abstract: Large pretrained language models have shown surprising in-context learning (ICL) ability. With a few demonstration input-label pairs, they can predict labels for unseen inputs without parameter updates. Despite the great success in performance, its working mechanism still remains an open question. In this paper, we explain language models as meta-optimizers and understand ICL as implicit finetuning. Theoretically, we figure out that Transformer attention has a dual form of gradient descent. On top of it, we understand ICL as follows: GPT first produces meta-gradients according to the demonstration examples, and then these meta-gradients are applied to the original GPT to build an ICL model. We compare the behaviors of ICL and explicit finetuning on real tasks to provide empirical evidence that supports our understanding. Experimental results show that in-context learning behaves similarly to explicit finetuning from multiple perspectives.
Community Implementations: [![CatalyzeX](/images/catalyzex_icon.svg) 2 code implementations](https://www.catalyzex.com/paper/why-can-gpt-learn-in-context-language-models/code)
0 Replies

Loading