Instructions to use julian-schelb/philberta-3class-lat-intertext-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use julian-schelb/philberta-3class-lat-intertext-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="julian-schelb/philberta-3class-lat-intertext-v1")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("julian-schelb/philberta-3class-lat-intertext-v1") model = AutoModelForSequenceClassification.from_pretrained("julian-schelb/philberta-3class-lat-intertext-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Latin Intertextuality Classifier (3-class)
This model is a fine-tuned version of bowphs/PhilBerta for sequence-pair classification of intertextual links between Jerome (Hieronymus) and other classical authors. It is intended to integrate with the LociSimiles Python package for Latin intertextuality workflows: https://julianschelb.github.io/locisimiles/api/
Labels
Given a pair of passages, the model predicts one of three classes:
| id | label | meaning |
|---|---|---|
| 0 | no_match |
the two passages are unrelated |
| 1 | cit |
citation / close lexical reuse |
| 2 | cf |
loose thematic echo (confer) |
The earlier -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.
Model Description
- Task: 3-class classification for detecting and typing intertextual links between classical Latin authors
- Model type: Sequence Classification
- Base model: bowphs/PhilBerta
- Max input tokens: 512
- Training data: one of five cross-validation splits of the Loci Similes benchmark
- Class balance: trained with class-balanced sampling, since real corpora are overwhelmingly negative
- Language: Latin
- License: Apache 2.0
Usage
When using standard tokenization for a sequence-pair classification task, the final input sequence follows the encoder-style pattern with special tokens:
<s> Jerome_phrase </s></s> Candidate_phrase </s>
Here is a complete example:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("julian-schelb/philberta-3class-lat-intertext-v1")
model = AutoModelForSequenceClassification.from_pretrained("julian-schelb/philberta-3class-lat-intertext-v1")
model.eval()
# Define your sentence pair
sentence1 = "omnia fert aetas, animum quoque; saepe ego longos cantando puerum memini me condere soles."
sentence2 = "saepe ego longos cantando puerum memini me condere soles."
# Tokenize the sentence pair for the model
inputs = tokenizer(
sentence1, # Hieronymus
sentence2, # Classical author
add_special_tokens=True,
truncation=True,
padding="max_length",
return_tensors="pt",
)
# Run the model in evaluation mode (no gradient calculation)
with torch.no_grad():
probs = torch.softmax(model(**inputs).logits, dim=-1)[0]
# probs is indexed by class id: 0 = no_match, 1 = cit, 2 = cf
for idx, p in enumerate(probs):
print(f"{model.config.id2label[idx]}: {p:.4f}")
Decision thresholds
Argmax over the three classes is a reasonable default, but the experiments this
model comes from apply a per-class threshold instead, tuned one-vs-rest on the
training split, falling back to no_match. For this checkpoint:
| class | threshold | meaning |
|---|---|---|
cit |
0.98 | citation / close lexical reuse |
cf |
0.61 | loose thematic echo (confer) |
THRESHOLDS = {"cit": 0.98, "cf": 0.61}
# A positive class fires when its probability clears its own threshold.
# If both fire, the higher probability wins (ties go to `cit`).
def predict(probs):
fired = {
name: probs[model.config.label2id[name]]
for name, threshold in THRESHOLDS.items()
if probs[model.config.label2id[name]] >= threshold
}
return max(fired, key=fired.get) if fired else "no_match"
Real corpora are overwhelmingly negative, so thresholding trades recall for a large
reduction in false positives. Note also that cf (loose thematic echo) is a much
harder class than cit, since it carries no reliable lexical signal.
Citation
@misc{schelb2026locisimilesbenchmarkextracting,
title={Loci Similes: A Benchmark for Extracting Intertextualities in Latin Literature},
author={Julian Schelb and Michael Wittweiler and Marie Revellio and Barbara Feichtinger and Andreas Spitz},
year={2026},
eprint={2601.07533},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2601.07533},
}
- Downloads last month
- 28
Model tree for julian-schelb/philberta-3class-lat-intertext-v1
Base model
bowphs/PhilBerta