HyperAIHyperAI

Command Palette

Search for a command to run...

Outstanding Paper Honorable MentionICLR 2024

인-컨텍스트 분류 과제에서 데이터 의존성과 급격한 학습의 메커니즘적 기초

Gautam Reddy

초록

트랜스포머 모델은 인-컨텍스트 학습(in-context learning) 능력을 보인다. 이는 입력 시퀀스에 포함된 예시를 바탕으로 새로운 쿼리에 대한 응답을 정확하게 예측하는 능력이다. 인-컨텍스트 학습은 쿼리-출력 관계의 전통적인 가중치 내 학습(in-weights learning)과 대비된다. 학습 데이터 분포와 아키텍처의 어떤 측면이 인-컨텍스트 학습과 가중치 내 학습 중 어느 쪽을 선호하게 하는가? 최근 연구에서는 버스팅(burstiness), 대규모 어휘집, 왜곡된 순위-빈도 분포와 같이 언어에 내재된 특정한 분포적 특성이 이 두 가지 학습 형태 간의 트레이드오프 또는 동시 출현을 조절함을 보였다. 본 연구는 먼저 단순화된 데이터셋에서 학습된 최소한의 어텐션 전용 네트워크에서 이러한 결과가 재현됨을 보인다. 인-컨텍스트 학습(ICL)은 유도 헤드(induction head)의 급격한 출현에 의해 구동되며, 이는 이후 가중치 내 학습과 경쟁한다. 인-컨텍스트 학습에 선행하는 진행 지표와 표적 실험을 식별함으로써, 어텐션 기반 네트워크가 보여주는 완전한 데이터 분포 의존성을 모방하는 유도 헤드의 2-매개변수 모델을 구성한다. 유도 헤드 형성의 현상론적 모델은 그 급격한 출현을 내재적 커리큘럼에 의해 가능해지는 세 중첩 로짓의 순차적 학습으로 추적한다. 본 연구는 어텐션 기반 네트워크에서 발생하는 급격한 전이는 ICL을 달성하기 위해 필요한 다층 연산의 특정한 사슬에 기인하며, 이는 학습 중에 순차적으로 학습되는 중첩 비선형성으로 구현됨을 제안한다.

One-sentence Summary

Researchers at Princeton University, NTT Research, and Harvard University reveal the mechanistic basis of in-context learning in attention-only transformers by demonstrating that its abrupt emergence is driven by induction head formation through sequential learning of nested logits enabled by an intrinsic curriculum, and that a minimal two-parameter model recapitulates data distributional effects including burstiness and skewed rank-frequency distributions.

Key Contributions

  • The paper reproduces the distributional dependencies that influence the balance between in-context learning and in-weights learning in a minimal attention-only network trained on a simplified dataset, showing that in-context learning is driven by the abrupt emergence of an induction head.
  • This work builds a two-parameter model of an induction head and identifies progress measures and targeted experiments that capture how features such as burstiness, large dictionaries, and skewed rank-frequency distributions shape learning dynamics, with the model emulating the broader distributional dependencies of the attention-based network.
  • The paper develops a phenomenological model of the loss landscape to explain abrupt in-context learning transitions as the sequential learning of three nested logits enabled by an intrinsic curriculum, offering a mechanistic account of sharp transitions in transformer training.

Introduction

Large language models exhibit in-context learning, where example query-response pairs in the prompt allow the model to answer a new query without weight updates. This matters because it supports zero-shot generalization and often appears abruptly during training, sometimes alongside the formation of induction heads that support simple associative copying. Prior work identified data distribution features that favor in-context learning over in-weights learning, but the mechanistic origin of the abrupt transition and the minimal circuit required remained unclear. The authors leverage a simplified two-layer attention-only setting to show that induction-head formation drives this transition, and they build a minimal model with a loss-landscape analysis to explain the sharp dynamics created by nested nonlinearities.

Method

The authors leverage a causal sequence-based framework that trains a transformer-like attention network to predict the label of a target item from an alternating sequence of context items and labels. The network observes a prompt of the form x1,ℓ1,x2,ℓ2,…,xN,ℓN,xq,?x_1, \ell_1, x_2, \ell_2, \dots, x_N, \ell_N, x_q, ?x1​,ℓ1​,x2​,ℓ2​,…,xN​,ℓN​,xq​,? and is trained to assign the target xqx_qxq​ to one of LLL labels. The first NNN labeled pairs provide the in-context signal, while the final unassigned query requires prediction. This setup allows the model to rely either on in-weights learning, where it uses class structure memorized in its parameters, or on in-context learning, where it uses label information explicitly supplied by the prompt. Refer to the framework diagram.

Each item and label is represented in P+DP + DP+D dimensions. The first PPP dimensions encode position, while the remaining DDD dimensions encode content. Position is represented by a one-hot vector, and the input sequence is placed in a random window of length 2N+12N+12N+1 within the positional range. This random-window placement encourages translation-invariant computation, reducing reliance on absolute positional cues and making the task more sensitive to local associative structure between items and labels.

The item content is generated from a Gaussian mixture model with KKK classes. For a class kkk with mean vector μk\mu_kμk​, the normalized content vector of item xix_ixi​ is

x~i=μk+εη1+ε2,\tilde{x}_i = \frac{\mu_k + \varepsilon \eta}{\sqrt{1 + \varepsilon^2}},x~i​=1+ε2​μk​+εη​,

where η\etaη has the same distribution as μk\mu_kμk​, and ε\varepsilonε controls within-class variability. The normalization keeps the average item norm close to one. Classes are assigned to LLL labels, and label vectors are also drawn from the same content distribution before training. Within a given prompt, each label appears equally often, while the training objective guarantees that at least one context item belongs to the target’s class. Training uses a cross-entropy loss on the final label prediction.

The data distribution can be modulated beyond the number of classes and within-class noise. The main control variables are the class rank-frequency distribution and burstiness. Burstiness specifies how many repeated items from the same class appear in a prompt, and a fraction pBp_BpB​ of training sequences follows this bursty structure. This parameterization makes it possible to expose the network to varying degrees of in-context redundancy and class imbalance.

To distinguish in-weights learning from in-context learning, the authors use complementary evaluation protocols. For in-weights learning, the target and context items are sampled independently from the training class distribution, making it unlikely that the target class appears in the prompt. The network must therefore rely on class structure encoded in its weights. For in-context learning, the target and context items belong to novel classes, and only the label associations are available through the prompt. The network must use the in-context label structure rather than memorized class knowledge. A second in-context metric further removes the benefit of label memorization by swapping the labels during evaluation, so the model must follow the label bindings provided in the prompt.

The architecture is a two-layer attention-only encoder followed by a classification head. Each attention layer contains one causal attention head. Given an input sequence u1,u2,…,unu_1, u_2, \dots, u_nu1​,u2​,…,un​, the first attention layer computes

vi=ui+V1∑j≤ipij(1)uj,v_i = u_i + V_1 \sum_{j \leq i} p_{ij}^{(1)} u_j,vi​=ui​+V1​j≤i∑​pij(1)​uj​,

and the second layer computes

wi=vi+V2∑j≤ipij(2)vj.w_i = v_i + V_2 \sum_{j \leq i} p_{ij}^{(2)} v_j.wi​=vi​+V2​j≤i∑​pij(2)​vj​.

The attention weights are defined as

pij(μ)=exp⁡((Kμuj)⊤(Qμui))∑k≤iexp⁡((Kμuk)⊤(Qμui)),p_{ij}^{(\mu)} = \frac{ \exp\left( (K_\mu u_j)^\top (Q_\mu u_i) \right) }{ \sum_{k \leq i} \exp\left( (K_\mu u_k)^\top (Q_\mu u_i) \right) },pij(μ)​=∑k≤i​exp((Kμ​uk​)⊤(Qμ​ui​))exp((Kμ​uj​)⊤(Qμ​ui​))​,

where QμQ_\muQμ​, KμK_\muKμ​, and VμV_\muVμ​ are the query, key, and value matrices for layer μ\muμ. The final representation wnw_nwn​ is passed to a three-layer MLP with ReLU activations and a softmax output over the LLL labels. The classifier is intentionally deep so that strong in-weights classification remains feasible even when the number of underlying classes is large.

Training uses fixed core parameters unless otherwise varied, including L=32L = 32L=32, N=8N = 8N=8, D=63D = 63D=63, ε=0.1\varepsilon = 0.1ε=0.1, and a flat class rank-frequency exponent α=0\alpha = 0α=0. The attention query-key dimension and MLP hidden dimension are both 128128128. Each experiment is repeated across multiple random seeds, with training using a batch size of 128128128 and vanilla stochastic gradient descent at a learning rate of 0.010.010.01. The training curves track both in-weights and in-context accuracy, enabling the model’s learning dynamics to be interpreted as a trade-off between memorizing class structure and exploiting label associations in the prompt.

Experiment

Using a simplified transformer trained on synthetic sequences, the experiments systematically vary data distribution properties such as burstiness, class diversity, within class variation, and frequency skew to test when in context learning and in weights learning emerge, compete, or coexist. The results reproduce known distributional trade-offs, show that highly skewed frequencies can promote both forms of learning, and demonstrate that separate mechanisms can be acquired together. Attention dynamics and ablation studies with a minimal induction head model show that an initial slow phase of learning contextual labels prepares the network for an abrupt transition to structured attention and zero shot copying, supporting induction head formation as the core mechanism behind in context learning. A phenomenological loss landscape analysis further explains this abruptness as sequential optimization over nested decision logits and indicates that easier contextual cues can provide an intrinsic curriculum for reliably acquiring the in context solution.


AI로 AI 구축

아이디어에서 출시까지 — 무료 AI 코코딩, 즉시 사용 가능한 환경, 최적의 GPU 가격으로 AI 개발을 가속화하세요.

AI 협업 코딩
바로 사용 가능한 GPU
최적의 가격

HyperAI Newsletters

최신 정보 구독하기
한국 시간 매주 월요일 오전 9시 에 이번 주의 최신 업데이트를 메일로 발송합니다
이메일 서비스 제공: MailChimp