Views
No views yet
| Language | macro F1-Score |
|---|---|
| English | .853 |
| Romanian | .822 |
<e1> and <e2>. Before tokenization, these tags are mapped to four special tokens ([E1] [/E1] [E2] [/E2]) that were added to the vocabulary during fine-tuning. The classifier head predicts one of 19 directional labels (e.g. Cause-Effect(e1,e2) vs Cause-Effect(e2,e1)), which collapse to the 10 coarse SemEval relations.1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4RELATIONS = [
5 "Cause-Effect(e1,e2)", "Cause-Effect(e2,e1)",
6 "Instrument-Agency(e1,e2)", "Instrument-Agency(e2,e1)",
7 "Product-Producer(e1,e2)", "Product-Producer(e2,e1)",
8 "Content-Container(e1,e2)", "Content-Container(e2,e1)",
9 "Entity-Origin(e1,e2)", "Entity-Origin(e2,e1)",
10 "Entity-Destination(e1,e2)", "Entity-Destination(e2,e1)",
11 "Component-Whole(e1,e2)", "Component-Whole(e2,e1)",
12 "Member-Collection(e1,e2)", "Member-Collection(e2,e1)",
13 "Message-Topic(e1,e2)", "Message-Topic(e2,e1)",
14 "Other",
15]
16
17tok = AutoTokenizer.from_pretrained("DS4AI-UPB/xlmr-base-ro-re")
18model = AutoModelForSequenceClassification.from_pretrained("DS4AI-UPB/xlmr-base-ro-re").eval()
19
20def convert_markers(text):
21 text = text.replace("<e1>", "[E1] ").replace("</e1>", " [/E1]")
22 return text.replace("<e2>", "[E2] ").replace("</e2>", " [/E2]")
23
24sentence = "<e1>Furtuna</e1> a provocat mari <e2>pagube</e2>."
25inputs = tok(convert_markers(sentence), return_tensors="pt", truncation=True, max_length=192)
26with torch.no_grad():
27 pred = model(**inputs).logits.argmax(-1).item()
28print(RELATIONS[pred]) # Cause-Effect(e1,e2)infer_encoder.py in the code repository.1@misc{vasile2026crosslingual,
2 title = {Cross-lingual Relation Extraction with Large Language Models: Zero-Shot, Few-Shot, and Fine-Tuned Evaluation on Romanian},
3 author = {Vasile, Drago\c{s}-Mitru\c{t} and Apostol, Elena-Simona and Toma, \c{S}tefan-Adrian and Paschke, Adrian and Truic\u{a}, Ciprian-Octavian},
4 year = {2026},
5 note = {Preprint}
6}