AudioMosaic: Contrastive Masked Audio Representation Learning

Hanxun Huang, Qizhou Wang, Xingjun Ma, Cihang Xie, Christopher Leckie, Sarah Erfani

TL;DR

AudioMosaic rethinks masking in self-supervised audio learning by using it to generate distinct, contrastive views rather than targets for reconstruction. By applying independent, structured time-frequency masking to spectrogram patches, it achieves state-of-the-art performance across audio classification and deepfake detection tasks while remaining highly memory-efficient.

What Problem Does This Paper Address?

Self-supervised learning (SSL) for audio has largely been dominated by generative reconstruction methods (like Audio-MAE), where models learn by predicting missing or masked patches of an audio spectrogram. In contrast, contrastive learning—which has seen massive success in vision and language by learning to match different "views" of the same data—remains underexplored for audio spectrograms.

The barrier isn't a lack of trying; it's a fundamental compatibility issue. Designing effective data augmentations for audio is notoriously difficult and domain-dependent. Furthermore, contrastive methods typically require massive batch sizes to provide enough negative samples, leading to prohibitive computational and memory costs. Finally, standard random masking strategies make the contrastive task too easy: the views share too much local structure, causing the model to cheat and suffer from dimension collapse, where the learned features flatten into a low-dimensional subspace and lose their discriminative power.

Methods

AudioMosaic introduces an audio encoder pre-trained with a contrastive objective and a tailored structured time-frequency masking strategy.

  1. View Generation: Given a raw audio waveform, the system applies basic temporal and acoustic augmentations to create two initial views. These are converted into log-Mel spectrograms and partitioned into patches.
  2. Structured Masking: Instead of random, unstructured patch dropping, AudioMosaic applies independent masking along the time dimension for one view and the frequency dimension for the other view. This creates complementary, non-trivial positive pairs that force the model to look beyond local correlations.
  3. Efficient Encoding: Crucially, masked patches are omitted entirely. The shared Transformer encoder (an Audio Spectrogram Transformer, or AST) only processes the remaining visible patches (~24% of the full sequence per view), drastically reducing the quadratic attention computation and memory footprint.
  4. Contrastive Loss: A lightweight MLP projection head maps the encoder outputs to a normalized embedding space, where an InfoNCE-style contrastive loss maximizes the similarity between the time-masked and frequency-masked views of the same utterance while minimizing similarity to other samples in the batch.
Figure 1. Overview of AudioMosaic. (a) Comparison between commonly used unstructured masking in prior audio-SSL methods and the time–frequency masking strategy. (b) AudioMosaic first converts an input spectrogram into patch tokens with positional encoding, then applies time–frequency masking to construct a positive pair for contrastive learning. The masked patches are omitted, and only the visible ones are fed into the encoder in randomized order.

Datasets

  • Pre-training: AudioSet (unlabeled combination of the unbalanced and balanced splits, totaling ~1.93M samples).
  • Downstream Evaluation: AudioSet-20K (balanced), AudioSet-2M (unbalanced), ESC-50 (environmental sound classification), and Speech Commands (SPC-1, SPC-2).
  • Deepfake Detection: Environmental Sound Deepfake Detection (EnvSDD) dataset, evaluating robustness against unseen data sources and generative models.
  • Audio-LLM Alignment: OpenAQA (5.4M samples) to align the encoder with LLaMA-7B, evaluated on tasks like Vocal Sound, TUT Acoustic Scenes, VGGSound, FSD-50K, Clotho, and AudioCaps.

Key Insights and Ideas

  • Masking as View Generation, Not Noise: In reconstruction tasks, unstructured random masking is ideal because the model relies on nearby visible pixels to fill in the blanks. In contrastive learning, however, this shared local redundancy makes the task trivial. Structured time-frequency masking breaks this local redundancy, forcing the model to learn global, utterance-invariant features.
  • Preventing Dimension Collapse: By measuring the effective rank (a proxy for the intrinsic dimensionality of the representation space), the authors show that contrastive models using unstructured masking suffer from degenerate, low-rank solutions. AudioMosaic achieves the highest effective rank among all tested methods, proving it utilizes the embedding space much more effectively.
Figure 2. Comparison of the effective rank of encoder representa- tions. Encoders are trained with either unstructured masking or the proposed time–frequency masking, using identical hyperparam- eters and masking ratios. “Inference-time masking” denotes the masking strategy applied when extracting representations. “None” indicates that no masking is applied during inference.
  • Monotonic Feature Improvement: In many audio SSL models (like EAT or BEATs), representation quality peaks in the middle layers and degrades sharply in the final layers because the model overspecializes to its pre-training task. AudioMosaic's linear probing performance improves monotonically with depth, peaking at layer 10, indicating that its deeper layers consistently encode richer semantic content.
Figure 3. Layer-wise linear probe results on AudioSet-20K (mAP). Each layer’s output is frozen and a linear classifier is trained on top. Weighted Sum aggregates all layers with learned weights; Attentive uses a learned attention query over all layer representations.

Key Results

  • State-of-the-Art Fine-Tuning: On AudioSet-20K, AudioMosaic achieves 42.5 mAP, outperforming the strong SSLAM baseline (40.9 mAP). It also sets top marks on ESC-50 (97.5% accuracy) and SPC-1 (99.0% accuracy).
  • Superior Linear Probing: When evaluating frozen representations, AudioMosaic achieves 29.4 mAP on AS-20K, vastly outperforming purely reconstructive models like Audio-MAE (18.3 mAP).
  • Deepfake Detection: On the EnvSDD benchmark, AudioMosaic achieves an average Equal Error Rate (EER) of 1.30% for text-to-audio and 0.02% for audio-to-audio deepfakes, demonstrating exceptional generalization to entirely unseen generative artifacts.
  • Memory and Batch Scaling: Because it discards the heavy Transformer decoders typical of generative models, AudioMosaic is highly parameter- and memory-efficient. It scales cleanly to a pre-training batch size of 6144 on standard hardware, whereas competing models like EAT suffer from Out-Of-Memory (OOM) errors at much lower batch sizes.

Limitations and Future Work

  • Performance Saturation: On specific benchmarks like EnvSDD, the model's performance is already nearing saturation (e.g., 0.02% EER), making it difficult to measure further incremental improvements.
  • Batch Size Scaling Limits: Ablation studies show that performance continues to improve up to their maximum tested batch size of 6144. The full upper bound of this scaling behavior remains unexplored due to hardware constraints.
  • Localization Tasks: Because AudioMosaic optimizes for global, utterance-level representations, its performance on tasks requiring fine-grained temporal or spectral localization (like sound event detection) was not extensively mapped and remains a direction for future work.

Summary updated

Abstract

Audio self-supervised learning (SSL) aims to learn general-purpose representations from large-scale unlabeled audio data. While recent advances have been driven mainly by generative reconstruction objectives, contrastive approaches remain less explored, partly due to the difficulty of designing effective audio augmentations and the large batch sizes required for contrastive pre-training. We introduce \textbf{AudioMosaic}, a contrastive learning-based audio encoder for general audio understanding. During pre-training, AudioMosaic constructs positive pairs by applying structured time-frequency masking to spectrogram patches, which reduces memory usage and enables efficient large-batch training. Compared with generative approaches, the AudioMosaic encoder learns more discriminative utterance-level representations that demonstrate strong transferability across datasets, domains, and acoustic conditions. Extensive experiments show that AudioMosaic achieves state-of-the-art performance on several standard audio benchmarks under both linear probing and fine-tuning. We further show that integrating the pretrained AudioMosaic encoder into audio-language models improves performance on audio-language tasks. The code is publicly available in our \href{https://github.com/HanxunH/AudioMosaic}{GitHub repository}.
BibTeX
@inproceedings{huang2026audiomosaic,
  author = {Hanxun Huang and Qizhou Wang and Xingjun Ma and Cihang Xie and Christopher Leckie and Sarah Erfani},
  title = {{AudioMosaic: Contrastive Masked Audio Representation Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=OXJ7KqVOoT},
}
Figure