NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AST: Audio Spectrogram Transformer

Yuan Gong, Yu-An Chung, James R. Glass

Introduction

For the past decade, Convolutional Neural Networks (CNNs) have been the dominant architecture for audio classification. By treating audio as an image—converting waveforms into 2D spectrograms—researchers leveraged CNNs' ability to learn local patterns. However, CNNs have a limited receptive field, making it difficult to capture long-range global context without deep, complex architectures.

The Audio Spectrogram Transformer (AST) represents a paradigm shift as the first convolution-free, purely attention-based model for audio classification. Inspired by the Vision Transformer (ViT), AST relies entirely on self-attention mechanisms to process audio, proving that the inductive biases of CNNs are not strictly necessary for high-performance audio tasks.

Architecture and Methodology

The AST architecture is designed to process audio spectrograms as a sequence of patches, following the standard Transformer design.

The AST architecture processes an input spectrogram by splitting it into overlapping patches, projecting them into embeddings, and passing them through a Transformer encoder.

The process involves several key steps:

  1. Patching with Overlap: An input audio spectrogram is split into a sequence of $16 \times 16$ patches. Unlike the original ViT, AST utilizes overlapping patches to ensure better continuity across time and frequency dimensions.
  2. Linear Projection and Positional Embeddings: Each 2D patch is flattened and projected into a 1D embedding. Since Transformers are permutation-invariant, learnable positional embeddings are added to preserve spatial and temporal information.
  3. Transformer Encoder: The sequence, along with a special [CLS] classification token, is fed into a standard Transformer encoder.
  4. Cross-Modality Transfer Learning: To address the data-hungry nature of Transformers, AST is initialized with weights from a Vision Transformer (DeiT) pretrained on ImageNet. This cross-modality transfer is highly effective, as spatial patterns in spectrograms share similarities with natural images.

Evaluation and Results

AST was evaluated on major benchmarks including AudioSet, ESC-50, and Speech Commands V2. The model set new state-of-the-art (SOTA) records across all three datasets.

Comparison of AST performance against previous CNN-based and hybrid models on the AudioSet benchmark.

On AudioSet, a massive dataset of over 2 million clips, AST achieved a Mean Average Precision (mAP) of 0.485, significantly outperforming the previous best CNN-attention hybrid (0.474). It also reached 95.6% accuracy on ESC-50 and 98.1% accuracy on Speech Commands V2. Beyond accuracy, AST demonstrated superior efficiency, converging significantly faster than comparable CNN-based models.

Discussion and Future Work

The success of AST highlights several key insights:

  • Global Context: Unlike CNNs, which only capture global context in deeper layers, the Transformer's self-attention allows every patch to communicate with every other patch from the very first layer.
  • Flexibility: AST naturally supports variable-length audio by interpolating positional embeddings, avoiding the need for fixed-size inputs or complex pooling layers.
  • Vision-to-Audio Transfer: The effectiveness of ImageNet pretraining suggests that low-level features learned from natural images are highly transferable to the audio domain.

Despite its success, AST faces challenges. Its performance drops significantly without ImageNet pretraining, indicating a high dependency on large-scale data. Additionally, the $O(N^2)$ complexity of self-attention makes processing very long audio files computationally expensive. Future research may explore more efficient Transformer variants and self-supervised pretraining specifically tailored for audio data.

Summary updated

BibTeX
@inproceedings{gong2021ast,
  author = {Yuan Gong and Yu-An Chung and James R. Glass},
  title = {{AST: Audio Spectrogram Transformer}},
  booktitle = {Interspeech},
  year = {2021},
  doi = {10.21437/interspeech.2021-698},
}
Figure