All models

ast_audio_spectrogram_transformer

A Transformer encoder applied to overlapping patches of an audio spectrogram, for audio classification.

Audio and speech · 303 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (29 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
AST
Parameters
86.2M
Operations
303
Framework
PyTorch
Recurrent
No
Published
Interspeech 2021
Cited by
37 (as of 29 October 2026)
Authors
Yuan Gong, Yu-An Chung, James Glass
License
BSD-3-Clause
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m3535
Graph hash
302eba5b5fba8947159dac8ec5bd7ba37ab23b940dd342d82cd2eb54d7b2fcd2
Skeleton hash
6861ba2c190e68105f34e05f220c38f64a44124eea43ddf9ce1fe15d3e66d1d3
Architecture hash
6b9820bde4d06ca11be2ffa546397de316d54f1fef5553da5a2c121533c93a24
Diagram SHA-256
4a149d854105438010bd1c67b35b2ed643cfdc990e86f008d539369fbf1c3fae
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

About this model's family

The Audio Spectrogram Transformer (AST) is an audio classification model that the paper presents as the first convolution-free, purely attention-based model for the task. The question behind it was whether the reliance on a CNN is necessary, or whether networks based purely on attention are sufficient for good performance in audio classification.

The audio waveform is converted into a spectrogram of log Mel filterbank features, which is split into a sequence of 16×16 patches with an overlap of 6 in both the time and the frequency dimension. Each patch is flattened to a patch embedding of size 768 by a linear projection layer. The paper notes that, strictly speaking, this patch embedding layer can be viewed as a single convolution layer with a large kernel and stride size. The Transformer encoder has an embedding dimension of 768, 12 layers and 12 heads, and its output for the [CLS] token serves as the representation of the audio spectrogram. The model card on the Hugging Face Hub describes it as equivalent to ViT, but applied on audio.

That similarity lets the authors transfer knowledge from an ImageNet-pretrained ViT, with a cut and bilinear interpolation method that adapts the positional embedding. The paper reports 0.485 mAP on AudioSet, 95.6% accuracy on ESC-50 and 98.1% accuracy on Speech Commands V2. AST also supports variable-length inputs and can be applied to different tasks without any change of architecture.

Key idea. AST applies a Transformer encoder directly to patches of an audio spectrogram, giving a convolution-free, purely attention-based model for audio classification.

  • ast
  • audio spectrogram transformer
  • audio classification
  • spectrogram transformer
  • audioset classifier
  • convolution-free audio model
  • audio transformer
  • vit for audio

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{gong2021astaudiospectrogramtransformer,
      title={AST: Audio Spectrogram Transformer}, 
      author={Yuan Gong and Yu-An Chung and James Glass},
      year={2021},
      eprint={2104.01778},
      archivePrefix={arXiv},
      primaryClass={cs.SD},
      url={https://arxiv.org/abs/2104.01778}, 
}