Skip to content
Animated Visuals

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 · simulated

This 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 · simulated

Each 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 · simulated

The 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 · simulated

Same 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 values

Every 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 values

Means 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:

81.01solver steps per input for the LTC with Hard-tanh, against 0.61 for the neural ODE: 133× moreTable 2 · ± 10.05 and ± 0.02
56.9for the LTC with ReLU, against 1.29 for the neural ODE and 4.31 for the CT-RNNTable 2 · ReLU row
7.00for the LTC with sigmoid, against 0.56 for the neural ODE: the smallest gap, still 12.5×Table 2 · sigmoid row · ± 5.36

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:

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