﻿# CLAP long-audio embeddings: feature fusion and random crops affect reproducibility

Keep CLAP fused checkpoint selection, long-audio crop policy, and short-audio padding consistent when building audio-text retrieval embeddings and caches.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-clap-feature-fusion-crop-embedding-cache/
Language: en

## Begin with the selected fusion model

The [CLAP research paper](https://arxiv.org/abs/2211.06687) combines audio-text contrastive learning with feature fusion for audio representation. Fused and non-fused configurations should be treated as concrete artifact choices, not a harmless runtime enhancement automatically available for every checkpoint. Match the feature extractor and audio encoder configuration before evaluating retrieval. Otherwise a change attributed to a new embedding model may actually originate in a mismatched preparation or fusion path.

## Inspect long-recording preparation

The [CLAP feature reference](https://huggingface.co/docs/transformers/model_doc/clap) documents a fusion truncation policy that combines local random crops with a downsampled representation of the full mel spectrogram. It also distinguishes random truncation without that fusion path. Therefore, a long recording is not necessarily represented by every original frame at equal detail. An event's inclusion and local visibility can depend on preparation, which matters when comparing cached embeddings from repeated runs.

## Keep short-input padding explicit

The same reference distinguishes repeating, repeat-and-pad, and padding-only behaviors for short recordings. These operations create different effective inputs even when the source file is unchanged. The [official repository](https://github.com/LAION-AI/CLAP) exposes fusion selection in its loading examples. Preserve that selection alongside the extractor settings rather than standardizing every short clip to a generic silence-padding routine inherited from a speech-recognition service with a different training contract.

## Diagnose unstable retrieval results

Consider indexing a long ambient recording containing a brief bell. If its similarity to a bell description changes between runs, inspect crop selection and fusion metadata before blaming approximate nearest-neighbor search. Compare stored embeddings from identical effective features, then compare independently prepared features. This separates model execution from stochastic preparation. It does not guarantee localization of the bell or imply that a single pooled embedding can precisely identify the event's time boundary.

## Give the embedding cache a complete identity

Record checkpoint, fusion configuration, source segment, resampling, padding policy, crop procedure, and relevant random state. Guides on [contrastive representations](/journal/clip-image-text-contrastive-space/) and [inference evaluation](/journal/inference-benchmark-method/) explain adjacent concepts. Evaluate retrieval with representative long and short clips, and retain the preparation route in the index version. A stable file hash alone cannot identify the actual model input when the preprocessing path can select different local evidence from the same recording.
