DL0188 Liquid Neural Networks

What are Liquid Neural Networks (LNNs), and how do their continuous-time ODE-based dynamics with time-varying parameters differ from fixed-weight RNNs and Transformers?

Answer

A Liquid Neural Network is a recurrent model whose hidden state is defined by an ordinary differential equation in continuous time rather than by a fixed-stride update rule, and whose effective time constant is computed from the current input and state instead of being frozen at training time. The canonical instance is the Liquid Time-Constant (LTC) network, where a neuron leaks toward a resting value at rate 1/\tau and is simultaneously driven by a nonlinearity f(x, I; \theta) that also appears in the denominator of the effective time constant, so each neuron can behave like a fast detector on one input and a slow integrator on another. The trained parameters \theta are static after training; what is “liquid” is the input-dependent time constant and synaptic drive, which makes the system a family of dynamics selected on the fly rather than one fixed linear-time-invariant filter. Because the state is a function of physical time, the elapsed interval \Delta t is an explicit argument to a numeric solver, which is what lets LNNs consume irregularly sampled sensor streams without imputation. Against this, a gated RNN applies the same learned transition once per token at an implicit constant stride, and a Transformer has no recurrent state at all: it mixes tokens by attention over the whole prefix, paying O(L^2) prefill and carrying a linearly growing KV cache.

(1) Continuous-Time State: the hidden vector is the solution of an ODE evaluated by a solver, so the model interpolates between observations instead of skipping to the next index.
(2) Liquid Time Constant: \tau_{sys} = \tau / (1 + \tau f) varies per neuron per step, giving input-dependent timescales from one fixed parameter set.
(3) Elapsed Time Is An Input: unequal gaps between samples are handled exactly by integrating over \Delta t, which matters for event streams, medical records, and asynchronous sensors.
(4) Sparse Auditable Wiring: Neural Circuit Policies wire LTC neurons in a sensory, inter, command, motor hierarchy, and a 19-neuron command layer has flown real drones and driven real cars.
(5) Cost Scales With Solver Steps: compute is O(L k d^2) for k solver steps per observation, with no KV cache, but the recurrence is inherently sequential.
(6) Provable Boundedness: the LTC construction bounds both the state and \tau_{sys}, so the dynamics cannot blow up the way an unconstrained neural ODE can.

Flow diagram of a liquid time-constant cell: an irregularly sampled input stream feeds a nonlinear drive function f of state and input, which both drives the ODE state x of t and, through a lower box, sets the liquid time constant tau over one plus tau times f; the state is integrated by an ODE solver taking k fused Euler steps across each delta t, then read out linearly, with a dashed feedback arrow returning the state at the next observation and a timeline below showing unequally spaced observation ticks with grey internal solver steps between them

Figure 1: One nonlinearity does two jobs. The same f(x, I; \theta) supplies the drive toward the resting potential A and sets the effective time constant, and the solver spans whatever \Delta t the sensor happened to deliver, so the grey internal steps, not the sequence index, determine the compute bill.

The contrast with a fixed-weight RNN is easiest to see through the timescale. An LSTM or GRU also has a forget gate that modulates memory retention, but the gate acts on a fixed discrete stride: the model learns one retention profile for “one step” and has no representation of how much real time a step covered. If your samples arrive at 3 ms and then at 400 ms, the gated RNN sees two identical steps unless you hand it the gap as an extra feature and hope it learns the exponential relationship. The LTC instead solves for the exponential, because \Delta t enters the integrator directly. The contrast with a Transformer is structural rather than temporal. Attention is a stateless global mixer: it can reach any earlier token in one hop, which is why it dominates language, but it has no notion of physical duration beyond whatever positional scheme you inject, and its cost grows quadratically with context while its memory grows linearly. An LNN keeps a fixed-size state regardless of horizon, which is exactly what an embedded controller running at 50 Hz for hours needs, and exactly the wrong trade for retrieving a fact from 200,000 tokens of text.

Mathematical Formulation:
\frac{dx}{dt} = -\frac{x}{\tau} + f(x, I; \theta)\,(A - x)
\tau_{sys}(x, I) = \frac{\tau}{1 + \tau f(x, I; \theta)}
\frac{\tau}{1 + \tau f_{max}} \leq \tau_{sys} \leq \tau
h_t = \sigma(W h_{t-1} + U I_t + b)

Where:

  • x(t) \in \mathbb{R}^{d} is the continuous-time neuron state and I(t) the sensory input at that instant.
  • f(x, I; \theta) is a bounded nonlinearity (typically a sigmoid of an affine map) with static trained parameters \theta; it appears twice, as the drive and inside the time constant.
  • \tau is the per-neuron leak time constant, A the resting potential the drive pulls toward, and f_{max} the supremum of f that bounds the fastest achievable dynamics.
  • \tau_{sys} is the liquid (effective) time constant; the bracketing inequality is what guarantees the state stays bounded and the solver stays stable.
  • The last line is the fixed-weight RNN baseline: h_t depends on step index t only, with W, U, b applied identically at every step and no \Delta t anywhere in the update.
Two panel chart. Left panel plots the effective time constant tau_sys against input drive f on a logarithmic vertical axis for three base time constants 0.1, 0.5 and 2.0 seconds, all curves collapsing toward one over f as the drive grows. Right panel plots state x of t against time for a square input pulse between one and three seconds, comparing a fixed leaky integrator with a constant one second time constant against a liquid time constant cell whose effective time constant is 0.21 seconds while the input is on and 0.84 seconds when it is off, showing a much faster rise and a partially sustained level

Figure 2: Left, the whole point of the 1 + \tau f denominator: a strong input collapses \tau_{sys} toward 1/f, so one neuron spans a wide band of timescales. Right, the same input pulse through a fixed leaky integrator and an LTC cell with identical \tau; the liquid cell charges roughly five times faster while driven and relaxes more slowly once the drive is removed, behaviour a single fixed-weight filter cannot produce.

The practical objection to LNNs is the solver. Every observation costs k evaluations of f, stiff dynamics push k up, and the whole recurrence is sequential, so training cannot be parallelized across time the way attention or a convolutional scan can. Closed-form Continuous-time (CfC) networks answer this by replacing the numeric integration with an analytic approximation of the LTC solution, keeping the input-dependent timescale while deleting the solver from the graph, at reported speedups of one to five orders of magnitude in training and inference over solver-based LTCs.

Closed Form And Cost:
x(t) = \sigma(-f\,t) \odot g + [1 - \sigma(-f\,t)] \odot h
C_{LNN} = O(L\,k\,d^2)
C_{TF} = O(L^2 d + L\,d^2)

Here f, g, h are separate learned heads of (x, I) and \sigma(-f t) acts as a time-dependent gate that interpolates between two candidate states as elapsed time grows, which is the closed-form stand-in for exponential relaxation. Note that C_{LNN} has no term in L^2 and no cache: an LNN controller at d = 64 can run indefinitely in constant memory, while the Transformer term grows with every token retained.

PropertyLiquid (LTC / CfC)Fixed-weight RNN (LSTM / GRU)Transformer
State definitionContinuous state from an ODE, evaluated by a solver or a closed-form gateDiscrete hidden and cell state, one update per stepNo recurrent state; every token attends over the full prefix
Handling of elapsed timeDelta t is an explicit solver argument, so unequal gaps are exactImplicit constant stride; gaps must be imputed or appended as a featurePosition index or RoPE; real timestamps must be encoded as extra inputs
Effective timescaleInput-dependent, tau over one plus tau f, bounded above by tauSet by trained gate weights, modulated only within one fixed strideNone; the mixing radius is the context window
Cost per observationk solver evaluations, sequential, no cacheOne matmul pass, sequential, no cacheParallel in training, but KV cache grows linearly with L
Typical deployed sizeTens to a few thousand neurons, including 19-neuron flight and driving policiesThousands to millions of parametersHundreds of millions to hundreds of billions
Dominant failure modeStiff dynamics inflate solver steps; no parallelism over timeVanishing gradients and timescale mismatch on long horizonsQuadratic prefill, and no built-in notion of physical duration

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *