Views
No views yet
1from transformers import AutoModel
2
3model = AutoModel.from_pretrained(
4 "cruciverb-it/crossword-space-mpnet-base-ade",
5 trust_remote_code=True,
6)1from model import DualEncoderADE
2
3model = DualEncoderADE.from_pretrained("cruciverb-it/crossword-space-mpnet-base-ade")1import torch
2import torch.nn.functional as F
3from transformers import AutoModel, AutoTokenizer
4
5model = AutoModel.from_pretrained(
6 "cruciverb-it/crossword-space-mpnet-base-ade",
7 trust_remote_code=True,
8)
9tokenizer = AutoTokenizer.from_pretrained("cruciverb-it/crossword-space-mpnet-base-ade")
10model.eval()
11
12clues = ["Capitale d'Italia", "Fiume che attraversa Roma"]
13answers = ["ROMA", "TEVERE"]
14
15clue_enc = tokenizer(clues, padding=True, truncation=True, max_length=64, return_tensors="pt")
16ans_enc = tokenizer(answers, padding=True, truncation=True, max_length=16, return_tensors="pt")
17
18with torch.no_grad():
19 clue_emb, ans_emb = model(
20 def_input_ids=clue_enc["input_ids"],
21 def_attention_mask=clue_enc["attention_mask"],
22 ans_input_ids=ans_enc["input_ids"],
23 ans_attention_mask=ans_enc["attention_mask"],
24 )
25
26# L2-normalize for cosine similarity / inner-product search
27clue_emb = F.normalize(clue_emb, dim=-1)
28ans_emb = F.normalize(ans_emb, dim=-1)
29
30# Similarity matrix
31similarity = clue_emb @ ans_emb.T
32print(similarity)| Test Set | Acc@1 | Acc@10 | Acc@100 | Acc@1000 | MRR |
|---|---|---|---|---|---|
| Crossword | 31.8 | 63.4 | 81.3 | 91.0 | 42.7 |
| Dictionary | 17.5 | 40.5 | 63.3 | 82.2 | 25.3 |
| ONLI | 11.8 | 34.9 | 61.0 | 81.5 | 19.7 |
| Neologisms | 9.0 | 25.0 | 59.0 | 82.0 | 14.6 |
| Test Set | Acc@1 | Acc@10 | Acc@100 | Acc@1000 | MRR |
|---|---|---|---|---|---|
| Crossword | 54.0 | 80.2 | 91.3 | 97.2 | 63.6 |
| Dictionary | 35.6 | 62.6 | 82.5 | 95.7 | 45.0 |
| ONLI | 36.0 | 65.0 | 84.3 | 95.8 | 45.8 |
| Neologisms | 28.0 | 60.0 | 84.0 | 94.0 | 38.1 |
1@inproceedings{ciaccio-etal-2025-crossword-space,
2 title = "Crossword Space: Latent Manifold Learning for Italian Crosswords and Beyond",
3 author = "Ciaccio, Cristiano and Sarti, Gabriele and Miaschi, Alessio and Dell'Orletta, Felice",
4 booktitle = "Proceedings of the Eleventh Italian Conference on Computational Linguistics (CLiC-it 2025)",
5 year = "2025",
6 url = "https://aclanthology.org/2025.clicit-1.26/"
7}