CoolFace
Modelpublic

cara-ai/ALM2Vec-PT

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
2likes20downloads
Model Card

<h1 align="center">ALM2Vec-PT</h1>

<p align="center"> <a href="https://arxiv.org/abs/2606.30682"><img src="https://img.shields.io/badge/Paper-arXiv-b31b1b?logo=arxiv&logoColor=white" alt="Paper"></a> <a href="https://caml-labs.github.io/ALM2Vec"><img src="https://img.shields.io/badge/Project-Page-1f6feb?logo=googlechrome&logoColor=white" alt="Project Page"></a> <a href="https://github.com/caml-labs/ALM2Vec"><img src="https://img.shields.io/badge/Code-GitHub-181717?logo=github&logoColor=white" alt="GitHub"></a> </p>

ALM2Vec is a universal audio embedding model for retrieval, derived from a pretrained large audio–language model (LALM). Instead of being optimized only for audio–caption matching like conventional contrastive dual-encoders, it transfers the audio understanding, instruction-following, and reasoning abilities of LALMs into a single unified embedding space that works across audio domains, task types, and user intents.

Its key feature is instruction-aware retrieval: a natural-language instruction guides the embedding, so the same audio can be encoded differently for different needs. This supports:

  • —Instruction-aware retrieval — focus the embedding on a specific aspect of the audio.
  • —Text ↔ audio retrieval — bidirectional matching between audio and text.
  • —Audio question answering — match an audio query plus a question against candidate answers.

ALM2Vec achieves competitive results on standard audio and speech retrieval benchmarks while adding these controllable retrieval capabilities. See the project page for interactive demos.

This repository hosts the pretrain checkpoint, built on MiDashengLM.

Requirements: transformers>=4.52, torch, safetensors, and torchaudio for non-WAV audio. Requires a GPU (~31GB weights) and trust_remote_code=True.

Example

python
import torch
from transformers import AutoModel, AutoTokenizer

# switch between pretrain and finetune
repo_id = "cara-ai/ALM2Vec-PT"
# repo_id = "cara-ai/ALM2Vec-FT"

tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True, torch_dtype=torch.float32).cuda()
model.eval()

QUERY_INSTRUCTION = "Based on the question asked in the text query and context in the audio query, retrieve the relevant text document associated with that question."
DOC_INSTRUCTION = "Represent the user's input."

query_text = ["What is the gender of speaker in this audio?"] * 4

remote_prefix = "https://huggingface.co/cara-ai/ALM2Vec-PT/resolve/main/example/"
query_audio = [remote_prefix + "en_male_music.wav", remote_prefix + "en_male.wav", 
               remote_prefix + "en_female_music.wav", remote_prefix + "en_female.wav"]

doc_text = [
    "male",
    "female",
]

query_embeddings = model.encode(
    text=query_text,
    audio=query_audio,
    task="query",
    instruction=QUERY_INSTRUCTION,
    normalize=True,
    device="cuda",
)
doc_embeddings = model.encode(
    text=doc_text,
    task="document",
    instruction=DOC_INSTRUCTION,
    normalize=True,
    device="cuda",
)

similarity = query_embeddings @ doc_embeddings.T
print(similarity)

similarity = query_embeddings @ query_embeddings.T
print(similarity)

Results

ALM2Vec-PT is the checkpoint hosted in this repository; ALM2Vec-FT is the fine-tuned variant. In every table, bold marks the best score and <u>underline</u> the second best.

Text–audio retrieval — AudioCaps

MethodT→A R@1T→A R@5T→A R@10A→T R@1A→T R@5A→T R@10
LAION-CLAP36.171.883.946.8<u>82.9</u><u>90.7</u>
MS-CLAP15.447.264.532.066.079.2
WavCaps-CLAP-PT39.774.586.151.782.390.6
WavCaps-CLAP-FT<u>42.2</u><u>76.5</u><u>87.1</u><u>54.6</u>85.292.4
JINA-Embed.-v520.450.364.423.152.767.2
ALM2Vec-PT40.074.585.943.874.386.5
ALM2Vec-FT43.278.087.855.580.088.2

Text–audio retrieval — Clotho

MethodT→A R@1T→A R@5T→A R@10A→T R@1A→T R@5A→T R@10
LAION-CLAP16.138.351.122.748.560.8
MS-CLAP15.638.951.422.148.962.0
WavCaps-CLAP-PT19.545.258.223.450.963.4
WavCaps-CLAP-FT<u>19.7</u><u>45.7</u><u>59.4</u><u>26.9</u><u>52.6</u><u>64.9</u>
JINA-Embed.-v59.223.935.010.524.734.3
ALM2Vec-PT19.243.455.717.939.452.2
ALM2Vec-FT24.852.965.827.952.766.3

Speech retrieval — LibriSQA

MethodT→S R@1T→S R@5T→S R@10S→T R@1S→T R@5S→T R@10
LAION-CLAP †0.00.10.80.10.20.6
Whisper+BGE83.793.394.985.293.495.3
CLSR85.0<u>93.4</u><u>95.0</u><u>85.5</u><u>94.0</u><u>95.6</u>
ALM2Vec-PT43.764.572.811.224.934.1
ALM2Vec-FT<u>84.7</u>94.195.886.095.297.2

Audio understanding — MMAU-mini (accuracy)

MethodOverallMusicSoundSpeech
GPT-4o Audio ‡60.863.264.656.3
Gemini 2.5 Pro ‡<u>71.6</u><u>75.1</u>71.568.3
Qwen2.5-Omni ‡71.565.9<u>78.1</u><u>70.6</u>
Audio Flamingo 3 ‡73.176.966.173.9
ALM2Vec-PT66.362.378.758.0
ALM2Vec-FT63.061.774.852.6

† LAION-CLAP is not trained for speech and effectively fails on LibriSQA; shown for reference. ‡ Generative large audio–language models, listed as reference upper bounds rather than directly comparable retrieval baselines.

Citation

If you find this work useful, please consider citing:

@misc{lu2026alm2veclearningaudioembeddings,
      title={ALM2Vec: Learning Audio Embeddings for Universal Audio Retrieval with Large Audio-Language Models}, 
      author={Fengjie Lu and Chenang Jiang and Jiarui Hai and Helin Wang and Aaron Yee},
      year={2026},
      eprint={2606.30682},
      archivePrefix={arXiv},
      primaryClass={cs.SD},
      url={https://arxiv.org/abs/2606.30682}, 
}

Acknowledgement

ALM2Vec is built on MiDashengLM and further trained for universal audio retrieval. We thank MiDashengLM and its underlying Dasheng audio encoder for their open-source contributions.