Authors: Nino Scherrer*, Claudia Shi*, Amir Feder and David Blei
Paper: Evaluating the Moral Beliefs Encoded in LLMs (NeurIPS 2023 - Spotlight).
Dataset: https://huggingface.co/datasets/ninoscherrer/moralchoice

@inproceedings{scherrer2023evaluating,
title={Evaluating the Moral Beliefs Encoded in LLMs},
author={Nino Scherrer and Claudia Shi and Amir Feder and David Blei},
booktitle={Thirty-seventh Conference on Neural Information Processing Systems},
year={2023},
url={https://openreview.net/forum?id=O06z2G18me}
}
This paper presents a case study on the design, administration, post-processing, and evaluation of surveys on large language models (LLMs). It comprises two components:
A statistical method for eliciting beliefs encoded in LLMs. We introduce statistical measures and evaluation metrics that quantify the probability of an LLM "making a choice", the associated uncertainty, and the consistency of that choice.
We apply this method to study what moral beliefs are encoded in different LLMs, especially in ambiguous cases where the right choice is not obvious. We design a large-scale survey comprising 680 high-ambiguity moral scenarios (e.g., "Should I tell a white lie?") and 687 low-ambiguity moral scenarios (e.g., "Should I stop for a pedestrian on the road?"). Each scenario includes a description, two possible actions, and auxiliary labels indicating violated rules (e.g., "do not kill"). We administer the survey to 28 open- and closed-source LLMs. We find that:
gpt-4, Anthropic's claude-v1.1, claude-instant-v1.1 and Google's text-bison-001 (PaLM 2) show strong agreement.General Requirements:
>> python -m pip install -r requirements.txt
API-Keys: You must add you API-key's into the corresponding files in api_keys.
data/scenariosdata/question_templatesdata/response_templatesdata/responses/paperAll available data is also shared through HuggingFace: https://huggingface.co/datasets/ninoscherrer/moralchoice
You can run a new evaluation on supported models by running:
>> python -m src.evaluate
--experiment-name "moraltest"
--dataset "low"
--model "openai/gpt-4"
--question-types "ab" "repeat" "compare"
--eval-nb-samples 5
This will generate multiple pickle files, i.e., one per (scenario, model, question_type) combination. This allows to resume interrupted experiments efficiently.
Finally, you can collect and aggregate all results into a single csv per model using:
>> python -m src.collect
--experiment-name "moraltest"
--dataset "low"
ai21/j2-grande-instructai21/j2-jumbo-instructcohere/command-xlargecohere/command-mediumopenai/text-ada-001openai/text-babbage-001openai/text-curie-001openai/text-davinci-001openai/text-davinci-002openai/text-davinci-003openai/gpt-3.5-turboopenai/gpt-4anthropic/claude-v1.2anthropic/claude-v1.3anthropic/claude-v2.0anthropic/claude-instant-v1.0anthropic/claude-instant-v1.1google/flan-t5-smallgoogle/flan-t5-basegoogle/flan-t5-largegoogle/flan-t5-xlgoogle/flan-t5-xxlgoogle/text-bison-001meta/opt-iml-regular-smallmeta/opt-iml-regular-largemeta/opt-iml-max-smallmeta/opt-iml-max-largebigscience/bloomz-560mbigscience/bloomz-1b1bigscience/bloomz-1b7bigscience/bloomz-3bbigscience/bloomz-7b1bigscience/bloomz-7b1-mtbigscience/bloomz-7b1-p3models.pymodels.pyYou can add further question templates to our evaluation procedure by:
<question_name>.json to data/question_templates with the question template<question_name>.json to data/response_templates with common answer patternsNote:
To map LLM outputs (i.e., sequences of tokens) to actions, we employ a rule-based matching function. This matching procedure is mainly based on common answer variations/patterns of the evaluated LLMs under the specific question templates. On average, we are able to match ~97% of the answers to action1, action2 and refusal and only classify ~3% of the answers as invalid. However, as this matching procedure does not account for all possible answer paraphrases,there may be some obvious answer matches in the response that were classified as invalid responses.
In future work, we intend to improve the current pipeline to also account for a broader set of answer variations by using a prompted LLMs or a bidirectional entailment algorithm (such as introduced in Kuhn et al. 2023) for matching.
4 commits
1 commits
Python
100.0%
Authors: Nino Scherrer*, Claudia Shi*, Amir Feder and David Blei
Paper: Evaluating the Moral Beliefs Encoded in LLMs (NeurIPS 2023 - Spotlight).
Dataset: https://huggingface.co/datasets/ninoscherrer/moralchoice

@inproceedings{scherrer2023evaluating,
title={Evaluating the Moral Beliefs Encoded in LLMs},
author={Nino Scherrer and Claudia Shi and Amir Feder and David Blei},
booktitle={Thirty-seventh Conference on Neural Information Processing Systems},
year={2023},
url={https://openreview.net/forum?id=O06z2G18me}
}
This paper presents a case study on the design, administration, post-processing, and evaluation of surveys on large language models (LLMs). It comprises two components:
A statistical method for eliciting beliefs encoded in LLMs. We introduce statistical measures and evaluation metrics that quantify the probability of an LLM "making a choice", the associated uncertainty, and the consistency of that choice.
We apply this method to study what moral beliefs are encoded in different LLMs, especially in ambiguous cases where the right choice is not obvious. We design a large-scale survey comprising 680 high-ambiguity moral scenarios (e.g., "Should I tell a white lie?") and 687 low-ambiguity moral scenarios (e.g., "Should I stop for a pedestrian on the road?"). Each scenario includes a description, two possible actions, and auxiliary labels indicating violated rules (e.g., "do not kill"). We administer the survey to 28 open- and closed-source LLMs. We find that:
gpt-4, Anthropic's claude-v1.1, claude-instant-v1.1 and Google's text-bison-001 (PaLM 2) show strong agreement.General Requirements:
>> python -m pip install -r requirements.txt
API-Keys: You must add you API-key's into the corresponding files in api_keys.
data/scenariosdata/question_templatesdata/response_templatesdata/responses/paperAll available data is also shared through HuggingFace: https://huggingface.co/datasets/ninoscherrer/moralchoice
You can run a new evaluation on supported models by running:
>> python -m src.evaluate
--experiment-name "moraltest"
--dataset "low"
--model "openai/gpt-4"
--question-types "ab" "repeat" "compare"
--eval-nb-samples 5
This will generate multiple pickle files, i.e., one per (scenario, model, question_type) combination. This allows to resume interrupted experiments efficiently.
Finally, you can collect and aggregate all results into a single csv per model using:
>> python -m src.collect
--experiment-name "moraltest"
--dataset "low"
ai21/j2-grande-instructai21/j2-jumbo-instructcohere/command-xlargecohere/command-mediumopenai/text-ada-001openai/text-babbage-001openai/text-curie-001openai/text-davinci-001openai/text-davinci-002openai/text-davinci-003openai/gpt-3.5-turboopenai/gpt-4anthropic/claude-v1.2anthropic/claude-v1.3anthropic/claude-v2.0anthropic/claude-instant-v1.0anthropic/claude-instant-v1.1google/flan-t5-smallgoogle/flan-t5-basegoogle/flan-t5-largegoogle/flan-t5-xlgoogle/flan-t5-xxlgoogle/text-bison-001meta/opt-iml-regular-smallmeta/opt-iml-regular-largemeta/opt-iml-max-smallmeta/opt-iml-max-largebigscience/bloomz-560mbigscience/bloomz-1b1bigscience/bloomz-1b7bigscience/bloomz-3bbigscience/bloomz-7b1bigscience/bloomz-7b1-mtbigscience/bloomz-7b1-p3models.pymodels.pyYou can add further question templates to our evaluation procedure by:
<question_name>.json to data/question_templates with the question template<question_name>.json to data/response_templates with common answer patternsNote:
To map LLM outputs (i.e., sequences of tokens) to actions, we employ a rule-based matching function. This matching procedure is mainly based on common answer variations/patterns of the evaluated LLMs under the specific question templates. On average, we are able to match ~97% of the answers to action1, action2 and refusal and only classify ~3% of the answers as invalid. However, as this matching procedure does not account for all possible answer paraphrases,there may be some obvious answer matches in the response that were classified as invalid responses.
In future work, we intend to improve the current pipeline to also account for a broader set of answer variations by using a prompted LLMs or a bidirectional entailment algorithm (such as introduced in Kuhn et al. 2023) for matching.
4 commits
1 commits
Python
100.0%