In-context Learning and Gradient Descent Revisited

Gilad Deutch, Nadav Magar, Tomer Bar Natan, Guy Dar
11/13/2023
33 citations
cs.CLcs.LG

Official code: GiilDe/ft-vs-icl (4 stars, Python, Apache-2.0, last commit 2023-12-14).

Abstract

In-context learning (ICL) has shown impressive results in few-shot learning tasks, yet its underlying mechanism is still not fully understood. A recent line of work suggests that ICL performs gradient descent (GD)-based optimization implicitly.

Show full abstract

While appealing, much of the research focuses on simplified settings, where the parameters of a shallow model are optimized. In this work, we revisit evidence for ICL-GD correspondence on realistic NLP tasks and models. We find gaps in evaluation, both in terms of problematic metrics and insufficient baselines. We show that surprisingly, even untrained models achieve comparable ICL-GD similarity scores despite not exhibiting ICL. Next, we explore a major discrepancy in the flow of information throughout the model between ICL and GD, which we term Layer Causality. We propose a simple GD-based optimization procedure that respects layer causality, and show it improves similarity scores significantly.

View on arXivView PDF

Code Implementations(1)

GiilDe/ft-vs-iclOfficial100%
Apache-2.0
40Python, ShellJul 30, 20232 years agoApache-2.0

Similar Papers

Cite this paper

@article{deutch2023incontext,
  title  = {In-context Learning and Gradient Descent Revisited},
  author = {Gilad Deutch and Nadav Magar and Tomer Bar Natan and Guy Dar},
  year   = {2023},
  eprint = {2311.07772},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2311.07772v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2311.07772.svg)](https://codeofpaper.com/paper/2311.07772)

Discussion