加载中…
加载中…
CLAP2-S is one of the five CLAP2 contrastive audio-text models (27M to 340M parameters), in OpenCLIP and Transformers format. An audio tower and a text tower map audio clips and English text into a shared embedding space, so the models can be used for zero-shot audio classification, audio-text retrieval, and as general audio embeddings. All models were trained from scratch on LAION-Audio-XL, a corpus of 366M audio-text pairs.
The audio tower is a NaFlex vision transformer over log-mel patches. It takes audio of any length (no fixed-size crop or padding to a fixed length) and produces one embedding per clip.
Each model size is a separate repository (see the table below).
Paper: arXiv:2611.11592 · Code: LAION-AI/clap2 · Project page: projects.laion.ai/clap2
All models were trained for 1,024M samples seen (WSD learning-rate schedule, last checkpoint). Parameter counts are for both towers.
| Model | Repository | Params | MAEB-30 | HEAR-17 | MSEB |
|---|---|---|---|---|---|
| L | laion/clap2-large-audioxl-s1B | 340.1M | 53.6 | 81.9 | 30.3 |
| M | laion/clap2-medium-audioxl-s1B | 152.8M | 52.3 | 81.4 | 29.4 |
| S (this model) | laion/clap2-small-audioxl-s1B | 103.9M | 51.8 | 81.8 | 29.8 |
| XS | laion/clap2-xs-audioxl-s1B | 48.3M | 49.1 | 80.6 | 27.6 |
| XXS | laion/clap2-xxs-audioxl-s1B | 27.3M | 46.2 | 79.1 | 28.0 |
Scores are in %, higher is better. MAEB-30 is the mean over the 30 tasks of the Massive Audio Embedding Benchmark. The tasks cover speech, music and sound, and the task types classification, zero-shot classification, pair classification, clustering and retrieval. HEAR-17 is the mean over 17 HEAR tasks (all except Beehive and Maestro 5h). MSEB is the mean over 62 English MSEB scores. For the exact protocol, per-domain and per-task-type scores, and comparisons with other audio-text models, see the paper.
pip install "open_clip_torch>=4.2.1" soundfile
import torch, open_clip
from open_clip.audio.io import load_audio
hub = "hf-hub:laion/clap2-small-audioxl-s1B"
model, preprocess = open_clip.create_model_from_pretrained(hub)
tokenizer = open_clip.get_tokenizer(hub)
audio = preprocess()(load_audio("dog.wav")) # any sample rate and channel count
texts = ["A dog barks.", "A door slams shut.", "People are applauding."]
with torch.no_grad():
logits, _ = model.get_logits({k: v[None] for k, v in audio.items()}, tokenizer(texts))
print({t: round(p, 3) for t, p in zip(texts, logits.softmax(-1)[0].tolist())})
Output for an FSD50K clip of a dog barking: {'A dog barks.': 1.0, 'A door slams shut.': 0.0, 'People are applauding.': 0.0}. For embeddings, use model.encode_audio({k: v[None] for k, v in audio.items()}, normalize=True) and model.encode_text(tokenizer(texts), normalize=True).
Pad the patch dictionaries to the longest clip. patch_valid masks the padding, so the embeddings are the same as when each clip is encoded alone:
from torch.nn.utils.rnn import pad_sequence
items = [preprocess()(load_audio(f)) for f in ["dog.wav", "rain.wav"]]
batch = {k: pad_sequence([x[k] for x in items], batch_first=True) for k in items[0]}
with torch.no_grad():
audio_embeds = model.encode_audio(batch, normalize=True)
For zero-shot classification, describe each class with several short captions in full sentences, in the style of the training captions. For example, "A cello plays a slow melody." or "A man gives a lecture." Cover the different kinds of sound in the class. Avoid bare labels ("speech", "dog") and negations ("no background music"). Average the prompt embeddings of each class. Before taking the top class, subtract each class's mean score over the clips.
preprocess averages multi-channel audio to mono and resamples it to 32 kHz. The front end is a 128-bin log-mel spectrogram (50 Hz to 16 kHz, 320-sample hop), cut into non-overlapping 16x16 patches. This gives 50 tokens per second of audio.Intended use: zero-shot audio tagging and classification, audio-text retrieval, audio embeddings for downstream classifiers, and data curation (for example filtering or ranking audio by text queries). The small models are meant to be cheap to run.
Limitations:
LAION-Audio-XL contains 366,006,046 audio-text pairs with audio of at most 30 s. They were selected from 1.48B collected audio samples (316 academic datasets, internet datasets, Common Crawl, and Creative Commons YouTube videos, which make up most of the raw pool). Unreadable and silent audio, exact and near duplicates, and audio overlapping with the MAEB, HEAR and MSEB evaluation sets are removed. A taxonomy-based, coverage-aware procedure then selects the samples. The mixture is 44.8% speech, 22.4% music, 16.6% designed sound effects and 16.2% other. Samples without a source description get a short (about 12 words) and a long (about 29 words) caption from Qwen3-Omni-30B-A3B-Instruct and MOSS-Audio-8B-Thinking. Training picks one at random.
About 94% of the samples carry a Creative Commons licence. Audio from sources whose licence allows redistribution is released in laion/laion-audio-xl. The other clips are released as links with captions and metadata.
The models were trained from scratch with a standard CLIP (InfoNCE) loss, AdamW (betas 0.9/0.98, weight decay 0.2), a warmup-stable-decay learning-rate schedule, gradient clipping 1.0, bf16 autocast and a learnable logit scale (initial 1/0.07, capped at 300). Audio is batched by length bucket with a budget of 49,152 audio tokens per GPU batch. The audio tower is a NaFlex ViT with axial RoPE, RMSNorm, SwiGLU, LayerScale, one register token and attention pooling. The text tower is a bidirectional transformer with RoPE, RMSNorm, SwiGLU and QK-norm (50,260-token vocabulary).
| Model | Audio tower (width x depth) | Text tower (width x depth) | Embedding dim |
|---|---|---|---|
| XXS | 224 x 12 | 224 x 12 | 224 |
| XS | 320 x 12 | 320 x 12 | 320 |
| S | 512 x 12 | 512 x 11 | 512 |
| M | 640 x 12 | 640 x 11 | 640 |
| L | 1024 x 12 | 960 x 11 | 960 |
The benchmarks (MAEB, MSEB, HEAR) are run with the audio extension of CLIP_benchmark, which loads these models with the same OpenCLIP calls as above.
Apache 2.0.
@misc{wijngaard2026laionaudioxlwebscalecorpusscaling,
title={LAION-Audio-XL: A Web-Scale Corpus and Scaling Studies for Contrastive Language-Audio Pretraining},
author={Gijs Wijngaard and Felix Förster and Ross Wightman and Marianna Nezhurina and Christoph Schuhmann and Jenia Jitsev and A. Sophia Koepke},
year={2026},
eprint={2611.11592},
archivePrefix={arXiv},
primaryClass={cs.SD},
url={https://arxiv.org/abs/2611.11592},
}