LegalBench.PT is the first comprehensive legal benchmark specifically designed for the European Portuguese context. It assesses large language models' legal knowledge and reasoning abilities across key areas of the Portuguese law.
馃搫 Paper: https://arxiv.org/abs/2502.16357
馃 Dataset: https://huggingface.co/datasets/BeatrizCanaverde/LegalBench.PT
LegalBench.PT provides a rigorous evaluation framework that:
- Covers 31 fields of law, grouped into 5 main/broader areas
- Includes 6 diverse question types that allow for an automated evaluation:
- Multiple-Choice: Questions with only one correct option
- Cloze Tasks: Fill-in-the-blank exercises formulated as multiple-choice
- Case Analysis: Multiple-choice questions. The difference from the former type is solely related to the exam questions used to create them. Case analysis questions were created from theoretical exercises, while multiple-choice were created from practical problems.
- True/False: Classification of statements as either "True" or "False"
- Multiple Selection: Multiple-choice questions where more than one option can be correct
- Matching Questions: Require respondents to pair items from two columns
Install the required dependencies:
pip install -r requirements.txt
Run your model on LegalBench.PT to generate predictions:
python generation.py \
--model_path <path_to_your_model> \
--max_len 1000 \
--temperature 0.001 \
--output_path <path_to_save_predictions.jsonl> \
--seed 42
max_len, temperature, and seed can be omitted above.
Evaluate the generated predictions against the ground truth:
python evaluation.py evaluate_model_answers \
--input_path <folder_path_with_predictions> \
--output_path <folder_path_to_save_evaluations>
Calculate aggregate scores across all evaluations:
python evaluation.py compute_model_scores \
--input_path <folder_path_to_save_evaluations> \
--output_path <folder_path_to_save_aggregated_scores>
Please cite the following paper if you use LegalBench.PT in your work:
@misc{canaverde2025legalbenchptbenchmarkportugueselaw,
title={LegalBench.PT: A Benchmark for Portuguese Law},
author={Beatriz Canaverde and Telmo Pessoa Pires and Leonor Melo Ribeiro and Andr茅 F. T. Martins},
year={2025},
eprint={2502.16357},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={},
}