π CT-BERT-PRCT
A specialized BERT model for detection of Population Replacement Conspiracy Theory content
Overview
|
CT-BERT-PRCT is a fine-tuned BERT model for detecting Population Replacement Conspiracy Theories across multiple platforms and languages. Key metrics:
|
Model description
CT-BERT-PRCT is a fine-tuned version of CT-BERT specifically adapted for detecting Population Replacement Conspiracy Theory (PRCT) content across social media platforms. The model has been trained to identify both explicit and implicit PRCT narratives while maintaining robust cross-platform generalization capabilities.
Model Configuration
Label Mapping
- 0: Non-PRCT content
- 1: PRCT content
Model Architecture
- Base model: CT-BERT
- Hidden layers: 12
- Attention heads: 12
- Parameters: 110M
Input Requirements
- Maximum sequence length: 512 tokens
- Input type: Text (strings)
- Preprocessing: Standard BERT tokenization
Intended uses & limitations
Intended uses
- Content moderation for social media platforms
- Research on conspiracy theory propagation
- Cross-platform conspiracy content detection
- Multilingual PRCT detection
Limitations
- Performance may vary across different social media platforms
- May require periodic fine-tuning to adapt to evolving narratives
- Should be used as part of a broader content moderation strategy
- Best performance on YouTube content, with some performance degradation on other platforms
Training and evaluation data
The model was fine-tuned on a dataset of 56,085 YouTube comments and evaluated using:
- A manually annotated gold standard of 500 YouTube comments
- A cross-platform test set of 160 Telegram messages in multiple languages (Spanish and Portuguese)
Training procedure
The model was fine-tuned using:
- Learning rate: 2e-5
- Batch size: 32
- Maximum epochs: 6
- Early stopping based on validation performance
- Base model: CT-BERT (pre-trained on COVID-19 conspiracy content)
Results
Detailed performance metrics:
YouTube Dataset
- Accuracy: 83.8%
- Precision: 86.5%
- Recall: 83.3%
- F1-score: 83.3%
Telegram Dataset (Cross-platform and multilingual)
- Accuracy: 71.9%
- Precision: 74.2%
- Recall: 71.9%
- F1-score: 71.2%
The model demonstrates strong performance on its primary training domain (YouTube - English) while maintaining reasonable effectiveness in cross-platform and multilingual scenarios (Telegram - Portuguese and Spanish), showing good generalization capabilities across different social media environments.
Example Predictions
Here are some example texts and how the model classifies them:
Example Text | Prediction | Confidence |
---|---|---|
"Immigration policies should be decided based on economic needs and humanitarian considerations." | Non-PRCT | 0.96 |
"We need more controlled immigration to match our labor market demands." | Non-PRCT | 0.92 |
"European countries must protect their cultural identity while respecting diverse backgrounds." | Non-PRCT | 0.78 |
"Politicians are secretly working to change our demographics." | PRCT | 0.85 |
"They're bringing in foreigners to replace native voters." | PRCT | 0.94 |
"The elites have a plan to erase our culture through mass immigration." | PRCT | 0.97 |
Note: These examples are simplified for illustration. The model evaluates nuanced content in context.
Online Demo
Try the model directly in your browser using the Hugging Face Inference API:
- Go to the model page
- Navigate to the "Inference API" tab
- Type or paste text into the input field
- Click "Compute" to see the model's prediction
You can also integrate the API into your applications using the Hugging Face Inference API.
Example Usage
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("erikbranmarino/CT-BERT-PRCT")
model = AutoModelForSequenceClassification.from_pretrained("erikbranmarino/CT-BERT-PRCT")
# Prepare your text
text = "Your text here"
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
# Make prediction
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
# Get predicted class (0: Non-PRCT, 1: PRCT)
predicted_class = predictions.argmax().item()
confidence = predictions[0][predicted_class].item()
print(f"Class: {'PRCT' if predicted_class == 1 else 'Non-PRCT'}")
print(f"Confidence: {confidence:.2f}")
Complete Example with Batch Processing
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
from torch.utils.data import Dataset, DataLoader
class TextDataset(Dataset):
def __init__(self, texts, tokenizer, max_length=512):
self.encodings = tokenizer(texts, truncation=True, padding=True, max_length=max_length)
def __getitem__(self, idx):
return {key: torch.tensor(val[idx]) for key, val in self.encodings.items()}
def __len__(self):
return len(self.encodings.input_ids)
def predict_batch(texts, model, tokenizer, batch_size=16):
# Prepare dataset and dataloader
dataset = TextDataset(texts, tokenizer)
dataloader = DataLoader(dataset, batch_size=batch_size)
predictions = []
model.eval()
with torch.no_grad():
for batch in dataloader:
outputs = model(**batch)
probs = torch.nn.functional.softmax(outputs.logits, dim=-1)
predictions.extend(probs.cpu().numpy())
return predictions
# Example usage
texts = ["text1", "text2", "text3"] # Your list of texts
results = predict_batch(texts, model, tokenizer)
for text, pred in zip(texts, results):
predicted_class = pred.argmax()
confidence = pred[predicted_class]
print(f"Text: {text[:50]}...")
print(f"Class: {'PRCT' if predicted_class == 1 else 'Non-PRCT'}")
print(f"Confidence: {confidence:.2f}\n")
Bias and limitations
This model is intended for research and content moderation purposes. It should be used as part of a broader content moderation strategy and not as a sole decision-maker for content removal. The model may exhibit:
- Platform-specific biases due to training data source
- Language-specific performance variations
- Sensitivity to evolving conspiracy narratives
Citation
If you use this model, please cite:
@article{marino2025one,
title={One Model to Detect Them All? Comparing LLMs, BERT and Traditional ML in Cross-Platform Conspiracy Detection},
author={Marino, Erik Bran and Vieira, Renata and Bassi, Davide and Ribeiro, Ana Sofia and Baleato, Suso},
year={2025}
}
Contact
Erik Bran Marino ([email protected]) ```
- Downloads last month
- 23