Views
No views yet
| id | label | meaning |
|---|---|---|
| 0 | no_match | the two passages are unrelated |
| 1 | cit | citation / close lexical reuse |
| 2 | cf | loose thematic echo (confer) |
-class-lat-intertext-v1 models solved the binary version of this
task (match / no match). This model distinguishes the two positive types instead,
so its outputs are not interchangeable with theirs.<s> Jerome_phrase </s></s> Candidate_phrase </s>1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5tokenizer = AutoTokenizer.from_pretrained("julian-schelb/modernbert-large-3class-lat-intertext-v1")
6model = AutoModelForSequenceClassification.from_pretrained("julian-schelb/modernbert-large-3class-lat-intertext-v1")
7model.eval()
8
9# Define your sentence pair
10sentence1 = "omnia fert aetas, animum quoque; saepe ego longos cantando puerum memini me condere soles."
11sentence2 = "saepe ego longos cantando puerum memini me condere soles."
12
13# Tokenize the sentence pair for the model
14inputs = tokenizer(
15 sentence1, # Hieronymus
16 sentence2, # Classical author
17 add_special_tokens=True,
18 truncation=True,
19 padding="max_length",
20 return_tensors="pt",
21)
22
23# Run the model in evaluation mode (no gradient calculation)
24with torch.no_grad():
25 probs = torch.softmax(model(**inputs).logits, dim=-1)[0]
26
27# probs is indexed by class id: 0 = no_match, 1 = cit, 2 = cf
28for idx, p in enumerate(probs):
29 print(f"{model.config.id2label[idx]}: {p:.4f}")no_match. For this checkpoint:| class | threshold | meaning |
|---|---|---|
cit | 0.91 | citation / close lexical reuse |
cf | 0.88 | loose thematic echo (confer) |
1THRESHOLDS = {"cit": 0.91, "cf": 0.88}
2
3# A positive class fires when its probability clears its own threshold.
4# If both fire, the higher probability wins (ties go to `cit`).
5def predict(probs):
6 fired = {
7 name: probs[model.config.label2id[name]]
8 for name, threshold in THRESHOLDS.items()
9 if probs[model.config.label2id[name]] >= threshold
10 }
11 return max(fired, key=fired.get) if fired else "no_match"cf (loose thematic echo) is a much
harder class than cit, since it carries no reliable lexical signal.1@misc{schelb2026locisimilesbenchmarkextracting,
2 title={Loci Similes: A Benchmark for Extracting Intertextualities in Latin Literature},
3 author={Julian Schelb and Michael Wittweiler and Marie Revellio and Barbara Feichtinger and Andreas Spitz},
4 year={2026},
5 eprint={2601.07533},
6 archivePrefix={arXiv},
7 primaryClass={cs.IR},
8 url={https://arxiv.org/abs/2601.07533},
9}