All models

MGA-CLAP

A CLAP whose audio and text towers share one codebook, so frames and words align as well as clips and captions.

Multimodal · 1,318 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (20 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
148.1M
Operations
1,318
Framework
PyTorch
Recurrent
No
Published
ACM MM 2024
Cited by
9 (as of 9 October 2026)
Authors
Yiming Li, Zhifang Guo, Xiangdong Wang, Hong Liu
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m14395
Graph hash
27c4569699722dd3b98b240a4fbc7d7952c0e4c1230b3c6d3783df189d50961e
Skeleton hash
4e73b61f0818416b0000031bea19a9db1a698b00d2ed2ab3a3548bad09b678c0
Architecture hash
7fdd1e21794f4c06e2973473b58329b8c2439d33fdae2b2a777696a72ca6ff64
Diagram SHA-256
b726869f11d48a6eff4f8e4feb8c939dd7f6a75a6af0d10441a8fb17373b2592
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

MGA-CLAP is a contrastive language-audio model built to improve both coarse- and fine-grained alignment between audio and text in large-scale pre-training. Audio-language models such as CLAP usually aggregate local frame or word features into global ones and apply the contrastive loss there, which reaches only coarse-grained alignment. That can ignore frame-level correspondence with text, hurting explainability, fine-grained tasks and even coarse-grained performance.

The central device is a shared codebook: both modalities' global features are represented with common bases, and each codeword is regularized to encode modality-shared semantics, bridging the gap between frame and word features. On top of it, a locality-aware block purifies local patterns and a hard-negative guided loss sharpens the alignment.

The text encoder is the pre-trained BERT base model, which contains 110M parameters. For the audio encoder the authors use either a patch-wise HTS-AT of 27M parameters or a frame-wise AST of 86M, with checkpoints trained on AudioSet by previous works. Pre-training merges WavCaps with the training sets of AudioCaps and Clotho, about 450K audio-text pairs.

Across eleven zero-shot coarse- and fine-grained tasks, the model surpasses the baseline CLAP significantly and is superior or competitive against current state-of-the-art work. The repository ships a trained checkpoint, model.pt, downloadable from Google Drive. Its zero-shot audio classification example runs on esc-50, urbansound8k and vggsound. The paper was an oral at ACM MM 2024.

Key idea. A modality-shared codebook that represents audio and text global features with common codewords, bridging frame and word features so one contrastive model aligns at both coarse and fine grain.

  • mga-clap
  • multi-grained alignment
  • contrastive language-audio pre-training
  • clap
  • audio-text retrieval
  • zero-shot sound event detection
  • text-to-audio grounding
  • audio classification
  • wavcaps

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{li2024advancingmultigrainedalignmentcontrastive,
      title={Advancing Multi-grained Alignment for Contrastive Language-Audio Pre-training}, 
      author={Yiming Li and Zhifang Guo and Xiangdong Wang and Hong Liu},
      year={2024},
      eprint={2408.07919},
      archivePrefix={arXiv},
      primaryClass={eess.AS},
      doi={https://doi.org/10.1145/3664647.3681145},
      url={https://arxiv.org/abs/2408.07919}, 
}