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
NeurIPS 2026
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: {\em Task Recognition}, which applies pre-trained knowledge to familiar tasks, and {\em 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 using a {\em species-sampling mixture} over latent tasks to capture the continual emergence of new tasks as the pre-training corpus grows. By formulating an information-theoretic optimization problem, we derive the structure of the optimal ICL predictor under explicit capacity constraints.
Our analysis characterizes optimal capacity allocation across task frequencies: 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 \textit{Task Recognition}, with a prediction-error upper bound consisting of an exponentially decaying recognition term and a residual pre-training error. For rare or unseen tasks, the model performs Task Learning by executing an implicit inference algorithm, with a power-law lower bound on its expected prediction error. 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.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:48 UTC.
- Decision
- Accept (poster)
Read decision
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)
Final justification
The authors have responded carefully to the reviews and overall the reviewers view of the paper has somewhat improved from the initial set of reviews. The manuscript will need to be updated substantially to incorporate the rebuttals into the text to make the paper suitable for publication.
Read meta-review
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)
Final justification
The authors have responded carefully to the reviews and overall the reviewers view of the paper has somewhat improved from the initial set of reviews. The manuscript will need to be updated substantially to incorporate the rebuttals into the text to make the paper suitable for publication.
- Rating
- 5/6
- Confidence
- 4/5
- Quality
- 4/4
- Clarity
- 2/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
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 and task-specific memory . 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-, 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:
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 actually approaches 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 , , and treats the learned predictor as if it has a well-defined latent-task posterior and task-conditional components. A generic language model distribution 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 , 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 , not just on . So the result is cleanest when tasks have comparable distortion curves. Similarly, the simplified condition for 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,
This cannot hold globally on an unbounded parameter space, since is bounded while 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 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 ? As model size increases, should the memorization boundary move monotonically deeper into the tail, and should the shared generalilzation capacity 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.
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.
Formatting concerns
No major formatting or anonymity concerns observed.
5 comments
- Frequency threshold, the distortion function, and the interpretation of a “task.”
We thank the reviewer for identifying an ambiguity in our notation. Under the theoretical setting actually defined in the paper, the reviewer is correct that the memorization threshold is purely frequency-based.
Specifically, all task parameters are exchangeable draws from the same base measure , and the distortion is averaged over this common prior. Consequently, although we write , the resulting distortion function is identical across tasks: . We also noticed a typo in the definition of : should be . After this correction, the marginal benefit $ -\frac{\partial D}{\partial m}(0,m_{\mathrm{gen}}) $ is common to all tasks. Thus, within our current model, task frequency alone determines whether task-specific information is stored. We will correct the typo and revise the presentation to make this specialization explicit.
Writing the distortion as also allows the framework to accommodate heterogeneous tasks as a natural extension of the current exchangeable setting. For example, distortion functions may differ when tasks have different intrinsic dimensions, noise levels, or task-family-specific priors. In this more general setting, the allocation boundary would depend on the frequency-weighted marginal benefit , rather than on frequency alone. We will distinguish this general extension from the setting analyzed in the current paper.
This clarification also narrows the intended real-world interpretation of a “task.” The setting most closely represented by our theory is not one in which a single task family contains arbitrarily different domains or reasoning procedures. Rather, a task family should be understood as a relatively narrow domain, while each latent task corresponds to a coherent class of problems within that domain. For example, the task family could be solving algorithmic problems in Python, with different tasks corresponding to problems that require dynamic programming, greedy algorithms, divide-and-conquer, or graph search. Problems belonging to the same task share a characteristic reasoning and solution structure, while all tasks in the family share a higher-level prior over algorithmic reasoning and Python implementation. The Bayesian inference procedure therefore has the same general form across the family: the context provides evidence about which class of reasoning is appropriate and about the task-specific structure needed to produce a solution. Extending the framework to multiple heterogeneous task families—potentially with hierarchical or family-dependent priors and genuinely different distortion functions—would be both practically relevant and theoretically meaningful. We agree that investigating this broader setting is an important direction for future work.
We also agree that the assumptions behind Eq. should be stated more precisely. Eq. is the exact KKT condition and requires no additional approximation, whereas Eq. is a simplified approximation to it. In the revision, we will replace informal statements such as "approximately zero" with explicit bounds such as . Given this -based assumption, we will present a precise characterization in terms of $\delta clearly label Eq. (11) as an approximation.
- Assumption A.1 is stated too globally.
We agree that the stated global equivalence cannot hold on an unbounded parameter space because Hellinger distance is bounded while Euclidean distance need not be. We will replace it with a local condition. Equivalently, one may assume a compact parameter space with uniformly nonsingular Fisher information. The proof only needs local quadratic equivalence in the posterior-concentration region, so this correction does not change the argument's intended use.
- Presentation of the experiments.
We agree that our experiments are controlled settings intentionally matched to the theory. They are designed to isolate the proposed mechanism and should be interpreted within this scope. We also agree that the full fitted equations in the legends of Fig. 2 provide limited useful information. We will remove them and retain only concise frequency-bin and fit-type labels. Finally, the phrase "across all four settings" is inaccurate. The optimal Bayesian generalization predictor is intractable in the PCFG experiment, so that setting does not include a comparison with . We will state this explicitly in the revised version.
- Related work.
We agree that these references merit a more detailed discussion and will include such a discussion in the revised manuscript. Jeon et al. provide an information-theoretic decomposition of prediction error into meta-learning and intra-task components for a Bayes-optimal sequential predictor. Zhang et al. analyze Bayesian model averaging, its parameterization by attention, and ICL generalization/regret. Our distinct focus is the allocation of finite representational capacity across non-uniform latent tasks and the resulting coexistence of task-specific retrieval and shared inference. We will also add Fan et al. on in-context semi-supervised learning and discuss its complementary perspective on learning shared, context-dependent structure from unlabeled context.
Q2: We thank the reviewer for this highly insightful question, which helps clarify both the flexibility and the boundary of our definition of a task.
An explicit instruction can be modeled as side information about latent task index$Z$, replacing the posterior with . By sharpening the posterior over tasks, such side information may substantially reduce prediction error when the prompt is short. However, under the same identifiability and regularity conditions, finite side information changes the finite-context constants rather than the asymptotic regimes. As the context length tends to infinity, the Task Recognition term retains its exponential lower bounds, while the Task Learning regime retains its power-law upper bounds.
For a task that appears to change within the prompt, two cases should be distinguished. If it means that an internal hidden state evolves over time, as in an HMM, then this is already compatible with our framework: a task is a general stochastic process , so the entire HMM including its transition and emission mechanisms can be treated as one task, while its hidden state changes within a sequence. In contrast, if the HMM itself changes partway through the prompt - for example, if its transition or emission model is replaced by a different one - then the data are no longer generated by one persistent stochastic process. This nonstationary setting goes beyond the current Bayesian-inference formulation. We view this as a meaningful direction for future work.
The multi-subtask setting is particularly interesting. We believe that combining our framework with theories of compositional reasoning or compositional generalization would provide a natural extension, allowing a prompt to invoke and compose multiple latent subtasks rather than assuming a single persistent task. We are currently exploring preliminary formulations along this direction and view it as an important avenue for future work.
Q3: Our theory predicts that increasing model size moves the memorization boundary toward lower-frequency tasks. In contrast, the theory does not determine a monotonic trend for . A larger may allow more capacity to be allocated to shared generalization. At the same time, it moves the memorization boundary deeper into the tail, reducing the total probability mass of unmemorized tasks that benefit from and therefore weakening the incentive to allocate capacity to it.
Fig. 6 supports the first prediction. From 7M to 453M parameters, larger models remain -like farther into the task tail. The figure also suggests that generalization remains approximately stable over a range of model sizes. However, when the model becomes large enough to memorize almost all pretraining tasks, its behavior may move away from , indicating that generalization can begin to be affected.
Finally, the theoretical capacity measures task-relevant information stored by the model, whereas the corresponding parameter count depends on numerical precision and architecture. For example, parameters used only for token embeddings need not contribute directly to storing information about or the task-specific parameters , and therefore should not be counted. Relating to model size also requires a sufficiently trained model: a large but randomly initialized model contains essentially no information about tasks, regardless of its parameter count.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 4/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
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
- A novel theory framework, Explicit injection of the Pitman-Yor mixture into ICL theory, with information theory and so on. Make Sense.
- The mathematical backbone is sound.Bayesian chain-rule decomposition, capacity-side decoupling, bivariate rate-distortion and KKT analysis...
- Casting "TR exp / TL polynomial" as a frequency-driven phase transition offers an operational theoretical handle on the empirical observations
- Structure is well-organised
Weekness:
- 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
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.
Formatting concerns
no
4 comments
Response to Reviewer TRQJ
We sincerely thank the reviewer for the thoughtful questions and constructive feedback.
W1/Q1: Assumption 5.1 does not constitute circular reasoning. It imposes a sufficient distinguishability condition on the learned task components, while Theorem 5.2 provides a conditional characterization: given distinguishable learned components, it derives how rapidly the error decreases as the prompt length increases. The assumption does not presuppose that Task Recognition succeeds or that its error decreases exponentially with the prompt length. Condition 1 states that when the context is generated by a particular task, the learned predictor associated with that task assigns consistently higher likelihood to the observed data than any mismatched predictor, with a positive expected margin. In other words, the learned task components must be distinguishable through their predictive behavior. Such distinguishability is necessary: without it, no predictor could reliably determine which latent task generated the context, regardless of the context length.
If we directly analyzed the ideal Bayesian predictor , Condition 1 would be automatically satisfied whenever the underlying task family is distinguishable, because uses the exact task-conditional distributions and the full Bayesian posterior. However, analyzing alone would remove the model-capacity constraint that is central to our framework. Our goal is precisely to characterize how a finite-capacity model selectively retains task-specific information and how this selection gives rise to different ICL behaviors. We therefore analyze a general predictive distribution and impose only the distinguishability condition, rather than assuming that the learned predictor is exactly .
Note that the task-specific part of this assumption concerns only the memorized head tasks and does not require a separately distinguishable learned component for every rare task. As shown by the capacity-allocation analysis in Section 4.3, each head task receives positive task-specific capacity , meaning that the model retains information unique to that task. It is therefore natural to require the predictive distributions associated with different memorized head tasks to be distinguishable. The only additional component is , which serves as a single representative predictor for all unmemorized long-tail and novel tasks; as a special case of Condition 1, it should also be distinguishable from every memorized head-task predictor. We do not require the model to distinguish among individual tail tasks through separately stored components.
Condition 2, which bounds the log-likelihood ratios between learned components, is a technical condition needed to apply a concentration inequality.
We will revise the paper to provide a more detailed explanation of Assumption 5.1, including its intuitive meaning, motivation, and scope of applicability.
Q2: We thank the reviewer for raising this question. In all four experiments, one third of the pretraining documents are completely random-task data.
We illustrate the resulting frequency distribution using the linear-regression setting, where the recurrent pool has tasks with . For comparison, we simulate a PYP with , , and documents. We rank tasks by empirical frequency, divide the cumulative data mass into ten consecutive 10% intervals, and report the number of distinct tasks needed to account for each interval. The PYP column averages over 100 trajectories and rounded to the nearest integer.
| Fraction of total data (frequent to rare) | PYP: number of tasks | Truncated PL: number of tasks |
|---|---|---|
| 0–10% | 25 | 40 |
| 10–20% | 57 | 63 |
| 20–30% | 110 | 110 |
| 30–40% | 212 | 207 |
| 40–50% | 429 | 445 |
| 50–60% | 968 | 1,159 |
| 60–66.7% | 1,407 | 2,072 |
The table shows that the truncated power law provides a close approximation to the PYP frequency profile over the recurrent two-thirds of the data. For the remaining one third, we use fresh random tasks as a proxy for the deeper PYP tail. The rationale is that both still rarer PYP components and completely random tasks appear only a few times during pretraining, so neither provides enough repeated exposure for reliable task-specific memorization. Consistent with this rationale, our experiments show that even within the retained recurrent pool, sufficiently low-frequency tasks already behave similarly to OOD tasks. This observation provides empirical support for the approximation rather than serving as its premise.
Additional Real-World LLM Experiment (1/2)
In real-world settings, the pretraining data distribution is not controllable, and the identities and frequencies of latent tasks in an LLM's pretraining corpus are generally unobserved, making it difficult to construct an experiment that exactly matches our theoretical setting.
For real-world evidence, Chan et al. train Transformers on bursty sequences of Omniglot image-label pairs and separately evaluate in-context learning on held-out classes and in-weights learning on pretrained classes. Burstiness and a large number of rare classes promote in-context learning but generally trade off against in-weights learning. A uniform distribution yields strong in-context learning but little in-weights learning, increasing the skew strengthens in-weights learning for common classes while weakening in-context learning, and a Zipf exponent of approximately 1 provides a sweet spot at which both remain strong, while rare pretrained classes remain unmemorized.
Pan et al. provide complementary evidence on real LLMs by using random labels to isolate Task Recognition and consistent mappings to abstract labels to isolate Task Learning. Systematic label flipping provides a related but more direct probe because it preserves a coherent mapping while placing it in conflict with pretrained label semantics. Wei et al. and Kossen et al. both use this flip-label paradigm to measure Task Learning ability. Following this methodology, our additional experiment fixes a flipped class-label mapping, varies the pretraining frequency of the label words from very common to very rare, and measures ICL error as the number of demonstrations increases. Label-word frequency is only a controllable proxy for the unobserved latent-task frequency, so we use this experiment as complementary real-world evidence while retaining the matched synthetic experiments as the direct validation of our theoretical mechanism.
Real-LLM experiment setup. To test the real-model consequence of our theory, we use a setting in which the pretrained response convention and the in-context convention can be placed in direct conflict. In our framework, more frequent tasks induce a stronger in-weights/TR prior; because the relevant pretraining frequencies are unobserved for a real LLM, we use the strength of the model's natural label prior as the observable proxy and ask how many demonstrations are needed for TL to override it.
We evaluate SmolLM2-1.7B-Instruct on 48 held-out common-sense category questions, using the same questions, demonstration orderings, and nested contexts for every label pair and every integer context length . Each question is elementary, e.g., Is a peach a kind of fruit? or Is a peach a kind of vehicle? Natural GOLD demonstrations use the ordinary mapping from truth to labels, whereas natural CONFLICT demonstrations reverse that mapping. Abstract labels have no fixed truth meaning, so their mapping must be inferred entirely from context. A representative CONFLICT prompt is:
[system]
Answer each common-sense category question with exactly one allowed label
and no other text. Infer the local response convention from previous examples.
[user]
Question: Is a violin a kind of vehicle?
Allowed labels: yes / no
[assistant]
yes
[user]
Question: Is a cathedral a kind of building?
Allowed labels: yes / no
[assistant]
no
[user]
Question: Is a peach a kind of fruit?
Allowed labels: yes / no
[assistant]
Natural category–answer pairs are plausibly represented during pretraining, whereas a systematic reversal of their label convention is unlikely to be. In GOLD, the familiar pretrained convention and the mapping demonstrated in context agree, so high accuracy mainly verifies that the model can solve the task. In CONFLICT, they point in opposite directions: TR favors the ordinary semantic label encoded in the model’s weights, while TL favors the flipped mapping inferred from the demonstrations. The model’s prediction therefore provides an operational comparison of their relative influence, with the balance depending on both the strength of the natural label prior and the number of demonstrations .
We score only the two allowed label strings. Context accuracy is the fraction of queries for which the higher-likelihood label is the one specified by the demonstrations. We also report
For natural CONFLICT pairs, is the label required by the flipped demonstrations, while is the ordinary semantic label. Therefore, means that the contextual mapping dominates, whereas means that the pretrained convention dominates. For abstract pairs, there is no natural prior label, so is simply the other candidate and the margin measures contextual task learning alone.
[Continued in the next comment]
Additional Real-World LLM Experiment (2/2)
[Continuation of the previous response]
We organize the verbalizers into eight two-pair groups with progressively weaker natural response priors. Strong English uses yes/no and correct/incorrect; intermediate English uses true/false and right/wrong; and weak English uses plausible/implausible and ✓/✗. The three natural non-English groups are strong non-English (Italian and Portuguese), intermediate non-English (Turkish and Greek), and weak non-English (Hindi and Filipino). The abstract controls are familiar abstract (A/B, X/Y) and nonce abstract (blick/zorp, dax/wug). The ordering reflects how directly and reliably each pair expresses the ordinary affirmative/negative response available to this model: canonical English labels provide the clearest pretrained convention, less canonical English and non-English labels provide progressively weaker or less immediately accessible conventions, and abstract labels have no fixed truth semantics. This ordering is qualitative rather than a measured corpus-frequency statistic; SmolLM2 does not release its exact pretraining corpus, so token or document frequencies cannot be estimated rigorously.
As a validity check, all twelve natural label pairs reach class-balanced GOLD accuracy between 96.7% and 99.7% at , with both truth classes above 90% and no single-label collapse. Thus the model can solve the common-sense task and use every natural label pair once its convention is demonstrated.
Context accuracy. Natural rows use CONFLICT; abstract rows use their balanced contextual mapping.
| Group | K=0 | K=1 | K=2 | K=4 | K=8 | K=12 | K=16 | K=20 | K=24 |
|---|---|---|---|---|---|---|---|---|---|
| Strong English | 0.109 | 0.130 | 0.053 | 0.099 | 0.201 | 0.306 | 0.404 | 0.438 | 0.505 |
| Intermediate English | 0.240 | 0.074 | 0.047 | 0.088 | 0.258 | 0.532 | 0.671 | 0.751 | 0.832 |
| Weak English | 0.234 | 0.102 | 0.089 | 0.174 | 0.522 | 0.676 | 0.765 | 0.837 | 0.884 |
| Strong non-English | 0.297 | 0.147 | 0.113 | 0.171 | 0.456 | 0.595 | 0.753 | 0.870 | 0.911 |
| Intermediate non-English | 0.490 | 0.275 | 0.316 | 0.362 | 0.609 | 0.749 | 0.878 | 0.929 | 0.929 |
| Weak non-English | 0.401 | 0.393 | 0.400 | 0.471 | 0.755 | 0.858 | 0.901 | 0.938 | 0.958 |
| Familiar abstract | 0.500 | 0.553 | 0.645 | 0.700 | 0.856 | 0.916 | 0.962 | 0.970 | 0.981 |
| Nonce abstract | 0.500 | 0.592 | 0.676 | 0.757 | 0.846 | 0.938 | 0.967 | 0.975 | 0.977 |
Context margin . Positive values favor the demonstrated mapping; negative values favor the pretrained natural convention.
| Group | K=0 | K=1 | K=2 | K=4 | K=8 | K=12 | K=16 | K=20 | K=24 |
|---|---|---|---|---|---|---|---|---|---|
| Strong English | -1.251 | -2.957 | -3.384 | -2.700 | -1.506 | -0.874 | -0.403 | -0.207 | 0.064 |
| Intermediate English | -0.699 | -3.037 | -3.471 | -2.318 | -0.710 | 0.040 | 0.447 | 0.734 | 1.010 |
| Weak English | -1.602 | -2.471 | -2.799 | -1.785 | -0.117 | 0.562 | 1.001 | 1.320 | 1.538 |
| Strong non-English | -0.639 | -2.429 | -3.133 | -2.220 | -0.384 | 0.364 | 0.906 | 1.353 | 1.593 |
| Intermediate non-English | -0.448 | -1.388 | -1.625 | -0.933 | 0.643 | 1.591 | 2.217 | 2.750 | 3.038 |
| Weak non-English | -0.172 | -0.845 | -0.743 | -0.083 | 1.311 | 2.346 | 2.983 | 3.503 | 3.913 |
| Familiar abstract | 0.000 | 0.332 | 0.924 | 1.564 | 2.792 | 3.311 | 3.620 | 4.017 | 4.212 |
| Nonce abstract | 0.000 | 0.127 | 0.528 | 1.080 | 2.178 | 2.926 | 3.536 | 4.451 | 4.839 |
Interpretation. The main pattern is a systematic shift in the number of demonstrations needed for TL to overcome the pretrained convention. Abstract labels follow the demonstrated mapping almost immediately. Weak natural groups cross to with relatively few demonstrations, intermediate groups cross later, and strong English remains prior-dominated until approximately . At , context accuracy is only 0.505 for strong English, rises to 0.832--0.958 for the weaker natural groups, and is about 0.98 for the abstract controls. Thus stronger natural label priors keep the model in the TR/prior-following mode for longer, while weaker or arbitrary labels allow TL/context-following to dominate with fewer demonstrations. This is the real-model behavior predicted by our framework. Because adjacent groups are somewhat noisy and the ordering is qualitative, we use the result as complementary evidence for the predicted TR--TL mechanism, not as a direct measurement of corpus frequency or a formal phase transition.
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.
- Rating
- 3/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 2/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
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
- Can the proposed theory be validated on real LLMs using standard ICL benchmarks rather than only synthetic environments?
- 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?
- 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
-
Assumptions too strong / Limited realism: Theoretical premises (Pitman–Yor mixture, explicit latent tasks) oversimplify real pretraining corpora, limiting practical relevance.
-
Empirical validation weak: Experiments restricted to synthetic tasks (e.g., linear regression, PCFGs); no evaluation on real LLMs or standard ICL benchmarks.
-
Novelty unclear: Incremental compared to recent unification efforts; lacks clear articulation of fundamentally new theoretical insight beyond existing Bayesian/info-theoretic work.
-
Derivations under-justified: Key approximations (threshold/phase transitions) lack sufficient theoretical or empirical justification for robustness.
Formatting concerns
No
4 comments
Response to Reviewer 2B6o
We sincerely thank the reviewer for the thoughtful questions and constructive feedback.
Q2 / W1: Sensitivity to the Pitman–Yor assumption and realism of the latent-task model. Theorem 4.1 is more distribution-agnostic than our presentation may suggest. It conditions on arbitrary task frequencies . For any such distribution and convex decreasing distortion functions, the KKT boundary is
Therefore, the frequency-dependent separation between memorized and unmemorized tasks does not require a power law or the Pitman–Yor construction.
The qualitative conclusions extend to other heavy-tailed priors and even arbitrary empirical task-frequency distributions. The key quantity governing the emergence of Task Learning is not the precise functional form of the frequency distribution, but the total probability mass (P_{\mathrm{tail}}) of tasks that are not worth memorizing individually. Even under a light-tailed distribution, the task-specific memorization threshold remains; however, the remaining tail mass may be too small to justify allocating shared capacity, in which case the optimum may reduce to predominantly Task Recognition.
We adopt the Pitman–Yor mixture because it is a classical Bayesian nonparametric model with two properties that are particularly relevant to natural language: reinforcement of previously frequent components and the continued emergence of new components. For a positive discount parameter, it induces power-law-ranked component frequencies and a growing number of components, qualitatively corresponding to Zipf’s and Heaps’ laws. Thus, the Pitman–Yor assumption provides a principled language-motivated instantiation of our framework rather than a mathematical requirement for the theoretical results.
We agree that modeling pretraining data as a mixture of explicit latent tasks is an abstraction of real-world LLM pretraining. However, a “task” in our framework is not restricted to a conventional supervised task or an explicitly labeled input-output mapping: each task is modeled as a general parameterized stochastic process, allowing it to represent a broad range of predictive data-generating regimes, such as domains, document types, linguistic patterns, or their combinations. This abstraction is necessary for isolating the mechanism studied in our paper: how pretraining task frequency governs the transition between Task Recognition and Task Learning. For real LLMs, neither the identities nor the pretraining frequencies of such latent processes are directly observable, making it difficult to measure or causally vary task frequency. We therefore adopt controlled synthetic settings in which task identities, frequencies, and ground-truth predictors are known and can be varied independently. These experiments are interpreted as controlled validation of the proposed frequency-dependent mechanism.
Q3 / W4: Empirical and theoretical support for the phase transition. The paper contains a more direct behavioral test than the exponential-versus-power-law curve fits. In Appendix C, Fig. 6(a) orders the 10,000 in-distribution Markov tasks by controlled pretraining frequency and measures the learned predictor's Hellinger distance from each of two references: the memorization predictor and the generalization predictor . The learned predictor is -like for frequent tasks; as frequency decreases, it moves away from and approaches . Fig. 6(b) additionally shows that increasing model size from 7M to 453M parameters moves this transition point toward lower-frequency tasks.These results provide behavioral evidence for a capacity-dependent memorization/generalization transition. We will move this result into the main discussion in the revised version.
On the theoretical side, Eq. (9) gives the exact KKT phase boundary for task-specific memory. Above the critical frequency, the optimal allocation satisfies ; at or below it, the nonnegativity constraint becomes active and . Eq. (9) therefore marks an exact transition from a memorized phase to an unmemorized phase.
W3: We respectfully disagree that the contribution is incremental, although we agree that the distinction from the closest prior work should be stated more sharply. Most existing theories study either Task Recognition as Bayesian retrieval over pretrained tasks or Task Learning as an inference algorithm implemented in context. Among the few works considering both modes, Chan et al. provide compelling empirical evidence that Task Recognition and Task Learning can coexist under a skewed task distribution, but do not provide a theoretical characterization of this coexistence. Lin et al. (2024) analyze the two modes in a restricted Gaussian-mixture setting, without characterizing how non-uniform task frequencies determine the behavior of individual tasks. Wurgaft et al. study rational strategy selection by positing Task Recognition and Task Learning predictors as available candidate strategies, rather than explaining how these two capabilities emerge from the information acquired during pretraining. These limitations leave open why a single model develops both capabilities simultaneously and what determines which mode it uses for a particular task.
Our contributions address these two missing questions more directly:
-
A unified explanation for coexistence within one model. We combine a Bayesian nonparametric model of a growing, non-uniform task population with a capacity-constrained bivariate rate-distortion formulation. The resulting optimization shows why a finite-capacity predictor simultaneously stores task-specific information for some tasks and learns a shared inference mechanism for others. Thus, Task Recognition and Task Learning emerge as complementary allocations of the same finite capacity, rather than as separately assumed or mutually exclusive mechanisms.
-
An explicit task-wise allocation criterion. The KKT analysis shows that task-specific memory is determined by the frequency-weighted marginal benefit relative to the capacity shadow price. Under comparable task distortion curves, this reduces to the intuitive prediction that frequent tasks are preferentially memorized and therefore favor Task Recognition, whereas rare tasks receive no task-specific memory and must rely on the shared Task Learning mechanism. The corresponding tail-mass condition further explains when allocating capacity to shared generalization becomes optimal.
-
A connection from pretraining to ICL behavior. We construct a single capacity-constrained ICL predictor that combines the stored predictors for memorized tasks with a shared generalization predictor for unmemorized tasks. For a memorized task, the task-recognition component admits an exponentially decreasing upper bound with prompt length. For a novel or unmemorized task, estimation incurs an lower bound, while our controlled experiments empirically exhibit the corresponding slower power-law behavior. The central novelty is therefore not merely the observation that both modes exist. It is the derivation of why they coexist in a finite-capacity model and the explicit characterization of which tasks are assigned to each mode. To our knowledge, this frequency and capacity-dependent allocation principle is not established by the cited Bayesian or information-theoretic analyses.
We will revise the related-work section to compare these technical distinctions directly with the closest unification efforts and avoid relying on an overly broad priority claim.
Additional Real-World LLM Experiment (1/2)
In real-world settings, the pretraining data distribution is not controllable, and the identities and frequencies of latent tasks in an LLM's pretraining corpus are generally unobserved, making it difficult to construct an experiment that exactly matches our theoretical setting.
For real-world evidence, Chan et al. train Transformers on bursty sequences of Omniglot image-label pairs and separately evaluate in-context learning on held-out classes and in-weights learning on pretrained classes. Burstiness and a large number of rare classes promote in-context learning but generally trade off against in-weights learning. A uniform distribution yields strong in-context learning but little in-weights learning, increasing the skew strengthens in-weights learning for common classes while weakening in-context learning, and a Zipf exponent of approximately 1 provides a sweet spot at which both remain strong, while rare pretrained classes remain unmemorized.
Pan et al. provide complementary evidence on real LLMs by using random labels to isolate Task Recognition and consistent mappings to abstract labels to isolate Task Learning. Systematic label flipping provides a related but more direct probe because it preserves a coherent mapping while placing it in conflict with pretrained label semantics. Wei et al. and Kossen et al. both use this flip-label paradigm to measure Task Learning ability. Following this methodology, our additional experiment fixes a flipped class-label mapping, varies the pretraining frequency of the label words from very common to very rare, and measures ICL error as the number of demonstrations increases. Label-word frequency is only a controllable proxy for the unobserved latent-task frequency, so we use this experiment as complementary real-world evidence while retaining the matched synthetic experiments as the direct validation of our theoretical mechanism.
Real-LLM experiment setup. To test the real-model consequence of our theory, we use a setting in which the pretrained response convention and the in-context convention can be placed in direct conflict. In our framework, more frequent tasks induce a stronger in-weights/TR prior; because the relevant pretraining frequencies are unobserved for a real LLM, we use the strength of the model's natural label prior as the observable proxy and ask how many demonstrations are needed for TL to override it.
We evaluate SmolLM2-1.7B-Instruct on 48 held-out common-sense category questions, using the same questions, demonstration orderings, and nested contexts for every label pair and every integer context length . Each question is elementary, e.g., Is a peach a kind of fruit? or Is a peach a kind of vehicle? Natural GOLD demonstrations use the ordinary mapping from truth to labels, whereas natural CONFLICT demonstrations reverse that mapping. Abstract labels have no fixed truth meaning, so their mapping must be inferred entirely from context. A representative CONFLICT prompt is:
[system]
Answer each common-sense category question with exactly one allowed label
and no other text. Infer the local response convention from previous examples.
[user]
Question: Is a violin a kind of vehicle?
Allowed labels: yes / no
[assistant]
yes
[user]
Question: Is a cathedral a kind of building?
Allowed labels: yes / no
[assistant]
no
[user]
Question: Is a peach a kind of fruit?
Allowed labels: yes / no
[assistant]
Natural category–answer pairs are plausibly represented during pretraining, whereas a systematic reversal of their label convention is unlikely to be. In GOLD, the familiar pretrained convention and the mapping demonstrated in context agree, so high accuracy mainly verifies that the model can solve the task. In CONFLICT, they point in opposite directions: TR favors the ordinary semantic label encoded in the model’s weights, while TL favors the flipped mapping inferred from the demonstrations. The model’s prediction therefore provides an operational comparison of their relative influence, with the balance depending on both the strength of the natural label prior and the number of demonstrations .
We score only the two allowed label strings. Context accuracy is the fraction of queries for which the higher-likelihood label is the one specified by the demonstrations. We also report
For natural CONFLICT pairs, is the label required by the flipped demonstrations, while is the ordinary semantic label. Therefore, means that the contextual mapping dominates, whereas means that the pretrained convention dominates. For abstract pairs, there is no natural prior label, so is simply the other candidate and the margin measures contextual task learning alone.
[Continued in the next comment]
Additional Real-World LLM Experiment (2/2)
[Continuation of the previous response]
We organize the verbalizers into eight two-pair groups with progressively weaker natural response priors. Strong English uses yes/no and correct/incorrect; intermediate English uses true/false and right/wrong; and weak English uses plausible/implausible and ✓/✗. The three natural non-English groups are strong non-English (Italian and Portuguese), intermediate non-English (Turkish and Greek), and weak non-English (Hindi and Filipino). The abstract controls are familiar abstract (A/B, X/Y) and nonce abstract (blick/zorp, dax/wug). The ordering reflects how directly and reliably each pair expresses the ordinary affirmative/negative response available to this model: canonical English labels provide the clearest pretrained convention, less canonical English and non-English labels provide progressively weaker or less immediately accessible conventions, and abstract labels have no fixed truth semantics. This ordering is qualitative rather than a measured corpus-frequency statistic; SmolLM2 does not release its exact pretraining corpus, so token or document frequencies cannot be estimated rigorously.
As a validity check, all twelve natural label pairs reach class-balanced GOLD accuracy between 96.7% and 99.7% at , with both truth classes above 90% and no single-label collapse. Thus the model can solve the common-sense task and use every natural label pair once its convention is demonstrated.
Context accuracy. Natural rows use CONFLICT; abstract rows use their balanced contextual mapping.
| Group | K=0 | K=1 | K=2 | K=4 | K=8 | K=12 | K=16 | K=20 | K=24 |
|---|---|---|---|---|---|---|---|---|---|
| Strong English | 0.109 | 0.130 | 0.053 | 0.099 | 0.201 | 0.306 | 0.404 | 0.438 | 0.505 |
| Intermediate English | 0.240 | 0.074 | 0.047 | 0.088 | 0.258 | 0.532 | 0.671 | 0.751 | 0.832 |
| Weak English | 0.234 | 0.102 | 0.089 | 0.174 | 0.522 | 0.676 | 0.765 | 0.837 | 0.884 |
| Strong non-English | 0.297 | 0.147 | 0.113 | 0.171 | 0.456 | 0.595 | 0.753 | 0.870 | 0.911 |
| Intermediate non-English | 0.490 | 0.275 | 0.316 | 0.362 | 0.609 | 0.749 | 0.878 | 0.929 | 0.929 |
| Weak non-English | 0.401 | 0.393 | 0.400 | 0.471 | 0.755 | 0.858 | 0.901 | 0.938 | 0.958 |
| Familiar abstract | 0.500 | 0.553 | 0.645 | 0.700 | 0.856 | 0.916 | 0.962 | 0.970 | 0.981 |
| Nonce abstract | 0.500 | 0.592 | 0.676 | 0.757 | 0.846 | 0.938 | 0.967 | 0.975 | 0.977 |
Context margin . Positive values favor the demonstrated mapping; negative values favor the pretrained natural convention.
| Group | K=0 | K=1 | K=2 | K=4 | K=8 | K=12 | K=16 | K=20 | K=24 |
|---|---|---|---|---|---|---|---|---|---|
| Strong English | -1.251 | -2.957 | -3.384 | -2.700 | -1.506 | -0.874 | -0.403 | -0.207 | 0.064 |
| Intermediate English | -0.699 | -3.037 | -3.471 | -2.318 | -0.710 | 0.040 | 0.447 | 0.734 | 1.010 |
| Weak English | -1.602 | -2.471 | -2.799 | -1.785 | -0.117 | 0.562 | 1.001 | 1.320 | 1.538 |
| Strong non-English | -0.639 | -2.429 | -3.133 | -2.220 | -0.384 | 0.364 | 0.906 | 1.353 | 1.593 |
| Intermediate non-English | -0.448 | -1.388 | -1.625 | -0.933 | 0.643 | 1.591 | 2.217 | 2.750 | 3.038 |
| Weak non-English | -0.172 | -0.845 | -0.743 | -0.083 | 1.311 | 2.346 | 2.983 | 3.503 | 3.913 |
| Familiar abstract | 0.000 | 0.332 | 0.924 | 1.564 | 2.792 | 3.311 | 3.620 | 4.017 | 4.212 |
| Nonce abstract | 0.000 | 0.127 | 0.528 | 1.080 | 2.178 | 2.926 | 3.536 | 4.451 | 4.839 |
Interpretation. The main pattern is a systematic shift in the number of demonstrations needed for TL to overcome the pretrained convention. Abstract labels follow the demonstrated mapping almost immediately. Weak natural groups cross to with relatively few demonstrations, intermediate groups cross later, and strong English remains prior-dominated until approximately . At , context accuracy is only 0.505 for strong English, rises to 0.832--0.958 for the weaker natural groups, and is about 0.98 for the abstract controls. Thus stronger natural label priors keep the model in the TR/prior-following mode for longer, while weaker or arbitrary labels allow TL/context-following to dominate with fewer demonstrations. This is the real-model behavior predicted by our framework. Because adjacent groups are somewhat noisy and the ordering is qualitative, we use the result as complementary evidence for the predicted TR--TL mechanism, not as a direct measurement of corpus frequency or a formal phase transition.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Response to Reviewer nmjG
We sincerely thank the reviewer for the unusually careful and constructive reading. We agree with most of the issues identified.
We agree that Equation 15 is a lower bound and by itself is compatible with constant or more slowly decreasing error. It therefore does not establish that the rare-task error converges at a power-law rate. Our intended claim was a separation in what the theorem guarantees: the head-task recognition term has an exponentially decaying upper bound, whereas the tail/novel-task regime faces a power-law lower bound. We will correct the theorem discussion and other related section accordingly.
Our intended model class is a joint predictor over tokens and the latent task variable, whose observable next-token prediction is obtained by marginalizing the task:
We will explicitly incorporate this point in the revised manuscript.
We agree that a single mutual-information constraint I(M;G0,ϕ1:K)≤C is the most direct information-theoretic model of finite model capacity. We use the additive scalar form in Eq. 8 because of the standard separability lemma in rate-distortion theory: for independent sources with an additive distortion objective, the joint rate-distortion problem decomposes into component-wise problems, and an optimal test channel can be chosen to factorize across the sources. Conditional on G0 and a fixed shared allocation, our task-specific problem has this form. Intuitively, coupling the task-specific test channels cannot improve the additive distortion, so their rates can be allocated separately.
This separability can also be related directly to the global mutual information. Since the task parameters are conditionally independent given G0,
with equality when the task parameters remain conditionally independent given (M,G0).
The factorized optimal test channel guaranteed by the separability lemma preserves this conditional independence and therefore achieves equality:
This yields the additive constraint used in Eq. 8. We will add the separability lemma and its application to our setting in the revised version.