Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 8 min read How-to mediumAdept

Evaluating Language Model Bias with 🤗 Evaluate

Hugging Face's Evaluate library now includes bias measurements for causal language models such as GPT-2 and BLOOM. The workflow is to prompt a model with curated datasets and then score the generations. Three measurements are demonstrated with code: toxicity (WinoBias prompts scored by the R4 Target hate classifier), regard/polarity across groups (BOLD profession prompts), and HONEST for hurtful completions about LGBTQAI+ groups. Small pronoun or group swaps produce measurably different toxicity, regard and hurtfulness scores, but these datasets are reductive, so several complementary metrics should be used together rather than treated as the whole truth about model bias.

Assumes: PythonHugging Face Transformers basicscausal language models

Related posts

  • Red-Teaming Large Language Models

    Hugging Face easyNovice

    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.

  • An Introduction to AI Secure LLM Safety Leaderboard

    Hugging Face easyNovice

    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. Each perspective uses tailored red-teaming methods, such as 33 adversarial system prompts scored with the Perspective API, adversarial examples transferred from attacks on Alpaca and Vicuna, and prompts designed to extract emails and credit card numbers. Key findings: GPT-4 is more vulnerable than GPT-3.5, no model leads on every perspective, the perspectives trade off against each other, and small wording changes such as "confidentially" versus "in confidence" change privacy leakage. Model owners can submit public safetensors models that load through transformers AutoClasses.

  • Can foundation models label data like humans?

    Hugging Face hardMaster

    Human preference labels from Scale AI and GPT-4 pairwise ratings on a 327-prompt blind test set produce the same Elo ordering of four open instruction-tuned models (Vicuna-13B, Koala-13B, OpenAssistant-12B, Dolly-12B), but the margins between models differ. GPT-4 evaluation shows clear positional bias on a 1–8 Likert scale. When GPT-4 also rates human-written demonstrations, it ranks them below most models, which suggests it favors verbose, LLM-style outputs. Treat GPT-4-based "preferred to ChatGPT" claims with caution, and be wary of training on and evaluating with another LLM, since this can amount to unintentional doping.

  • CyberSecEval 2 - A Comprehensive Evaluation Framework for Cybersecurity Risks and Capabilities of Large Language Models

    Hugging Face easyNovice

    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. Average compliance with attack-assistance requests fell from 52% to 28% since the December 2023 version, and code-specialized models are closing the safety gap with general models. Prompt injection remains unsolved, so developers should not trust system prompts to hold against adversarial input. Interpreter abuse calls for extra guardrails, while end-to-end exploitation is still beyond current models.

  • Introducing the Red-Teaming Resistance Leaderboard

    Hugging Face easyNovice

    The Red-Teaming Resistance leaderboard from Haize Labs and Hugging Face scores LLMs on how often they safely refuse realistic, human-written jailbreak prompts. It pulls these from datasets such as AdvBench, AART, Beavertails, Do Not Answer, RedEval and SAP, and deliberately skips unreadable automated attacks like GCG suffixes. Responses are judged Safe or Unsafe by LlamaGuard with a custom taxonomy plus GPT-4, then manually sanity-checked, and results are broken down by violation category modelled on OpenAI's usage policies. GPT-4 and Claude-2 lead across categories, though their API-side safety layers may account for some of that lead. Models are weakest on adult content, physical harm and child harm, and strongest on privacy, professional advice and political campaigning.

The quest for software engineering knowledge.

Look:
Layout: