Liquid time-constant networks
A visual guide to Ramin Hasani, Mathias Lechner, Alexander Amini, Daniela Rus and Radu Grosu, “Liquid Time-constant Networks”, AAAI 2021 · the paper. Built with Animated Visuals; every number from the paper says which equation, figure or table it comes from, and every simulated figure says so.
A liquid time-constant network (LTC) lets each neuron's time constant change with its current input. This guide uses one neuron connected to one touch sensor to explain the paper's equation, bounds, fused solver, trajectory length, benchmark results and limits.
The example: one neuron and one sensor
A touch sensor produces a value near 0 when untouched and 1 when pressed. The neuron converts that input into a smooth internal value called its state. Its time constant is roughly the seconds needed for the state to cover two thirds of the distance to its new resting value.
In an LTC, the input determines the time constant. Drag the input knob at the right edge. A firm press lowers the time constant toward 0.20 s, so the state rises quickly. Releasing it raises the time constant toward 0.93 s, so the state returns more slowly.
A stronger input shortens the time constant
Eq. 1 · simulatedThis illustrative LTC neuron uses Eq. 1 with τ = 1 s, gate strength W = 4 and target A = 1, solved live with the paper's fused step (Eq. 3). Drag the knob on the input lane, or leave it on the press loop.
The one change from older continuous-time networks
The paper starts from two older ideas. A neural ODE lets a small network f set how fast the state changes. A continuous-time RNN (CT-RNN) adds a leak, −x/τ, that pulls the state back to rest with one fixed time constant τ. The LTC changes where the input enters. It uses a synaptic current f·(A − x), which pulls the state toward a target A and grows with the input (Section 1, “Why this specific formulation?”). Expanding that current gives the paper's Eq. 1:
dx/dt = −[ 1/τ + f(x, I, t, θ) ] · x + f(x, I, t, θ) · A
The input now appears inside the bracket that multiplies x, beside the leak. That bracket sets how fast the state moves, so the effective time constant is τsys = τ / (1 + τ·f). When f is large, τsys is small. Use the steps to compare the same press across all three models.
Only the LTC changes its response speed
Eq. 1 · simulatedEach model gets the same gate f and τ = 1 s; the equations are the paper's (Section 1), the numbers are illustrative. Rise and fall times are measured on the simulated curves: the seconds to cover 63% of the gap to the new resting value.
Bounds on the state and the time constant
Section 4 gives two bounds. They require the gate f to be a sigmoid between 0 and 1, scaled by a weight W.
Theorem 1 (Eq. 4): the time constant stays between τ/(1 + τW) and τ. Our neuron has τ = 1 s and W = 4, so it remains between 0.20 s and 1 s. Theorem 2 (Eq. 5): the state stays between min(0, A) and max(0, A). In Eq. 1, the leak pulls toward 0 and the gate pulls toward A, so the state remains in that range.
Use the rough, illustrative signal and raise its strength to ×10. The time constant approaches its lower bound, and the state remains inside its bounds. Drag the target A below zero to move the state bounds with it.
The time constant and state stay within bounds
Eqs. 4–5 · simulatedThe envelopes are the paper's expressions (Theorems 1 and 2); the input is a seeded random signal and the neuron is the same illustrative one. Drag the target line in the bottom lane; the gate strength W is in settings.
A CT-RNN with the same gate is also bounded by τ·W·A, so its upper bound grows with the weights. The LTC's upper bound is A for any W. The paper also proves that LTCs can approximate any smooth dynamical system over a finite stretch of time (Theorem 3, Section 5), the same kind of guarantee CT-RNNs have.
The fused solver step
Eq. 1 has no closed-form answer in general, so a computer advances it in small time steps of Δt. The paper describes LTCs as stiff: a strong gate can make the state change quickly. A step based on the current slope, called explicit Euler, can overshoot the target. Runge-Kutta solvers handle this by taking many small steps, which is slow (Section 2).
The paper's fused solver uses the state at the end of the step for the x that multiplies the bracket in Eq. 1. It keeps the start-of-step state inside f (Eq. 2). The result is the paper's Eq. 3:
x(t + Δt) = [ x(t) + Δt · f · A ] / [ 1 + Δt · (1/τ + f) ]
The result is a weighted average of the current state, the target A and rest at 0. An average of numbers between 0 and A stays between 0 and A, so the step cannot overshoot for any Δt. Drag the step size on the time axis to compare the methods.
The fused step does not overshoot
Eqs. 2–3 · simulatedSame illustrative neuron, input held pressed from t = 0. The exact curve is the closed-form answer for a constant gate; the two step rules are Euler and the paper's Eq. 3. Drag the step marker on the time axis; W is in settings.
In the paper's experiments each input sample is split into 6 of these fused steps (Algorithm 1 unfolds L steps; Section S5 sets the step to 1/6 of the input sampling period). Training runs plain backpropagation through all of those steps instead of the adjoint method neural ODEs often use: memory grows with the sequence, O(L × T) instead of O(1), but the gradients are accurate (Table 1, Section 3).
Trajectory length
The paper uses trajectory length (Raghu et al. 2017) to measure how much each network transforms the same input. The input is a circle traced once (I₁ = sin t, I₂ = cos t, for t from 0 to 2π). The hidden state is reduced to 2D with PCA, then the length of its path is measured. The input circle has length 2π ≈ 6.28. The paper treats a longer resulting path as a more expressive transformation (Section 5.1, Fig. 1).
The paper applies this measure to randomly initialised neural ODEs, CT-RNNs and LTCs solved with RK45. Use the tabs to compare the values printed in Fig. 2.
LTC leads trajectory length in 14 of 15 settings
Fig. 2 · paper valuesEvery value is printed in the paper's Fig. 2 above its panel (one network per setting). The dashed line is the input circle's length, 2π, for scale. Hover a dot for its exact value.
Theorems 4 and 5 (Eqs. 7–9) put lower bounds on how this length grows: for all three models it grows exponentially with depth times the number of solver steps, and the LTC's bound carries an extra factor that grows with the size of its hidden state. The paper's reading of its Figs. 2 and 3: the length grows linearly with width, the LTC's grows faster than linearly with the spread of the weights, and in multi-layer tanh and sigmoid networks none of the three grows with depth.
Benchmark results
Trajectory length measures expressivity. Section 6 tests task performance by training each model with 32 hidden units on real sequences for five runs and reporting mean ± standard deviation (Tables 3, 4 and 6; setup in Section S5). Choose a comparison model. Every row places the better result farther to the right.
LTC leads in four of seven Table 3 tasks
Tables 3, 4, 6 · paper valuesMeans and standard deviations over 5 runs, copied from Tables 3, 4 and 6; each row has its own scale. The bracket and its difference are computed here. Hover a dot for the method and value.
The paper reports improvements of 5% to 70% in four of seven Table 3 tasks, but this range could not be matched to one baseline. Against the best other model on each task, the gains are 1.8% on gesture, 0.1% on occupancy, 41% less error on traffic and 6.3% on ozone. The gains are larger against weaker baselines. On gesture, the LTC beats the neural ODE by 48%. On a second version of the person activity task (Table 5), set up to match Rubanova et al. 2019, the LTC scores 0.882 ± 0.005 against 0.846 ± 0.013 for the best latent ODE.
Limits
Table 2 calls the average number of solver steps per input sample computational depth. The LTC uses more steps than the other models:
Section 8 says neural ODEs are “remarkably fast” next to LTCs, and that the LTC's expressivity comes “at the expense of elevated time and memory complexity”. It gives two more limits:
- Long-term dependencies. Like other continuous-time RNNs trained by gradient descent, LTCs suffer from vanishing gradients, so in their current form they're “not the obvious choice” for learning long-range dependencies.
- The solver matters. They do well with variable-step solvers and the fused solver, but performance is “majorly influenced” when off-the-shelf explicit Euler is used: the overshoot in the solver figure.
And in Table 3 itself, three of seven tasks favour another model: activity recognition (neural ODE, 97.26% against 95.67%), sequential MNIST (LSTM, 98.41% against 97.57%) and power (CT-GRU, 0.586 against 0.642 squared error).
Checked against the source
- Equations. Eq. 1 (state equation), τsys = τ/(1 + τf) (Section 1), Eqs. 2–3 (fused step), Algorithm 1, Eq. 4 (Theorem 1), Eq. 5 (Theorem 2), trajectory length l(I) = ∫‖dI/dt‖dt with the circular input (Section 5.1), Eqs. 7–9 (Theorems 4–5), as written in the paper. The CT-RNN and neural ODE equations are the ones in Section 1.
- Fig. 2 (trajectory length). All 45 values in the trajectory-length figure are read from the labels printed above the panels of the paper's Fig. 2 (A: layers 1–3, Hard-tanh, depth 3; B: σw² = 1, 2, 4, Hard-tanh, depth 1; C: width 100 and 200, ReLU, depth 1; D: layers 1–5, depth 5; E: width 100 and 200, Hard-tanh, depth 1; all RK45, width 100, σw² = 2 and σb² = 1 unless varied). Panel D's label says “tanh” while the caption says “logistic-sigmoid”; the guide follows the panel and says so.
- Tables 3, 4, 6 (benchmarks). Means and standard deviations as printed. Table 4 has a latent ODE where Table 3 has a neural ODE; the guide shows it in the same column and says so. Table 5 (0.882 ± 0.005 against 0.846 ± 0.013) and Table 2 (computational depth) are quoted in the prose. Ratios (133×, 12.5×), percentage gains (1.8%, 0.1%, 41%, 6.3%, 48%) and the brackets are computed here from those tables.
- Setup numbers. 32 hidden units, 5 runs, ODE step 1/6 of the input sampling period (Section S5, Table S1); O(L × T) against O(1) memory (Table 1).
- Simulated. The neuron in the first four figures is illustrative: τ = 1 s, W = 4, A = 1, and a gate f = W·sigmoid(8·(I − 0.5)) that depends only on the input. Its numbers (time constant 0.20 s to 0.93 s, resting state 0.07, pressed state 0.80, the Euler and fused values) are computed from Eq. 1 and Eq. 3 with those values, not reported by the paper. The rough input in the bounds figure is a seeded random signal.
- Left out on purpose. The proofs (Supplement S1–S4), Theorem 3's construction, Fig. 3's box plots (no numbers are printed for them), the Half-Cheetah setup beyond Table 6, the parameter counts of Table S2, and the wiring of multi-neuron LTC networks: the guide keeps to one neuron so every number can be checked by hand.
- Not verified. The paper's “5% to 70%” range could not be matched to a single baseline (see the benchmarks section). No experiment from the paper was re-run.