Fast Wavenet Generation Algorithm

Tom Le Paine, Pooya Khorrami, Shiyu Chang, Yang Zhang, Prajit Ramachandran, Mark A. Hasegawa-Johnson, Thomas S. HuangarXiv 2016

Introduction

WaveNet has established itself as a premier generative model for high-fidelity audio, utilizing stacks of dilated causal convolutional layers to capture long-range temporal dependencies. While highly effective during training due to parallel processing, WaveNet faces significant efficiency challenges during inference. This paper introduces "Fast WaveNet," an algorithm that transforms the generation process from exponential time complexity to linear, enabling practical real-time applications.

The Challenge of Autoregressive Generation

In the generation phase, WaveNet operates autoregressively, predicting one sample at a time. Each new sample is fed back into the network to predict the next. A naive implementation recomputes the entire receptive field for every new sample.

Figure 1: Standard dilated convolution architecture showing the exponential growth of dependencies.

As shown in Figure 1, for a network with $L$ layers, the number of operations required to generate a single sample grows as $O(2^L)$. For deep networks necessary for high-fidelity audio (often dozens of layers), this computational cost makes real-time generation computationally prohibitive.

Methodology: Caching Recurrent States

The core insight of the Fast WaveNet algorithm is that many intermediate convolutional states are redundant across successive time steps. By reframing the dilated CNN as a Recurrent Neural Network (RNN) during inference, the authors introduce a caching mechanism to store these "recurrent states."

The algorithm utilizes Convolution Queues at each layer. These are First-In-First-Out (FIFO) buffers that store previously computed hidden states. Because of the dilation factor $d$, the output at layer $l$ depends on the current input and a state computed $d$ steps ago.

Figure 2: The Fast WaveNet architecture using FIFO queues to store recurrent states ($h_r$) for efficient generation.

The generation process follows a two-phase cycle for each sample:

  • Pop Phase: The oldest state is removed from the front of the queue and used as the "recurrent" input for the current layer's convolution.
  • Push Phase: The newly computed hidden state is appended to the back of the queue to be used in future time steps.

Performance and Complexity

By eliminating redundant calculations, Fast WaveNet reduces the time complexity per sample from $O(2^L)$ to $O(L)$. This shift is transformative; while the naive method's generation time explodes as the network depth increases, Fast WaveNet's performance scales linearly.

Interestingly, this speedup does not come at the cost of memory. Both the naive and fast methods require $O(2^L)$ space to store the necessary states for the receptive field. Fast WaveNet simply organizes this memory more effectively into persistent queues. Empirical results show that while there is a small overhead for very shallow networks due to GPU parallelization optimizations in standard convolutions, the benefits of Fast WaveNet become overwhelming as network depth increases.

Conclusion

Fast WaveNet provides a critical optimization for autoregressive models based on dilated convolutions. By treating these networks as efficient RNNs during inference, the algorithm enables the deployment of deep generative models for real-time audio synthesis and other online prediction tasks without sacrificing model depth or receptive field size.

Summary updated

BibTeX
@misc{paine2016fast,
  author = {Tom Le Paine and Pooya Khorrami and Shiyu Chang and Yang Zhang and Prajit Ramachandran and Mark A. Hasegawa-Johnson and Thomas S. Huang},
  title = {{Fast Wavenet Generation Algorithm}},
  year = {2016},
  eprint = {1611.09482},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.09482},
}
Figure