Dixit, Heller & Donahue (Carnegie Mellon), 2024

Vision Language Models Are
Few-Shot Audio Spectrogram Classifiers

Turn a sound into a picture of its frequencies, hand that picture to GPT-4o with a handful of labeled examples, and it recognizes the sound — beating the only commercial audio model and even edging out human experts.

Prerequisites: STFT / spectrograms + In-context learning
10
Chapters
6
Simulations

Chapter 0: The Problem

You have two big families of frontier models. Vision-language models (VLMs) like GPT-4o, Claude 3.5 Sonnet, and Gemini-1.5 are extraordinary: they reason over images and text with hundreds of billions of parameters. And audio language models (ALMs) like Pengi and SALMONN — which take sound directly as input — are tiny by comparison (Pengi's language brain is GPT-2, 124M parameters) and far weaker at language.

So here is the awkward gap. If you want a model that can both hear a sound and talk richly about it — to fix a vague audio caption, say — the model that can talk can't hear, and the model that can hear can't talk well.

The core question: A spectrogram is a literal image of a sound. VLMs have seen millions of images — surely some spectrograms among them. Can a VLM that was never trained to process audio nonetheless recognize the sound if we draw it as a picture and show it a few labeled examples?

Why this is a real bet, not a gimmick

It is not obvious this should work. A VLM was trained on photos of dogs, charts, memes, screenshots — natural images and text. A spectrogram of a barking dog looks nothing like a photo of a dog. It is a heat-map of energy across frequency (vertical) and time (horizontal). The model has to learn, from a handful of in-context examples, that "this smear of horizontal stripes that pulse" means dog and "this rising broadband swoosh" means sea waves.

If it works, you get something valuable for free: the full language reasoning of a frontier VLM, now grounded in sound, with zero training, zero fine-tuning — just a clever prompt.

A worked sense of scale

The benchmark is ESC-10 — a 10-class subset of the ESC-50 environmental-sound dataset. Let's make the numbers concrete before we go anywhere:

QuantityValueWhy it matters
Classes10dog, rooster, rain, sea waves, crackling fire, crying baby, sneezing, clock tick, helicopter, chainsaw
Clips400 (5 s each)40 per class, split into 5 folds of 80
Random-guess accuracy10%The floor any method must clear
GPT-4o zero-shot27.5%Already 2.75× chance — with no examples
GPT-4o few-shot (cross-validated)59.0%The headline number
Ensembled human experts72.5% (fold 1)GPT-4o hit 73.75% on the same fold

That last comparison is the punchline of the whole paper. On the first fold, a model that has never been taught audio matched a panel of audio-research professors looking at the same pictures.

What gap does this paper exploit?

Chapter 1: The Key Insight

The whole method fits on a sticky note: recast audio classification as image classification, then solve image classification with in-context learning on a VLM. The authors name the new task Visual Spectrogram Classification (VSC) — classifying a sound purely from a picture of its spectrogram.

The insight: A frontier VLM is already a few-shot image classifier. You don't fine-tune it. You hand it one labeled spectrogram per class as in-context examples, then a test spectrogram, and ask "which class?". The model does analogical pattern-matching in its forward pass — no weights change.

The pipeline in one breath

Audio clip → STFT → render as a labeled spectrogram image (PNG) → build a prompt that interleaves example images with their class names → append the test image → the VLM emits one class name. Everything downstream of "render as image" is just prompting.

represent
Design the spectrogram image carefully — colormap, axes, scale. The VLM only ever sees this picture, so its design is feature engineering.
exemplify
Pick the best example per class with k-means, not random ones. Good in-context examples are the second lever on accuracy.
prompt
Interleave example image + label pairs, then the query image. The VLM classifies by analogy — zero gradient steps.

What is actually "learned" here?

Nothing, in the weight sense. This is the part worth slowing down on. In ordinary supervised learning you adjust millions of parameters on the training set. Here the model is frozen. The "learning" happens entirely inside one forward pass: the attention mechanism reads the labeled examples in the context window and uses them to interpret the query. The paper's two engineering levers — how you draw the picture and which examples you show — are the only things you control. We will pull both levers interactively.

In few-shot VSC, what changes about the VLM between zero-shot and few-shot?

Chapter 2: Sound → Picture — the STFT

Before any VLM touches anything, we must turn a waveform into a spectrogram image. This is the one piece of classical signal processing the method rests on, so let's build it from the ground up.

A waveform is a stream of air-pressure numbers — at 22,050 Hz (the paper's resample rate) that's 22,050 numbers per second. A 5-second clip is a vector of 110,250 samples. Useless as a picture: it's a 1-D squiggle. The Short-Time Fourier Transform (STFT) turns that squiggle into a 2-D image of which frequencies are present, when.

The recipe, step by step

The STFT chops the signal into short overlapping windows and asks each window "what frequencies are you made of?" via the Fourier transform. The paper's defaults:

The output is a matrix of shape [1025 freq bins × 215 time frames]. Color each cell by its magnitude and you have an image. That image is the only thing the VLM ever sees.

Two logs that matter: The paper uses a logarithmic frequency axis and a logarithmic amplitude (dB) scale by default. Human hearing is logarithmic in both — an octave is a doubling of frequency, and loudness perception is roughly log-power. Drawing the picture the way the ear works packs the informative structure into the visible range. (Chapter 6 shows that, surprisingly, this default isn't always best for the VLM.)
STFT — Window vs. Frequency Resolution
window

Drag the window size. A bigger window resolves frequency sharply (thin horizontal bands) but smears time; a small window resolves time but blurs frequency into a vertical haze. This is the time–frequency tradeoff: you cannot have both at once. The 2048 default is the chosen compromise.

With a 2048-sample window at 22,050 Hz, how much time does each STFT frame cover?

Chapter 3: The VSC Task

Now we have an image. The task is to assign it one of 10 labels. The paper studies two regimes that differ only in what you put in the prompt.

Zero-shot

Show the VLM one spectrogram (the test clip) plus a text prompt that lists the 10 class names and instructs "pick the most likely one; respond with the exact class name only." No examples. The model must rely entirely on whatever it absorbed about spectrograms during pre-training. GPT-4o scores 27.5% here on fold 1 — well above the 10% floor, proof that some spectrogram knowledge is latent in the model.

Few-shot (in-context learning)

Now precede the test image with one labeled example spectrogram per class — a 10-shot prompt. The model can now compare the query against ten reference patterns it can see right there in its context. GPT-4o jumps to 70% with random examples, and higher with good ones. Same frozen model; the only change is the contents of the prompt.

Why few-shot helps so much here specifically: Spectrograms are an out-of-distribution image type for a VLM. Zero-shot, the model has only a fuzzy prior on what "a rooster spectrogram" looks like. The in-context examples re-anchor that prior on this exact rendering style — same colormap, same axes, same resolution as the query. The examples don't just say "here are the classes"; they say "here is what these classes look like in the picture format I'm about to test you on."

The data flow, with shapes

StageWhat flowsShape / form
Audio clipwaveform[110250] floats @ 22.05 kHz
STFT + renderspectrogram PNG~[1025 × 215] → image, base64
10-shot prompt10 (image, label) pairs + 1 query image + text~11 images in one context window
VLM outputa single class name stringe.g. "rooster"

Notice the model never outputs probabilities or logits over classes — it emits free text, which is then matched to one of the 10 class strings. Parsing that text (and handling refusals or off-list answers) is a quiet part of the engineering.

Zero-shot vs Few-shot — the same query, two prompts

Toggle the two prompt layouts. Zero-shot is just the query image + a text list. Few-shot stacks ten labeled reference images before the query, so the model can pattern-match against same-style examples in one forward pass.

Why does adding one labeled example per class help VSC more than it might help a normal image task?

Chapter 4: The Few-Shot Prompt

The prompt is the entire program. There are no weights to set — only words and images. Here is the zero-shot prompt the paper used, lightly paraphrased, so you can see exactly how literal it is:

# Zero-shot: system + user message to the VLM API
system = "You are a helpful assistant with expertise in recognizing
          patterns and identifying classes based on visual
          representations of audio data."

user_text = """Analyze this spectrogram (a visual representation of
  the frequency spectrum of sound over time) and determine the most
  likely sound class. Consider frequency patterns, intensity, and time
  variations. Focus SOLELY on patterns in the spectrogram. Do not let
  assumptions about common sounds influence your decision.
  Classes: [dog, chainsaw, crackling_fire, helicopter, rain,
            crying_baby, clock_tick, sneezing, rooster, sea_waves].
  Your response must contain the EXACT class name only."""

messages = [
  {"role": "system", "content": system},
  {"role": "user", "content": [
      {"type": "text", "text": user_text},
      {"type": "image_url",
       "image_url": {"url": f"data:image/png;base64,{spectrogram_b64}"}}
  ]}
]
Read the instruction "Focus SOLELY on patterns... do not let assumptions about common sounds influence your decision." That sentence is a deliberate guardrail. A VLM loves to reason about the world — "helicopters are loud, this looks loud, so helicopter." The authors want it to read the image, not free-associate from the class names. This is prompt engineering as a substitute for the inductive bias a trained audio model would have built in.

The few-shot upgrade

For few-shot, the single user message becomes a sequence: for each class, a small text label ("Example — class: rooster") followed by that class's example image; then finally the query image with "Now classify this:". Ten example images plus one query, all in one context window, all read in one forward pass.

# Few-shot content list (one example image per class, then the query)
content = [{"type": "text", "text": intro}]
for cls, img_b64 in examples.items():        # 10 (label, image) pairs
    content += [
      {"type": "text",  "text": f"This is a {cls} spectrogram:"},
      {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{img_b64}"}}
    ]
content += [
   {"type": "text",  "text": "Now classify THIS spectrogram (class name only):"},
   {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{query_b64}"}}
]

That's the realization in full. No training loop, no optimizer, no labels-as-gradient-signal. The labels are words in the prompt, and the analogy happens in attention.

Why does the prompt explicitly tell the model NOT to reason from "common sounds"?

Chapter 5: Picking the Examples (the showcase)

If the few-shot examples are the model's only anchor for "what does a rooster spectrogram look like," then which example you pick per class matters enormously. Pick a weird, atypical rooster clip and you mislead the model. Pick a representative one and you nail it.

The authors' clean idea: don't pick examples randomly. For each class, run k-means clustering on the mel-spectrogram features of all that class's clips, then choose the clip closest to a cluster centroid — i.e. the most prototypical example. This single change moved GPT-4o from 70% (random) to 73.75% (k-means, 1 per class), and to a peak of 76.25% with 2 examples per class.

The counterintuitive bit: 3 examples per class did worse (70%) than 2 (76.25%). More shots is not monotonically better. Extra examples add tokens, dilute attention across more (possibly less typical) references, and can confuse the analogy. The sweet spot was 2 prototypical examples per class — quality and centrality beat quantity.

Why the centroid example, in plain terms

Each clip becomes a point in feature space (flattened mel-spectrogram). k-means finds cluster centers — the "average" rooster sound. The clip nearest a centroid is the least weird, most textbook example of its cluster. Showing the model a textbook rooster gives it the cleanest possible template to match against. Showing it an outlier rooster (a faint, distant one) teaches a misleading template.

k-means Example Selection — centroid vs. random vs. outlier
k

Each dot is one clip of a single class in mel-feature space. Run k-means to find centroids (rings). Toggle the selection rule: "centroid" picks the clip nearest a center (prototypical — what the paper does); "random" picks any clip (the baseline). The chosen example becomes the in-context reference. Watch how an outlier pick lands far from the cloud's heart — that's the misleading template.

The reported numbers (GPT-4o, ESC-10 fold 1, 1 example/class): random → 70.00%  |  hand-picked → 75.00%  |  k-means on mel → 73.75%  |  k-means on raw amplitude features → only 60.00%. Two lessons: (1) the feature space you cluster in matters — mel beats raw amplitude because mel matches perceptual structure; (2) a human hand-picking the clearest example still beats automatic selection, hinting there's headroom in "what makes a good example."
The paper found 2 examples/class beat 3 examples/class. What's the lesson?

Chapter 6: Spectrogram Knobs

Here is the most VLM-specific finding in the paper, and the one a signal-processing person would never guess. How you draw the picture changes the score — and the "best for the human ear" choices are not always the best for the model.

The authors swept the spectrogram rendering hyperparameters and measured GPT-4o zero-shot accuracy on ESC-10 fold 1. The defaults (log frequency, log amplitude, viridis colormap, axis labels, no colorbar) gave 27.5%. The single best change was switching to a linear frequency axis, which lifted accuracy to 35%.

The deep point: For a trained audio classifier, the log/mel scale is correct because it matches human hearing. But a VLM is a vision model — it cares about visual contrast and edge structure, not auditory perception. A linear frequency axis evidently spreads the discriminative structure across the image in a way the VLM's visual features pick up better. The "right" representation depends on who is looking: ear vs. eye-of-a-language-model.

The full sweep (GPT-4o zero-shot, ESC-10 fold 1)

Spectrogram Hyperparameter Sweep — what helps the VLM
Bars above the default line (27.5%) help; below, they hurt.

Reconstructed from the paper's Appendix A ablation table. The dashed line is the default config. Linear frequency and linear amplitude beat the perceptually-motivated logarithmic defaults. MFCCs — a heavily compressed representation that throws away the visual texture — collapse to 13.75%, near chance: great features for a classical model, terrible pictures for a VLM.

Config changeAcc.Reading
Default (log freq, log amp, viridis)27.50%baseline
Linear frequency axis35.00%best — spreads structure for the eye
Linear amplitude scale30.00%helps
Remove axis labels26.25%slight hurt — labels give context
Show colorbar23.75%hurts — clutter
Magma colormap25.00%viridis is better
Mel spectrogram25.00%perceptual ≠ visual-best
MFCCs13.75%near chance — destroys the picture
Low resolution20.00%detail matters
MFCCs are excellent features for classical audio classifiers but scored near chance (13.75%) here. Why?

Chapter 7: Results

Now the headline comparisons. Three claims, each with a number.

Claim 1 — Few-shot transforms VLMs

Across all six VLMs, examples helped. GPT-4o went from 35% (tuned zero-shot) to 70% (10-shot). Claude-3.5 Sonnet went 22.5% → 56.25%. The effect is real and large — but uneven: Gemini models barely moved or even dropped, suggesting in-context image reasoning quality varies a lot between model families.

Claim 2 — VLMs beat the commercial audio model

The fair fight: GPT-4o seeing a spectrogram vs. Gemini-1.5 Pro hearing the actual audio (the only commercial model that ingests audio at the time). On the full cross-validated ESC-10, GPT-4o scored 59.00% vs. Gemini-audio's 49.62%. A picture of the sound, read by a model that can't hear, beat a model that can hear it directly.

Claim 3 — GPT-4o matched human experts

Three audio-research experts each labeled the 80 spectrograms of fold 1 with the same 10-shot references. Ensembled, they hit 72.5%. GPT-4o on the identical setup: 73.75%. Inter-annotator agreement (Cohen's κ) was only 0.53 — even the experts disagreed a lot, which tells you VSC is genuinely hard, not that the model is trivially good.

Where both fail the same way: The confusion matrices show GPT-4o and the humans both struggle to separate spectrograms that look alike — dog vs. sneezing, and helicopter vs. rain vs. sea waves (all broadband, noisy, low-structure textures). The model isn't making alien mistakes; it's making the human mistakes. That's strong evidence it's reading the same visual cues a person would.
Model Leaderboard — zero-shot vs few-shot

Toggle zero-shot vs few-shot. The dashed line is the human-expert ensemble (72.5%) and the dotted line is random chance (10%). Watch GPT-4o leap past the human line in few-shot while the Gemini models barely move.

What's the strongest evidence that GPT-4o is genuinely "reading" the spectrogram rather than guessing?

Chapter 8: Limits & Failure Modes

The paper is refreshingly honest about where this breaks.

1. It does not beat real audio classifiers

A purpose-built supervised model (e.g. an Audio Spectrogram Transformer) crushes 59% on ESC-10. The VLM approach is impressive given zero audio training, not impressive in absolute terms. Its value is the free language reasoning attached, not raw accuracy.

2. It collapses as classes grow

The sharpest failure. On ESC-10 (10 classes), GPT-4o cross-validated at 59%. On a 50-class ESC-50 subset, 50-shot accuracy fell to 14%. Still above the 2% chance floor, but a brutal drop.

Why scaling classes hurts so much: Two compounding pressures. (a) More confusable pairs — with 50 classes there are vastly more spectrograms that look alike, and the VLM's visual features can't tell them apart. (b) Context dilution — 50 example images plus a query is a huge, crowded context; attention is spread thin and the analogy weakens. The method's whole engine, in-context comparison, degrades as the comparison set grows.
Accuracy vs. Number of Classes
classes

Drag the class count. The solid curve is the model's accuracy (anchored on the paper's two measured points: 59% at 10 classes, 14% at 50); the dashed curve is the 1/N random-chance floor. Notice the model stays well above chance throughout, but the margin over chance shrinks — the structure it relies on is eroding faster than chance does.

3. Why it works at all is partly a mystery

The authors are candid: VLMs were trained on natural images and text, not spectrograms, so the latent spectrogram knowledge is incidental — picked up from incidentally-seen plots online. As VLMs scale and see more such images, this should improve, but it's an emergent side-effect, not a designed capability.

Why does few-shot VSC degrade so sharply from 10 to 50 classes?

Chapter 9: Connections & Cheat Sheet

This paper sits at a crossroads of three ideas: the spectrogram as the bridge between sound and vision, in-context learning as a substitute for training, and the surprising generality of frontier VLMs.

Two envisioned uses

The cheat sheet

TermPlain meaningNumber to remember
VSCVisual Spectrogram Classification — name the sound from a picture of its spectrogram10 classes (ESC-10)
STFT defaults22.05 kHz resample, 2048 window, 512 hop, log freq/amp, viridis~93 ms/frame
Zero-shotquery image + class list, no examplesGPT-4o: 27.5%
Few-shot1+ labeled example image per class in contextGPT-4o 10-shot: 70%
k-means selectionpick example nearest a cluster centroid (most prototypical)peak 76.25% (2/class)
Best render knoblinear frequency axis (visual ≠ perceptual)27.5% → 35%
vs. audio modelGPT-4o (sees picture) vs Gemini-1.5 Pro (hears audio)59.0% vs 49.6%
vs. humansmatched ensembled audio experts73.75% vs 72.5%
Scaling cliffaccuracy collapses with more classes10cls 59% → 50cls 14%
The one-sentence takeaway: A frozen vision-language model, handed a sound drawn as a carefully-rendered picture plus a few prototypical labeled examples, classifies audio about as well as a human expert and better than a commercial model that can actually hear — because the spectrogram turns "hearing" into "seeing," and seeing is what these models do best.

Related lessons

What is the single most useful downstream application the authors envision?