HyperAIHyperAI

Command Palette

Search for a command to run...

文脈内分類タスクにおけるデータ依存性と急激な学習の機構的基盤

Gautam Reddy

概要

Transformerモデルは、入力シーケンス内の例示的なサンプルに基づいて、新しいクエリに対する応答を正確に予測する能力である文脈内学習(in-context learning)を示す。文脈内学習は、クエリと出力の関係をモデルパラメータ内に学習する従来の重み内学習とは対照的である。学習データ分布およびアーキテクチャのどのような側面が、文脈内学習と重み内学習のどちらを促進するのであろうか。近年の研究により、言語に内在するバースト性、大規模語彙、歪んだ頻度-順位分布といった特定の分布特性が、これら2つの学習形態のトレードオフまたは同時出現を制御することが示されている。まず、我々はこれらの結果が、簡略化されたデータセットで訓練された最小限の注意力のみのネットワークにおいても再現されることを示す。文脈内学習(ICL)は、誘導ヘッドの急激な出現によって駆動され、その後、重み内学習と競合する。ICLに先行する進捗指標の特定と対象を絞った実験を通じて、注意力ベースのネットワークが示すデータ分布依存性の全体を再現する誘導ヘッドの二パラメータモデルを構築する。誘導ヘッド形成の現象論的モデルは、その急激な出現を、内在的カリキュラムによって可能となる3つの入れ子構造のロジットの逐次的学習に帰する。我々は、注意力ベースのネットワークにおける急峻な遷移は、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 によって提供されています