cMSCI — Calibrated Multimodal Semantic Coherence Index
Score how semantically coherent a text / image / audio triple is, with a single calibrated metric.
cMSCI evaluates coherence using pre-aligned embedding spaces (CLIP for text–image, CLAP for text–audio), Gramian-volume geometry, distribution calibration, contrastive margins against hard negatives, a trained cross-space bridge for the image–audio channel, and probabilistic uncertainty weighting.
On a 100-sample human evaluation (5 raters), cMSCI correlates with human coherence judgments at Spearman ρ = 0.785 (p < 1e-6), versus 0.558 for the uncalibrated MSCI baseline.
Install
pip install "cmsci @ git+https://github.com/Pratik25priyanshu20/MultiModal-Coherence-Evaluation-and-Generation.git#subdirectory=cmsci-package"
Or from a local clone:
pip install ./cmsci-package
All trained artifacts (calibration statistics, Ex-MCR projector, cross-space bridge, probabilistic adapters, negative-bank indexes — ~9 MB) are bundled; the CLIP and CLAP backbones download automatically from Hugging Face on first use.
Usage
Python
from cmsci import CoherenceScorer
scorer = CoherenceScorer()
result = scorer.score(
text="rain falling in a dense forest",
image="scene.png", # optional
audio="rain.wav", # optional
domain="nature", # optional hint for harder negatives
)
print(result.cmsci) # calibrated coherence score
print(result.msci) # legacy weighted-cosine baseline
print(result.st_i, result.st_a, result.si_a) # channel similarities
print(result.variant_scores) # ablation variants A–F
print(result.uncertainty) # probabilistic uncertainty estimates
Batch scoring:
results = scorer.score_batch([
{"text": "waves on a beach", "image": "beach.jpg", "audio": "waves.wav"},
{"text": "a busy city street", "image": "street.jpg", "audio": "traffic.wav"},
])
Command line
cmsci --text "rain falling in a dense forest" --image scene.png --audio rain.wav
cmsci --text "..." --image scene.png --json # full result as JSON
How it works
| Stage | Component |
|---|---|
| Embedding | CLIP (openai/clip-vit-base-patch32) for text/image, CLAP (laion/clap-htsat-unfused) for text/audio |
| Geometry | Gramian volume of the embedding set — 0 = aligned, 1 = orthogonal |
| Calibration | Per-channel z-score normalization from baseline statistics |
| Contrastive | Margin vs. hard negatives from the bundled embedding indexes |
| Cross-space | Trained 590K-param bridge enables the image–audio channel |
| Uncertainty | ProbVLM-style adapters adaptively weight channels |
Scores are calibrated against the paper's baseline distribution. For very
different domains, recalibration is possible — point CMSCI_ASSETS_DIR at a
directory with your own artifacts/cmsci_calibration.json (same layout as the
bundled assets).
Configuration
| Env var | Effect |
|---|---|
CMSCI_ASSETS_DIR |
Use a custom assets directory instead of the bundled one |
CMSCI_CACHE_DIR |
Embedding cache location (default ~/.cache/cmsci) |
Notes
- Missing assets degrade gracefully: without the bridge the
si_achannel is omitted; without calibration, raw uncalibrated scores are returned. - CPU works fine for scoring; GPU is only beneficial for large batches.
Citation
If you use cMSCI in academic work, please cite the accompanying paper (reference to be added upon publication).
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cmsci-0.1.0.tar.gz.
File metadata
- Download URL: cmsci-0.1.0.tar.gz
- Upload date:
- Size: 8.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f8aab0fb65cfd3fa7d2cc3889eaa076c6dff9e8232e34a3801d618d9ccd03b
|
|
| MD5 |
47330f66e04ffe3e36cfa0ee84772e00
|
|
| BLAKE2b-256 |
b48710c6559a24544a4ddac39d054131fc03f725ab5e3c1fee691bef59ee57af
|
File details
Details for the file cmsci-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cmsci-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66055502ed13498c871dea0db32099dd0e80dabadaf523665e5ce59e24276d99
|
|
| MD5 |
571cacc09f223a27a88bb5d9af02dbb5
|
|
| BLAKE2b-256 |
7309d7f82ee13fe899ef0e41a789c552f036c7955b165854e06f93153a48baf7
|