Efficient Training of Audio Transformers with Patchout

Khaled Koutini, Jan Schlüter, Hamid Eghbal-zadeh, Gerhard Widmer

TL;DR

This paper introduces "Patchout," a novel method to efficiently train transformer models for audio processing by randomly dropping parts of the input sequence during training. This technique significantly reduces computational complexity and memory requirements, enabling state-of-the-art performance on audio tagging tasks using a single consumer GPU, while also acting as a regularizer to improve generalization.

What Problem Does This Paper Address?

Transformer models, highly successful in NLP and increasingly in computer vision, face a significant challenge when applied to audio: their computational and memory complexity grows quadratically with the input sequence length. This makes training on long audio sequences computationally prohibitive, often requiring massive datasets or complex pre-training strategies. While previous work has adapted transformers to audio by treating spectrograms as sequences of patches, this often exacerbates the complexity issue. This paper aims to make audio transformers more efficient and accessible without sacrificing performance.

Methods

The core contribution is Patchout, a technique inspired by dropout in neural networks. During training, Patchout randomly drops portions of the input sequence (spectrogram patches) fed into the transformer. This effectively reduces the sequence length the transformer needs to process, thereby lowering computational and memory demands. Patchout also acts as a regularizer, forcing the model to learn robust representations from incomplete data, which improves generalization.

The authors also propose:

  • Disentangled Positional Encoding: Separating time and frequency positional encodings, which simplifies fine-tuning on audio snippets of varying lengths.
  • Structured Patchout: A variation where entire rows or columns of patches are dropped, inspired by SpecAugment.
  • Reduced Transformer Depth (PaSST-L): Using a shallower transformer by removing self-attention blocks, leveraging pre-trained models.
  • No Overlap (PaSST-N): Training without overlapping input patches to further reduce sequence length.

Datasets

  • Audioset: The primary dataset used for training and evaluating the proposed models. It's described as the largest publicly available audio dataset for audio tagging.
  • Downstream Tasks: The models are fine-tuned on several smaller datasets for specific audio tasks:
  • Polyphonic Musical Instrument Recognition (OpenMIC)
    • Environmental Sound Classification (ESC50)
    • Acoustic Scene Classification (TAU Urban Acoustic Scenes 2020 Mobile)
    • Sound Event Recognition (Tagging) (FSD50K)

Key Insights and Ideas

  • Patchout as a Dual-Purpose Tool: It's not just about efficiency; Patchout also acts as a powerful regularizer, leading to better generalization. This is a significant finding, as many efficiency methods come at the cost of performance.
  • Transformer Efficiency is Achievable: The paper demonstrates that transformers can be trained efficiently on consumer-grade hardware, challenging the notion that they are inherently too resource-intensive for many audio tasks.
  • Structured Dropping Matters: Structured Patchout (dropping entire rows/columns) shows competitive results, suggesting that the spatial structure of spectrograms can be leveraged for more targeted efficiency gains.
  • Disentangled Encoding Simplifies Adaptation: Separating time and frequency positional encodings is a practical improvement for adapting models to varying audio clip lengths without complex interpolation.

Key Results

  • State-of-the-Art on Audioset: The proposed PaSST models achieve new state-of-the-art performance on the Audioset dataset.
  • Significant Speedup and Memory Reduction: Patchout can increase training speed by up to 4x and reduce GPU memory requirements by over 25% compared to baseline transformer models.
  • Consumer GPU Training: The models can be trained on a single consumer GPU (Nvidia RTX 2080ti) in a matter of days, achieving state-of-the-art results.
  • Outperforming CNNs: In terms of training speed and memory requirements, the Patchout-enhanced transformers outperform CNNs.
  • Effective Fine-tuning: Pre-trained PaSST models can be fine-tuned on downstream tasks with minimal resources and training time, achieving state-of-the-art results on several benchmarks. For example, PaSST-S-N achieved state-of-the-art on Polyphonic Musical Instrument Recognition in under 30 minutes.

Limitations and Future Work

  • Accuracy Trade-off with Patchout: While Patchout significantly improves efficiency, the paper notes that it can lead to a slight decrease in accuracy on some downstream tasks (e.g., ESC50).
  • Further Exploration of Structured Patchout: The paper mentions different types of structured Patchout and suggests further investigation into their optimal application.
  • Broader Application: While focused on audio spectrograms, the principles of Patchout could potentially be applied to other sequential data modalities where transformers are used.
  • Hyperparameter Tuning: The optimal configuration of Patchout (e.g., the percentage of dropped patches, structured vs. unstructured) might require further tuning for specific tasks.

Summary updated

BibTeX
@inproceedings{koutini2022efficient,
  author = {Khaled Koutini and Jan Schlüter and Hamid Eghbal-zadeh and Gerhard Widmer},
  title = {{Efficient Training of Audio Transformers with Patchout}},
  booktitle = {Interspeech},
  year = {2022},
}
Figure