acceptodds
Published as a conference paper at NeurIPS 2026

A Unified Theoretical Framework for Task Recognition and Task Learning in In-Context Learning

Zhixuan Pan, Li Cao, Yiqi Dong, Chenyu Gan, Shaowen Wang, Jian Li

Abstract

In-context learning (ICL) allows large language models (LLMs) to adapt to new tasks from a few examples without parameter updates. Previous work and our empirical studies suggest two modes in ICL: Task Recognition, which applies pre-trained knowledge to familiar tasks, and Task Learning, which generalizes to novel mappings during inference. However, a unified theoretical account of these behaviors remains lacking. We propose a new Bayesian prediction framework that models pre-training data as a Pitman–Yor mixture over latent tasks, which captures the growing and heavy-tailed structure of natural language. By formulating an information-theoretic optimization problem, we derive the structure of the optimal ICL predictor under explicit capacity constraints. Our analysis reveals a phase transition in optimal capacity allocation: a water-filling strategy that prioritizes high-frequency tasks while assigning zero task-specific information to rare ones. This gives rise to two regimes: for frequent tasks, the model performs Task Recognition, yielding exponentially fast error decay with prompt length. For rare or unseen tasks, the model performs Task Learning by executing an implicit inference algorithm, resulting in a slower power-law convergence rate. Our results provide a principled explanation for the dual nature of ICL and establish a direct connection between pre-training data distributions, model capacity, and in-context generalization behavior.

Keywords:
Sydney, Main Track

Reviews

Among:
Shape:
123456this paper, Bottom 17%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.00 over 3 reviews, above 17% of the others.
Reviewer_nmjGOpenReview ↗
Rating
5
Clarity
2
Confidence
4
Originality
3
Quality
4
Significance
3
Read review
Summary

This paper proposes a theoretical account of two modes of in-context learning: Task Recognition, where a model recognizes a familiar task and uses task-specific information learned during pretraining, and Task Learning, where a model uses the prompt to infer a rare or new task. The main modeling move is to assume that pretraining data comes from a Pitman-Yor mixture over latent tasks, and then to study an information-constrained predictor whose capacity is split between shared structure mgenm_{\mathrm{gen}} and task-specific memory mzm_z. Under this setup, high-frequency tasks get task-specific capacity, while tail tasks get no task-specific memory and must rely on a shared generalization predictor. The experiments test this story on synthetic linear regression, Markov chains, Dyck-kk, and PCFG tasks with power-law task frequencies.

Strengths and weaknesses

Strengths:

I like the high-level idea/exigence of this paper. The paper gives a clean story which is clearly and directly motivated by a lot of past work in the literature for why task recognition and task learning might be in the same pretrained model: if task frequencies are heavy-tailed and model capacity is finite, it is natural to memorize the head and learn a shared inference mechanism for the tail. I think this is a nice conceptual synthesis of work on ICL, task diversity, pretraining distributions, and information-theoretic views of meta-learning.

Weaknesses:

My main concern is that a few of the claims are written more strongly than the math seems to support. The rare-task part of Theorem 5.2 is written as a lower bound:

\geq \Omega(n^{-1}) - \frac{|\mathcal{H}|\exp(-\Omega(n))}{p_{\mathrm{tail}}}.$$ I do not think this by itself proves power-law convergence of the ICL predictor. A lower bound is compaitible with constant error, or with a much worse upper bound, unless there is a matching upper bound or another argument showing that $P_{\mathrm{ICL}}$ actually approaches $P_{\mathrm{OPT}}$ at this rate. Naturally, I think this is more of a wording issue. I think the text's phrasing of what the theorem states is perhaps a bit ambitiious, but an accurate recount of the theorem is nevertheless worthwhile. There are also some theoretical objects that I think need to be stated more explicitly. The decomposition using $P_M(Z \mid H)$, $P_{M,z}$, and $P_M(Z \mid X,H)$ treats the learned predictor as if it has a well-defined latent-task posterior and task-conditional components. A generic language model distribution $P_M(X \mid H)$ does not typicallly uniquely determine these objects. I think the paper should say whether this is an assumed model class or some sort of a approximation. Similarly, the capacity allocation problem uses $m_{\mathrm{gen}}+\sum_z m_z \leq C$, but it is not obvious that this scalar allocation is equivalent to one shared model satisfying a single mutual-information capacity constraint (perhaps i'm missing something here). I like the KKT/waterfilling story, but I think the exact “frequency threshold” framing should be softened. To my reading, I think I understand the allocation condition as it depends on the weighted in some manner marginal benefit of the memory, roughly something like $p_z(-\partial D_z/\partial m_z)$, not just on $p_z$. So the result is cleanest when tasks have comparable distortion curves. Similarly, the simplified condition for $m_{\mathrm{gen}}$ seems to rely on extra assumptions about head tasks getting little marginal benefit from shared capacity and tail tasks having similar shared-capacity sensitivity. I think these are reasonable intuitions, but they should be stated explicitly, or perhaps go into a bit of discussion about this. Please do let me know if I'm misunderstanding this! I have a similar issue with Assumption A.1. The paper assumes a global equivalence between squared Hellinger distance and squared parameter distance, $$C_1\|\phi-\phi'\|^2 \leq h^2(P_\phi,P_{\phi'}) \leq C_2\|\phi-\phi'\|^2.$$ This cannot hold globally on an unbounded parameter space, since $h^2$ is bounded while $\|\phi-\phi'\|^2$ need not be. This seems fixable easily by adding compactness or making the condition local, but right now it is stated too broadly. The experiments are good evidence for this sort of stylized theory for this genre of papers, but they are still synthetic and quite matched to the assumptions. The task pools are generated, the task frequencies are imposed, and the main empirical validation is whether frequency-bin curves look exponential or power-law. I think this is enough for a weak accept as a theory paper, but it does not yet show that the same mechanism explains real transformer/LLM ICL. I would have liked one less matched stress test, for example mixed task families, overlapping head/tail tasks, irrelevant context, non-power-law frequencies, or a more realistic meta-dataset where the latent task structure is not explicitly generated by the authors. The plotting and experimental exposition could be much clearer. The legends in Figure 2 are too verbose, and the full fitted equations in the legend do not give me much useful information. The main text should also say more about the experiments instead of pushing so much to the appendix. (Something I might have also misunderstood is I think I came across a small thing when skimming through the appendix : the main text says the low-frequency/OOD curves and $P_{\mathrm{gen}}$ are close across all four settings, but Appendix B.4 says the PCFG generalization predictor is intractable to compute exactly.) The related work is mostly reasonable, but I think three nearby ICL theory papers are worth explicitly citing breifly: Jeon et al. on information-theoretic analysis of ICL, Zhang et al. on Bayesian model averaging/parameterization/generalization in ICL, and Fan et al. on in-context semi-supervised learning. These are not the same paper as this one, but they are close enough to the paper's broader claims about contextual inference and shared structure that I would expect them to appear in the discussion.
Questions
  • What is the intended qualitative/fuzzy meaning meaning of a "task" in the Pitman-Yor mixture when mapping this theory back to natural language? Should I think about a task closer to an instruction, a domain, a document type, an input-output relation, a factual cluster, or some mixture of these?

  • How should the framework be interpreted for prompts that mix tasks or contain instructions that explicitly identify the task? A lot of real ICL prompts are not clean draws from one latent task for the whole context. Does the theory predict a different behavior when the context shifts partway through or contains multiple subtasks? It's always interesting when we have a theoretical framework to think about what it could imply, because otherwise it's sort of just built up without too much purpose.

  • What concrete model-scale predicttion follows from the capacity parameter CC? As model size increases, should the memorization boundary move monotonically deeper into the tail, and should the shared generalilzation capacity mgenm_{\mathrm{gen}} increase, decrease, or stay roughly stable?

Limitations

Partially. The paper does acknowledge some limitations, and I appreciate that the experiments are framed as controlled synthetic tests. I think the limitations section should more directly say that the experiments are matched to the assumptions of the theory, that the paper does not yet show this mechanism in real LLM pretraining or natural prompting settings, and that the current theorem gives a lower bound for tail tasks rather than a full convergence result. I would also like the authors to discuss the gap between abstract mutual-information capacity and concrete model scale.

Paper formatting concerns

No major formatting or anonymity concerns observed.

Final justification

The rebuttal directly addresses my main theoretical concern. In particular, the authors correctly acknowledge my correct for Theorem 5.2, and commit to narrowing the corresponding claims in the abstract, introduction, and theorem discussion. They also make other clarification changes, which I think ups the clarity of the text to be substantially clearer (clarify that the latent-task decomposition is an explicit modeling assumption, distinguish the exact KKT condition from the approximate tail-mass interpretation, and replace the global Hellinger assumption with an appropriately local condition). I perhaps view the SmolLM2 experiment as qualitative support for the main ideas. Nevertheless, the paper makes a distinctive contribution by combining heavy-tailed latent-task population with a finite-capacity allocation between shared and task-specific information, yielding an explicit task-wise set up which is quite ncie! Within the context of this theoretical literature, the empirical evaluation is extensive. The authors examine multiple task families, task-frequency regimes, and model scales, and show a consistent frequency-dependent transition between memorization-like and generalization-like behavior. The additional real-model experiment further demonstrates that stronger pre-existing label semantics resist contextual remapping for longer. Taken together, I find the revised claims, theoretical contribution, and breadth of supporting evidence sufficiently compelling for acceptance.

Reviewer_TRQJOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
4
Read review
Summary

The paper addresses the long-standing absence of a unified theoretical account of the two empirically observed modes of in-context learning (ICL) — Task Recognition (TR) and Task Learning (TL) — by combining Bayesian non-parametrics with information-theoretic capacity constraints. The paper core insight includes Data-generation model, Error decomposition,Bivariate rate-distortion and Two-regime convergence The pre-training corpus is modelled as a Pitman-Yor Mixture Model (PYMM), each mixture component being a latent task; the heavy-tail prior naturally reproduces Zipf/Heaps statistics of natural language.The Bayesian sequential-prediction loss is split into an Optimal Estimation Error (data-limited, irreducible) and a Capacity Approximation Error (model-capacity-limited). The latter is further decomposed into a task-specific prediction error, a task-inference KL, and a residual term; the authors argue the task-specific term dominates when documents are long. Four controlled synthetic settings (linear regression, Markov chains, Dyck-k languages, PCFGs) under truncated power-law pretraining frequencies; position-wise prediction error is fit with exponential and power-law families and compared to dMMSE, Ridge, Bayesian mixtures, smoothed bigrams, and Dirichlet posterior baselines.

Strengths and weaknesses

Strengths

  1. A novel theory framework, Explicit injection of the Pitman-Yor mixture into ICL theory, with information theory and so on. Make Sense.
  2. The mathematical backbone is sound.Bayesian chain-rule decomposition, capacity-side decoupling, bivariate rate-distortion and KKT analysis...
  3. Casting "TR exp / TL polynomial" as a frequency-driven phase transition offers an operational theoretical handle on the empirical observations
  4. Structure is well-organised

Weekness:

  1. Assumption 5.1 sits on the learned distribution rather than the data-generating distribution, creating a circularity. 2.The theory is never connected to real world LLMs, it'll be better with some popular llm evaluation on some popular bench
Questions

1.Can you give more information or explanation about Assumption 5.1 2.How large is the gap between the truncated-power-law + random-task injection setup of §6 and a true PYP$(\alpha, \beta, G_0)$ sampling trajectory? 3. Are you willing to add even a minimal experiment on a public small LLM ?

Limitations

yes

Paper formatting concerns

no

Final justification

I appreciate the authors' response, which is consistent with my overall understanding of the paper and satisfactorily resolves my questions. I am happy to maintain my positive score of 4.

Reviewer_2B6oOpenReview ↗
Rating
3
Clarity
2
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

This work tackles the core challenge of providing a unified theoretical account for the two operational modes of in-context learning (ICL)—namely, task recognition and task learning. By modeling the pre-training corpus with a Pitman–Yor Mixture Model and framing capacity allocation within an information-theoretic framework, the authors derive a phase transition in capacity allocation. They theoretically characterize two distinct convergence regimes, whose validity is further corroborated through synthetic experiments.

Strengths and weaknesses

The paper tackles an interesting and timely theoretical problem, namely understanding the coexistence of Task Recognition and Task Learning within a unified framework. The information-theoretic formulation is mathematically elegant, and the connection between capacity allocation and heavy-tailed task distributions is conceptually appealing. The theoretical analysis is relatively comprehensive and the manuscript is generally well organized.

Questions
  1. Can the proposed theory be validated on real LLMs using standard ICL benchmarks rather than only synthetic environments?
  2. How sensitive are the theoretical conclusions to the assumption of Pitman–Yor distributed latent tasks? Would similar results hold under other heavy-tailed or nonparametric priors?
  3. Can the authors provide empirical evidence supporting the proposed phase transition in model capacity allocation, for example by analyzing internal representations or scaling behaviors of existing LLMs?
Limitations
  1. Assumptions too strong / Limited realism:​ Theoretical premises (Pitman–Yor mixture, explicit latent tasks) oversimplify real pretraining corpora, limiting practical relevance.

  2. Empirical validation weak:​ Experiments restricted to synthetic tasks (e.g., linear regression, PCFGs); no evaluation on real LLMs or standard ICL benchmarks.

  3. Novelty unclear:​ Incremental compared to recent unification efforts; lacks clear articulation of fundamentally new theoretical insight beyond existing Bayesian/info-theoretic work.

  4. Derivations under-justified:​ Key approximations (threshold/phase transitions) lack sufficient theoretical or empirical justification for robustness.

Paper formatting concerns

No

Comments on the paper

1 comment
Meta-review

The paper is about ICL and it proposes a unified framework to study task recognition and task learning. The former is concerned with recognizing tasks in training and then applying pre-trained knowledge, whereas the latter requires learning in context. The paper uses the Pitman-Yor mixture to model this framework. The reviews recognize this as an interesting problem and find the framework interesting. There are also several concerns/questions. The authors should address them. I've listed the most important ones below:

  • Assumption 5.1 seems to be about learned distributions and so hard to justify.
  • Mismatch between the theory and empirical results
  • No experiments with real-world LLMs
  • Discussion regarding sensitivity to Pitman-Yor assumption
  • Empirical evidence of phase transition
  • Some overclaiming of result (see Review nmjG)

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.