---
title: 'AudioProtoPNet: Prototype-Based Audio Models'
url: https://www.emergentmind.com/topics/audioprotopnet
type: topic
---

# AudioProtoPNet: Prototype-Based Audio Models

AudioProtoPNet denotes a line of prototype-based audio models in which prediction is mediated by explicit comparisons to learned prototypes rather than by an opaque terminal classifier. In the original formulation, AudioProtoPNet is an audio identification model based on learnable spectral prototypes and prototype-specific transformation networks that reconstruct a log-Mel spectrogram and classify by minimum reconstruction error [2208.03311]. Later work reused the name for an adaptation of ProtoPNet to multi-label bird sound classification, combining a ConvNeXt backbone with a prototype learning classifier trained on spectrogram embeddings and yielding prototype-based explanations at inference time [2404.10420]. A subsequent study examined the same bird-sound formulation under adversarial training and out-of-distribution evaluation [2507.13727]. Related work on controllable music recommendation employs an audio prototypical network over audio embeddings, but this system is presented as APRON rather than AudioProtoPNet [2508.00194].

## 1. Conceptual scope and defining characteristics

The unifying idea across AudioProtoPNet variants is that a model decision should be expressible as a relation between an input audio representation and a finite set of learned prototypes. This makes the model intrinsically interpretable in the sense that the prototypes are part of the forward computation rather than an auxiliary explanation layer. In the 2022 formulation, the prototypes are themselves spectrogram templates and can be inverted to audio and “played” [2208.03311]. In the bird-sound formulations, the prototypes live in embedding space and correspond to representative spectro-temporal patches from the training set, supporting “this looks like that” explanations [2404.10420].

A common misconception is that AudioProtoPNet refers to a single fixed architecture. The literature instead uses the name for at least two distinct instantiations. One operates directly in the spectrogram domain with prototype-specific transformation networks and a reconstruction-based distance [2208.03311]. Another adapts ProtoPNet to bird sound classification with a ConvNeXt backbone and prototype matching in latent space [2404.10420, 2507.13727]. The shared commitment is not a particular metric or backbone, but prototype-mediated inference and case-based reasoning.

Another common misconception is that interpretability is purely post-hoc. In all of these formulations, the prototypes directly determine the output: either the input is assigned to the prototype with minimum reconstruction error, or class scores are aggregated from prototype activations. The explanation is therefore structurally coupled to the prediction rather than retrofitted afterward.

## 2. Original spectrogram-domain formulation

In "A Model You Can Hear: Audio Identification with Playable Prototypes" [2208.03311], the input is a log-Mel spectrogram
\[
x \in \mathbb{R}^{F \times T},
\]
and the model learns \(K\) spectral prototypes
\[
p_k \in \mathbb{R}^{F \times T}.
\]
In practice each \(p_k\) is implemented as a learned parameter of dimension \(F \times 1\), broadcast to all \(T\) frames. For each prototype \(k\), a small U-Net style network \(T_k(\cdot;\theta_k)\) predicts four per-time-step transformation parameter sets: gain \(G_k(x)\in\mathbb{R}^T\), pitch-shift \(S_k(x)\in\mathbb{R}^T\), low-frequency filter \(L_k(x)\in\mathbb{R}^{F\times T}\), and high-frequency filter \(H_k(x)\in\mathbb{R}^{F\times T}\) [2208.03311].

These transformations are applied in sequence to reconstruct the input from the prototype. The full reconstruction for prototype \(k\) is
\[
R_k(x)[t]
=\bigl(T_\text{high}\bigr)_{H_k(x)[t]}\circ
 \bigl(T_\text{low}\bigr)_{L_k(x)[t]}\circ
 \bigl(T_\text{pitch}\bigr)_{S_k(x)[t]}\circ
 \bigl(T_\text{gain}\bigr)_{G_k(x)[t]}\bigl(p_k[:,t]\bigr),
\]
with the elementary spectral transforms defined as gain, pitch-shift, low-frequency filter, and high-frequency filter operations in the spectrogram domain. The reconstruction error is the average frame-wise \(\ell_2\) distance:
\[
d_k(x)=\ell_\text{rec}(x,k)=\frac{1}{T}\sum_{t=1}^T \|x[t]-R_k(x)[t]\|_2^2.
\]

Classification can then proceed either by minimum reconstruction error,
\[
\hat{k}=\arg\min_k d_k(x),
\]
or by a softmax over negative reconstruction errors,
\[
P(y=k\mid x)=\frac{\exp(-\beta\,d_k(x))}{\sum_{j=1}^K \exp(-\beta\,d_j(x))},
\]
with inverse-temperature \(\beta>0\). The model supports both unsupervised clustering and supervised classification. The unsupervised objective is
\[
\mathcal{L}_\text{clu}=\sum_{n=1}^N \min_{k=1\ldots K}\ell_\text{rec}(x_n,k),
\]
and the supervised objective combines correct-prototype reconstruction loss with a cross-entropy term on the softmax of negative reconstruction errors:
\[
\mathcal{L}_\text{sup}
= \sum_{n=1}^N
\bigl[\ell_\text{rec}(x_n,y_n)+\lambda_{\rm ce}\,\ell_{\rm ce}(x_n,y_n)\bigr],
\]
with \(\lambda_{\rm ce}\approx 0.01\), learned \(\beta\), and no additional triplet or contrastive terms.

The decisive architectural feature is that each prototype is itself a log-Mel spectrogram. Because it can be inverted to audio, the model’s internal reference points are not merely vectors in latent space but audible exemplars. This grounds the term “playable prototypes” in a literal sense.

## 3. ProtoPNet-style bird sound classification variants

The 2024 bird-sound adaptation, "AudioProtoPNet: An interpretable deep learning model for bird sound classification" [2404.10420], places the prototype mechanism on top of a ConvNeXt embedding network. The model is structured as
\[
f(x)=f_{(f)}\circ f_{(p)}\circ f_{(b)}(x),
\]
where \(f_{(b)}\) maps an input spectrogram \(x\in\mathbb{R}^{T\times F}\) to an embedding tensor \(z\in\mathbb{R}^{H_z\times W_z\times D}\), \(f_{(p)}\) is a prototype-matching layer with \(M=C\cdot J\) learned prototypes, and \(f_{(f)}\) is a final fully-connected classification layer. Each prototype \(p^{(c,j)}\) is associated with class \(c\), and in practice \(H_p=W_p=1\), so each prototype is a \(D\)-dimensional vector.

Similarity is computed by cosine matching between \(\ell_2\)-normalized embedding patches and \(\ell_2\)-normalized prototypes:
\[
s^{(c,j)}_{h,w}(z)=\langle \tilde p^{(c,j)},\tilde z_{h,w}\rangle,
\qquad
s^{(c,j)}(z)=\max_{h,w} s^{(c,j)}_{h,w}(z).
\]
The final layer uses a fixed weight matrix so that each prototype votes only for its own class:
\[
\ell_c(z)=\sum_{j=1}^J s^{(c,j)}(z),
\qquad
\hat y_c=\sigma(\ell_c(z)).
\]
Training uses a weighted sum of asymmetric classification loss, prototype clustering loss, prototype separation loss, and an orthogonality loss:
\[
L=\lambda_1L_{asym}+\lambda_2L_{clst}+\lambda_3L_{sep}+\lambda_4L_{ortho}.
\]
The training schedule is two-phase: first the ConvNeXt backbone is frozen and only the prototypes are trained; then the backbone and prototypes are jointly fine-tuned.

The 2025 robustness study adopts a related AudioProtoPNet for bird-sound recognition with a ConvNeXt-B backbone pre-trained on ImageNet and fine-tuned on spectrogram inputs [2507.13727]. Here the embedding extractor outputs
\[
\phi_{\theta_b}(x)=z\in\mathbb{R}^{H_z\times W_z\times D},
\]
with \(H_z=8\), \(W_z=19\), and \(D=1024\). The prototype layer contains \(M=K\cdot P\) learnable prototype vectors \(p_j\in\mathbb{R}^D\), with \(P=20\) prototypes per class. Distances are computed patchwise,
\[
d_j(x,h,w)=\|z^{(h,w)}-p_j\|_2^2,
\]
and converted into similarity activations by negative patch-max-pool,
\[
a_j(x)=\max_{h,w}\bigl(-d_j(x,h,w)\bigr).
\]
A fully-connected matrix \(W\in\mathbb{R}^{K\times M}\) then maps prototype activations to logits,
\[
s(x)=W\,a(x)+b,
\qquad
\hat y_k=\sigma(s_k(x)).
\]

The coexistence of cosine-similarity and squared-distance instantiations should not be read as a contradiction. It indicates that the AudioProtoPNet label spans multiple prototype-based realizations of inherently interpretable audio classification, unified by prototype matching, class-linked activations, and inspectable evidence paths.

## 4. Training objectives and optimization regimes

The optimization strategy depends on the variant. In the original spectrogram-domain model, learning is reconstruction-centric. Unsupervised learning minimizes the best achievable reconstruction across prototypes, which is formally analogous to a k-means style objective in the spectrogram domain. Supervised learning augments that reconstruction term with cross-entropy on the softmax of negative reconstruction errors, while still keeping the reconstruction pathway central to classification [2208.03311].

In the 2024 bird-sound model, the objective is explicitly multi-label and prototype-structuring. The asymmetric loss handles label imbalance, the clustering loss encourages at least one active prototype for a positive class, the separation loss pushes embeddings away from prototypes of negative classes, and the orthogonality loss decorrelates prototypes within each class [2404.10420]. This means that prototype learning is not merely a representational convenience; it is directly regularized to produce distinct, class-informative evidence.

In the 2025 robustness study, ordinary training minimizes a composite loss comprising asymmetric multi-label classification loss \(L_{cls}\), prototype projection losses \(L_{proto}\), and weight decay regularization:
\[
L(\theta,P,W,b)=L_{cls}(\hat y,y)
+\lambda_{cl}L_{cluster}(z,y,P)
+\lambda_{sep}L_{separation}(z,y,P)
+\lambda_{wd}R(\theta,P,W,b),
\]
with \(\lambda_{cl}=\lambda_{sep}=0.1\) and \(\lambda_{wd}=10^{-4}\) [2507.13727]. Training alternates between a prototype projection step, which re-assigns each prototype to its closest latent patch of its class in the current mini-batch, and a joint fine-tuning step that backpropagates the full loss with respect to \(\theta\), \(P\), \(W\), and \(b\).

That same study further extends TRADES–AWP to AudioProtoPNet through two adversarial training procedures. Output-space adversarial training (AT-O) uses FGSM on the classification loss to generate \(\delta_O\), whereas embedding-space adversarial training (AT-E) uses FGSM on average spatial cosine distance in the embedding extractor to generate \(\delta_E\). The reported hyperparameters are \(\epsilon=0.1\), \(\lambda=1\), AWP budget \(\gamma=0.005\), and warm-up of 8 epochs [2507.13727]. This is important because it shows that prototype-based interpretability and adversarial training are not treated as mutually exclusive design goals.

## 5. Interpretability and explanation semantics

Interpretability in AudioProtoPNet is implemented through prototypes as explicit evidence carriers. In the original model, each \(p_k\) is a log-Mel spectrogram that can be inverted to audio, and the explanation for a decision reduces to which prototype best reconstructs the input and which learned gain, pitch, and spectral-envelope transformations were required [2208.03311]. The model therefore exposes both a reference exemplar and a deformation pathway.

In the bird-sound formulations, prototypes correspond to representative spectro-temporal patches from the training data rather than directly playable spectrogram templates. For the 2024 model, one can identify the prototypes with highest activation for a predicted class, visualize the training spectrogram patch onto which each prototype was projected, and overlay an up-sampled activation map on the test spectrogram to show which time-frequency region triggered the match [2404.10420]. This yields a case-based rationale of the form “this time-frequency patch looks like that prototype.”

The 2025 study makes the explanation structure explicit by distinguishing local and global explanations. Local explanations are of the form “This 5s spectrogram patch activates prototype \(p_j\),” whereas global explanations are given by the linear weights \(W\), which indicate how much each prototype votes for class \(k\) [2507.13727]. Because each prototype is anchored to an actual training spectrogram patch, the explanation remains human-readable at the level of training exemplars.

A further misconception is that prototype models are automatically stable under perturbation. The robustness study specifically evaluates prototype stability under targeted embedding-space attacks and finds that stability depends strongly on training regime [2507.13727]. This indicates that interpretability in the prototype sense does not, by itself, guarantee robustness; it must be supported by the optimization procedure.

## 6. Empirical results, robustness evidence, and related extensions

The original AudioProtoPNet was evaluated on SOL, with 33 instruments and 24 450 single-note spectrograms, and on LibriSpeech, with 128 speakers [2208.03311]. In unsupervised clustering, AudioProtoPNet achieved OA \(\approx 34.5\%\) and AA \(\approx 15.4\%\) on SOL, and OA \(\approx 48.6\%\) and AA \(\approx 49.5\%\) on LibriSpeech. In supervised classification, the reported results were OA \(\approx 99.3\%\) and AA \(\approx 95.8\%\) on SOL, and OA \(\approx 99.9\%\) and AA \(\approx 99.9\%\) on LibriSpeech, exceeding both direct CNN classification and APNet in those experiments.

In bird sound classification, the 2024 AudioProtoPNet was trained on the BirdSet training dataset, described as consisting of 9,734 bird species and over 6,800 hours of recordings, and evaluated on the seven test datasets of BirdSet, covering different geographical regions [2404.10420]. It outperformed Perch, achieving an average AUROC of 0.90 and a cmAP of 0.42, with relative improvements of 7.1% and 16.7%, respectively. These figures situate prototype-based interpretability within a high-capacity, large-scale multi-label setting rather than a narrowly constrained benchmark.

The 2025 robustness study reports clean-data cmAP on one validation plus seven OOD soundscape datasets [2507.13727]. For AudioProtoPNet, ordinary training (OT) yielded 0.49 on POW and 0.38 mean over 7 test sets; AT-E yielded 0.57 \((+16.3\%)\) and 0.41 \((+7.9\%)\); and AT-O yielded 0.59 \((+20.4\%)\) and 0.42 \((+10.5\%)\). Against embedding-space PGD at \(\epsilon=0.1\), the reported PRS values were approximately 0.00 for OT, 0.01 for AT-E, and 0.35 for AT-O. Against output-space PGD at \(\epsilon=0.01\), the corresponding PRS values were approximately 0.03, 0.09, and 0.15. Under targeted attacks that align \(\phi(x+\delta)\) with a random target prototype, TARS at \(\epsilon=0.1\) was 0.27 for OT, 0.37 for AT-E, and 0.65 for AT-O. This indicates that adversarial training, particularly output-space adversarial training, can simultaneously improve clean-data generalization under distribution shift and stabilize prototype-based explanations.

A neighboring but distinct development is APRON, the "Audio Prototypical Network For Controllable Music Recommendation" [2508.00194]. APRON relies on MERT-v1-330M as a fixed front-end, uses 1024-dimensional audio embeddings, selects \(K=80\) common song-level Last.fm tags as prototypes, and constructs a scrutable user profile
\[
u_i=\sum_{j=1}^{S_i}\sum_{k=1}^K w^i_{kj}(P_kA^p_k)
=\sum_{k=1}^K \widetilde w^i_k\,\widetilde P_k.
\]
It is trained with recommendation, controllability, and prototype-separability losses, and supports direct editing of prototype weights to steer recommendations. On the Million Song Dataset, APRON with \(H=16\) heads achieved Recall@20 \(=0.277\), Recall@50 \(=0.377\), NDCG@100 \(=0.327\), and average \(\Delta@20=0.054\) for controllability. Its stated limitations are that it requires access to all audio, relies on the quality and coverage of the chosen tags, has no user study yet, and uses a fixed set of 80 prototypes. This suggests that prototype-based audio modeling has broadened from interpretable classification toward controllable user-facing systems, while retaining the central idea that semantically inspectable prototypes should mediate prediction.

Source: https://www.emergentmind.com/topics/audioprotopnet