Knowledge Base Regulation Tracker Standards & Frameworks OSS Directory AI Incident Database Research Paper Library Case Studies Society Articles News Jobs About Charter Sign inBecome a Member

TrustLLM

Safety and harm benchmarks

Benchmark and toolkit for trustworthiness in LLMs (ICML 2024) covering truthfulness, safety, fairness, robustness, privacy and machine ethics across 30 datasets, with a pip-installable evaluator. For researchers comparing models on trust dimensions.

benchmarktrustworthinesssafetyfairness

TrustLLM: A Comprehensive Framework for Evaluating Trustworthiness in Large Language Models

TrustLLM is a benchmark and toolkit designed to assess the trustworthiness of large language models (LLMs) across multiple dimensions. Introduced in ICML 2024, it provides a structured approach to evaluating truthfulness, safety, fairness, robustness, privacy, and machine ethics. The framework is built upon eight principles of trustworthiness, though transparency and accountability are excluded from the benchmark due to benchmarking challenges. TrustLLM evaluates 16 mainstream LLMs, including both proprietary and open-weight models, using over 30 datasets spanning 18 subcategories.

The toolkit is developed to facilitate researchers in comparing models based on trust dimensions, offering a pip-installable evaluator for streamlined assessment. It is particularly useful for red-teaming and identifying vulnerabilities in LLMs, ensuring that models adhere to ethical and safety standards before deployment.

The toolkit has since undergone iterative updates, incorporating bug fixes, enhanced evaluation capabilities, and support for new models such as ChatGLM3, Llama3-8b, Llama3-70b, GLM4, and Mixtral.

The framework’s design emphasizes practicality, offering researchers an easy-to-use pipeline for generating and evaluating model responses. It supports both offline and online model evaluations, accommodating a wide range of LLMs hosted on platforms like Replicate, DeepInfra, and Azure OpenAI API.

How TrustLLM Works

TrustLLM operates through a modular pipeline that begins with dataset preparation and proceeds to model evaluation. Researchers can install the toolkit via GitHub or pip, with the recommended approach being a GitHub clone for the latest features. The installation process involves creating a Python 3.9 environment and executing a pip installation command within the cloned repository.

These datasets are categorized into six primary trustworthiness dimensions: truthfulness, safety, fairness, robustness, privacy, and machine ethics. Each dimension is further subdivided into specific tasks, such as misinformation detection, stereotype recognition, and adversarial robustness testing.

The evaluation process begins with model generation, where users specify parameters such as the model path, test type, dataset location, and generation settings (e.g., repetition penalty, GPU allocation). The toolkit then processes the model’s responses against predefined evaluation criteria, producing detailed results for each trust dimension. For example, truthfulness is assessed using datasets like TruthfulQA and HaluEval, while safety is evaluated through jailbreak and toxicity prompts.

Use Cases for TrustLLM

TrustLLM is primarily intended for researchers and developers focused on improving the trustworthiness of LLMs. The toolkit’s comprehensive benchmarking capabilities make it particularly valuable for red-teaming exercises, where the goal is to stress-test models under controlled conditions.

One key application of TrustLLM is in assessing the trade-offs between utility and trustworthiness. For instance, the framework highlights how over-alignment—where models refuse to answer innocuous prompts—can degrade usability. By evaluating models like Llama2-7b, which exhibit a 57% refusal rate for non-harmful inputs, researchers can identify instances where safety mechanisms may be overly restrictive. This insight is critical for developers aiming to balance security with practical functionality.

TrustLLM also serves as a diagnostic tool for understanding model behaviors across different trust dimensions. For example, the benchmark reveals that proprietary LLMs like GPT-4 generally outperform open-weight models in safety and fairness, though exceptions exist, such as Llama2’s strong performance in certain tasks. This disparity underscores the need for transparency in model development, particularly for open-source models that may lack rigorous safety evaluations.

Researchers can leverage TrustLLM to explore specific challenges, such as hallucination in open-ended tasks or stereotype amplification in biased datasets. The toolkit’s support for datasets like WinoBias and StereoSet enables detailed analysis of model fairness, while its adversarial robustness evaluations (e.g., AdvGLUE) help identify vulnerabilities to input perturbations. These use cases demonstrate TrustLLM’s versatility in addressing both theoretical and applied questions in AI ethics and safety.

Key Features and Capabilities

TrustLLM’s core feature is its extensive dataset collection, which includes over 30 datasets spanning truthfulness, safety, fairness, robustness, privacy, and machine ethics. The datasets are either adapted from prior work or newly proposed within the TrustLLM benchmark.

The toolkit supports dynamic evaluation through its generation module, which allows users to configure model-specific parameters for response generation. The evaluation module then processes these responses against predefined criteria, generating metrics for each trust dimension. For example, truthfulness is evaluated using internal consistency, external consistency, hallucination detection, and sycophancy resistance.

TrustLLM’s leaderboard feature provides a centralized platform for comparing model performances across trust dimensions. The leaderboard includes metrics such as refusal-to-answer rates for out-of-distribution (OOD) inputs, semantic similarity under perturbations, and agreement rates with human annotations on privacy-related queries. This transparency fosters accountability and encourages continuous improvement in model trustworthiness.

The toolkit’s support for parallel retrieval of embeddings and integration with external APIs (e.g., Azure OpenAI, Replicate) enhances its scalability. Version 0.3.0 introduced significant updates, including bug fixes, enhanced evaluation pipelines, and compatibility with newer models like Llama3 and GLM4.

TrustLLM also addresses practical challenges in trustworthiness assessment, such as the impact of model utility on evaluation results. Weak NLP capabilities in a model can skew trustworthiness metrics, leading to biased conclusions. The toolkit mitigates this by requiring a minimum level of utility in evaluated models, ensuring that trustworthiness assessments are both reliable and meaningful.

Dataset and Task Overview

Truthfulness datasets, such as TruthfulQA and HaluEval, focus on evaluating factual accuracy and hallucination resistance. Safety datasets, including Jailbreak Trigger and Misuse, assess model responses to adversarial or harmful prompts, while fairness datasets like WinoBias and Adult evaluate bias in model outputs. Robustness datasets, such as AdvGLUE and AdvInstruction, test model resilience to input perturbations and noise.

The dataset overview includes 30 curated collections, each with a specific purpose. Similarly, the Climate-FEVER dataset contains climate change claims curated by human fact-checkers, providing a rigorous test for factual accuracy in specialized domains. Privacy-related datasets, like the Enron Email Dataset, evaluate model behavior in handling sensitive information, ensuring compliance with ethical guidelines.

Tasks within TrustLLM are designed to reflect real-world scenarios where LLMs may encounter ethical dilemmas or security risks. For instance, the Do-Not-Answer dataset contains prompts that responsible LLMs should refuse to address, testing the model’s adherence to safety protocols. The AdvInstruction dataset, with 600 instructions generated via 11 perturbation methods, evaluates robustness under adversarial conditions. These tasks collectively provide a holistic view of model trustworthiness, covering both technical and ethical considerations.

TrustLLM’s task pipeline is modular, allowing researchers to focus on specific dimensions or combine evaluations across multiple areas.

Insights from TrustLLM Benchmarking

TrustLLM’s experimental results reveal several key insights into the trustworthiness of contemporary LLMs. One notable finding is the relationship between trustworthiness and utility, where models demonstrating strong performance in tasks like moral behavior classification also exhibit higher trustworthiness. However, this relationship is not absolute, as some models prioritize safety over utility, leading to exaggerated refusal rates for non-harmful inputs. For example, Llama2-7b refuses to answer 57% of innocuous prompts, indicating a potential over-alignment issue.

The benchmark highlights a performance gap between proprietary and open-weight LLMs, with proprietary models like GPT-4 generally outperforming open-source alternatives in trustworthiness metrics. However, exceptions exist, such as Llama2, which competes with proprietary models in certain tasks without additional safety modules. This suggests that open-weight models can achieve high trustworthiness levels through careful design, though transparency in their development remains a concern.

TrustLLM also identifies variability in model responses to different types of adversarial attacks. Leetspeak attacks, for instance, exhibit the highest success rates in jailbreaking LLMs, underscoring the need for comprehensive defense strategies. The benchmark further reveals that most LLMs struggle with zero-shot commonsense reasoning, a task that humans perform effortlessly. This limitation highlights the gap between human-like reasoning and current LLM capabilities, particularly in open-ended scenarios.

In terms of fairness, TrustLLM’s evaluations show that even top-performing models like GPT-4 achieve only 65% accuracy in stereotype recognition, with agreement rates on biased sentences varying widely across models. This inconsistency underscores the challenge of mitigating bias in LLMs, particularly when models are forced to choose between opposing options. The benchmark also notes that privacy awareness in LLMs improves when models are explicitly informed of privacy policies, though correlation with human judgments varies significantly.

The toolkit’s findings emphasize the need for transparency in both model development and trustworthiness technologies. While proprietary models may achieve higher trustworthiness scores, their closed nature limits reproducibility and collaboration. Open-sourcing trustworthy technologies could enhance reliability and foster broader adoption of ethical AI practices.

Sources

Contribute

Spot an error, or know a record we should add? Members can propose additions and submit corrections.