kaleido-small / README.md
tsor13's picture
Update README.md
37f0a85
metadata
license: apache-2.0
tags:
  - generated_from_trainer
model-index:
  - name: flan-t5-small-a100
    results: []
widget:
  - text: "[Generate]:\tSituation: Do a pushup"
    example_title: Generate
  - text: "[Relevance]:\tSituation: Do a pushup\tValue: Health"
    example_title: Relevance
  - text: "[Valence]:\tSituation: Do a pushup\tValue: Health"
    example_title: Valence
  - text: "[Explanation]:\tSituation: Do a pushup\tValue: Health"
    example_title: Explain
datasets:
  - allenai/ValuePrism
extra_gated_prompt: >-
  Access to this model is automatically granted upon accepting the [**AI2 ImpACT
  License - Medium Risk Artifacts (“MR
  Agreement”)**](https://allenai.org/licenses/impact-mr) and completing all
  fields below.
extra_gated_fields:
  Your full name: text
  Organization or entity you are affiliated with: text
  State or country you are located in: text
  Contact email: text
  Please describe your intended use of the medium risk artifact(s): text
  I UNDERSTAND that the model is intended for research purposes and not for real-world use-cases: checkbox
  I AGREE to the terms and conditions of the MR Agreement above: checkbox
  I AGREE to AI2’s use of my information for legal notices and administrative matters: checkbox
  I CERTIFY that the information I have provided is true and accurate: checkbox

Model Card for Kaleido

Model Description

Kaleido is a multi-task seq2seq model designed to generate, explain, and output the relevance and valence of contextualized values, rights, and duties, distilled from GPT-4 generated data.

Uses

It is intended to be used for research purposes to a) understand how well large language models can approximate pluralistic human values and b) to make an open, transparent attempt to increase the capabilities of LLMs to model human values.

Out-of-Scope Use

The model is not intended to be used for advice, human-facing applications, or other purposes.

Bias, Risks, and Limitations

Significant research has explored bias and fairness issues with language models (see, e.g., Sheng et al. (2021) and Bender et al. (2021)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.

Additionally, certain groups may be represented better in the model's outputs than others, and the fact that the data is entirely in English and generated by predominantly by English speakers/LLMs trained on English, the model's outputs likely fit perspectives from English-speaking countries better.

The relevance score should not be interpreted as an importance score, but, due to the composition of the training data, corresponds more closely with "is this value likely to have been generated for this situation by GPT-4?"

Recommendations

We recommend that this model not be used for any high-impact or human-facing purposes as its biases and limitations need to be further explored. We intend this to be a research artifact to advance AI's ability to model and interact with pluralistic human values, rights, and duties.

Training Details

Training Data

The model is trained on the mixture training split of ValuePrism.

Training Procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 3e-05
  • train_batch_size: 32
  • eval_batch_size: 8
  • seed: 42
  • distributed_type: multi-GPU
  • num_devices: 2
  • total_train_batch_size: 64
  • total_eval_batch_size: 16
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 4.0

Framework versions

  • Transformers 4.22.0.dev0
  • Pytorch 1.12.1+cu113
  • Datasets 2.4.0
  • Tokenizers 0.12.1

Testing Data, Factors & Metrics

Testing Data

The model is tested on the four subtasks in ValuePrism.

Metrics

Accuracy is used for relevance and valence, as they are classification tasks, and perplexity is used for generation and explanation, as they are free text generation tasks.

Results

Model Relevance Acc ↑ Valence Acc ↑ Generative Perp ↓ Explanation Perp ↓
kaleido-xxl (11B) 89.1 81.9 2.22 2.99
kaleido-xl (3B) 88.4 80.8 2.23 3.14
kaleido-large (770M) 87.2 79.2 2.34 3.52
kaleido-base (220M) 83.5 74.5 2.53 4.23
kaleido-small (60M) 66.0 59.7 2.86 5.70

Model Architecture and Objective

Kaleido is an encoder-decoder T5-based model trained using negative log-likelihood.

Citation

BibTeX:

@misc{sorensen2023value,
      title={Value Kaleidoscope: Engaging AI with Pluralistic Human Values, Rights, and Duties}, 
      author={Taylor Sorensen and Liwei Jiang and Jena Hwang and Sydney Levine and Valentina Pyatkin and Peter West and Nouha Dziri and Ximing Lu and Kavel Rao and Chandra Bhagavatula and Maarten Sap and John Tasioulas and Yejin Choi},
      year={2023},
      eprint={2309.00779},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Model Card Contact

Contact Taylor Sorensen (tsor13@cs.washington.edu) for any questions about this model.

How to Get Started with the Model

Use the code below to get started with the model.

Load the model:

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

model_name = 'allenai/kaleido-small'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

Each task ('generate', 'relevance', 'valence', 'explanation') has its own template that can be accessed from the model config.

task = 'generate' # can be 'generate', 'relevance', 'valence', or 'explanation'
model.config.task_specific_params[task]['template']

Output:

'[Generate]:\tAction: ACTION'

The generate template requires ACTION, while the other three templates require ACTION, VRD ('Value', 'Right', or 'Duty') and TEXT. Replace the arguments with the text and generate with the model.

Generate example:

action = 'Go to the gym'
input_text = model.config.task_specific_params['generate']['template'].replace('ACTION', action)
# tokenize
input_ids = tokenizer.encode(input_text, return_tensors='pt')
# generate
output_ids = model.generate(input_ids, max_length=64)
# decode
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
output_text

Output:

'Value: Personal growth'

Valence example:

action = 'Go to the gym'
vrd = 'Value'
text = 'Health'
input_text = model.config.task_specific_params['valence']['template']
replacements = {
    'ACTION': action,
    'VRD': vrd,
    'TEXT': text
}
for key, value in replacements.items():
    input_text = input_text.replace(key, value)
# tokenize
input_ids = tokenizer.encode(input_text, return_tensors='pt')
# generate
output_ids = model.generate(input_ids, max_length=64)
# decode
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
output_text

Output:

'Supports'

Alternatively, one could use the KaleidoSys class in the companion git repo which automates templatization and such.