Views
No views yet
1from sentence_transformers import CrossEncoder
2
3model = CrossEncoder(
4 "cometadata/jina-reranker-v2-multilingual-affiliations",
5 trust_remote_code=True,
6)
7
8# Score affiliation pairs (higher = more likely same institution)
9pairs = [
10 ["University of California, Berkeley", "UC Berkeley"],
11 ["University of California, Berkeley", "Berkeley College"],
12]
13scores = model.predict(pairs)
14# [0.82, 0.15] - first pair matches, second doesn't
15
16# Rank candidates for an affiliation string
17results = model.rank(
18 "MIT, Cambridge, MA",
19 [
20 "Massachusetts Institute of Technology",
21 "MIT University (India)",
22 "University of Cambridge",
23 ]
24)
25# Returns candidates ranked by relevance| Parameter | Value |
|---|---|
| Epochs | 3 |
| Batch size | 16 |
| Learning rate | 2e-5 |
| Loss | BinaryCrossEntropyLoss |
| Validation split | 15% |
| Tier | Cases | Base Model | Fine-tuned | Δ |
|---|---|---|---|---|
| Baseline | 30 | 100.0% | 100.0% | — |
| OCR/Noise | 30 | 100.0% | 100.0% | — |
| Abbreviations | 40 | 60.0% | 80.0% | +20.0% |
| Hierarchical | 35 | 71.4% | 77.1% | +5.7% |
| Medical/Hospital | 25 | 64.0% | 68.0% | +4.0% |
| Research Labs | 25 | 80.0% | 84.0% | +4.0% |
| International | 35 | 82.9% | 91.4% | +8.6% |
| Disambiguation | 31 | 45.2% | 51.6% | +6.5% |
| Negative Controls | 19 | 100.0% | 100.0% | — |
| Ultra-Hard | 30 | 93.3% | 96.7% | +3.3% |
1@misc{jina-affiliation-reranker,
2 title={Jina Affiliation Reranker},
3 author={cometadata},
4 year={2024},
5 publisher={Hugging Face},
6 url={https://huggingface.co/cometadata/jina-reranker-v2-multilingual-affiliations}
7}