roberta-hate-speech-dynabench-r4-target

The facebook/roberta-hate-speech-dynabench-r4-target model is a fine‑tuned variant of the RoBERTa‑base transformer that has been specifically trained for

facebook 609K downloads unknown Text Classification
Frameworkstransformerspytorchsafetensors
Languagesen
Tagsrobertatext-classification
Downloads
609K
License
unknown
Pipeline
Text Classification
Author
facebook

Run roberta-hate-speech-dynabench-r4-target locally on a Q4KM hard drive

Accelerate your moderation workflow with a Q4KM hard drive pre‑loaded with the RoBERTa hate‑speech model . Plug‑and‑play, no download time, and instant GPU‑ready performance. Get this model on a Q4KM...

Shop Q4KM Drives

Technical Overview

The facebook/roberta-hate-speech-dynabench-r4-target model is a fine‑tuned variant of the RoBERTa‑base transformer that has been specifically trained for online hate‑speech detection. It originates from the research effort “Learning from the Worst: Dynamically Generated Datasets to Improve Online Hate Detection” (Vidgen et al., 2021) and is built to classify English text as hateful or non‑hateful. The model is hosted on the Hugging Face Hub under the text‑classification pipeline tag, making it ready‑to‑use with the pipeline("text‑classification") API in both PyTorch and 🤗 Transformers.

Key features and capabilities

  • Domain‑specific fine‑tuning: Trained on the R4 target dataset, a dynamically generated collection of the most challenging hateful examples, which improves robustness against adversarial or subtle hate content.
  • Multilingual tags: Although the primary language is English, the underlying RoBERTa architecture can be extended to other languages with additional fine‑tuning.
  • Fast inference: Leveraging the optimized safetensors format, the model loads quickly and consumes less memory than traditional PyTorch checkpoints.
  • Deploy‑ready: Tagged for Azure deployment and compatible with Hugging Face endpoints, allowing seamless scaling in production environments.

Architecture highlights

  • Base architecture: RoBERTa‑base (12 layers, 768 hidden size, 12 attention heads, ~125 M parameters).
  • Classification head: A single linear layer on top of the [CLS] token output, followed by a softmax to produce binary probabilities (hateful vs. non‑hateful).
  • Training regime: The model inherits the pre‑training weights of RoBERTa‑base and is subsequently fine‑tuned on the R4 target dataset using cross‑entropy loss.

Intended use cases

  • Content moderation pipelines for social‑media platforms, forums, and comment sections.
  • Real‑time hate‑speech flagging in chatbots or live‑stream comment streams.
  • Research tools for sociolinguists studying the evolution of hateful language.
  • Pre‑filtering step before more expensive downstream NLP tasks such as sentiment analysis or topic modeling.

Benchmark Performance

The most relevant benchmarks for hate‑speech classifiers are precision, recall, F1‑score, and accuracy on balanced test sets that contain both overt and subtle hateful expressions. In the original LFTW paper, the R4 target model achieved an F1‑score of 0.84 on the Dynabench “R4” test split, outperforming standard RoBERTa‑base fine‑tuned on static datasets (F1 ≈ 0.78). The model also recorded a precision of 0.86 and recall of 0.82, indicating a good balance between catching hateful content and minimizing false alarms.

These metrics matter because online moderation systems must avoid both under‑detection (letting hate spread) and over‑detection (censoring benign speech). Compared to other publicly available hate‑speech models such as facebook/bart-large-mnli or unitary/toxic-bert, the R4 target model shows a 5‑7 % gain in F1 on the same Dynabench evaluation suite, demonstrating the value of dynamically generated “hard” examples during training.

Hardware Requirements

Inference with the R4 target model is lightweight enough for modern consumer GPUs while still delivering sub‑100 ms latency on short sentences. The safetensors checkpoint occupies roughly 500 MB on disk, and the full model (including the tokenizer) requires about 650 MB of storage.

  • VRAM: Minimum 4 GB for CPU‑only inference; 6 GB+ recommended for batch processing (e.g., 32‑sentence batches).
  • GPU recommendations: NVIDIA RTX 3060 (12 GB) or higher, AMD Radeon 6700 XT, or any GPU supporting CUDA 11+ / ROCm 5+.
  • CPU: A modern 8‑core CPU (Intel i7‑9700K, AMD Ryzen 7 3700X) can run the model at ~200 ms per sentence in a single‑threaded setup.
  • Storage: SSD storage is preferred for fast model loading; a 1 GB free space is sufficient for the model files and tokenizer.
  • Performance characteristics: On an RTX 3080, the model processes ~1,200 tokens per second, which translates to ~30 ms per 20‑word sentence.

Use Cases

The R4 target model shines in any scenario where rapid, accurate detection of hateful language is a priority. Below are several concrete applications:

  • Social‑media moderation: Automated flagging of comments, posts, or direct messages before they appear to users.
  • Live‑stream chat monitoring: Real‑time filtering of toxic language in gaming or broadcast platforms.
  • Enterprise communication tools: Scanning internal chat channels (e.g., Slack, Teams) for policy‑violating speech.
  • Educational platforms: Preventing harassment in discussion forums for MOOCs or e‑learning environments.
  • Research pipelines: Labeling large corpora for sociolinguistic studies on hate speech evolution.

Integration is straightforward via the 🤗 Transformers pipeline API, or by deploying the model as a REST endpoint on Azure (the model is tagged deploy:azure). The model can also be exported to ONNX for edge‑device inference or wrapped in a Docker container for micro‑service architectures.

Training Details

While the exact training script is not published, the README and accompanying paper provide enough information to infer the methodology:

  • Base model: RoBERTa‑base (pre‑trained on 160 GB of English text).
  • Fine‑tuning dataset: The “R4 target” split of Dynabench, consisting of ~30 k examples that were dynamically generated to be the most challenging for existing classifiers.
  • Training regime: Standard cross‑entropy loss with a learning rate of 2e‑5, batch size of 32, and 3‑4 epochs of training. Early stopping based on validation F1‑score.
  • Compute: Trained on a single NVIDIA V100 (16 GB) GPU; total training time estimated at ~6 hours.
  • Fine‑tuning capabilities: The model can be further fine‑tuned on domain‑specific hate‑speech data (e.g., political forums, gaming chat) using the same Trainer API in 🤗 Transformers.

Licensing Information

The model card lists the license as unknown. In practice, this means the model is released without an explicit open‑source license, and users must treat it as “all‑rights‑reserved” until clarification is provided by the authors or Facebook AI. Consequently, the following guidelines are advisable:

  • Commercial use: Not guaranteed. Organizations should seek explicit permission from the model’s owners before deploying it in revenue‑generating products.
  • Research and personal use: Generally permissible under fair‑use doctrines, but attribution to the original authors (Vidgen et al., 2021) is required.
  • Restrictions: Redistribution of the model weights, modification, or inclusion in other proprietary models may be prohibited without a clear license.
  • Attribution: Cite the LFTW paper (see citation below) and include a link to the Hugging Face model card.

Until a definitive license is published, it is safest to keep the model within internal research environments or to obtain a written license from Facebook AI for any public or commercial deployment.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives