Liquid Neural Networks (LNNs)
Liquid neural networks are continuous-time RNNs whose neuron time constants change with the input. Covers LTC and CfC models, NCP controllers, and code.
Liquid neural networks (LNNs) are a family of continuous-time recurrent neural networks (RNNs) in which each neuron's state follows a differential equation whose time constant depends on the current input, so how quickly a neuron responds changes from moment to moment. Ramin Hasani, Mathias Lechner, and colleagues at MIT, IST Austria, and TU Wien introduced the core model, the liquid time-constant (LTC) network, at AAAI 2021, drawing on models of the nervous system of the nematode C. elegans, which has 302 neurons. LNNs are small, often a few dozen neurons, and have been used mainly for time series analysis and for steering vehicles and drones, where their compact size makes the learned behavior easier to inspect. Training fixes their weights as in any network, and the "liquid" part is the dynamics, which the input reshapes at every step.
How Liquid Time-Constant Networks Work#
A continuous-time RNN describes its hidden state x(t) with an ordinary differential equation, as neural ODEs do, instead of a discrete update. An LTC network uses dx/dt = −[1/τ + f(x, I, θ)] ⊙ x + f(x, I, θ) ⊙ A, where I(t) is the input, τ is a base time constant for each neuron, A is a learned bias vector, and f is a small neural network with a bounded, sigmoid-like output. Because f appears in the decay rate, each neuron's effective time constant is τ_sys = τ / (1 + τ f), which shrinks when f is large, making the neuron react quickly, and approaches τ when f is near zero. The paper proves that both τ_sys and the state stay within fixed bounds, so the network remains stable even under very large inputs.
Training unrolls a numerical ODE solver and backpropagates through it. The authors' fused solver takes a semi-implicit step, x(t + Δt) = [x(t) + Δt f A] / [1 + Δt (1/τ + f)], which the PyTorch snippet below implements for four neurons and feeds three different inputs:
import torch
from torch import nn
torch.manual_seed(0)
n_inputs, n_neurons, dt = 2, 4, 0.1
f = nn.Linear(n_inputs + n_neurons, n_neurons) # gate network f(x, I); its weights stay fixed below
tau = torch.full((n_neurons,), 2.0) # base time constant of each neuron
A = torch.randn(n_neurons) # level each neuron is pulled toward when its gate opens
def ltc_step(x, I):
"""One fused-solver step of dx/dt = -(1/tau + f) * x + f * A, plus the effective time constant."""
gate = torch.sigmoid(f(torch.cat([I, x])))
x_next = (x + dt * gate * A) / (1 + dt * (1 / tau + gate))
return x_next, tau / (1 + tau * gate)
x = torch.zeros(n_neurons)
for I in [torch.tensor([0.0, 0.0]), torch.tensor([5.0, -5.0]), torch.tensor([-5.0, 5.0])]:
x, tau_sys = ltc_step(x, I)
print(f"Input {I.tolist()}: time constants {[round(t, 2) for t in tau_sys.tolist()]}")It prints effective time constants of [1.02, 0.99, 0.92, 1.1] for a zero input, [1.35, 1.5, 1.06, 1.26] for the input (5, −5), and [0.8, 0.74, 0.82, 0.97] for (−5, 5). With the same weights, the second neuron's time constant ranges from 0.74 to 1.5, a factor of two, depending only on what the network sees. Because the state evolves in continuous time, Δt can also be set to the actual gap between samples, which lets LNNs read irregularly sampled data, such as medical records or event-driven sensors, without resampling it to a fixed rate.
Neural Circuit Policies and CfC Networks#
Two related works from the same group carried LTC neurons into control and removed the cost of the ODE solver:
- Neural circuit policies (NCPs): In Nature Machine Intelligence in 2020, Lechner, Hasani, and colleagues wired LTC neurons into a sparse, layered circuit modeled on C. elegans, with sensory, inter, command, and motor neurons. Behind a convolutional feature extractor, a policy of 19 control neurons and 253 synapses learned to steer a car from camera images to keep it in its lane, and the paper reports that it generalized and resisted noise better than black-box controllers orders of magnitude larger.
- Closed-form continuous-time (CfC) networks: Hasani and colleagues showed in 2022 that a closed-form approximation of the LTC solution removes the numerical solver, making training and inference between one and five orders of magnitude faster than ODE-based counterparts while keeping continuous-time behavior.
The authors' ncps library implements LTC and CfC cells and NCP wirings for PyTorch and Keras.
Applications#
- Drone navigation: In a 2023 Science Robotics study, drones controlled by liquid networks learned to fly to a target from human-piloted demonstrations recorded in a forest in summer, then completed the task in a winter forest, in urban settings, and with added noise, rotation, and occlusion, outperforming many state-of-the-art alternatives.
- Medical and sensor time series: Continuous-time models suit irregular streams such as intensive-care measurements, where readings arrive whenever a test is run.
- Perception-to-control pipelines: A liquid controller needs compact per-frame features, and YOLO26 can supply them: its predict mode with
stream=Trueyields one result per video frame as a generator, so box coordinates or pose keypoints reach the controller as each frame is processed.
LNNs vs. Related Models#
- LSTM and GRU: Discrete-time cells that update once per input step, with no notion of how much time passed between steps. LTC neurons evolve continuously, and controllers built from them typically use far fewer neurons.
- Neural ODEs: LTC networks are neural ODEs with a specific bounded form that guarantees stable dynamics.
- Spiking neural networks: Also brain-inspired, but their neurons communicate with discrete spikes. LTC neurons have continuous-valued states modeled on the non-spiking neurons of C. elegans.
- State space models: Also continuous-time recurrences, discretized for computation. Mamba computes its step size from each input, which gives every channel an input-dependent time constant, and Hasani's group combined the S4 state space model with LTC dynamics in Liquid-S4 at ICLR 2023.
- Liquid AI models: Hasani, Lechner, Alexander Amini, and Daniela Rus founded Liquid AI as an MIT CSAIL spin-off in 2023. Its LFM2 language models, released in July 2025, combine gated short convolutions with a small number of grouped-query attention layers, an architecture separate from LTC networks despite the shared "liquid" name.










