Polynomial-Time Learning of Random Automata from One Label per Word

Yilin ChengarXiv 2026

TL;DR

Imagine trying to map a maze in the dark when your only feedback is a light that flashes once at the very end of a walk to tell you if you reached an exit. This paper presents the first polynomial-time algorithm to learn a randomly wired deterministic finite automaton (DFA) from random binary strings labeled only at the end, breaking an exponential barrier while simultaneously refuting a standing conjecture on how fast hidden paths merge.

What Problem Does This Paper Address?

A deterministic finite automaton (DFA) is one of computer science’s foundational state machines: it reads a binary string one bit at a time, hopping from state to state, and finally accepts or rejects the string. Learning an unknown $n$-state DFA when you can actively query strings or watch internal state transitions is well-studied.

Here, the learner is passive and nearly blind: it only sees independent, uniformly random binary strings of length $m$ along with a single acceptance bit at the end. In the worst case, learning DFAs passively is notoriously hard, and brute-force search over $n$ states requires checking $n^{2n}2^n$ possibilities. In 2017, Fish and Reyzin asked how efficiently we can learn average-case DFAs—where the $2n$ state transitions are chosen uniformly at random. Prior conditional approaches still required exponential $2^{O(n)}$ time and relied on an unproven conjecture about trajectories quickly merging. The fundamental hurdle: to map the hidden states, a learner needs to know how a single hidden state responds to two different future inputs, yet each training string only reveals one timeline and one final bit.

Methods

Instead of relying on trajectories merging quickly, Yilin Cheng introduces a clever "two-window" moment-comparison method:

  • Extracting Same-State Products: Fix a short history string $w$ and two continuation tests $g$ and $h$. By averaging outputs of words ending in $wg$ and $wh$ separately and multiplying those averages, you simulate two independent hidden walks reading the same history $w$ before branching. Crucially, the learner computes this at history length $l$ and again at $l+1$. Pairs of states that stay distinct shrink in total mass by a predictable ratio $x_l$, while maintaining almost the exact same shape. Taking a weighted difference between length $l+1$ and $l$ cancels out the distinct pairs, isolating the expected product of both tests acting on the exact same hidden state!
Two-window cancellation rule isolating single-state test products
  • Decoding Discrete States: Using these estimated products, the learner builds observable Gram matrices over short distinguishing tests. Applying a shifted positive-definiteness test acts like a prism, separating realized state signatures from absent ones and reconstructing the recurrent state transitions up to relabeling.
  • Handling Traps: With probability $\Theta(1/n)$, a random DFA contains small closed "trap" components (like a state with two self-loops) that absorb runs early. To guarantee failure rates smaller than $1/n$ (say, $o(n^{-\beta})$), the algorithm explicitly enumerates all tiny binary actions on at most $\lceil \beta + 2 \rceil$ states and solves orthogonal regression tasks to capture residual prefix information.

Datasets

Not discussed in the paper (as a theoretical computer science paper, there are no external benchmark datasets). To validate the theoretical approximations, the author evaluates the formulas on synthetic, randomly generated transition tables ($n$ ranging from $6$ to $64$) and accompanies the work with 22 modules formalized in the Lean theorem prover.

Key Insights and Ideas

  • Refuting the Linear Meeting-Time Conjecture: Fish and Reyzin conjectured that linear-length words ($\lfloor cn \rfloor$) would merge two distinct starting states with high enough probability to simplify learning. Cheng proves this false: after $\lfloor cn \rfloor$ letters, the fraction of words keeping two prescribed states apart converges in probability to $e^{-c}$. Driving that separation down to $1/n$ actually takes asymptotically $n \log n$ letters.
  • Simulating Cloning via Consecutive Windows: You cannot clone a hidden state in a passive sample, nor can you wait $n \log n$ steps to condition on exact suffixes without blowing up sample complexity to $2^{n \log n}$. Comparing two consecutive logarithmic windows ($O(\log n)$) extracts single-state correlations using only polynomial samples.

Key Results

  • Polynomial-Time Guarantee: For any fixed confidence exponent $\beta > 0$, the algorithm succeeds on $1 - o(n^{-\beta})$ of all random $n$-state tables, achieving prediction error $\le \epsilon$ with sample size and bit running time polynomial in $n$, $m$, $1/\epsilon$, and $\log(2/\gamma)$.
  • Empirical Window Sharpness: In numerical tests across $n \in \{6, 10, 16, 32, 64\}$, the population diagonal-extraction error drops rapidly at surprisingly short history lags—for example, hitting $1.60 \times 10^{-5}$ by lag $t = 40$ for $n = 64$.
Population diagonal-extraction error across state sizes and window lags
  • Decoder Recovery: Out of 61 synthetic random machines ($n \in \{6, 10, 16\}$) with nonconstant recurrent cores, the decoder recovered 58 targets by lag $t=20$; the remaining 3 were exact non-synchronizing edge cases (such as pure swap/permutation blocks).

Limitations and Future Work

  • Astronomical Polynomial Degree: This is strictly a theoretical feasibility proof, not an algorithm to run on your laptop tonight. In a baseline analysis at $m = n$, the first sample batch scales as $O(n^{573722})$ and dense matrix inversion takes $O(n^{860160})$ operations! Because empirical errors vanish at much shorter lags than the proofs currently require, proving tighter bounds could dramatically slash this exponent.
  • Confidence-Dependent Scaling & Alphabet Size: The polynomial degree currently grows with the target confidence parameter $\beta$ (due to enumerating larger trap components). Removing this dependence on $\beta$, as well as extending the two-window method beyond binary strings to larger alphabets, remain open problems.

Summary updated

BibTeX
@misc{cheng2026polynomial,
  author = {Yilin Cheng},
  title = {{Polynomial-Time Learning of Random Automata from One Label per Word}},
  year = {2026},
  eprint = {2611.32959},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.32959},
}
Figure