Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA047 · Metric
CLAP text–audio similarity
Scores alignment between audio and text using a fixed contrastively trained dual encoder.
In CodeSplash
No method yet, but the reference's example runs here as a notebook.
Do it in CodeSplash Open the reference's example as a Python or R notebook.
- Availability
- Runs as a notebook
- Code example
- Complete calculation
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Scores alignment between audio and text using a fixed contrastively trained dual encoder.
Question / hypotheses
Does generated audio resemble the concepts represented by its prompt in the chosen embedding space?
Architecture / computational structure
A fixed pretrained feature/evaluation model followed by the named aggregation rule. The feature extractor is part of the metric specification.
Assumptions
Use compatible audio/text encoders, resampling, duration/cropping, and normalization. The evaluator’s training distribution determines its sensitivities.
Formula / computational definition
Parameters and notation
Encoder weights are pretrained and frozen for evaluation. Checkpoint, crop aggregation, and score scaling are protocol hyperparameters; changing the evaluator changes the metric.
Fitting, fine-tuning, and adaptation
There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.
How to use and calibrate
Report prompt-level similarity alongside distributional quality and human review. Check negation, event counts, ordering, and unseen sound classes explicitly.
Example application
Assess prompt relevance of text-to-audio outputs.
Interpretation / pitfalls
Watch out
CLAP can miss temporal order or subtle acoustic defects and can reward generic sound mixtures. Fine-tuning the evaluator on the evaluated generator’s outputs risks circular assessment.
Python and R code examples
Scope: Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.
Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline. · needs numpy
import numpy as np
a=np.array([1.,.2,.1]); t=np.array([.8,.3,.2])
print(a@t/(np.linalg.norm(a)*np.linalg.norm(t)))
Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.
a <- c(1,.2,.1); t <- c(.8,.3,.2)
print(sum(a*t)/sqrt(sum(a*a)*sum(t*t)))
Sources
- Source 1github.com
From the CodeSplash reference, entry EVA047.