---
title: "Red-Teaming Large Language Models"
description: "Red-teaming evaluates LLMs by crafting natural-language prompts that elicit harmful outputs such as toxicity, bias, misinformation or leaked personal data, and it differs from adversarial attacks, which can use unintelligible inputs."
url: "https://swe.quest/articles/red-teaming-large-language-models-a911211681792c3b"
canonical: "https://huggingface.co/blog/red-teaming"
source: "Hugging Face"
published: "2023-02-24"
difficulty: "easy"
kind: "Opinion"
reading_minutes: 6
tags: ["ai-safety","evals","llms"]
---

# Red-Teaming Large Language Models

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-02-24, 6 min read, Opinion. Original: [https://huggingface.co/blog/red-teaming](https://huggingface.co/blog/red-teaming)

## Summary

Red-teaming evaluates LLMs by crafting natural-language prompts that elicit harmful outputs such as toxicity, bias, misinformation or leaked personal data, and it differs from adversarial attacks, which can use unintelligible inputs. Techniques include roleplay attacks, asking for responses in code, and using one LM to red-team another. Canned-response classifiers make a model safe but evasive, which shows the tension between helpfulness and harmlessness. Findings from Anthropic's work are summarized: RLHF models get harder to red-team as they scale, humans agree poorly on what counts as a successful attack, and crowdsourced prompts become templated. The post lists open datasets (Bot Adversarial Dialog, Anthropic red-team attempts, RealToxicityPrompts) and future directions such as code-generation jailbreaks and critical threat scenarios.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [AI safety](https://swe.quest/tags/ai-safety.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- large language models ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- RLHF basics ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))

## Keywords

red-teaming, jailbreaking, GPT-3, RLHF, RealToxicityPrompts, Bot Adversarial Dialog, GeDi, PPLM

## Related posts

- [Introducing the Red-Teaming Resistance Leaderboard](https://swe.quest/articles/introducing-the-red-teaming-resistance-leaderboard-e6f29b275caeecf9.md): Hugging Face · 2024-02-23 · Easy · 6 min read · AI safety, Evaluation, LLMs
  The Red-Teaming Resistance leaderboard from Haize Labs and Hugging Face scores LLMs on how often they safely refuse realistic, human-written jailbreak prompts.
- [An Introduction to AI Secure LLM Safety Leaderboard](https://swe.quest/articles/an-introduction-to-ai-secure-llm-safety-leaderboard-3389612600bb2dd0.md): Hugging Face · 2024-01-26 · Easy · 5 min read · Evaluation, AI safety, LLMs
  The LLM Safety Leaderboard, built on the Hugging Face leaderboard template, ranks open and closed models using DecodingTrust, a NeurIPS 2023 evaluation framework covering eight trustworthiness perspectives: toxicity, stereotype bias, adversarial robustness, OOD robustness, adversarial demonstrations, privacy, machine ethics and fairness.
- [CyberSecEval 2 - A Comprehensive Evaluation Framework for Cybersecurity Risks and Capabilities of Large Language Models](https://swe.quest/articles/cyberseceval-2-a-comprehensive-evaluation-framework-for-cybersecurity-risks-and-b77206af9c9d754e.md): Hugging Face · 2024-05-24 · Easy · 5 min read · Evaluation, AI safety, LLMs, Application security
  CyberSecEval 2 is Meta's open-source benchmark suite measuring LLM cybersecurity risks across five areas: insecure code generation (mapped to CWE), prompt injection susceptibility, compliance with cyber-attack requests versus false refusals of benign prompts, code interpreter abuse, and automated CTF-style exploitation.
- [Evaluating Language Model Bias with 🤗 Evaluate](https://swe.quest/articles/evaluating-language-model-bias-with-evaluate-b158fee88571748c.md): Hugging Face · 2022-10-24 · Medium · 8 min read · Evaluation, AI safety, LLMs, Python
  Hugging Face's Evaluate library now includes bias measurements for causal language models such as GPT-2 and BLOOM.
- [AprielGuard: A Guardrail for Safety and Adversarial Robustness in Modern LLM Systems](https://swe.quest/articles/aprielguard-a-guardrail-for-safety-and-adversarial-robustness-in-modern-llm-be1690a9de4ab65c.md): Hugging Face · 2025-12-23 · Medium · 10 min read · AI safety, LLMs, AI agents, Evaluation, Model training
  AprielGuard is an 8B-parameter guardrail model from ServiceNow that classifies 16 categories of safety risk and flags adversarial attacks such as jailbreaks and prompt injections.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
