Views
No views yet
| File | Description |
|---|---|
max_diff.pth | Best checkpoint (selected by max pos–neg similarity difference) |
config.yaml | Training hyperparameters |
model_config.json | Model architecture configuration |
model.py | Model architecture code |
matcha.py | Simple inference interface |
pip install matcha-metric1from matcha_metric import MATCHA
2
3model = MATCHA.from_pretrained("Siran-Li/MATCHA")
4
5# Score a pair of texts
6similarity = model.score("The vaccine was proven effective.", "Clinical trials confirmed the vaccine works.")
7print(f"Similarity: {similarity:.4f}")
8
9# Batch scoring
10scores = model.score(
11 ["The cat sat on the mat.", "It is raining outside."],
12 ["A feline rested on the rug.", "The weather is sunny and clear."],
13)
14
15# Get embeddings directly
16embeddings = model.encode(["Hello world", "Hi there"])1# Get raw token attributions
2result = model.interpret("The cat sat on the mat.", "A feline rested on the rug.")
3for token, attr in zip(result["tokens"], result["attributions"]):
4 print(f"{token:>15s} {attr:+.4f}")
5
6# Save interactive HTML heatmap
7model.visualize(
8 "The cat sat on the mat.",
9 "A feline rested on the rug.",
10 label="Correct",
11 output_path="attribution.html",
12)

1@inproceedings{li2026matcha,
2 title={MATCHA: Matching Text via Contrastive Semantic Alignment},
3 author={Li, Siran and Etoglu, Ece Sena and Eickhoff, Carsten and Bahrainian, Seyed Ali},
4 booktitle={Findings of the Association for Computational Linguistics: ACL 2026},
5 pages={21001--21018},
6 year={2026}
7}