Skip to content
beginnertext

RAFT Few-Shot Harm Classification of NeurIPS Impact Statements

Label whether a NeurIPS 2020 impact statement mentions a harmful application, using ten real RAFT items and a SetFit trainer for prelabels.

Try it live — no install

Boot the real Potato server in your browser (WebAssembly) and annotate with this exact config. Nothing leaves your machine.

Run live in your browser

Get This Design

View on GitHub(opens in a new tab)

Clone or download from the repository

Quick start:

bash
git clone https://github.com/davidjurgens/potato-showcase.git
cd potato-showcase/text/topic-classification/raft-few-shot-text-classification
potato start config.yaml

About this dataset

RAFT (Real-world Annotated Few-shot Tasks) is a benchmark from Ought and collaborators that bundles 11 naturally occurring text classification tasks. Each task provides 50 labeled examples, plus task instructions and textual label names, and the test labels are held out for a leaderboard. The paper presents the 50-example budget as roughly the number of examples the authors saw people willing to label for a task with a few thousand unlabeled examples.

This design uses one task, NeurIPS impact statement risks. Annotators read the paper title and the broader impact statement from a NeurIPS 2020 paper and choose "doesn't mention a harmful application" or "mentions a harmful application". The instructions are the paper's own wording from appendix A.3. Contractors paid by Ought produced the original labels, with a majority vote of three annotators. The paper's appendix A.1 licenses the task's labels under CC BY 4.0 and the underlying impact statement dataset under MIT. The ten sample items are therefore real training examples with attribution. Other RAFT tasks are unlicensed, share-alike, or non-commercial and are not used. The design shows 10 of the 50 training items. The released labels stay in the data for reference and are withheld from annotators.

The model_training block turns training on, and the setfit trainer is chosen on /admin/training. Setfit fits text classification from a handful of labeled items per class. The trainer fine-tunes a sentence-transformer on pairs of labeled statements, fits a logistic head, and writes predictions onto statements nobody has labeled. The next annotator sees the predictions as prelabels to confirm or change. Training needs at least 8 labeled items by default. The trainer does not reproduce the GPT-3 baseline from the paper and does not deploy or serve a model.

Tasks in RAFT
11
Labeled examples per task
50 (per task, not per class)
NIS test items (unlabeled)
150
NIS classes
2
NIS training labels
27 "doesn't mention a harmful application", 23 "mentions a harmful application"
Original annotators
Three contractors per statement, majority vote

Configuration File

This Potato config reproduces the annotation task. Save it as config.yaml and run potato start config.yaml to try it.

yaml
# RAFT: NeurIPS Impact Statement Risks, few-shot harm classification
#
# Paper: Neel Alex, Eli Lifland, Lewis Tunstall, Abhishek Thakur, Pegah Maham,
#   C. Jess Riedel, Emmie Hine, Carolyn Ashurst, Paul Sedille, Alexis Carlier,
#   Michael Noetel, and Andreas Stuhlmuller (2021). "RAFT: A Real-World
#   Few-Shot Text Classification Benchmark." NeurIPS 2021 Datasets and
#   Benchmarks Track. arXiv preprint; no proceedings DOI was found.
#   @misc{alex2021raft,
#     doi = {10.48550/ARXIV.2109.14076},
#     url = {https://arxiv.org/abs/2109.14076},
#     author = {Alex, Neel and Lifland, Eli and Tunstall, Lewis and Thakur, Abhishek and Maham, Pegah and Riedel, C. Jess and Hine, Emmie and Ashurst, Carolyn and Sedille, Paul and Carlier, Alexis and Noetel, Michael and Stuhlmüller, Andreas},
#     title = {RAFT: A Real-World Few-Shot Text Classification Benchmark},
#     publisher = {arXiv},
#     year = {2021}
#   }
# DOI: 10.48550/arXiv.2109.14076
# Dataset: https://huggingface.co/datasets/ought/raft (config
#   neurips_impact_statement_risks); homepage https://raft.elicit.org
#
# Licence: RAFT bundles 11 tasks under different licences. This design uses the
#   NeurIPS impact statement risks (NIS) task, which the paper's appendix A.1
#   gives as "an MIT License" for the underlying impact statement dataset
#   (Ashurst et al.) and Creative Commons Attribution 4.0 International for the
#   derivative RAFT labels. The ten sample items are real items from the NIS
#   training split, redistributed under CC BY 4.0 with attribution to the RAFT
#   authors and the paper authors named in each item's paper_link.
#
# Task: RAFT's NIS task labels each NeurIPS 2020 broader impact statement by
#   whether it mentions a harmful application of the research. Labels, quoted
#   from the dataset card (ClassLabel names):
#     "doesn't mention a harmful application"
#     "mentions a harmful application"
#   Instructions, quoted from the paper's appendix A.3 (task-specific
#   instructions): "Label the impact statement based on whether it mentions a
#   harmful application of the research done in the paper. Make sure the
#   statement is sufficient to conclude there are harmful applications of the
#   research being done, not a past risk that this research is solving."
#   RAFT's annotation record (dataset datasheet): contractors paid by Ought
#   labeled the statements, and a majority vote of three annotators was taken.
#   The paper provides 50 labeled examples per task, "not per class", which is
#   about the number of examples its authors saw people willing to label.
#
# Model training: the trainer is setfit (potato/training/registry.py), which
#   consumes radio, select, likert and multiselect schemes over text. It
#   fine-tunes a sentence-transformer on pairs of labeled statements, then fits
#   a logistic head, and needs at least 8 training items (min_instances).
#   Install with: pip install 'potato-annotation[embeddings]'. It predicts a
#   label for statements nobody has labeled and shows it as a prelabel. It does
#   not serve or deploy a model, and it is not the GPT-3 baseline from the paper.
#   Open /admin/training with the admin key below, pick setfit and the
#   harm_mention scheme, and click Train now.
#
# Adaptations:
#   - One task of RAFT's eleven, with 10 items instead of the 50 labeled and 150
#     unlabeled ones. The released labels stay in the data as released_label for
#     reference and are listed in private_keys, so annotators never receive them.
#   - The annotator-facing task is a radio scheme with the two RAFT label names;
#     the original labeling was done in a spreadsheet.
#   - Items show the paper title and impact statement. RAFT also carries a paper
#     link, which is kept in the data but not displayed.
#   - The instructions are the paper's wording, shown unchanged.

annotation_task_name: "RAFT: NeurIPS Impact Statement Harm Mention"
task_dir: "."

data_files:
  - sample-data.json

item_properties:
  id_key: "id"
  text_key: "impact_statement"
  private_keys: ["released_label"]

instance_display:
  fields:
    - key: paper_title
      type: text
      label: "Paper title"
    - key: impact_statement
      type: text
      label: "Impact statement"

output_annotation_dir: "annotation_output/"
export_annotation_format: "jsonl"

port: 8000
require_password: false
admin_api_key: "demo-admin-key"

annotation_schemes:
  - annotation_type: radio
    name: harm_mention
    description: "Does the impact statement mention a harmful application of the research done in the paper?"
    labels:
      - "doesn't mention a harmful application"
      - "mentions a harmful application"
    sequential_key_binding: true
    label_requirement:
      required: true

annotation_instructions: |
  Label the impact statement based on whether it mentions a harmful application
  of the research done in the paper. Make sure the statement is sufficient to
  conclude there are harmful applications of the research being done, not a
  past risk that this research is solving.

  (Instructions quoted from Alex et al., 2021, appendix A.3.)

model_training:
  enabled: true
  writeback:
    schemas: ["harm_mention"]
    include_unlabeled: true
    min_confidence: 0.6

user_config:
  allow_all_users: true
max_annotations_per_user: 10
num_annotators_per_item: 1

Sample Data

json
[
  {
    "id": "raft_001",
    "paper_title": "Learning the Geometry of Wave-Based Imaging",
    "paper_link": "https://proceedings.neurips.cc/paper/2020/file/5e98d23afe19a774d1b2dcbefd5103eb-Paper.pdf",
    "impact_statement": "We do not see any major ethical consequences of this work. Our work has implications in the fields of exploratory imaging — earthquake detection, medical imaging etc. Our work improves the quality and reliability of imaging in these fields. Improving these fields has direct societal impact in finding new natural preserves, improved diagnosis in healthcare etc. A failure of our system leaves machine learning unreliable in exploratory imaging. Our method provides strong out-of-distribution generalization and hence is not biased according to the data.",
    "raft_train_id": 2,
    "released_label": "doesn't mention a harmful application"
  },
  {
    "id": "raft_002",
    "paper_title": "Implicit Neural Representations with Periodic Activation Functions",
    "paper_link": "https://proceedings.neurips.cc/paper/2020/file/53c04118df112c13a8c34b38343b9c10-Paper.pdf",
    "impact_statement": "The proposed SIREN representation enables accurate representations of natural signals, such as images, audio, and video in a deep learning framework. This may be an enabler for downstream tasks involving such signals, such as classification for images or speech-to-text systems for audio. Such applications may be leveraged for both positive and negative ends. SIREN may in the future further enable novel approaches to the generation of such signals. This has potential for misuse in impersonating actors without their consent. For an in-depth discussion of such so-called DeepFakes, we refer the reader to a recent review article on neural rendering [16].",
    "raft_train_id": 13,
    "released_label": "mentions a harmful application"
  }
]

// ... and 8 more items

Dataset & paper

Alex et al., NeurIPS Datasets and Benchmarks 2021

Paper DOI
10.48550/arXiv.2109.14076

Citation (BibTeX)

bibtex
@misc{alex2021raft,
  doi = {10.48550/ARXIV.2109.14076},
  url = {https://arxiv.org/abs/2109.14076},
  author = {Alex, Neel and Lifland, Eli and Tunstall, Lewis and Thakur, Abhishek and Maham, Pegah and Riedel, C. Jess and Hine, Emmie and Ashurst, Carolyn and Sedille, Paul and Carlier, Alexis and Noetel, Michael and Stuhlmüller, Andreas},
  keywords = {Computation and Language (cs.CL), Artificial Intelligence (cs.AI), Machine Learning (cs.LG)},
  title = {RAFT: A Real-World Few-Shot Text Classification Benchmark},
  publisher = {arXiv},
  year = {2021}
}

Details

Annotation Types

radio

Domain

NLPFew-Shot LearningResearch Ethics

Use Cases

Text ClassificationFew-Shot ClassificationImpact Statement Analysis

Tags

raftfew-shotneuripsimpact-statementssetfittext-classificationbenchmark

Found an issue or want to improve this design?

Open an Issue(opens in a new tab)