<!--intro-start-->
# Holistic Evaluation of Language Models
[comment]: <> (When using the img tag, which allows us to specify size, src has to be a URL.)
<img src="https://github.com/stanford-crfm/helm/raw/main/src/helm/benchmark/static/images/helm-logo.png" alt="" width="800"/>
Welcome! The **`crfm-helm`** Python package contains code used in the **Holistic Evaluation of Language Models** project ([paper](https://arxiv.org/abs/2211.09110), [website](https://crfm.stanford.edu/helm/latest/)) by [Stanford CRFM](https://crfm.stanford.edu/). This package includes the following features:
- Collection of datasets in a standard format (e.g., NaturalQuestions)
- Collection of models accessible via a unified API (e.g., GPT-3, MT-NLG, OPT, BLOOM)
- Collection of metrics beyond accuracy (efficiency, bias, toxicity, etc.)
- Collection of perturbations for evaluating robustness and fairness (e.g., typos, dialect)
- Modular framework for constructing prompts from datasets
- Proxy server for managing accounts and providing unified interface to access models
<!--intro-end-->
To get started, refer to [the documentation on Read the Docs](https://crfm-helm.readthedocs.io/) for how to install and run the package.
## Papers
This repository contains code used to produce results for the following papers:
- Holistic Evaluation of Vision-Language Models (VHELM) - paper (TBD), [leaderboard](https://crfm.stanford.edu/helm/vhelm/latest/), [documentation](https://crfm-helm.readthedocs.io/en/latest/vhelm/)
- Holistic Evaluation of Text-To-Image Models (HEIM) - [paper](https://arxiv.org/abs/2311.04287), [leaderboard](https://crfm.stanford.edu/helm/heim/latest/), [documentation](https://crfm-helm.readthedocs.io/en/latest/heim/)
The HELM Python package can be used to reproduce the published model evaluation results from these paper. To get started, refer to the documentation links above for the corresponding paper, or the [main Reproducing Leaderboards documentation](https://crfm-helm.readthedocs.io/en/latest/reproducing_leaderboards/).
## Holistic Evaluation of Text-To-Image Models
<img src="https://github.com/stanford-crfm/helm/raw/heim/src/helm/benchmark/static/heim/images/heim-logo.png" alt="" width="800"/>
Significant effort has recently been made in developing text-to-image generation models, which take textual prompts as
input and generate images. As these models are widely used in real-world applications, there is an urgent need to
comprehensively understand their capabilities and risks. However, existing evaluations primarily focus on image-text
alignment and image quality. To address this limitation, we introduce a new benchmark,
**Holistic Evaluation of Text-To-Image Models (HEIM)**.
We identify 12 different aspects that are important in real-world model deployment, including:
- image-text alignment
- image quality
- aesthetics
- originality
- reasoning
- knowledge
- bias
- toxicity
- fairness
- robustness
- multilinguality
- efficiency
By curating scenarios encompassing these aspects, we evaluate state-of-the-art text-to-image models using this benchmark.
Unlike previous evaluations that focused on alignment and quality, HEIM significantly improves coverage by evaluating all
models across all aspects. Our results reveal that no single model excels in all aspects, with different models
demonstrating strengths in different aspects.
This repository contains the code used to produce the [results on the website](https://crfm.stanford.edu/heim/latest/)
and [paper](https://arxiv.org/abs/2311.04287).
## Citation
If you use this software in your research, please cite the [Holistic Evaluation of Language Models paper](https://openreview.net/forum?id=iO4LZibEqW) as below.
```bibtex
@article{
liang2023holistic,
title={Holistic Evaluation of Language Models},
author={Percy Liang and Rishi Bommasani and Tony Lee and Dimitris Tsipras and Dilara Soylu and Michihiro Yasunaga and Yian Zhang and Deepak Narayanan and Yuhuai Wu and Ananya Kumar and Benjamin Newman and Binhang Yuan and Bobby Yan and Ce Zhang and Christian Alexander Cosgrove and Christopher D Manning and Christopher Re and Diana Acosta-Navas and Drew Arad Hudson and Eric Zelikman and Esin Durmus and Faisal Ladhak and Frieda Rong and Hongyu Ren and Huaxiu Yao and Jue WANG and Keshav Santhanam and Laurel Orr and Lucia Zheng and Mert Yuksekgonul and Mirac Suzgun and Nathan Kim and Neel Guha and Niladri S. Chatterji and Omar Khattab and Peter Henderson and Qian Huang and Ryan Andrew Chi and Sang Michael Xie and Shibani Santurkar and Surya Ganguli and Tatsunori Hashimoto and Thomas Icard and Tianyi Zhang and Vishrav Chaudhary and William Wang and Xuechen Li and Yifan Mai and Yuhui Zhang and Yuta Koreeda},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2023},
url={https://openreview.net/forum?id=iO4LZibEqW},
note={Featured Certification, Expert Certification}
}
```
# Tutorial
This tutorial will explain how to use the HELM command line tools to run benchmarks, aggregate statistics, and visualize results.
We will run two runs using the `mmlu` scenario on the `openai/gpt2` model. The `mmlu` scenario implements the **Massive Multitask Language (MMLU)** benchmark from [this paper](https://arxiv.org/pdf/2009.03300.pdf), and consists of a Question Answering (QA) task using a dataset with questions from 57 subjects such as elementary mathematics, US history, computer science, law, and more. Note that GPT-2 performs poorly on MMLU, so this is just a proof of concept. We will run two runs: the first using questions about anatomy, and the second using questions about philosophy.
## Using `helm-run`
`helm-run` is a command line tool for running benchmarks.
To run this benchmark using the HELM command-line tools, we need to specify **run entries** that describes the desired runs. For this example, the run entries are `mmlu:subject=anatomy,model=openai/gpt2` (for anatomy) and `mmlu:subject=philosophy,model=openai/gpt2` (for philosophy).
We will now use `helm-run` to execute the runs. Run this command:
```sh
helm-run --run-entries mmlu:subject=anatomy,model=openai/gpt2 mmlu:subject=philosophy,model=openai/gpt2 --suite my-suite --max-eval-instances 10
```
The meaning of the arguments are as follows:
- `--run-entries` specifies the run entries from the desired runs.
- `--suite` specifies a subdirectory under the output directory in which all the output will be placed.
- `--max-eval-instances` limits evaluation to only *N* instances (i.e. items) from the benchmark, using a randomly shuffled order of instances.
`helm-run` creates an environment directory environment and an output directory by default.
- The environment directory is `prod_env/` by default and can be set using `--local-path`. Credentials for making API calls should be added to a `credentials.conf` file in this directory.
- The output directory is `benchmark_output/` by default and can be set using `--output-path`.
After running this command, navigate to the `benchmark_output/runs/my-suite/` directory. This should contain a two sub-directories named `mmlu:subject=anatomy,model=openai_gpt2` and `mmlu:subject=philosophy,model=openai_gpt2`. Note that the names of these sub-directories is based on the run entries we used earlier, but with `/` replaced with `_`.
Each output sub-directory will contain several JSON files that were generated during the corresponding run:
- `run_spec.json` contains the `RunSpec`, which specifies the scenario, adapter and metrics for the run.
- `scenario.json` contains a serialized `Scenario`, which contains the scenario for the run and specifies the instances (i.e. inputs) used.
- `scenario_state.json` contains a serialized `ScenarioState`, which contains every request to and response from the model.
- `per_instance_stats.json` contains a serialized list of `PerInstanceStats`, which contains the statistics produced for the metrics for each instance (i.e. input).
- `stats.json` contains a serialized list of `PerInstanceStats`, which contains the statistics produced for the metrics, aggregated across all instances (i.e. inputs).
## Using `helm-summarize`
The `helm-summarize` reads the output files of `helm-run` and computes aggregate statistics across runs. Run the following:
```sh
helm-summarize --suite my-suite
```
This reads the pre-existing files in `benchmark_output/runs/my-suite/` that were written by `helm-run` previously, and writes the following new files back to `benchmark_output/runs/my-suite/`:
- `summary.json` contains a serialized `ExecutiveSummary` with a date and suite name.
- `run_specs.json` contains the run entries for all the runs.
- `runs.json` contains serialized list of `Run`, which contains the run path, run spec and adapter spec and statistics for each run.
- `groups.json` contains a serialized list of `Table`, each containing information about groups in a group category.
- `groups_metadata.json` contains a list of all the groups along with a human-readable description and a taxonomy.
Additionally, for each group and group-relavent metric, it will output a pair of files: `benchmark_output/runs/my-suite/groups/latex/<group_name>_<metric_name>.tex` and `benchmark_output/runs/my-suite/groups/json/<group_name>_<metric_name>.json`. These files contain the statistics for that metric from each run within the group.
## Using `helm-server`
Finally, the `helm-server` command launches a web server to visualize the output files of `helm-run` and `helm-benchmark`. Run:
```sh
helm-server --suite my-suite
```
Open a browser and go to http://localhost:8000/ to view the visualization. You should see a similar view as [live website for the paper](https://crfm.stanford.edu/helm/classic/latest/), but for the data from your benchmark runs. The website has the following sections accessible from the top menu bar:
- **Leaderboards** contains the leaderboards with aggregate metrics.
- **Models** contains a list of models and their descriptions
- **Scenarios** contains a list of scenarios and their descriptions.
- **Predictions** contains a searchable list of runs.
Raw data
{
"_id": null,
"home_page": "https://github.com/stanford-crfm/helm",
"name": "crfm-helm",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.12,>=3.9",
"maintainer_email": null,
"keywords": "language models benchmarking",
"author": "Stanford CRFM",
"author_email": "contact-crfm@stanford.edu",
"download_url": "https://files.pythonhosted.org/packages/93/11/f1f0005d0b742537c662dc4c881dad8f7a1d0ec5ae20bde36a5813a90dcc/crfm_helm-0.5.4.tar.gz",
"platform": null,
"description": "<!--intro-start-->\n\n# Holistic Evaluation of Language Models\n\n[comment]: <> (When using the img tag, which allows us to specify size, src has to be a URL.)\n<img src=\"https://github.com/stanford-crfm/helm/raw/main/src/helm/benchmark/static/images/helm-logo.png\" alt=\"\" width=\"800\"/>\n\nWelcome! The **`crfm-helm`** Python package contains code used in the **Holistic Evaluation of Language Models** project ([paper](https://arxiv.org/abs/2211.09110), [website](https://crfm.stanford.edu/helm/latest/)) by [Stanford CRFM](https://crfm.stanford.edu/). This package includes the following features:\n\n- Collection of datasets in a standard format (e.g., NaturalQuestions)\n- Collection of models accessible via a unified API (e.g., GPT-3, MT-NLG, OPT, BLOOM)\n- Collection of metrics beyond accuracy (efficiency, bias, toxicity, etc.)\n- Collection of perturbations for evaluating robustness and fairness (e.g., typos, dialect)\n- Modular framework for constructing prompts from datasets\n- Proxy server for managing accounts and providing unified interface to access models\n<!--intro-end-->\n\nTo get started, refer to [the documentation on Read the Docs](https://crfm-helm.readthedocs.io/) for how to install and run the package.\n\n## Papers\n\nThis repository contains code used to produce results for the following papers:\n\n- Holistic Evaluation of Vision-Language Models (VHELM) - paper (TBD), [leaderboard](https://crfm.stanford.edu/helm/vhelm/latest/), [documentation](https://crfm-helm.readthedocs.io/en/latest/vhelm/)\n- Holistic Evaluation of Text-To-Image Models (HEIM) - [paper](https://arxiv.org/abs/2311.04287), [leaderboard](https://crfm.stanford.edu/helm/heim/latest/), [documentation](https://crfm-helm.readthedocs.io/en/latest/heim/)\n\nThe HELM Python package can be used to reproduce the published model evaluation results from these paper. To get started, refer to the documentation links above for the corresponding paper, or the [main Reproducing Leaderboards documentation](https://crfm-helm.readthedocs.io/en/latest/reproducing_leaderboards/).\n\n## Holistic Evaluation of Text-To-Image Models\n\n<img src=\"https://github.com/stanford-crfm/helm/raw/heim/src/helm/benchmark/static/heim/images/heim-logo.png\" alt=\"\" width=\"800\"/>\n\nSignificant effort has recently been made in developing text-to-image generation models, which take textual prompts as \ninput and generate images. As these models are widely used in real-world applications, there is an urgent need to \ncomprehensively understand their capabilities and risks. However, existing evaluations primarily focus on image-text \nalignment and image quality. To address this limitation, we introduce a new benchmark, \n**Holistic Evaluation of Text-To-Image Models (HEIM)**.\n\nWe identify 12 different aspects that are important in real-world model deployment, including:\n\n- image-text alignment\n- image quality\n- aesthetics\n- originality\n- reasoning\n- knowledge\n- bias\n- toxicity\n- fairness\n- robustness\n- multilinguality\n- efficiency\n\nBy curating scenarios encompassing these aspects, we evaluate state-of-the-art text-to-image models using this benchmark. \nUnlike previous evaluations that focused on alignment and quality, HEIM significantly improves coverage by evaluating all \nmodels across all aspects. Our results reveal that no single model excels in all aspects, with different models \ndemonstrating strengths in different aspects.\n\nThis repository contains the code used to produce the [results on the website](https://crfm.stanford.edu/heim/latest/) \nand [paper](https://arxiv.org/abs/2311.04287).\n\n## Citation\n\nIf you use this software in your research, please cite the [Holistic Evaluation of Language Models paper](https://openreview.net/forum?id=iO4LZibEqW) as below.\n\n```bibtex\n@article{\nliang2023holistic,\ntitle={Holistic Evaluation of Language Models},\nauthor={Percy Liang and Rishi Bommasani and Tony Lee and Dimitris Tsipras and Dilara Soylu and Michihiro Yasunaga and Yian Zhang and Deepak Narayanan and Yuhuai Wu and Ananya Kumar and Benjamin Newman and Binhang Yuan and Bobby Yan and Ce Zhang and Christian Alexander Cosgrove and Christopher D Manning and Christopher Re and Diana Acosta-Navas and Drew Arad Hudson and Eric Zelikman and Esin Durmus and Faisal Ladhak and Frieda Rong and Hongyu Ren and Huaxiu Yao and Jue WANG and Keshav Santhanam and Laurel Orr and Lucia Zheng and Mert Yuksekgonul and Mirac Suzgun and Nathan Kim and Neel Guha and Niladri S. Chatterji and Omar Khattab and Peter Henderson and Qian Huang and Ryan Andrew Chi and Sang Michael Xie and Shibani Santurkar and Surya Ganguli and Tatsunori Hashimoto and Thomas Icard and Tianyi Zhang and Vishrav Chaudhary and William Wang and Xuechen Li and Yifan Mai and Yuhui Zhang and Yuta Koreeda},\njournal={Transactions on Machine Learning Research},\nissn={2835-8856},\nyear={2023},\nurl={https://openreview.net/forum?id=iO4LZibEqW},\nnote={Featured Certification, Expert Certification}\n}\n```\n# Tutorial\n\nThis tutorial will explain how to use the HELM command line tools to run benchmarks, aggregate statistics, and visualize results.\n\nWe will run two runs using the `mmlu` scenario on the `openai/gpt2` model. The `mmlu` scenario implements the **Massive Multitask Language (MMLU)** benchmark from [this paper](https://arxiv.org/pdf/2009.03300.pdf), and consists of a Question Answering (QA) task using a dataset with questions from 57 subjects such as elementary mathematics, US history, computer science, law, and more. Note that GPT-2 performs poorly on MMLU, so this is just a proof of concept. We will run two runs: the first using questions about anatomy, and the second using questions about philosophy.\n\n## Using `helm-run`\n\n`helm-run` is a command line tool for running benchmarks.\n\nTo run this benchmark using the HELM command-line tools, we need to specify **run entries** that describes the desired runs. For this example, the run entries are `mmlu:subject=anatomy,model=openai/gpt2` (for anatomy) and `mmlu:subject=philosophy,model=openai/gpt2` (for philosophy).\n\nWe will now use `helm-run` to execute the runs. Run this command:\n\n```sh\nhelm-run --run-entries mmlu:subject=anatomy,model=openai/gpt2 mmlu:subject=philosophy,model=openai/gpt2 --suite my-suite --max-eval-instances 10\n```\n\nThe meaning of the arguments are as follows:\n\n- `--run-entries` specifies the run entries from the desired runs.\n- `--suite` specifies a subdirectory under the output directory in which all the output will be placed.\n- `--max-eval-instances` limits evaluation to only *N* instances (i.e. items) from the benchmark, using a randomly shuffled order of instances.\n\n`helm-run` creates an environment directory environment and an output directory by default.\n\n- The environment directory is `prod_env/` by default and can be set using `--local-path`. Credentials for making API calls should be added to a `credentials.conf` file in this directory.\n- The output directory is `benchmark_output/` by default and can be set using `--output-path`.\n\nAfter running this command, navigate to the `benchmark_output/runs/my-suite/` directory. This should contain a two sub-directories named `mmlu:subject=anatomy,model=openai_gpt2` and `mmlu:subject=philosophy,model=openai_gpt2`. Note that the names of these sub-directories is based on the run entries we used earlier, but with `/` replaced with `_`.\n\nEach output sub-directory will contain several JSON files that were generated during the corresponding run:\n\n- `run_spec.json` contains the `RunSpec`, which specifies the scenario, adapter and metrics for the run.\n- `scenario.json` contains a serialized `Scenario`, which contains the scenario for the run and specifies the instances (i.e. inputs) used.\n- `scenario_state.json` contains a serialized `ScenarioState`, which contains every request to and response from the model.\n- `per_instance_stats.json` contains a serialized list of `PerInstanceStats`, which contains the statistics produced for the metrics for each instance (i.e. input).\n- `stats.json` contains a serialized list of `PerInstanceStats`, which contains the statistics produced for the metrics, aggregated across all instances (i.e. inputs).\n\n## Using `helm-summarize`\n\nThe `helm-summarize` reads the output files of `helm-run` and computes aggregate statistics across runs. Run the following:\n\n```sh\nhelm-summarize --suite my-suite\n```\n\nThis reads the pre-existing files in `benchmark_output/runs/my-suite/` that were written by `helm-run` previously, and writes the following new files back to `benchmark_output/runs/my-suite/`:\n\n- `summary.json` contains a serialized `ExecutiveSummary` with a date and suite name.\n- `run_specs.json` contains the run entries for all the runs.\n- `runs.json` contains serialized list of `Run`, which contains the run path, run spec and adapter spec and statistics for each run.\n- `groups.json` contains a serialized list of `Table`, each containing information about groups in a group category.\n- `groups_metadata.json` contains a list of all the groups along with a human-readable description and a taxonomy.\n\nAdditionally, for each group and group-relavent metric, it will output a pair of files: `benchmark_output/runs/my-suite/groups/latex/<group_name>_<metric_name>.tex` and `benchmark_output/runs/my-suite/groups/json/<group_name>_<metric_name>.json`. These files contain the statistics for that metric from each run within the group.\n\n## Using `helm-server`\n\nFinally, the `helm-server` command launches a web server to visualize the output files of `helm-run` and `helm-benchmark`. Run:\n\n```sh\nhelm-server --suite my-suite\n```\n\nOpen a browser and go to http://localhost:8000/ to view the visualization. You should see a similar view as [live website for the paper](https://crfm.stanford.edu/helm/classic/latest/), but for the data from your benchmark runs. The website has the following sections accessible from the top menu bar:\n\n- **Leaderboards** contains the leaderboards with aggregate metrics.\n- **Models** contains a list of models and their descriptions\n- **Scenarios** contains a list of scenarios and their descriptions.\n- **Predictions** contains a searchable list of runs.\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Benchmark for language models",
"version": "0.5.4",
"project_urls": {
"Homepage": "https://github.com/stanford-crfm/helm"
},
"split_keywords": [
"language",
"models",
"benchmarking"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5cfbdfdb51039006e909f2270b2a1790472bbe28d4f5f7a6197e79581cd17b2f",
"md5": "197463d553a41d4c4f08143329bff340",
"sha256": "8ec0fe2872868a643d11c4dfb112a6208aa4190f74913d4c9359e88587bbdb72"
},
"downloads": -1,
"filename": "crfm_helm-0.5.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "197463d553a41d4c4f08143329bff340",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.12,>=3.9",
"size": 6547615,
"upload_time": "2024-10-10T03:07:48",
"upload_time_iso_8601": "2024-10-10T03:07:48.669391Z",
"url": "https://files.pythonhosted.org/packages/5c/fb/dfdb51039006e909f2270b2a1790472bbe28d4f5f7a6197e79581cd17b2f/crfm_helm-0.5.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9311f1f0005d0b742537c662dc4c881dad8f7a1d0ec5ae20bde36a5813a90dcc",
"md5": "90fde4f0c6717d9399d6ec2854329fe0",
"sha256": "9c12ebf90ef6f0b01c5e002b03e70afde79f6f424de741a2127a8cec7364e3ee"
},
"downloads": -1,
"filename": "crfm_helm-0.5.4.tar.gz",
"has_sig": false,
"md5_digest": "90fde4f0c6717d9399d6ec2854329fe0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.9",
"size": 6202205,
"upload_time": "2024-10-10T03:07:51",
"upload_time_iso_8601": "2024-10-10T03:07:51.364177Z",
"url": "https://files.pythonhosted.org/packages/93/11/f1f0005d0b742537c662dc4c881dad8f7a1d0ec5ae20bde36a5813a90dcc/crfm_helm-0.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-10 03:07:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stanford-crfm",
"github_project": "helm",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "crfm-helm"
}