Endrit commited on
Commit
f62ebed
·
verified ·
1 Parent(s): b27e88c

Update readme

Browse files
Files changed (1) hide show
  1. README.md +145 -0
README.md CHANGED
@@ -1,3 +1,148 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - sq
5
+ library_name: transformers
6
+ pipeline_tag: fill-mask
7
+ base_model: FacebookAI/xlm-roberta-base
8
+ tags:
9
+ - albanian
10
+ - albanian-nlp
11
+ - xlm-roberta
12
+ - masked-language-model
13
+ - social-media
14
+ - social-media-nlp
15
+ - informal-text
16
+ - noisy-text
17
+ - low-resource-nlp
18
+ - domain-adaptive-pretraining
19
+ - text-classification
20
+ - sentiment-analysis
21
+ - hate-speech-detection
22
+ - dialect-detection
23
  ---
24
+
25
+ # AlbaSocialXLM-R
26
+
27
+ **AlbaSocialXLM-R** is a social-media-adapted XLM-RoBERTa model for Albanian. It is based on `FacebookAI/xlm-roberta-base` and was further adapted with continued masked language model pretraining on more than **400,000 Albanian social-media comments**, including original and controlled synthetic social-media variants.
28
+
29
+ The model is mainly intended as a reusable encoder for Albanian **social-media classification tasks**, especially when the text is informal, noisy, dialectal, written without diacritics, or shaped by online communication style.
30
+
31
+ This model was developed for the paper:
32
+
33
+ **A Social-Media-Adapted Masked Language Model for Low-Resource Languages: Multi-Task Applications on Sentiment, Hate Speech, and Dialect Detection**
34
+
35
+ ## Intended use
36
+
37
+ AlbaSocialXLM-R is designed for Albanian user-generated text, especially:
38
+
39
+ * social-media comments, posts, replies, and short reactions
40
+ * noisy or informal Albanian text
41
+ * Albanian text written without diacritics
42
+ * dialectal or regionally influenced Albanian writing
43
+ * news portal comments, forum-style messages, and chat-like text
44
+
45
+ It can be fine-tuned for tasks such as sentiment analysis, emotion detection, stance detection, hate speech detection, offensive language detection, toxicity classification, dialect detection, regional variety classification, topic classification, intent classification, public opinion mining, comment moderation research, and other Albanian social-media text mining tasks.
46
+
47
+ ## Important note
48
+
49
+ This is a **masked language model**, not a ready-made classifier.
50
+
51
+ For classification tasks, use this checkpoint as the base encoder and fine-tune it with a classification head on your labelled dataset.
52
+
53
+ ## How to use: masked-token prediction
54
+
55
+ ```python
56
+ from transformers import AutoTokenizer, AutoModelForMaskedLM, pipeline
57
+
58
+ model_id = "Endrit/AlbaSocialXLM-R"
59
+
60
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
61
+ model = AutoModelForMaskedLM.from_pretrained(model_id)
62
+
63
+ fill_mask = pipeline("fill-mask", model=model, tokenizer=tokenizer)
64
+
65
+ predictions = fill_mask("ky sen nuk osht hiq <mask>")
66
+
67
+ for item in predictions:
68
+ print(item["token_str"], item["score"])
69
+ ```
70
+
71
+ ## How to use: fine-tuning for classification
72
+
73
+ ```python
74
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
75
+
76
+ model_id = "Endrit/AlbaSocialXLM-R"
77
+
78
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
79
+
80
+ model = AutoModelForSequenceClassification.from_pretrained(
81
+ model_id,
82
+ num_labels=3,
83
+ ignore_mismatched_sizes=True
84
+ )
85
+ ```
86
+
87
+ Example label settings:
88
+
89
+ ```python
90
+ # Sentiment classification
91
+ id2label = {0: "negative", 1: "neutral", 2: "positive"}
92
+
93
+ # Hate speech detection
94
+ id2label = {0: "non_hate", 1: "hate"}
95
+
96
+ # Dialect detection
97
+ id2label = {0: "AL", 1: "KS", 2: "MK"}
98
+ ```
99
+
100
+ For sentence similarity, retrieval, or semantic search, additional sentence-embedding fine-tuning or post-processing is recommended because raw XLM-R embeddings are not optimized as standalone semantic embeddings.
101
+
102
+ ## Training data
103
+
104
+ The model was adapted on Albanian social-media text from the training partitions of sentiment analysis, hate speech detection, and dialect detection datasets. The adaptation corpus combines original social-media comments with controlled LLM-generated variants.
105
+
106
+ Validation and test partitions were excluded from the MLM adaptation corpus. The original datasets and raw comments are not included in this repository.
107
+
108
+ ## Training procedure
109
+
110
+ The model was initialized from `FacebookAI/xlm-roberta-base` and continued with the masked language modelling objective. The tokenizer was kept unchanged from XLM-R.
111
+
112
+ The released checkpoint corresponds to the **Social-original+augmented MLM** setting, using original and synthetic Albanian social-media comments for domain adaptation.
113
+
114
+ ## Evaluation summary
115
+
116
+ In the associated paper, social-media adaptation improved performance across three Albanian social-media classification tasks: sentiment analysis, hate speech detection, and dialect detection.
117
+
118
+ Additional analysis showed that the adapted model better handles informal Albanian tokens, missing diacritics, dialectal forms, compressed expressions, and social-media-specific writing patterns.
119
+
120
+ ## Limitations and responsible use
121
+
122
+ AlbaSocialXLM-R is not a general-purpose Albanian model trained from scratch. It is a continued-pretrained XLM-R model adapted to Albanian social-media text.
123
+
124
+ Because the adaptation data comes from online language, the model may reflect social-media biases, offensive expressions, political language, regional patterns, and platform-specific writing habits.
125
+
126
+ The model should not be used as the only basis for decisions affecting people. For hate speech, toxicity, moderation, or other sensitive applications, task-specific evaluation and human oversight are strongly recommended.
127
+
128
+ ## License
129
+
130
+ This model is released under the MIT license.
131
+
132
+ ## Citation
133
+
134
+ If you use this model, please cite the associated paper:
135
+
136
+ ```bibtex
137
+ @article{fetahi2026albasocialxlmr,
138
+ title={A Social-Media-Adapted Masked Language Model for Low-Resource Languages: Multi-Task Applications on Sentiment, Hate Speech, and Dialect Detection},
139
+ author={Fetahi, Endrit and Schuster, Sebastian},
140
+ year={2026}
141
+ }
142
+ ```
143
+
144
+ ## Repository
145
+
146
+ ```text
147
+ https://huggingface.co/Endrit/AlbaSocialXLM-R
148
+ ```