This repository contains data and code for the paper NormBank: A Knowledge Bank of Situational Social Norms by Caleb Ziems, Jane Dwivedi-Yu, Yi-Chia Wang, Alon Y. Halevy, Diyi Yang
NormBank is a knowledge bank of 155k situational norms that we built to ground flexible normative reasoning for interactive, assistive, and collaborative AI systems. Unlike prior commonsense resources, NormBank grounds each inference within a multivalent sociocultural frame, which includes the setting (e.g., restaurant), the agents’ contingent roles (waiter, customer),
their attributes (age, gender), and other physical, social, and cultural constraints (e.g., the temperature or the country of operation). In total, NormBank contains 63k unique constraints from a taxonomy that we introduce and iteratively refine here. Constraints then apply in different combinations to frame social norms. Under these manipulations, norms are non-monotonic — one can cancel an inference by updating its frame even slightly.
Follow this link to download NormBank.csv
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
- CUDA, cudnn
- anaconda
- Create main project environment
conda create --name normbank python=3.7
conda activate normbank
pip install -r normbank.txt- Add openai API key, replacing
API_KEYwith your key
touch resources/openai_api_key.txt
echo "API_KEY"|cat>resources/openai_api_key.txtAttributes are drawn from the literature and so they are pre-populated in
data/raw/Attributesin the repo
To bypass this step, simply use the
data/raw/Settings-Rolesanddata/raw/Settings-Itemsdirectories pre-populated in the repo
- Pull roles for each setting ==>
data/raw/Settings-Roles
cd src
python pull_roles_GPT.py- Use GPT-3 to pull items (social props) for each setting (+ role) ==> Output:
data/raw/Settings-Items(+data/raw/Settings-Roles-Items)
python pull_items_GPT.pyTo bypass this step, simply use the
data/raw/Behaviors-All-Hand-Filtereddirectory pre-populated in the repo
- Use GPT-3 to pull behaviors conditioned on settings + role ==> Output:
data/raw/Settings-Behaviors_Normal
python pull_behaviors_GPT.py- Use GPT-3 to pull behaviors conditioned on personal attributes ==> Output:
data/raw/Settings-Attributes-Behaviors_Taboo
python pull_behaviors_attributes.py- Use regexes clean and merge all behaviors ==> Ouput:
data/raw/Behaviors-All-Merged
python merge_behaviors.py- Manually filter behaviors ==> Output: `data/raw/Behaviors-All-Hand-Filtered
To bypass this step, download HIT output files from
output.zipin the following Drive folder: https://drive.google.com/drive/folders/1XRhrzgG_R0zypPgPlCxK0nlqKbfaI9xe?usp=sharing
- Build HIT input files ==> Output: `hit/temp/subsample.csv'
python behaviors_to_hit.py- Build HIT qual on MTurk (after you modify the python code with the proper API keys) (
cd ../hit/qual)
python qual_request.py- Set up and run HIT on MTurk using
HIT_Conditional_Norms.html==> Output:hit/output
- Build SCENE training CSV file
python build_gen_train_file.py- Compute SCENE statistics with
dataset-statistics.ipynb