Update README.md
Browse files
README.md
CHANGED
|
@@ -18,107 +18,130 @@ pipeline_tag: text-classification
|
|
| 18 |
|
| 19 |
## Model Description
|
| 20 |
|
| 21 |
-
This model detects propaganda and manipulation techniques in Ukrainian text. It
|
| 22 |
|
| 23 |
-
## Task
|
| 24 |
|
| 25 |
-
The model
|
| 26 |
|
| 27 |
-
###
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
*
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
* Cherry picking facts to support arguments
|
| 48 |
-
|
| 49 |
-
* Whataboutism to deflect criticism
|
| 50 |
-
|
| 51 |
-
* Straw man arguments distorting opponent's position
|
| 52 |
-
|
| 53 |
-
### 5. **Thought-Terminating Cliché** (`cliche`)
|
| 54 |
-
|
| 55 |
-
* Phrases that block critical thinking
|
| 56 |
-
|
| 57 |
-
* Examples: "Все не так однозначно", "Де ви були 8 років?"
|
| 58 |
-
|
| 59 |
-
## Dataset
|
| 60 |
-
|
| 61 |
-
* **Training Data**: 2,147 Ukrainian texts from UNLP 2025 Shared Task
|
| 62 |
|
| 63 |
-
|
| 64 |
|
| 65 |
-
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
| 70 |
-
Base Model: Goader/modern-liberta-large
|
| 71 |
-
Learning Rate: 2e-5
|
| 72 |
-
Batch Size: 16 (train), 32 (eval)
|
| 73 |
-
Epochs: 10
|
| 74 |
-
Max Sequence Length: 512
|
| 75 |
-
Optimizer: AdamW
|
| 76 |
-
Loss Function: BCEWithLogitsLoss with class weights
|
| 77 |
-
Train/Val Split: 90/10
|
| 78 |
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
pip install transformers torch
|
|
|
|
| 83 |
|
|
|
|
| 84 |
|
| 85 |
-
|
|
|
|
|
|
|
| 86 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 87 |
import torch
|
| 88 |
|
| 89 |
-
#
|
| 90 |
model_name = "olehmell/ukr-manipulation-detector-modern-bert"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 92 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 93 |
|
| 94 |
# Prepare text
|
| 95 |
-
text = "Всі експерти вже давно це підтвердили, тільки ви не
|
| 96 |
|
| 97 |
# Tokenize and predict
|
| 98 |
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
|
| 99 |
with torch.no_grad():
|
| 100 |
outputs = model(**inputs)
|
|
|
|
| 101 |
predictions = torch.sigmoid(outputs.logits)
|
| 102 |
|
| 103 |
-
# Get detected techniques (threshold
|
| 104 |
threshold = 0.5
|
| 105 |
-
|
| 106 |
-
'selective_truth', 'cliche']
|
| 107 |
-
detected = []
|
| 108 |
for i, score in enumerate(predictions[0]):
|
| 109 |
if score > threshold:
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
|
| 113 |
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
def detect_manipulation_batch(texts, batch_size=32):
|
|
|
|
| 117 |
results = []
|
| 118 |
for i in range(0, len(texts), batch_size):
|
| 119 |
batch = texts[i:i+batch_size]
|
| 120 |
-
inputs = tokenizer(
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
with torch.no_grad():
|
| 124 |
outputs = model(**inputs)
|
|
@@ -127,48 +150,59 @@ def detect_manipulation_batch(texts, batch_size=32):
|
|
| 127 |
|
| 128 |
return results
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
| Metric | Value |
|
| 135 |
-
|
|
| 136 |
-
| F1
|
| 137 |
-
|
|
| 138 |
-
|
| 139 |
-
Note: Metrics to be updated after final evaluation
|
| 140 |
-
|
| 141 |
-
Label Distribution in Training Data
|
| 142 |
-
| Technique | Count | Percentage |
|
| 143 |
-
| Emotional Manipulation | 1,094 | 50.9% |
|
| 144 |
-
| Bandwagon Effect | 451 | 21.0% |
|
| 145 |
-
| Thought-Terminating Cliché | 240 | 11.2% |
|
| 146 |
-
| Fear Appeals | 198 | 9.2% |
|
| 147 |
-
| Selective Truth | 187 | 8.7% |
|
| 148 |
-
|
| 149 |
-
Limitations
|
| 150 |
-
Language: Optimized for Ukrainian; may not perform well on other languages
|
| 151 |
|
| 152 |
-
|
| 153 |
|
| 154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
-
|
| 157 |
|
| 158 |
-
|
|
|
|
|
|
|
| 159 |
|
| 160 |
-
|
| 161 |
-
This model is intended as a tool to support media literacy and critical thinking
|
| 162 |
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
Should not be used as the sole arbiter of truth or to censor content
|
| 166 |
-
|
| 167 |
-
May reflect biases present in the training data
|
| 168 |
-
|
| 169 |
-
Citation
|
| 170 |
-
If you use this model, please cite:
|
| 171 |
|
|
|
|
| 172 |
@misc{ukrainian-manipulation-modernbert-2025,
|
| 173 |
author = {Oleh Mell},
|
| 174 |
title = {Ukrainian Manipulation Detector - ModernBERT},
|
|
@@ -176,7 +210,8 @@ If you use this model, please cite:
|
|
| 176 |
publisher = {Hugging Face},
|
| 177 |
url = {[https://huggingface.co/olehmell/ukr-manipulation-detector-modern-bert](https://huggingface.co/olehmell/ukr-manipulation-detector-modern-bert)}
|
| 178 |
}
|
| 179 |
-
|
|
|
|
| 180 |
@inproceedings{unlp2025shared,
|
| 181 |
title={UNLP 2025 Shared Task on Techniques Classification},
|
| 182 |
author={UNLP Workshop Organizers},
|
|
@@ -184,16 +219,17 @@ If you use this model, please cite:
|
|
| 184 |
year={2025},
|
| 185 |
url={[https://github.com/unlp-workshop/unlp-2025-shared-task](https://github.com/unlp-workshop/unlp-2025-shared-task)}
|
| 186 |
}
|
|
|
|
| 187 |
|
|
|
|
| 188 |
|
| 189 |
-
License
|
| 190 |
-
MIT
|
| 191 |
|
| 192 |
-
Contact
|
| 193 |
-
For questions or feedback, please open an issue on the model repository.
|
| 194 |
|
| 195 |
-
|
| 196 |
-
UNLP 2025 Workshop organizers for providing the dataset
|
| 197 |
|
| 198 |
-
|
| 199 |
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
## Model Description
|
| 20 |
|
| 21 |
+
This model detects propaganda and manipulation techniques in Ukrainian text. It is a fine-tuned version of [Goader/modern-liberta-large](https://huggingface.co/Goader/modern-liberta-large) trained on the UNLP 2025 Shared Task dataset for multi-label classification of manipulation techniques.
|
| 22 |
|
| 23 |
+
## Task: Manipulation Technique Classification
|
| 24 |
|
| 25 |
+
The model performs multi-label text classification, identifying 5 major manipulation categories consolidated from 10 original techniques. A single text can contain multiple techniques.
|
| 26 |
|
| 27 |
+
### Manipulation Categories
|
| 28 |
|
| 29 |
+
| Category | Label Name | Description & Consolidated Techniques |
|
| 30 |
+
| :--- | :--- | :--- |
|
| 31 |
+
| **Emotional Manipulation** | `emotional_manipulation` | Involves using loaded language with strong emotional connotations or a euphoric tone to boost morale and sway opinion. |
|
| 32 |
+
| **Fear Appeals** | `fear_appeals` | Preys on fears, stereotypes, or prejudices. Includes Fear, Uncertainty, and Doubt (FUD) tactics. |
|
| 33 |
+
| **Bandwagon Effect** | `bandwagon_effect` | Uses glittering generalities (abstract, positive concepts) or appeals to the masses ("everyone thinks this") to encourage agreement. |
|
| 34 |
+
| **Selective Truth** | `selective_truth` | Employs logical fallacies like cherry-picking facts, whataboutism to deflect criticism, or creating straw man arguments to distort an opponent's position. |
|
| 35 |
+
| **Thought-Terminating Cliché** | `cliche` | Uses formulaic phrases designed to shut down critical thinking and end a discussion. *Examples: "Все не так однозначно", "Де ви були 8 років?"* |
|
| 36 |
|
| 37 |
+
## Training Data
|
| 38 |
|
| 39 |
+
The model was trained on the dataset from the UNLP 2025 Shared Task on manipulation technique classification.
|
| 40 |
|
| 41 |
+
* **Dataset:** [UNLP 2025 Techniques Classification](https://github.com/unlp-workshop/unlp-2025-shared-task/tree/main/data/techniques_classification)
|
| 42 |
+
* **Source Texts:** Ukrainian texts filtered from a larger multilingual dataset.
|
| 43 |
+
* **Size:** 2,147 training examples.
|
| 44 |
+
* **Task:** Multi-label classification.
|
| 45 |
|
| 46 |
+
### Label Distribution in Training Data
|
| 47 |
|
| 48 |
+
| Technique | Count | Percentage |
|
| 49 |
+
| :--- | :--- | :--- |
|
| 50 |
+
| Emotional Manipulation | 1,094 | 50.9% |
|
| 51 |
+
| Bandwagon Effect | 451 | 21.0% |
|
| 52 |
+
| Thought-Terminating Cliché | 240 | 11.2% |
|
| 53 |
+
| Fear Appeals | 198 | 9.2% |
|
| 54 |
+
| Selective Truth | 187 | 8.7% |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
## Training Configuration
|
| 57 |
|
| 58 |
+
The model was fine-tuned using the following hyperparameters:
|
| 59 |
|
| 60 |
+
| Parameter | Value |
|
| 61 |
+
| :--- | :--- |
|
| 62 |
+
| **Base Model** | `Goader/modern-liberta-large` |
|
| 63 |
+
| **Learning Rate** | `2e-5` |
|
| 64 |
+
| **Train Batch Size** | `16` |
|
| 65 |
+
| **Eval Batch Size**| `32` |
|
| 66 |
+
| **Epochs** | `10` |
|
| 67 |
+
| **Max Sequence Length** | `512` |
|
| 68 |
+
| **Optimizer** | AdamW |
|
| 69 |
+
| **Loss Function** | `BCEWithLogitsLoss` (with class weights) |
|
| 70 |
+
| **Train/Val Split** | 90% / 10% |
|
| 71 |
|
| 72 |
+
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
### Installation
|
| 75 |
|
| 76 |
+
First, install the necessary libraries:
|
| 77 |
+
```bash
|
| 78 |
pip install transformers torch
|
| 79 |
+
```
|
| 80 |
|
| 81 |
+
### Quick Start
|
| 82 |
|
| 83 |
+
Here is how to use the model to classify a single piece of text:
|
| 84 |
+
|
| 85 |
+
```python
|
| 86 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 87 |
import torch
|
| 88 |
|
| 89 |
+
# Define model and label names
|
| 90 |
model_name = "olehmell/ukr-manipulation-detector-modern-bert"
|
| 91 |
+
labels = [
|
| 92 |
+
'emotional_manipulation',
|
| 93 |
+
'fear_appeals',
|
| 94 |
+
'bandwagon_effect',
|
| 95 |
+
'selective_truth',
|
| 96 |
+
'cliche'
|
| 97 |
+
]
|
| 98 |
+
|
| 99 |
+
# Load pretrained model and tokenizer
|
| 100 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 101 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 102 |
|
| 103 |
# Prepare text
|
| 104 |
+
text = "Всі експерти вже давно це підтвердили, тільки ви не розумієте, що відбувається насправді."
|
| 105 |
|
| 106 |
# Tokenize and predict
|
| 107 |
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
|
| 108 |
with torch.no_grad():
|
| 109 |
outputs = model(**inputs)
|
| 110 |
+
# Apply sigmoid to convert logits to probabilities
|
| 111 |
predictions = torch.sigmoid(outputs.logits)
|
| 112 |
|
| 113 |
+
# Get detected techniques (using a threshold of 0.5)
|
| 114 |
threshold = 0.5
|
| 115 |
+
detected_techniques = {}
|
|
|
|
|
|
|
| 116 |
for i, score in enumerate(predictions[0]):
|
| 117 |
if score > threshold:
|
| 118 |
+
detected_techniques[labels[i]] = f"{score:.2f}"
|
| 119 |
+
|
| 120 |
+
if detected_techniques:
|
| 121 |
+
print("Detected techniques:")
|
| 122 |
+
for technique, score in detected_techniques.items():
|
| 123 |
+
print(f"- {technique} (Score: {score})")
|
| 124 |
+
else:
|
| 125 |
+
print("No manipulation techniques detected.")
|
| 126 |
+
```
|
| 127 |
|
| 128 |
+
### Batch Processing
|
| 129 |
|
| 130 |
+
For processing multiple texts efficiently, use batching:
|
| 131 |
|
| 132 |
+
```python
|
| 133 |
def detect_manipulation_batch(texts, batch_size=32):
|
| 134 |
+
"""Processes a list of texts in batches."""
|
| 135 |
results = []
|
| 136 |
for i in range(0, len(texts), batch_size):
|
| 137 |
batch = texts[i:i+batch_size]
|
| 138 |
+
inputs = tokenizer(
|
| 139 |
+
batch,
|
| 140 |
+
return_tensors="pt",
|
| 141 |
+
padding=True,
|
| 142 |
+
truncation=True,
|
| 143 |
+
max_length=512
|
| 144 |
+
)
|
| 145 |
|
| 146 |
with torch.no_grad():
|
| 147 |
outputs = model(**inputs)
|
|
|
|
| 150 |
|
| 151 |
return results
|
| 152 |
|
| 153 |
+
# Example usage
|
| 154 |
+
corpus = [
|
| 155 |
+
"Це жахливо, вони хочуть нас усіх знищити!",
|
| 156 |
+
"Весь світ підтримує це рішення, і тільки зрадники проти.",
|
| 157 |
+
"Просто роби, що тобі кажуть, і не став зайвих питань."
|
| 158 |
+
]
|
| 159 |
+
|
| 160 |
+
batch_results = detect_manipulation_batch(corpus)
|
| 161 |
+
|
| 162 |
+
# Print results for the batch
|
| 163 |
+
for i, text in enumerate(corpus):
|
| 164 |
+
print(f"\nText: \"{text}\"")
|
| 165 |
+
detected_batch = {}
|
| 166 |
+
for j, score in enumerate(batch_results[i]):
|
| 167 |
+
if score > threshold:
|
| 168 |
+
detected_batch[labels[j]] = f"{score:.2f}"
|
| 169 |
+
|
| 170 |
+
if detected_batch:
|
| 171 |
+
print("Detected techniques:")
|
| 172 |
+
for technique, score in detected_batch.items():
|
| 173 |
+
print(f"- {technique} (Score: {score})")
|
| 174 |
+
else:
|
| 175 |
+
print("No manipulation techniques detected.")
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
## Performance
|
| 179 |
+
|
| 180 |
+
*Note: Metrics will be updated after the final evaluation.*
|
| 181 |
|
| 182 |
| Metric | Value |
|
| 183 |
+
| :--- | :--- |
|
| 184 |
+
| F1 Macro | 0.46 |
|
| 185 |
+
| F1 Micro | 0.68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
+
## Limitations
|
| 188 |
|
| 189 |
+
* **Language Specificity:** The model is optimized for Ukrainian and may not perform well on other languages.
|
| 190 |
+
* **Domain Sensitivity:** Trained primarily on political and social media discourse, its performance may vary on other text domains.
|
| 191 |
+
* **Context Length:** The model is limited to short texts (up to 512 tokens). Longer documents must be chunked or truncated.
|
| 192 |
+
* **Class Imbalance:** Some manipulation techniques are underrepresented in the training data, which may affect their detection accuracy.
|
| 193 |
+
* **Mixed Language:** Accuracy may be reduced on text with heavy code-mixing of Ukrainian and Russian.
|
| 194 |
|
| 195 |
+
## Ethical Considerations
|
| 196 |
|
| 197 |
+
* **Purpose:** This model is intended as a tool to support media literacy and critical thinking, not as an arbiter of truth.
|
| 198 |
+
* **Human Oversight:** Model outputs should be interpreted with human judgment and a full understanding of the context. It should not be used to automatically censor content.
|
| 199 |
+
* **Potential Biases:** The model may reflect biases present in the training data.
|
| 200 |
|
| 201 |
+
## Citation
|
|
|
|
| 202 |
|
| 203 |
+
If you use this model in your research, please cite the following:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
+
```bibtex
|
| 206 |
@misc{ukrainian-manipulation-modernbert-2025,
|
| 207 |
author = {Oleh Mell},
|
| 208 |
title = {Ukrainian Manipulation Detector - ModernBERT},
|
|
|
|
| 210 |
publisher = {Hugging Face},
|
| 211 |
url = {[https://huggingface.co/olehmell/ukr-manipulation-detector-modern-bert](https://huggingface.co/olehmell/ukr-manipulation-detector-modern-bert)}
|
| 212 |
}
|
| 213 |
+
```
|
| 214 |
+
```bibtex
|
| 215 |
@inproceedings{unlp2025shared,
|
| 216 |
title={UNLP 2025 Shared Task on Techniques Classification},
|
| 217 |
author={UNLP Workshop Organizers},
|
|
|
|
| 219 |
year={2025},
|
| 220 |
url={[https://github.com/unlp-workshop/unlp-2025-shared-task](https://github.com/unlp-workshop/unlp-2025-shared-task)}
|
| 221 |
}
|
| 222 |
+
```
|
| 223 |
|
| 224 |
+
## License
|
| 225 |
|
| 226 |
+
This model is licensed under the **Apache 2.0 License**.
|
|
|
|
| 227 |
|
| 228 |
+
## Contact
|
|
|
|
| 229 |
|
| 230 |
+
For questions or feedback, please open an issue on the model's Hugging Face repository.
|
|
|
|
| 231 |
|
| 232 |
+
## Acknowledgments
|
| 233 |
|
| 234 |
+
* The organizers of the UNLP 2025 Workshop for providing the dataset.
|
| 235 |
+
* Goader for creating and sharing the base `modern-liberta-large` model for Ukrainian.
|