Whether a neural network trained by gradient descent can learn a hidden finite-state machine is usually explained in terms of how many states the machine has. We argue the deciding quantity is something else: how long the machine's internal state can stay hidden from whatever supervision the learner sees. A two-state parity tracker is easy to learn when it reports its running parity at every step. A machine of the same size that computes the parity of a secret subset of positions and reveals the result only at the end is, for any learner that works through averages, as hard as learning noisy parity. We propose to make this precise and test it. We define one parameter, the observation horizon: the number of recent steps of input and output needed to pin down the current state. We will prove that it controls statistical-query learnability of automata in both directions, and show empirically that it predicts gradient-based failure where state count does not.
The relevant model is statistical-query (SQ) learning. An SQ learner never sees individual examples. It sees only tolerance-bounded estimates of averages over the data, and gradient descent fits this description because each step averages a loss gradient over a batch (Statistical Query Algorithms for Stochastic Convex Optimization). SQ lower bounds are unconditional, unlike the cryptographic hardness results that dominate automata learning. Yet they have barely been applied to stateful sequence structure. Our aim is a single SQ statement covering final-label, next-symbol, per-step, and state-revealing supervision of automata, with a matching algorithm. We then test that statement against neural learners on the standard automata benchmarks.
Core Claim
Fix a deterministic finite automaton (DFA, a machine that reads a string one symbol at a time and moves between finitely many states) $M$. Fix an observation interface $O$ that says what the learner sees after each symbol: nothing until the end, an accept bit, a next-symbol continuation vector, or the state itself. Fix a string distribution $D$. Define the $\epsilon$-observation horizon as
$$h_\epsilon(M,O,D) = \min\{h : \Pr_{t,\,w\sim D}[\text{state after } w_{1..t} \text{ is not determined by the last } h \text{ input/observation pairs}] \le \epsilon\},$$
where $t$ is a uniformly chosen position in the string $w$.
Our conjecture has two halves. The upper bound says that any class of automata with horizon at most $h$ is SQ-learnable to error $O(\epsilon)$ with $\mathrm{poly}(n)\cdot|\Sigma|^{O(h)}$ queries at tolerance $|\Sigma|^{-O(h)}\mathrm{poly}(\epsilon)$, where $n$ is the state count and $\Sigma$ the alphabet. The lower bound says that for every $h$ there is a class of $O(h)$-state automata with horizon $h$ whose SQ dimension is $2^{\Omega(h)}$. The exponential dependence comes from the lower-bound construction: it embeds an $h$-bit parity over a secret subset, whose $2^h$ members are pairwise orthogonal (Noise-Tolerant Learning, the Parity Problem, and the Statistical Query Model).
We want to be upfront about which half is trivial. The lower bound alone is close to folklore, because parity over $h$ fixed positions is computed by a DFA with about $2h$ states. The content of the proposal lies elsewhere. It lies in the matching upper bound. It lies in the claim that $h_\epsilon$, rather than $n$ or the choice of supervision interface, is the right single parameter. And it lies in the prediction that gradient learners track it.
This parameter reorganizes existing results. Learning a Random DFA from Uniform Strings and State Information shows that random DFAs are SQ-learnable when the state is revealed. Revealing the state is the case $h=0$, and their random-walk argument is a special case of window statistics. Hardness of Learning Regular Languages in the Next Symbol Prediction Setting proves cryptographic hardness of passive DFA learning even with next-symbol continuation vectors. Their construction pads the machine so the vectors carry no information until the last step, which in our terms inflates $h$ to the string length. We predict that the same padding yields an unconditional SQ lower bound, with no factoring assumption needed. Algorithm Development in Neural Networks: Insights from the Streaming Parity Task observes RNNs collapse to a 2-state DFA under per-step parity labels, where $h=1$. The same target with only a final label is the SQ-hard sparse-parity problem that SGD solves only at the matching exponential cost (Matching the Statistical Query Lower Bound for k-sparse Parity Problems with Stochastic Gradient Descent).
Research Program
The theory component has three parts.
Upper bound. We give a window learner. It uses SQ estimates of the observation distribution conditioned on each length-$h$ window of recent inputs and observations. It then merges windows whose future-observation statistics agree over a jury of short suffixes. This merge step is the class-query idea of Towards Persistent Noise-Tolerant Active Learning of Regular Languages with Class Query, recast as a passive VSTAT-style query in the sense of A General Characterization of the Statistical Query Complexity rather than as active membership queries backed by an equivalence oracle. The proof obligation is a coverage condition: windows that matter must have mass at least $|\Sigma|^{-O(h)}$ under $D$. We will state it as an explicit assumption on $D$ rather than hide it. We expect it to hold for uniform strings and to fail for adversarial distributions. The open question about distribution-independent tightness in Feldman's framework is the reason we do not claim a distribution-free result.
Lower bound. We embed parity over a secret subset of an $h$-symbol segment into an otherwise fully observable machine. We will verify that the next-symbol padding of Bhattamishra et al. reduces to this embedding. We will compute statistical dimension using Feldman's randomized statistical dimension.
Computational caveat. Computational Bounds on Statistical Query Learning separates the number of queries from the cost of choosing them. Our window learner chooses its queries explicitly in time $|\Sigma|^{O(h)}$, so the characterization is computational as well, for constant $h$.
The empirical component turns the theory into a falsifiable prediction about neural learners. Its central device is a twin construction: the same transition graph, and therefore the same state count, paired with two observation interfaces that differ only in horizon. One twin emits the hidden parity only after $h$ steps. The other emits per-step outputs, giving $h=1$. If state count governed learnability, the twins would be equally hard. The horizon theory predicts the hidden twin costs $2^{\Theta(h)}$ more steps.
Baselines
The naive reference point is the prefix tree acceptor with majority-label fallback. It memorizes training strings and guesses the majority class elsewhere. It fixes the chance floor on every benchmark and shows how much of any learner's success is memorization.
The strongest passive symbolic baseline is RPNI state merging, together with a raw-sample Gaussian-elimination solver on the parity twins. These are not SQ algorithms. This matters because raw-sample algorithms escape SQ lower bounds on noiseless parity: Blum, Kalai and Wasserman's algorithm runs in subexponential time even with noise (Noise-Tolerant Learning, the Parity Problem, and the Statistical Query Model). Both get the same training strings as every other method, and RPNI gets its standard parameter-free configuration. Our theory predicts they beat gradient learners on noiseless hidden twins and lose that edge as label noise rises. Seeing that crossover would confirm the claim is specifically about aggregate learners.
The strongest neural extraction baseline is the regularized RNN of Learning minimal automata with recurrent neural networks. It adds an entropy penalty that forces hidden states to collapse into discrete states, and it is reported to learn the correct minimal automaton for all seven Tomita grammars and all Bluetooth Low Energy (BLE) protocol models where RPNI often failed. We will also run plain LSTM, GRU and small Transformer models. Every neural method gets the same data, the same number of gradient steps, and the same hyperparameter search of 20 configurations. Beating these baselines in our sense does not mean higher accuracy. It means our window learner matches their accuracy on low-horizon tasks with orders of magnitude less computation, and that the horizon predicts their failures before training.
As an oracle-access reference we include CAPAL, the active class-query learner of Towards Persistent Noise-Tolerant Active Learning of Regular Languages with Class Query. It reports 92.8% exact DFA recovery on 200 Sipser, RegexLib and KB13 DFAs, against 75% for standard L* variants, and stays robust at 15–20% membership-query noise. This number is the ceiling for a learner with active access. We report how close the passive window learner gets on the same 200 DFAs at matched noise. We do not claim to exceed CAPAL, since it uses strictly more access.
The key ablation is the twin construction itself. It holds transition graph and state count fixed and varies only the observation interface: final bit, next-symbol vector, per-step output, or revealed state.
Why not just…?
Why not just cite the folklore parity embedding and stop? It already shows DFAs are SQ-hard under uniform strings. We agree, and we treat that as the trivial half. The embedding says nothing about which automata under which supervision are easy. The streaming-parity result and Angluin and Chen's positive result both sit outside it. A lower bound without a matching upper bound in the same parameter cannot predict anything on Tomita or RegexLib. The upper-bound theorem and the benchmark regression are what the folklore lacks.
Why not just use state count or sample complexity to predict neural failure? This is the default explanation, and the twin construction is designed to refute it directly. If gradient learners need comparable steps on the hidden and observable twins, the horizon claim fails. On the benchmark suites, we fit learning cost against state count and against $h_\epsilon$, both alone and jointly, and report which explains more variance.
Why not just use algebraic class membership, such as C-RASP, as the predictor? This is a real threat. Algebraic Decomposition Theory for Transformer Length Generalization gives a polynomial-time test for C-RASP membership. It reports near-perfect accuracy at tripled length for languages inside the class, and an accuracy crash past training length for languages outside it. The two predictors answer different questions. C-RASP concerns which languages a Transformer can represent at unbounded length. The horizon concerns how hard it is to find a correct predictor from averaged signal at the training length. We will compute both on their 125-language suite and fit in-distribution learning cost and length-generalization accuracy against each. We expect C-RASP to win on length generalization and the horizon to win on in-distribution learning cost. If C-RASP also wins on learning cost, we will report that the horizon adds nothing for Transformers and restrict our empirical claim to recurrent models.
Why not just use a raw-sample state merger, since SQ bounds do not bind it? This is correct for noiseless data, and our experiments say so explicitly through the noise sweep in the baselines above. The proposal's claim is restricted to learners that act through averages. That class includes every gradient-trained network, which is why it matters in practice.
Proposed Experiments
The first experiment is the twin family. It covers horizons $h$ from 4 to 20 over the binary alphabet, at label-noise rates 0%, 5% and 10%. We measure gradient steps and samples needed to reach 99% test accuracy, plus exact minimal-DFA recovery for the extraction methods. We found no reported result on Lacuna for this family. The decisive check is the slope of log learning cost against $h$. It should be clearly positive for every gradient learner on the hidden twin, near zero on the observable twin, and matched by the window learner's query count.
The second experiment is predictive. We compute $h_\epsilon$ under final-bit and per-prefix supervision for the Tomita grammars, the 200 Sipser, RegexLib and KB13 DFAs, the 125-language suite, and the BLE models. We then check whether $h_\epsilon$ ranks neural failures better than state count does. Two known failures are natural test cases. One is modular counting under final-bit supervision, on which 1B-parameter models failed in Automata Learning and Identification of the Support of Language Models. The other is the sink-state latching failures in RNN Generalization to Omega-Regular Languages. We will check whether both are high-horizon cases.
The third experiment tests next-symbol supervision. On bounded Dyck languages, L-with-next-symbol-vectors is reported to converge with roughly 100 examples while standard L fails at 1,000 (Automata Learning and Identification of the Support of Language Models). We test whether next-symbol vectors lower $h_\epsilon$ there. We also test whether the padded construction of Bhattamishra et al. raises $h_\epsilon$ back to the string length and correspondingly defeats gradient learners trained with next-symbol targets.
The project succeeds if the twin slopes separate and $h_\epsilon$ beats state count on held-out benchmark languages. It fails if gradient learners on the hidden twins scale polynomially in $h$, because that would mean they escape the SQ abstraction in this setting.
References
- Statistical Query Algorithms for Stochastic Convex Optimization
- Noise-tolerant learning, the parity problem, and the statistical query model
- Learning a Random DFA from Uniform Strings and State Information
- Hardness of Learning Regular Languages in the Next Symbol Prediction Setting
- Algorithm Development in Neural Networks: Insights from the Streaming Parity Task
- Matching the Statistical Query Lower Bound for $k$-Sparse Parity Problems with Sign Stochastic Gradient Descent
- Towards Persistent Noise-Tolerant Active Learning of Regular Languages with Class Query
- A General Characterization of the Statistical Query Complexity
- Computational Bounds on Statistical Query Learning
- Learning minimal automata with recurrent neural networks
- Algebraic Decomposition Theory for Transformer Length Generalization
- Automata Learning and Identification of the Support of Language Models
- RNN Generalization to Omega-Regular Languages