In-context learning (ICL) has emerged as the "killer feature" of modern Large Language Models (LLMs), enabling them to solve novel tasks simply by observing a few examples in a prompt. Traditionally, these examples are fully labeled pairs. However, as context windows expand to millions of tokens, users frequently possess a surplus of unlabeled data.
Can transformers actually learn from this unlabeled data within a prompt? This paper bridges a critical gap in theoretical research by investigating Semi-Supervised ICL (SS-ICL), revealing that a model's depth fundamentally dictates its ability to extract information from unlabeled demonstrations.
The Core Problem: Semi-Supervised ICL
Previous theoretical work has focused almost exclusively on fully supervised ICL. In SS-ICL, the prompt contains a mix of labeled and unlabeled demonstrations. To understand how transformers handle this, the authors model the data using a binary Gaussian Mixture Model (GMM), where features are drawn from two clusters and the objective is to find the "task mean" that separates them.
Through a mix of rigorous mathematical proofs and empirical experiments, the researchers analyzed linear attention models of varying depths to see if they could leverage the unlabeled data to find this task mean more accurately.
The "One-Layer" Failure and the Power of Depth
The study uncovers a stark contrast between shallow and deep architectures:
- The 1-Layer Limitation: A single layer of linear attention is mathematically "blind" to unlabeled data. The authors prove that one-layer models converge to a "Supervised Plug-in" (SPI) estimator. This estimator is optimal for labeled data but completely ignores unlabeled data. Because the average covariance of data across many tasks looks like random noise, a single layer cannot orient the clusters without explicit labels.
- The Multi-Layer Advantage: Depth unlocks the ability to use unlabeled data. Multi-layer or "looped" models can implement higher-order polynomials of the data's covariance matrix. By doing so, deeper transformers implicitly perform a version of the Expectation-Maximization (EM) algorithm—each layer acts as an iteration of pseudo-labeling (Expectation) and weight updating (Maximization).
Remarkably, depth is exponentially powerful. An $L$-layer model can express a polynomial of degree $O(3^L)$. This means you don't need a massive 100-layer model for complex semi-supervised learning; even a shallow 2- or 5-layer model can represent very high-order iterations of an EM-like algorithm and approach the Bayes-optimal error limit.
From Theory to Practice: LoopTabFM
Drawing a parallel between transformer mechanics and classical statistics (where linear attention emulates EM and softmax attention emulates Belief Propagation), the authors propose a practical method for tabular data called LoopTabFM.
Instead of relying on a single inference pass, LoopTabFM "loops" an off-the-shelf tabular foundation model (like TabPFN). It uses the model's own predictions as soft pseudo-labels for the unlabeled data in the subsequent iteration.
Key Results: * Tested across 17 real-world binary classification datasets from OpenML, LoopTabFM provided an average 6.35% relative improvement in accuracy over standard single-pass inference. * On specific datasets, the performance jump was as high as 19.38%. * Confirming the theory that "shallow can suffice," most of these performance gains were realized within just the first two iterations of looping.
Limitations and Future Directions
While the theoretical framework provides profound insights, it primarily relies on linear attention and assumes data follows a Gaussian Mixture Model. Real-world data is often messier, and the exact mathematical manifold of what full softmax Transformers can represent remains an open question. Furthermore, on 2 out of the 17 tested datasets, the looping method slightly decreased performance, suggesting that high noise levels or class imbalances might make pseudo-labeling risky.
Ultimately, this research proves that we don't necessarily need to retrain models to handle unlabeled data. By simply feeding a model's own outputs back into the prompt as pseudo-labels, we can unlock powerful semi-supervised capabilities in existing foundation models. Future work may explore how self-generated "Chain-of-Thought" rationales could further enhance SS-ICL for complex reasoning tasks.
Summary updated