Quant Memo
Core

WaveNet and Dilated Causal Convolutions

WaveNet stacks causal convolutions whose dilation doubles at every layer, so the range of past context a prediction can see grows exponentially with depth instead of linearly, using very few layers.

Prerequisites: Causal Padding and Look-Ahead Leakage, Receptive Fields and Dilation

A plain causal convolution stack can see further into the past only by adding more layers — one extra layer typically buys only a few extra timesteps of context. Covering weeks of tick data this way would need an impractically deep stack. Is there a way to cover a huge stretch of history using only a handful of layers?

The analogy: radar rings that skip further each time

Picture a series of radar sweeps down a street, each one spaced further apart than the last — the first sweep checks every step, the next checks every second step, the next every fourth step, and so on. After only a few sweeps, you've covered a huge distance using barely more equipment, because each sweep's spacing compounds on the one before it. Dilated convolutions do exactly this to a time series: each layer's kernel samples inputs spaced further apart than the layer before it.

The mechanics

Layer ii uses dilation 2i2^i: with kernel size kk, layer ii's output at time tt depends on xt,xt2i,xt22i,x_t, x_{t-2^i}, x_{t-2\cdot2^i}, \dots — always causal, per causal padding, but sampling positions spaced 2i2^i apart. After LL stacked layers with dilations 1,2,4,,2L11, 2, 4, \dots, 2^{L-1}, the overall receptive field is:

RF=1+(k1)i=0L12i=1+(k1)(2L1)\text{RF} = 1 + (k-1)\sum_{i=0}^{L-1} 2^i = 1 + (k-1)(2^L - 1)

In words: because each layer's dilation doubles the one before it, the total span of past timesteps a prediction can draw on grows exponentially with the number of layers, not linearly — a small increase in depth buys a disproportionately large increase in lookback.

Worked example 1: receptive field with 4 layers

Kernel size k=2k=2, dilations 1,2,4,81,2,4,8 across 4 layers: RF=1+(21)(1+2+4+8)=1+15=16\text{RF} = 1 + (2-1)(1+2+4+8) = 1 + 15 = 16 timesteps of context, using only 4 layers.

Worked example 2: compare to non-dilated layers

Same kernel size k=2k=2, but 4 plain (non-dilated, dilation =1=1 throughout) causal conv layers: RF=1+(21)(4)=5\text{RF} = 1 + (2-1)(4) = 5 timesteps. Dilation delivered 1616 timesteps of context versus 55 for the same 4 layers and same kernel size — roughly 3×3\times more lookback for identical depth, and the gap widens further as more layers are added, since the non-dilated case grows only linearly while the dilated case keeps doubling.

Receptive field size against depth grows exactly like this — watch the curve as the exponent increases:

Function explorer
-2260.1
x = 1.00f(x) = 2.718

input output at t, dilation doubling each layer
Each successive layer's connections skip further apart (dilation doubling), so the triangular receptive field of the final output grows exponentially with depth while remaining strictly causal.

Doubling the dilation at each successive causal convolution layer makes the receptive field grow exponentially with depth instead of linearly, letting a handful of layers cover a long lookback window cheaply and in parallel, while every output remains strictly a function of the past.

What this means in practice

Dilated causal convolutions are attractive for long financial time series because they capture long lookback windows — weeks of tick data — cheaply, and because all timesteps within a layer compute in parallel, unlike a recurrent network which must process one step at a time; training is correspondingly much faster, while remaining strictly causal for legitimate live forecasting use.

A large nominal receptive field does not mean the model attends to every position inside it equally, or even at all. Dilation means a given layer literally only samples specific past positions — every 2i2^i-th one — so information at the skipped-over positions must be captured by an earlier, less-dilated layer and carried forward through the stack. Too few layers, or a dilation schedule with unintended gaps, can leave some positions inside the nominal receptive field effectively invisible to the final output.

Related concepts

Practice in interviews

Further reading

  • van den Oord et al., WaveNet: A Generative Model for Raw Audio (2016)
ShareTwitterLinkedIn