On the Sample Complexity of Language Generation in the Limit with Noise, Prompts, and Feedback

Alexandra Butoi, Ryan CotterellarXiv 2026

TL;DR

Suppose an AI listens to a stream of valid sentences from an unknown language and just needs to start generating new, valid sentences—without necessarily learning the whole grammar. We know this is mathematically possible, even when learning the exact rules isn’t. This paper asks the practical follow-up: how many examples does it actually take, especially when the training stream is noisy, prompted, or assisted by feedback?

What Problem Does This Paper Address?

In the 1960s, E. Mark Gold proved something sobering: if you only ever see positive examples of a language, it is generally impossible to deduce the exact underlying language—even for simple regular languages. Yet modern Large Language Models seem to do fine just reading the internet. Recently, Kleinberg and Mullainathan resolved this paradox by introducing language generation in the limit. Instead of identifying the hidden language from a candidate collection $\mathcal{C}$, the learner just has to eventually output valid, unseen strings from it. Surprisingly, this task is tractable!

However, "eventually" can be a very long time. To ask how many examples are needed (sample complexity), researchers look at uniform generation, where a fixed sample threshold $m$ guarantees success regardless of the target language or example order. Prior work found sample bounds for clean streams of regular, locally threshold testable (LTT), and context-free languages, but left two big gaps:

  1. Known bounds have massive exponents—can structural restrictions on languages yield tighter bounds?
  2. Real-world generation isn't clean or isolated. What happens to sample complexity when the input has errors (noise), requires continuing a prefix (prompting), or allows asking an oracle yes/no questions (feedback)?

Methods

The authors crystallize prior proof techniques into a clean four-step "recipe" for finding sample bounds. Because a learner only gets trapped if the intersection of all languages consistent with the data so far is finite (leaving it with no new strings to say), bounding sample complexity boils down to bounding the size of the largest possible finite intersection in $\mathcal{C}$:

  1. Close under intersection: Combine language representations (like finite automata) into a single intersection representation.
  2. Bound the longest string: Use the fact that the intersection is finite (meaning no cycles allowed!) to cap the maximum string length $\ell$.
  3. Count strings: Sum all possible strings over alphabet $\Sigma$ up to length $\ell$ (roughly $|\Sigma|^{\ell+1}$).
  4. Apply generatability: Once the learner sees more distinct examples than that maximum finite intersection, any remaining consistent intersection must be infinite.

The authors apply this recipe to a newly analyzed class—partially-ordered (PO) languages, whose automata forbid cycles other than self-loops—and reformulate uniform generation to closer match LLM usage: treating prompts as string prefixes (via left quotients) and feedback as a fixed total budget $f$ of membership queries.

Figure 1: Two PONFAs and their product PONFA. The longest simple path has length 2 × 2 = 4.

Datasets

Not discussed in the paper. (This is a purely theoretical learning-theory paper analyzing formal language classes.)

Key Insights and Ideas

  • Representation beats compactness: Expressing regular languages in monadic second-order logic is super compact, yet yields a horrific "exponential tower" sample bound. Automata are bulkier, but bound string length $\ell$ much more tightly.
  • Self-loops tame the exponent: In PO languages, paths can only move strictly forward through states (aside from self-loops, which disappear in finite intersections). This drops regular languages' double-exponential sample complexity down to a single exponential—the smallest exponent known in this framework.
  • Noise is remarkably cheap: Adding up to $k$ corrupt examples doesn't blow up the sample complexity exponentially; it just adds a modest linear penalty of $k|\mathcal{C}|$.
  • Binary search with feedback fails: With $f$ yes/no oracle queries, you’d hope to halve the candidate languages each time (reducing $|\mathcal{C}|$ to $|\mathcal{C}|/2^f$). The authors prove a clever counterexample using LTT languages where no query eliminates more than one candidate at a time!
  • The Context-Free Wall: Because you can encode Turing machine halting times into the intersection of two context-free grammars, no algorithm can ever compute the sample bound for context-free languages—not even with prompts or feedback.

Key Results

Across finite collections $\mathcal{C}$ (with representation size $s$, alphabet $\Sigma$, noise $k$, and feedback budget $f$), the authors establish crisp upper bounds (and partially matching lower bounds):

Table 1: Upper bounds of sample complexity of uniform generation in the limit for regular, locally threshold testable (LTT), partially-ordered (PO), and context-free languages across the base setting of Kleinberg & Mullainathan (2024), generation with noise, prompted generation, and generation with feedback. We sometimes give the bounds in terms of the base bound B. We use s to denote the largest size of the representation of each language, k the noise level, and f < |C| −1 the feedback budget. The notation x 7→y denotes that x gets replaced by y in the base bound.
  • PO Languages: Upper-bounded by $|\Sigma|^{|\mathcal{C}|(s-1)+1}$, with a nearly matching binary-alphabet lower bound of $\binom{2s}{s} - 1 = \Theta(4^s/\sqrt{s})$ for two languages.
  • Finite Noise ($k$): Increases the base sample bound $B$ to $B + k|\mathcal{C}|$ across regular, LTT, and PO languages.
  • Prompting: Leaves regular and PO bounds completely unchanged ($B$), and at most doubles the profile size parameter $r$ in the exponent for LTT languages—independently of prompt length!
  • Finite Feedback ($f$): Eliminating one language per query shrinks $|\mathcal{C}|$ to $|\mathcal{C}| - f$ in the exponent—an exponential sample reduction!

Limitations and Future Work

The authors are candid about their assumptions: candidate collections $\mathcal{C}$ must be finite (essential for uniform bounds), language membership is strictly binary, and feedback is 100% truthful. While unrealistic for pre-training a massive chatbot on the messy web, this maps well to constrained generation—like generating valid code or JSON against a small set of schemas with a compiler acting as a cheap, truthful validator. Finally, gaps remain between several upper and lower bounds (especially for LTT languages), and these information-theoretic bounds ignore computational runtime—leaving algorithmic efficiency wide open for future work.

Summary updated

BibTeX
@misc{butoi2026sample,
  author = {Alexandra Butoi and Ryan Cotterell},
  title = {{On the Sample Complexity of Language Generation in the Limit with Noise, Prompts, and Feedback}},
  year = {2026},
  eprint = {2611.39753},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.39753},
}
Figure