The graph matters, not just the neuron count

Some of my CTRNN transitions were failing even with the noise turned off. This bothered me more than I expected, partly because I’d put a lot of effort into getting the intended transitions to work, and partly because I couldn’t visualize what the rest of the state space was doing while I watched one beautiful trajectory on a plot. Somewhere there were basins, narrow passages, other equilibria. An input was pushing the system across that landscape and I was drawing an arrow between two circles as though that settled anything.

I’m extremely visual when I do mathematics. I have to be able to imagine where things can go, including the routes I don’t want them to take, and this was one of those problems where I kept finding myself unable to picture the thing I was claiming was happening. The network could be large enough that drawing it was useless, and an ODE solver would cheerfully produce another nice trajectory without telling me what happened to all the nearby ones.

So the question became fairly precise. Take a fixed-weight continuous-time recurrent neural network and a finite automaton we intend it to execute. Which initial neural states, inputs and perturbations can we guarantee lead to the right subsequent state? And once it gets there, can we do it again, from the actual state the network reached?

Giving a symbolic state some room

Let the automaton be A=(S,Σ,δ)\mathcal A=(S,\Sigma,\delta). The neural state is a vector h∈RN\mathbf h\in\mathbb R^N evolving continuously. I assign each symbolic state ss a full-dimensional core, a small region of neural configurations around a reference qs\mathbf q_s:

Ks={h:∥h−qs∥∞≤r}.K_s=\{\mathbf h:\|\mathbf h-\mathbf q_s\|_\infty\le r\}.

A little neighbourhood is a much more useful object than a single carefully prepared point. It gives you something to perturb; it also means that auxiliary neurons, even those which were inactive during the last transition, have to be in an acceptable configuration. The next transition may need them.

For an input symbol aa presented as a frame, I want the dynamics to carry every admitted starting point into the interior of the appropriate successor core:

h(0)∈Ks⟹h(T)∈int⁡Kδ(s,a).\mathbf h(0)\in K_s \quad\Longrightarrow\quad \mathbf h(T)\in\operatorname{int}K_{\delta(s,a)}.

There are safety conditions during the transition as well. If the system enters a different symbolic core on the way, the fact that it eventually comes back doesn’t rescue the computation. Similarly, a destination which activates while the same input pulse is still present can accidentally start the next transition. That one is particularly annoying; the network has no idea how many arrows I intended one pulse to represent.

The dynamics themselves are ordinary sigmoid CTRNN dynamics, with the input and a bounded current disturbance added:

h˙=−h+Wσ(h)+b1+Bu(t)+d(t),σ(x)=11+e−β(x−θ).\dot{\mathbf h}=-\mathbf h+W\sigma(\mathbf h) +b\mathbf 1+B\mathbf u(t)+\mathbf d(t), \qquad \sigma(x)=\frac{1}{1+e^{-\beta(x-\theta)}}.

Weights stay fixed during execution. Symbols are externally framed smooth pulses, so the protocol supplies the timing of an input occurrence. That is part of the mathematical setup and matters when interpreting the result.

The route I can actually look at

I used an explicit sparse construction with one semantic neuron for every state and two auxiliary neurons for each labelled transition that isn’t a self-loop. The idea of using edge and delay neurons has precedents in the CTRNN finite-state-computation literature; I liked that it made an otherwise unpleasantly high-dimensional problem break into pieces I could actually reason about.

For an edge s→ajs\xrightarrow{a}j the active route is

vs⟶es,a⟶ds,a⟶vj.v_s\longrightarrow e_{s,a}\longrightarrow d_{s,a}\longrightarrow v_j.

There is self-excitation, forward drive, local reverse inhibition and a negative baseline bias. The symbol channel for aa drives all edge neurons labelled aa; selection emerges from the currently active source and the circuitry around it. The rest of the system has to stay sufficiently quiet while this route is being used.

For mm semantic states and ee labelled non-self edges, the construction has N=m+2eN=m+2e neurons and m+8em+8e nonzero recurrent weights. It is an intentionally explicit representation. If I tried to use a distributed code for all the symbolic states the verification problem would change substantially, and I wanted to solve this version first.

There’s a useful regularity here. Every non-self transition presents the same four-neuron local problem, up to whatever currents leak in from the rest of the graph. That means I can try to understand one robust route and ask what it takes to embed it in many different automata graphs.

The graph kept turning up in the bounds

The word inactive is doing a lot of work in these networks. At finite sigmoid gain, a supposedly off neuron still has a small positive output. There can be hundreds of those outputs. Their effects are tiny individually and then you notice that a heavily connected state is receiving all of them.

Suppose all coordinates outside the active route remain below some current ceiling ρ\rho. Their sigmoid outputs are at most η=σ(ρ)\eta=\sigma(\rho). Now count the labelled transitions entering and leaving a semantic state; call the graph’s maximum in-degree Δ−\Delta^- and maximum out-degree Δ+\Delta^+. With forward weight wfw_f, reverse inhibitory magnitude wbw_b and disturbance allowance ε\varepsilon, the outside-current budget can be bounded by

∥ξ(t)∥∞≤ε+ηmax⁡{wfΔ−, wbΔ+}.\|\boldsymbol\xi(t)\|_\infty \le\varepsilon+\eta\max\{w_f\Delta^-,\,w_b\Delta^+\}.

That maximum took some getting used to. If you simply take absolute values and add up every coupling you get a stronger restriction. But the excitatory tails enlarge one side of the current interval and the inhibitory tails enlarge the other, so keeping their signs lets you bound the worst possible magnitude by the larger of the two one-sided contributions. There’s no statistical cancellation assumption hiding in this; it’s an interval calculation.

The original sufficient condition for a particular verified set of parameters came out as

9Δ−+8Δ+≤320.9\Delta^-+8\Delta^+\le 320.

After accounting for the signs and checking the rest of the network conditions again, the very same local certificate applies whenever

Δ−≤36,Δ+≤40.\Delta^-\le36,\qquad \Delta^+\le40.

I was much more excited about the appearance of the degrees than about the exact integers. The graph can have as many semantic states as you want, provided those local conditions remain bounded. If adding states spreads the transitions out, the local interference doesn’t necessarily increase; if adding states also piles more transitions into each one, the guarantee tightens. This changed the way I was thinking about the supposed capacity problem. Sometimes the graph is the object you need to redesign.

The constants are sufficient bounds for this construction, of course. Going beyond 36 or 40 doesn’t suddenly make a neuron physically incapable of another connection; the particular certificate runs out of room. But that gives a real design constraint you can reason about without running a larger full-dimensional enclosure every time you add a state.

An argument that almost eats its own tail

There’s an apparent circularity. The four-neuron certificate works when outside interference stays within its budget. The outside neurons stay suppressed if the selected route behaves as promised. I remember sitting with this and trying to imagine both parts at the same time, because you can’t just declare the rest of the recurrent network silent and move on.

The way out is a first-exit argument. Begin with all unwanted coordinates strictly below ρ\rho. Assume some outside coordinate has a first instant at which it reaches that ceiling. Up to that instant, the interference bound is valid, so the four-neuron route satisfies its contract. Now look at the vector field at the proposed boundary crossing. An unwanted semantic neuron, a delay neuron, an unpulsed edge neuron, and even an edge receiving the currently broadcast symbol each have their own inequality; each points inward at the boundary. The first crossing can’t happen.

I rather like this step, partly because it’s exactly where the local and global stories meet. The network is allowed to be fully recurrent, the inactive outputs remain finite, and we still get a uniform bound without pretending the surrounding neurons have been removed from the model.

The route itself needs a few carefully arranged timing properties. The destination remains sufficiently low until the pulse finishes, avoiding a second transition for the same symbol. The source releases. Afterward there’s time for the rest of the coordinates to settle, including all those auxiliary neurons which might become important on a later input. A useful bound for this quiet interval is

∥h(tc+tq)−qj∥∞≤E∞+(M−E∞)e−tq.\|\mathbf h(t_c+t_q)-\mathbf q_j\|_\infty \le E_\infty+(M-E_\infty)e^{-t_q}.

The decaying term gives a sufficient waiting time for a chosen return radius; the persistent term limits what this estimate can prove. Once every coordinate is back inside the next core, the next framed input starts from a permissible state again. That is what lets the argument repeat across an arbitrary finite word, carrying forward the real continuous endpoint each time.

The actual certificate

The local four-dimensional transition was enclosed by a polygonal tube covering 23,766 complete time cells. A numerical solver helped construct candidate walls and an interval checker independently checked the inequalities over those entire cells. A pleasant simulation can help you find an idea; the enclosure is what makes the universal statement about the admitted initial conditions and disturbances possible. The checker has its own implementation and arithmetic trust assumptions, which are worth keeping in mind if you’re using the result seriously.

With the declared weights, gain, disturbance budget, graph bounds and framed-input protocol, the construction executes every finite valid input word from each permitted full-state core. The graph can be arbitrarily large at fixed degree. I still find that an odd, satisfying statement to read.

Also, the network has an additional all-off attractor. That’s been one of my favourite things about the whole exercise. The reachable computation stays away from its certified neighbourhood, and every valid frame returns to the right region even while this other equilibrium exists elsewhere in the state space. I spent so much time worrying about unwanted dynamics and then ended up with a rigorous result in which one is demonstrably there and the computation survives it anyway.

There’s a lot left outside this theorem: distributed symbolic representations, arbitrary trained recurrent networks, continuously changing input streams without framing, and the biological constraints of particular circuits. I’m more and more interested in those biological constraints these days. Still, when I look back at the original FSM experiments that kept inexplicably taking the wrong turn, I like that the work led to a place where the graph structure gets a say in whether the computation is dependable. That was the thing I was missing when I kept looking at the individual neurons.

The longer history of why I was playing with neural automata to begin with is in BioLogic.