legalbench_old / README.md
pratyushmaini's picture
Upload dataset
ab980ad verified
metadata
license: apache-2.0
task_categories:
  - text-classification
language:
  - en
tags:
  - legal
  - legal-reasoning
  - multiple-choice
configs:
  - config_name: canada_tax_court_outcomes
    data_files:
      - split: train
        path: canada_tax_court_outcomes/train-*
      - split: test
        path: canada_tax_court_outcomes/test-*
  - config_name: citation_prediction_classification
    data_files:
      - split: train
        path: citation_prediction_classification/train-*
      - split: test
        path: citation_prediction_classification/test-*
  - config_name: diversity_3
    data_files:
      - split: train
        path: diversity_3/train-*
      - split: test
        path: diversity_3/test-*
  - config_name: diversity_5
    data_files:
      - split: train
        path: diversity_5/train-*
      - split: test
        path: diversity_5/test-*
  - config_name: diversity_6
    data_files:
      - split: train
        path: diversity_6/train-*
      - split: test
        path: diversity_6/test-*
  - config_name: jcrew_blocker
    data_files:
      - split: train
        path: jcrew_blocker/train-*
      - split: test
        path: jcrew_blocker/test-*
  - config_name: learned_hands_benefits
    data_files:
      - split: train
        path: learned_hands_benefits/train-*
      - split: test
        path: learned_hands_benefits/test-*
  - config_name: maud_ability_to_consummate_concept_is_subject_to_mae_carveouts
    data_files:
      - split: train
        path: maud_ability_to_consummate_concept_is_subject_to_mae_carveouts/train-*
      - split: test
        path: maud_ability_to_consummate_concept_is_subject_to_mae_carveouts/test-*
  - config_name: maud_additional_matching_rights_period_for_modifications_cor
    data_files:
      - split: train
        path: maud_additional_matching_rights_period_for_modifications_cor/train-*
      - split: test
        path: maud_additional_matching_rights_period_for_modifications_cor/test-*
  - config_name: maud_change_in_law_subject_to_disproportionate_impact_modifier
    data_files:
      - split: train
        path: maud_change_in_law_subject_to_disproportionate_impact_modifier/train-*
      - split: test
        path: maud_change_in_law_subject_to_disproportionate_impact_modifier/test-*
  - config_name: >-
      maud_changes_in_gaap_or_other_accounting_principles_subject_to_disproportionate_impact_modifier
    data_files:
      - split: train
        path: >-
          maud_changes_in_gaap_or_other_accounting_principles_subject_to_disproportionate_impact_modifier/train-*
      - split: test
        path: >-
          maud_changes_in_gaap_or_other_accounting_principles_subject_to_disproportionate_impact_modifier/test-*
  - config_name: maud_cor_permitted_in_response_to_intervening_event
    data_files:
      - split: train
        path: maud_cor_permitted_in_response_to_intervening_event/train-*
      - split: test
        path: maud_cor_permitted_in_response_to_intervening_event/test-*
  - config_name: maud_fls_mae_standard
    data_files:
      - split: train
        path: maud_fls_mae_standard/train-*
      - split: test
        path: maud_fls_mae_standard/test-*
  - config_name: maud_includes_consistent_with_past_practice
    data_files:
      - split: train
        path: maud_includes_consistent_with_past_practice/train-*
      - split: test
        path: maud_includes_consistent_with_past_practice/test-*
  - config_name: maud_initial_matching_rights_period_cor
    data_files:
      - split: train
        path: maud_initial_matching_rights_period_cor/train-*
      - split: test
        path: maud_initial_matching_rights_period_cor/test-*
  - config_name: maud_ordinary_course_efforts_standard
    data_files:
      - split: train
        path: maud_ordinary_course_efforts_standard/train-*
      - split: test
        path: maud_ordinary_course_efforts_standard/test-*
  - config_name: >-
      maud_pandemic_or_other_public_health_event_specific_reference_to_pandemic_related_governmental_responses_or_measures
    data_files:
      - split: train
        path: >-
          maud_pandemic_or_other_public_health_event_specific_reference_to_pandemic_related_governmental_responses_or_measures/train-*
      - split: test
        path: >-
          maud_pandemic_or_other_public_health_event_specific_reference_to_pandemic_related_governmental_responses_or_measures/test-*
  - config_name: >-
      maud_pandemic_or_other_public_health_event_subject_to_disproportionate_impact_modifier
    data_files:
      - split: train
        path: >-
          maud_pandemic_or_other_public_health_event_subject_to_disproportionate_impact_modifier/train-*
      - split: test
        path: >-
          maud_pandemic_or_other_public_health_event_subject_to_disproportionate_impact_modifier/test-*
  - config_name: maud_type_of_consideration
    data_files:
      - split: train
        path: maud_type_of_consideration/train-*
      - split: test
        path: maud_type_of_consideration/test-*
  - config_name: personal_jurisdiction
    data_files:
      - split: train
        path: personal_jurisdiction/train-*
      - split: test
        path: personal_jurisdiction/test-*
  - config_name: sara_entailment
    data_files:
      - split: train
        path: sara_entailment/train-*
      - split: test
        path: sara_entailment/test-*
  - config_name: sara_numeric
    data_files:
      - split: train
        path: sara_numeric/train-*
      - split: test
        path: sara_numeric/test-*
  - config_name: supply_chain_disclosure_best_practice_accountability
    data_files:
      - split: train
        path: supply_chain_disclosure_best_practice_accountability/train-*
      - split: test
        path: supply_chain_disclosure_best_practice_accountability/test-*
  - config_name: supply_chain_disclosure_best_practice_certification
    data_files:
      - split: train
        path: supply_chain_disclosure_best_practice_certification/train-*
      - split: test
        path: supply_chain_disclosure_best_practice_certification/test-*
  - config_name: supply_chain_disclosure_best_practice_training
    data_files:
      - split: train
        path: supply_chain_disclosure_best_practice_training/train-*
      - split: test
        path: supply_chain_disclosure_best_practice_training/test-*
  - config_name: telemarketing_sales_rule
    data_files:
      - split: train
        path: telemarketing_sales_rule/train-*
      - split: test
        path: telemarketing_sales_rule/test-*
dataset_info:
  - config_name: canada_tax_court_outcomes
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 7864
        num_examples: 6
      - name: test
        num_bytes: 392042
        num_examples: 244
    download_size: 161532
    dataset_size: 399906
  - config_name: citation_prediction_classification
    features:
      - name: answer
        dtype: string
      - name: citation
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 1471
        num_examples: 2
      - name: test
        num_bytes: 60272
        num_examples: 108
    download_size: 30302
    dataset_size: 61743
  - config_name: diversity_3
    features:
      - name: aic_is_met
        dtype: string
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: parties_are_diverse
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 3040
        num_examples: 6
      - name: test
        num_bytes: 153782
        num_examples: 300
    download_size: 38926
    dataset_size: 156822
  - config_name: diversity_5
    features:
      - name: aic_is_met
        dtype: string
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: parties_are_diverse
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 3520
        num_examples: 6
      - name: test
        num_bytes: 177382
        num_examples: 300
    download_size: 45990
    dataset_size: 180902
  - config_name: diversity_6
    features:
      - name: aic_is_met
        dtype: string
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: parties_are_diverse
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 5087
        num_examples: 6
      - name: test
        num_bytes: 253115
        num_examples: 300
    download_size: 66869
    dataset_size: 258202
  - config_name: jcrew_blocker
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 16657
        num_examples: 6
      - name: test
        num_bytes: 137273
        num_examples: 54
    download_size: 79424
    dataset_size: 153930
  - config_name: learned_hands_benefits
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 17791
        num_examples: 6
      - name: test
        num_bytes: 188795
        num_examples: 66
    download_size: 134816
    dataset_size: 206586
  - config_name: maud_ability_to_consummate_concept_is_subject_to_mae_carveouts
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 10943
        num_examples: 1
      - name: test
        num_bytes: 628674
        num_examples: 69
    download_size: 226362
    dataset_size: 639617
  - config_name: maud_additional_matching_rights_period_for_modifications_cor
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 4807
        num_examples: 1
      - name: test
        num_bytes: 698844
        num_examples: 158
    download_size: 242597
    dataset_size: 703651
  - config_name: maud_change_in_law_subject_to_disproportionate_impact_modifier
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 12303
        num_examples: 1
      - name: test
        num_bytes: 927240
        num_examples: 99
    download_size: 323047
    dataset_size: 939543
  - config_name: >-
      maud_changes_in_gaap_or_other_accounting_principles_subject_to_disproportionate_impact_modifier
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 12331
        num_examples: 1
      - name: test
        num_bytes: 921626
        num_examples: 98
    download_size: 314921
    dataset_size: 933957
  - config_name: maud_cor_permitted_in_response_to_intervening_event
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 5545
        num_examples: 1
      - name: test
        num_bytes: 419104
        num_examples: 100
    download_size: 149850
    dataset_size: 424649
  - config_name: maud_fls_mae_standard
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 9773
        num_examples: 1
      - name: test
        num_bytes: 733140
        num_examples: 77
    download_size: 237744
    dataset_size: 742913
  - config_name: maud_includes_consistent_with_past_practice
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 2551
        num_examples: 1
      - name: test
        num_bytes: 333827
        num_examples: 181
    download_size: 108295
    dataset_size: 336378
  - config_name: maud_initial_matching_rights_period_cor
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 6559
        num_examples: 1
      - name: test
        num_bytes: 698682
        num_examples: 158
    download_size: 249943
    dataset_size: 705241
  - config_name: maud_ordinary_course_efforts_standard
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 2407
        num_examples: 1
      - name: test
        num_bytes: 340523
        num_examples: 181
    download_size: 111087
    dataset_size: 342930
  - config_name: >-
      maud_pandemic_or_other_public_health_event_specific_reference_to_pandemic_related_governmental_responses_or_measures
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 7851
        num_examples: 1
      - name: test
        num_bytes: 932728
        num_examples: 98
    download_size: 331916
    dataset_size: 940579
  - config_name: >-
      maud_pandemic_or_other_public_health_event_subject_to_disproportionate_impact_modifier
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 7790
        num_examples: 1
      - name: test
        num_bytes: 926750
        num_examples: 98
    download_size: 344444
    dataset_size: 934540
  - config_name: maud_type_of_consideration
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 859
        num_examples: 1
      - name: test
        num_bytes: 337302
        num_examples: 172
    download_size: 100428
    dataset_size: 338161
  - config_name: personal_jurisdiction
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: slice
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 4587
        num_examples: 4
      - name: test
        num_bytes: 57966
        num_examples: 50
    download_size: 25202
    dataset_size: 62553
  - config_name: sara_entailment
    features:
      - name: answer
        dtype: string
      - name: case id
        dtype: string
      - name: description
        dtype: string
      - name: index
        dtype: string
      - name: question
        dtype: string
      - name: statute
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 4156
        num_examples: 4
      - name: test
        num_bytes: 362718
        num_examples: 272
    download_size: 118893
    dataset_size: 366874
  - config_name: sara_numeric
    features:
      - name: answer
        dtype: string
      - name: case id
        dtype: string
      - name: description
        dtype: string
      - name: index
        dtype: string
      - name: question
        dtype: string
      - name: statute
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 357847
        num_examples: 4
      - name: test
        num_bytes: 8595263
        num_examples: 96
    download_size: 1133960
    dataset_size: 8953110
  - config_name: supply_chain_disclosure_best_practice_accountability
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 41722
        num_examples: 8
      - name: test
        num_bytes: 2870825
        num_examples: 379
    download_size: 1320868
    dataset_size: 2912547
  - config_name: supply_chain_disclosure_best_practice_certification
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 46104
        num_examples: 8
      - name: test
        num_bytes: 2770224
        num_examples: 378
    download_size: 1303303
    dataset_size: 2816328
  - config_name: supply_chain_disclosure_best_practice_training
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 52370
        num_examples: 8
      - name: test
        num_bytes: 2883341
        num_examples: 379
    download_size: 1325423
    dataset_size: 2935711
  - config_name: telemarketing_sales_rule
    features:
      - name: answer
        dtype: string
      - name: index
        dtype: string
      - name: text
        dtype: string
      - name: input
        dtype: string
    splits:
      - name: train
        num_bytes: 2886
        num_examples: 4
      - name: test
        num_bytes: 39244
        num_examples: 47
    download_size: 19388
    dataset_size: 42130

DatologyAI/legalbench

Overview

This repository contains 26 legal reasoning tasks from LegalBench, processed for easy use in language model evaluation. Each task includes the original data as well as a formatted input column that can be directly fed to models for evaluation.

Task Categories

The tasks are organized into several categories:

Basic Legal Datasets

  • canada_tax_court_outcomes
  • jcrew_blocker
  • learned_hands_benefits
  • telemarketing_sales_rule

Citation Datasets

  • citation_prediction_classification

Diversity Analysis Datasets

  • diversity_3
  • diversity_5
  • diversity_6

Jurisdiction Datasets

  • personal_jurisdiction

SARA Analysis Datasets

  • sara_entailment
  • sara_numeric

Supply Chain Disclosure Datasets

  • supply_chain_disclosure_best_practice_accountability
  • supply_chain_disclosure_best_practice_certification
  • supply_chain_disclosure_best_practice_training

MAUD Contract Analysis Datasets

  • maud_ability_to_consummate_concept_is_subject_to_mae_carveouts
  • maud_additional_matching_rights_period_for_modifications_cor
  • maud_change_in_law_subject_to_disproportionate_impact_modifier
  • maud_changes_in_gaap_or_other_accounting_principles_subject_to_disproportionate_impact_modifier
  • maud_cor_permitted_in_response_to_intervening_event
  • maud_fls_mae_standard
  • maud_includes_consistent_with_past_practice
  • maud_initial_matching_rights_period_cor
  • maud_ordinary_course_efforts_standard
  • maud_pandemic_or_other_public_health_event_subject_to_disproportionate_impact_modifier
  • maud_pandemic_or_other_public_health_event_specific_reference_to_pandemic_related_governmental_responses_or_measures
  • maud_type_of_consideration

Task Details

Task Type Description
canada_tax_court_outcomes multiple_choice INSTRUCTIONS: Indicate whether the following judgment excerpt from a Tax Court of Canada decision...
citation_prediction_classification multiple_choice Can the case can be used as a citation for the provided text?
diversity_3 multiple_choice Diversity jurisdiction exists when there is (1) complete diversity between plaintiffs and defenda...
diversity_5 multiple_choice Diversity jurisdiction exists when there is (1) complete diversity between plaintiffs and defenda...
diversity_6 multiple_choice Diversity jurisdiction exists when there is (1) complete diversity between plaintiffs and defenda...
jcrew_blocker multiple_choice The JCrew Blocker is a provision that typically includes (1) a prohibition on the borrower from t...
learned_hands_benefits multiple_choice Does the post discuss public benefits and social services that people can get from the government...
maud_ability_to_consummate_concept_is_subject_to_mae_carveouts multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_additional_matching_rights_period_for_modifications_cor multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_change_in_law_subject_to_disproportionate_impact_modifier multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_changes_in_gaap_or_other_accounting_principles_subject_to_disproportionate_impact_modifier multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_cor_permitted_in_response_to_intervening_event multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_fls_mae_standard multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_includes_consistent_with_past_practice multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_initial_matching_rights_period_cor multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_ordinary_course_efforts_standard multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_pandemic_or_other_public_health_event_subject_to_disproportionate_impact_modifier multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_pandemic_or_other_public_health_event_specific_reference_to_pandemic_related_governmental_responses_or_measures multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
maud_type_of_consideration multiple_choice Instruction: Read the segment of a merger agreement and answer the multiple-choice question by ch...
personal_jurisdiction multiple_choice There is personal jurisdiction over a defendant in the state where the defendant is domiciled, or...
sara_entailment multiple_choice Determine whether the following statements are entailed under the statute.
sara_numeric regression Answer the following questions.
supply_chain_disclosure_best_practice_accountability multiple_choice Task involving supply chain disclosures
supply_chain_disclosure_best_practice_certification multiple_choice Task involving supply chain disclosures
supply_chain_disclosure_best_practice_training multiple_choice Task involving supply chain disclosures
telemarketing_sales_rule multiple_choice The Telemarketing Sales Rule is provided by 16 C.F.R. § 310.3(a)(1) and 16 C.F.R. § 310.3(a)(2).

Data Format

Each dataset preserves its original columns and adds an input column that contains the formatted prompt ready to be used with language models. The column structure varies by task category:

  • Basic Legal Datasets: answer, index, text, input
  • Citation Datasets: answer, citation, index, text, input
  • Diversity Analysis Datasets: aic_is_met, answer, index, parties_are_diverse, text, input
  • Jurisdiction Datasets: answer, index, slice, text, input
  • SARA Analysis Datasets: answer, case id, description, index, question, statute, text, input
  • Supply Chain Disclosure Datasets: answer, index, text, input
  • MAUD Contract Analysis Datasets: answer, index, text, input

Usage

from datasets import load_dataset

# Load a specific task
task = load_dataset("DatologyAI/legalbench", "canada_tax_court_outcomes")

# Access the formatted input
example = task["test"][0]
print(example["input"])

# Access the correct answer
print(example["answer"])

Model Evaluation Example

from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load model and tokenizer
model_name = "meta-llama/Llama-2-7b-chat-hf"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

# Load a LegalBench task
task_name = "personal_jurisdiction"
dataset = load_dataset("DatologyAI/legalbench", task_name)

# Process an example
example = dataset["test"][0]
input_text = example["input"]

# Generate a response
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(
    inputs["input_ids"], 
    max_new_tokens=10,
    temperature=0.0
)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)

# Check if correct
print(f"Gold answer: {example['answer']}")
print(f"Model response: {response}")

Citation

If you use this dataset, please cite both this repository and the original LegalBench paper:

@misc{legalbench_datology,
  author = {DatologyAI},
  title = {Processed LegalBench Dataset},
  year = {2024},
  publisher = {GitHub},
  url = {https://huggingface.co/DatologyAI/legalbench}
}

@article{guha2023legalbench,
  title={Legalbench: Foundational models for legal reasoning},
  author={Guha, Neel and Gaur, Mayank and Garrido, Georgios and Ji, Fali and Zhang, Spencer and Pathak, Aditi and Arora, Shivam and Teng, Zhaobin and Mao, Chacha and Kornilova, Anastassia and others},
  journal={arXiv preprint arXiv:2308.11462},
  year={2023}
}

License

These datasets are derived from LegalBench and follow the same licensing as the original repository.