TL;DR
How do language models learn to generate valid, creative outputs from positive examples alone—and how much time and data does it actually take? Moving beyond qualitative "eventually it works" guarantees, this paper builds a quantitative framework for the computational complexity of language generation. Along the way, the authors uncover a fascinating trade-off: you don't need strong adversarial (online) learning to build an efficient generator, provided you can sample from the intersections of your candidate hypotheses.
What Problem Does This Paper Address?
Modern language models ingest massive corpora of valid text (positive examples) and somehow learn to generate novel, valid text without ever explicitly being handed a dataset of "non-language." Recently, Kleinberg and Mullainathan (2024) captured this in an elegant model of language generation in the limit, showing that algorithms can eventually generate valid unseen examples after some finite training time. However, "finite but unspecified" is a qualitative guarantee—you might be waiting until the heat death of the universe.
To get concrete bounds on sample size and runtime, the authors shift to a Probably Approximately Correct (PAC) framework, building on a model by De, Diakonikolas, and Servedio (2015). Imagine the universe of all possible strings as an $n$-dimensional Boolean hypercube $\{-1,1\}^n$. An unknown Boolean function $f$ from a concept class $C$ defines our target language: strings where $f(x) = 1$ are valid (say, compiling Python programs), and $f(x) = -1$ are invalid.
Given uniformly random positive examples from $f^{-1}(1)$, the learner must efficiently output a sampler (a generative circuit) whose output distribution is close in Total Variation (TV) distance to the uniform distribution over the true language. Crucially, TV distance is measured conditioned on the training set—forcing genuine creativity rather than mere memorization—and requires a multiplicative error guarantee, which is far harder than standard classification when the valid language is an exponentially tiny needle in the Boolean haystack.
Prior work implicitly showed you can solve this efficiently if you have three algorithmic primitives ("oracles") for $C$: an approximate sampler/counter, a Statistical Query (SQ) learner, and an online learner (which learns against an adaptive adversary). Because efficient online learning is notoriously difficult and often impossible, the authors ask: Is online learnability actually necessary to efficiently learn to sample?
Methods
After proving that online learning is not strictly necessary (via a cryptographic counterexample), the authors design a new oracle-efficient reduction that swaps the demanding online learner for a standard offline Empirical Risk Minimization (ERM) oracle—an algorithm that simply finds a hypothesis consistent with a static batch of labeled data.
Here is how their core iterative "volume contraction" algorithm works:
- Capture Breadth: Run the offline ERM on the true positive training examples. This yields an initial guess $h^0$ that covers almost all of the true language (high breadth), though it may wildly overgeneralize ("hallucinate") across the rest of the hypercube.
- Generate Artificial Negatives: Because $h^0$ is much larger than the true language, random samples drawn from $h^0$ (using a sampling oracle) are overwhelmingly likely to fall outside the true language. Label these samples as artificial negatives.
- Contract Hallucinations: Feed the true positives and artificial negatives back into the offline ERM to get a new hypothesis $h^1$. Intersecting it with the previous guess ($h^0 \cap h^1$) slices the volume of the predicted language in half while preserving breadth.
- Boost Precision: Repeat this intersection loop at most $n$ times until the volume is within a polynomial factor of the true language's size (forming a "densifier"). Finally, apply standard Statistical Query (SQ) learning and rejection sampling techniques from prior work to shave off the remaining hallucinations and achieve $\varepsilon$-closeness in TV distance.
Datasets
Not discussed in the paper. (This is a purely theoretical computer science paper with no empirical datasets or benchmarks.)
Key Insights and Ideas
- Generation doesn't require online learning: Using pseudorandom functions (adapting a classic construction by Blum), the authors construct a concept class where online learning is cryptographically hard (assuming one-way functions exist), yet PAC learning to sample is solvable in polynomial time because its offline learner only relies on positive examples.
- The Learning vs. Sampling Trade-off: Replacing an online learner with an offline ERM oracle isn't free. Because the algorithm intersects hypotheses at each step, your sampling and counting oracles must now handle intersections of up to $n$ concepts from $C$ (e.g., intersections of halfspaces rather than single halfspaces).
- The trade-off is fundamental: Using unique cryptographic signature schemes, the authors prove that an offline ERM, an SQ learner, and sampling/counting oracles for single concepts in $C$ are not enough—sampling from intersections is strictly necessary in general.
- Smooth interpolation via negative examples: How many intersections you need depends directly on how hungry your offline learner is for negative examples. By defining learners robust to "$p$-negative filtering" (where $1-p$ of negative examples are randomly deleted), the authors show a smooth spectrum: needing all negatives ($p \approx 1$) requires $O(n)$ intersections, needing zero negatives ($p = 0$) requires $1$ (no intersections), and anything in between scales as $O(n / \log(1/p))$.
Key Results
- Sample Complexity (Ignoring Compute): Statistically, any Boolean class $C$ can be PAC learned to sample (potentially in exponential time) using $\widetilde{\Omega}(\text{VC}(C)/\varepsilon)$ positive samples.
- Oracle-Efficient Generation: Given an offline ERM oracle, an SQ learner for $C$, and approximate sampling/counting oracles for intersections of $k \le n$ concepts in $C$, the proposed algorithm PAC learns to sample within TV distance $\varepsilon$ in $\text{poly}(n, 1/\varepsilon, 1/\delta, \log|C|)$ time, making $O(n)$ calls to the ERM and intersection oracles per mass guess.
- Cryptographic Lower Bounds: Under RMA-secure unique signature schemes, there exists a class $C$ with polynomial-time ERM, SQ learning, and exact single-concept sampling/counting where no polynomial-time algorithm can PAC learn to sample up to TV error $\varepsilon = 1/4$ with probability $2/3$.
Limitations and Future Work
- Oracle Implementation: The algorithms are oracle-efficient—they run in polynomial time assuming the underlying ERM, SQ, and intersection-sampling oracles are efficient. Implementing approximate sampling/counting for intersections of concepts is computationally nontrivial for many natural function classes.
- Realizable Discrete Toy Model: The framework assumes a noiseless ("realizable") setting where the target distribution is strictly uniform over the satisfying assignments of a Boolean function. Extending this quantitative theory to continuous domains, non-uniform marginals, or agnostic/noisy settings remains open.
- Consistency vs. Breadth: Achieving small TV distance forces both low hallucination and high breadth (expressivity). Investigating computationally efficient PAC samplers that prioritize only avoiding hallucinations (trading away breadth) is left for future work.
Summary updated