Reading State-Dependent Feedback Off a Piecewise-Linear Model

Many systems we want to understand causally, such as two brain regions, a predator and its prey, or two coupled oscillators, influence each other in both directions. Often each direction of influence is switched on only in certain states. One region may drive another only when it is highly active, and feedback may appear only near a threshold. Current tools for causal discovery in dynamical systems return one verdict for the whole recording, "X drives Y" or "X and Y drive each other." Some are model-free tests on delay embeddings, which reconstruct a system's state from lagged copies of a single signal. Others are global linearizations. None can say where in state space each direction of influence is active.

This note proposes to fit a piecewise-linear recurrent neural network (PLRNN) to multi-subsystem time series. A PLRNN is a recurrent model with ReLU units whose state space splits into regions, and inside each region the dynamics are exactly linear. The latent space is structured so that each subsystem owns its own block of latent variables. In any region, the off-diagonal blocks of that region's linear map are then an exact, closed-form measure of how strongly one subsystem pushes the other. The switching boundaries between regions are also explicit. The result is a map of directed coupling in both directions, resolved by region, tied to the model's fixed points and cycles, and testable against ground truth.

Core Claim

Use the shallow PLRNN of Generalized Teacher Forcing for Learning Chaotic Dynamics, with latent state $z_t$ split into blocks $z^X, z^Y$ for subsystems $X$ and $Y$:

$$z_{t+1} = A z_t + W_1\,\mathrm{relu}(W_2 z_t + h_2) + h_1 .$$

Here $A$ is diagonal, $W_2$ maps latents to $M$ hidden ReLU units, $W_1$ maps them back, and $h_1, h_2$ are biases. The hidden units' on/off pattern $D$, a diagonal 0/1 matrix, labels the current region. Within that region the Jacobian (the matrix of how each next-state variable responds to each current-state variable) is exactly $J_D = A + W_1 D W_2$. We define the directed coupling from $X$ to $Y$ in region $D$ as

$$C^{X\to Y}_D = \big\| W_1^{Y,\cdot}\, D\, W_2^{\cdot,X} \big\|_F ,$$

the Frobenius norm of the $Y$-rows by $X$-columns block. Each hidden unit acts as a communication channel that reads from some subsystems and writes to others. The region's on/off pattern decides which channels are open. The coupling is therefore exactly zero in regions where no cross-writing unit is active, and it is computed without numerical derivatives or sampling.

The key design constraint concerns observations. Each subsystem's observations are decoded only from its own latent block. This block-diagonal decoder is what makes the off-diagonal Jacobian blocks meaningful. A latent space that mixes subsystems can be reshuffled by any invertible transform. Transforms that act separately within each block leave the zero or nonzero pattern of cross-blocks unchanged, so under a block decoder, "no coupling" is a property of the system rather than of the chosen coordinates.

What is new is not "Jacobians as causality," which TSCI already does on delay embeddings. It is a generative model whose Jacobians are exact, whose regimes are finite and enumerable, and whose coupling therefore comes out as a function of geometric state-space regions rather than as one global number.

Relation to Prior Work

Three lines of work motivate this. Tangent Space Causal Inference tests causality by pushing velocity vectors from one delay-embedded manifold to another through a learned map's Jacobian. It showed that vector-field alignment is more robust than point matching. It also depends on finite-difference velocities, which are noise-sensitive, and it produces no generative model. We keep its Jacobian view but take Jacobians from a fitted model rather than from finite differences.

Deep Koopman operator framework for causal discovery (Kausal) lifts dynamics into a learned space where one global linear operator applies. It scores causality by the drop in prediction error when a candidate driver is included. A single global operator cannot express coupling that turns on and off by state, and that is exactly the regime we target.

Modeling state-dependent communication between brain regions (MR-SDS) shares our view that inter-region messages depend on state. It gates them with a discrete switching variable inferred by a Transformer, and its dynamics inside each state are black-box networks. Our regimes are instead carved out by the continuous state itself, and within each regime the coupling is an exact matrix.

The method comes from the PLRNN literature. Shallow PLRNN training with generalized teacher forcing avoids exploding gradients on chaotic data Generalized Teacher Forcing for Learning Chaotic Dynamics. Exact fixed-point and cycle search is possible for these models, as in the bifurcation analyses of Bifurcations and loss jumps in RNN training. For irregularly sampled data we would use the continuous-time version Continuous-Time Piecewise-Linear Recurrent Neural Networks, whose region-wise analytic solutions give exact vector fields.

Two constraints shape the design. Cyclic Causal Discovery from Continuous Equilibrium Data warns that coupling strengths in feedback models are often not identifiable, even when graph structure is. We therefore claim only that the zero or nonzero pattern per region can be identified, not magnitudes. The PLRNN papers also report that exact guarantees hold for shallow architectures, so we stay shallow and accept its capacity limits.

Research Program

The first component is the model and scoring procedure. We would build the block-structured shallow PLRNN with per-subsystem decoders and a group-sparsity penalty on the cross-block rows of $W_1$ and columns of $W_2$. It would be trained with adaptive generalized teacher forcing. After training, we run the model freely to obtain the set of regions its attractor actually visits and each region's occupancy. For each region we compute $C^{X\to Y}_D$ and $C^{Y\to X}_D$.

A global directional score is the occupancy-weighted average of the per-region scores. Significance comes from refitting with the cross-block masked to zero. That masked fit is judged against the full fit on held-out attractor-geometry error $D_{stsp}$ and temporal error $D_H$, the metrics used by the generalized teacher forcing paper. This makes "no coupling" a falsifiable model comparison rather than a threshold on a norm.

The second component is region-resolved analysis. Because regions are finite, we can report which regimes carry feedback and whether coupling turns on near specific fixed points or saddles. We can also check whether a bidirectional verdict from a global test is really two unidirectional regimes that alternate over time. We also run simulated interventions: clamping a cross-channel unit off in the fitted model and measuring the change in attractor. This is cheap and exact within the model.

The third component is identifiability. We prove, or find counterexamples to, the claim that under block-diagonal decoders and a minimal-channel sparsity criterion, the set of regions with nonzero cross-coupling is invariant to latent reparametrization. We test this empirically by comparing coupling maps across random seeds.

Baselines

The naive reference point is linear vector-autoregressive Granger causality and VARLINGAM, run on the same observed series with the lag order tuned by cross-validation. It is the "do nothing clever" answer. Kausal reports beating VARLINGAM on coupled Rössler, reaction–diffusion and the ENSO model, so we expect it to be weak. It still anchors how much of the signal is merely linear.

The strongest global competitors are Kausal and the Imbalance Gain of Robust inference of causality in high-dimensional dynamical processes from the Information Imbalance of distance ranks. On coupled Rössler, Kausal reports an area under the ROC curve (AUROC) of 0.86. Imbalance Gain reports a 0% false positive rate on Rössler systems and about 10% on 40-dimensional Lorenz-96. On the double pendulum, TSCI with an MLP map reports a correlation score of 0.915, against 0.737 for latent CCM (convergent cross mapping, which tests coupling by predicting one signal's embedded state from another's).

All of these will be rerun on identical simulated trajectories and noise levels. Each gets the same hyperparameter search budget of a fixed number of trials and the same GPU-hours as our model. On established benchmarks, beating them means matching Kausal's 0.86 AUROC and Imbalance Gain's false positive rates while also passing the new region-resolved test, which none of them can attempt. On the global question alone, merely matching them is an acceptable outcome, because our contribution is the region-resolved map.

The most important baseline doubles as an ablation. It is a smooth model with the same block structure, per-subsystem decoders and group sparsity: a Neural ODE or tanh RNN of matched parameter count. Its Jacobian blocks come from automatic differentiation along trajectories, and states are clustered into regimes afterwards with k-means. This isolates whether the piecewise-linear partition matters, or whether block structure plus autodiff Jacobians would give the same answer. A second ablation removes the block-diagonal decoder, testing the claim that it makes cross-blocks meaningful. For the state-dependent question, MR-SDS is the direct competitor, run on the same data, with its communication-message magnitudes per discrete state serving as its coupling map. We found no reported MR-SDS coupling-recovery accuracy on Lacuna; its reported results are co-smoothing error.

Why not just…?

Why not just run a linear Granger test? Linear Granger causality assumes that information about the driver can be separated from the target's own history. TSCI and the Kausal authors argue this assumption fails in coupled nonlinear systems. The Imbalance Gain paper reports extended Granger causality with false positive rates of 93.8–100% on Rössler. Even where a linear test gets the global direction right, it has no notion of region, so it cannot answer the question posed here.

Why not just use a model-free test like Imbalance Gain or CCM? For the global yes/no direction, Imbalance Gain is a real threat: 0% false positive rate on Rössler is hard to beat. We do not claim to beat it there. Model-free tests produce no mechanism, however. They cannot say in which states coupling is active, cannot run in-model interventions, and cannot relate coupling to fixed points. The gated-coupling benchmark below measures exactly this gap. If running Imbalance Gain in sliding windows recovered the gating as well as our region map does, the region-resolution argument would weaken substantially. We include that windowed variant for this reason.

Why not just fit a Neural ODE and take autodiff Jacobians? This is the most serious alternative. Automatic differentiation also gives exact Jacobians, and block structure could be imposed on any architecture. The piecewise-linear model has two advantages it would have to earn. Its regimes come directly from the fitted dynamics rather than from post-hoc clustering, and its coupling is exactly zero in closed regions rather than merely small. The matched smooth ablation settles this. If the smooth model recovers gating boundaries and edge sets as accurately, the honest conclusion is that block structure, not piecewise linearity, does the work. We would then report that result.

Why not just use a switching linear system or MR-SDS? Switching linear models need many discrete states to approximate one smooth nonlinear flow. MR-SDS reports matching linear switching models with 3 latent dimensions per region against their 10. MR-SDS's switches are also a separate inferred variable, so nothing guarantees that its "states" correspond to regions of the physical state space. Head-to-head, we test whether its states align with ground-truth gating regions as well as PLRNN regions do.

Proposed Experiments

The decisive benchmark is new: coupled Rössler and Lorenz pairs whose cross-coupling is gated by state. In one direction, $X$ drives $Y$ only when a coordinate of $X$ exceeds a threshold. The reverse coupling is active only in a different band. Coupling strength is swept up to the edge of generalized synchrony. The ground truth is a coupling indicator over state space. Metrics are AUROC for pointwise recovery of "which direction is active here," plus accuracy in locating the gating threshold.

On established benchmarks we report global direction AUROC and false positive rate on coupled Rössler and 40-dimensional Lorenz-96 against the numbers above. On the irregularly sampled double pendulum, the continuous-time variant is compared with TSCI's 0.915. On StructInfer spring and NetSims graphs Benchmarking Structural Inference Methods for Interacting Dynamical Systems with Synthetic Data, SICSM reports an AUROC above 85% on NetSims when trajectories are shortened to 10 steps Structural Inference of Dynamical Systems with Conjoined State Space Models. These graphs serve as a scale check, where we expect to be competitive but not dominant.

As a real-data demonstration, we use the multi-region mouse calcium imaging from MR-SDS. The question is whether region-resolved coupling between the recorded cortical areas is stable across seeds and changes with behavioral epochs.

The idea succeeds if three things hold. First, gated coupling is recovered clearly better than by windowed Imbalance Gain and by the smooth autodiff ablation. Second, global accuracy stays within noise of Kausal and Imbalance Gain. Third, the coupling pattern per region is stable across seeds. The idea fails, and we would say so, if the smooth ablation matches it, or if seeds disagree on which regions carry coupling.