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
Or the latest development version straight from GitHub:
pip install "cmsci @ git+https://github.com/Pratik25priyanshu20/MultiModal-Coherence-Evaluation-and-Generation.git#subdirectory=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
Metadata
Release files for cmsci 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cmsci-0.1.1.tar.gz | 8.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cmsci-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.8 MB
Release files / cmsci-0.1.1.tar.gz
| Download URL | cmsci-0.1.1.tar.gz |
|---|---|
| Size | 8.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adb8697c4e814d02bf56e94399930677ff2f0b0f67b7720a5766eab11e9604dd
|
|
BLAKE2b-256 checksum How to use checksums |
1a6cba8c1cb9aac76eb9faf4dd87fac8849b91ecb58937387b05460eddb6a329
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Release files / cmsci-0.1.1-py3-none-any.whl
| Download URL | cmsci-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef59a5743b286bea6706b162768e9c6ab3395e97fe60cd92e819d695c1b79b4e
|
|
BLAKE2b-256 checksum How to use checksums |
3ea912d0d425c70d52630d1c5732431d01e97b111e9fc2f20a22ea861448ca1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|