Python library that scores LLM responses for likely hallucinations using uncertainty quantification, with black-box, white-box, judge and ensemble scorers.
HowieHwong/TrustLLM
Open research toolkit from the ICML 2024 TrustLLM benchmark for evaluating LLM trustworthiness across six dimensions via CLI and Python.
- Stars
- 635
- Forks
- 69
- Open issues
- 8
- Last commit
- last month
What is it?
TrustLLM is a research toolkit for measuring how trustworthy large language models are across six dimensions: truthfulness, safety, fairness, robustness, privacy, and ethics. It packages the ICML 2024 benchmark so you can run the datasets against local Hugging Face weights or any OpenAI-compatible API, then keep the data, settings, and outputs together in one run directory.
The workflow is split into generation and scoring. The generate step collects model responses per task, with checkpoints, bounded retries, and an HTML report of completion counts. The evaluate step then scores a complete set of responses, using rules, a downloaded classifier, embeddings, or an API judge depending on the task. The base install is lightweight, and optional extras add local model loading and scoring dependencies.
The project also documents CLI and Python orchestration with JSON results, so the same pipeline can be driven by scripts or AI agents.
Key features
- 01Covers six trustworthiness dimensions with the ICML 2024 benchmark datasets.
- 02Runs generation against local Hugging Face causal LMs or OpenAI-compatible APIs.
- 03Provides download, tasks, generate, and evaluate commands via the trustllm CLI.
- 04Saves per-sample checkpoints and supports guarded resume for interrupted runs.
- 05Scores responses with rules, classifiers, embeddings, or an API judge depending on the task.
Use cases
- Comparing the safety and truthfulness of several LLMs under a consistent benchmark.
- Checking a fine-tuned or local model for jailbreak susceptibility before deployment.
- Reproducing ICML 2024 TrustLLM results for academic research.
- Running a quick smoke test of a model API before a full evaluation.
Quick start
- 1
Install the base package from GitHub (requires Git)
python -m pip install "trustllm @ git+https://github.com/HowieHwong/TrustLLM.git@main#subdirectory=trustllm_pkg" - 2
Download the benchmark dataset
python -m trustllm download --output data - 3
Set your API key and endpoint, then run a smoke-test generation
export OPENAI_API_KEY="your-api-key" export OPENAI_BASE_URL="https://your-provider.example/v1" python -m trustllm generate \ --backend api --model your-model-id \ --task safety --data data/dataset \ --limit 5 --concurrency 4 --output runs/api-safety
Things to know
- Scoring for full runs may use an API judge that can incur charges.
- Generation settings differ from the original paper, so new runs are not directly equivalent to paper results.
- Installation is from the main branch on GitHub rather than a published package release.
In collections
Topics
FAQ
- What is TrustLLM?
- Open research toolkit from the ICML 2024 TrustLLM benchmark for evaluating LLM trustworthiness across six dimensions via CLI and Python. TrustLLM is a research toolkit for measuring how trustworthy large language models are across six dimensions: truthfulness, safety, fairness, robustness, privacy, and ethics. It packages the ICML 2024 benchmark so you can run the datasets against local Hugging Face weights or any OpenAI-compatible API, then keep the data, settings, and outputs together in one run directory.
- Is TrustLLM free to use? What license does it have?
- TrustLLM is open source under the MIT license. Check the license terms before using it in commercial products.
- Is TrustLLM still maintained?
- Updated within 6 months. The last commit to TrustLLM was on Oct 4, 2026.
- What can I use TrustLLM for?
- Comparing the safety and truthfulness of several LLMs under a consistent benchmark. Checking a fine-tuned or local model for jailbreak susceptibility before deployment. Reproducing ICML 2024 TrustLLM results for academic research. Running a quick smoke test of a model API before a full evaluation.
- How do I install TrustLLM?
- Install the base package from GitHub (requires Git): python -m pip install "trustllm @ git+https://github.com/HowieHwong/TrustLLM.git@main#subdirectory=trustllm_pkg" Download the benchmark dataset: python -m trustllm download --output data Set your API key and endpoint, then run a smoke-test generation: export OPENAI_API_KEY="your-api-key" export OPENAI_BASE_URL="https://your-provider.example/v1" python -m trustllm generate \ --backend api --model your-model-id \ --task safety --data data/dataset \ --limit 5 --concurrency 4 --output runs/api-safety
- Where can I get TrustLLM?
- The source code and installation instructions are on GitHub: https://github.com/HowieHwong/TrustLLM
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Python library that generates and runs robustness, bias, fairness and accuracy tests against NLP models and LLMs with one line of code.
An evaluation harness for testing LLMs as autonomous agents, with 300 human-verified tasks graded on completion, safety, and robustness.
A Python CLI that audits AI agents against 61 inspections, testing whether they stay within their role, resist manipulation and avoid fabrication.
An open-source command-line scanner that probes LLMs for failure modes such as prompt injection, data leakage, jailbreaks, and toxic output.
An open-source Python framework for building robust RL environments that run agent tasks in isolated VMs to train aligned AI.