--- license: cc-by-sa-4.0 language: - pt task_categories: - question-answering - text-classification - multiple-choice size_categories: - 1K **Goal:** provide a reproducible evaluation suite for Brazilian legal NLP and for open legal language models trained or adapted to Brazilian Law. Dataset repository: --- ## Why LegalBench.BR? Most legal benchmarks for LLMs are centered on foreign jurisdictions, especially common-law systems, or on legal tasks in English. Brazilian Law has its own legal sources, terminology, procedures, institutions, and exam formats. A model that performs well on general legal benchmarks may still fail when asked to reason about Brazilian statutes, legal areas, bar-exam-style questions, or court excerpts. LegalBench.BR was created to help evaluate models under conditions closer to Brazilian legal practice, including: - multiple-choice legal questions; - classification of court excerpts by legal area; - binary legal entailment over factual-legal scenarios; - closed-book recall of legal provisions; - Brazilian Portuguese legal language; - tasks inspired by statutes, case law, legal education, and practical legal reasoning. --- ## Dataset Summary LegalBench.BR contains **1,000 prompts** distributed across **15 areas of Brazilian Law** and **4 task families**. | Task family | Type value | Instances | Main skill evaluated | |---|---:|---:|---| | Multiple-choice legal QA | `multiple_choice_qa` | 443 | Legal knowledge and application to cases | | Legal-area classification | `text_classification` | 285 | Classification of court excerpts into legal areas | | Binary legal entailment | `binary_entailment` | 200 | Whether a legal conclusion follows from a factual-legal statement | | Closed-book rule recall | `closed_book_qa` | 72 | Recall of the exact legal provision/article from its text | The benchmark is intended for **evaluation**, not model training. --- ## Legal Areas The dataset covers the following areas: - Direito Administrativo - Direito Ambiental - Direito Civil - Direito Constitucional - Direito Constitucional Penal - Direito Eleitoral - Direito Empresarial - Direito Internacional - Direito Penal - Direito Previdenciário - Direito Processual Civil - Direito Processual Penal - Direito Trabalhista / Direito do Trabalho - Direito Tributário - Ética Profissional Minor label variants may appear in the dataset, such as `Direito Trabalhista` and `Direito do Trabalho`. --- ## Task Families ### 1. Multiple-Choice Legal Question Answering (`multiple_choice_qa`) The model receives a legal question and several alternatives, only one of which is correct. This task evaluates whether the model can identify concepts, principles, legal instruments, and solutions to short Brazilian legal problems. Example: ```text Question: Qual princípio constitucional está relacionado à proibição do retrocesso social? Alternatives: a) Princípio da razoabilidade b) Princípio da dignidade da pessoa humana c) Princípio da vedação ao retrocesso d) Princípio da eficiência Answer: c ``` This task includes both conceptual questions and applied case-style questions. --- ### 2. Legal-Area Classification (`text_classification`) The model receives a short excerpt from a Brazilian court decision and must classify it into one legal area. The excerpts were collected from decisions of Brazilian superior courts, especially STF and STJ, when the source material contained a single official legal-area label. Multi-label decisions were excluded to preserve a single-label classification setup. Example: ```text Question: A qual área do direito brasileiro pertence esta jurisprudência do STJ? Excerpt: RECURSO EM MANDADO DE SEGURANÇA. ICMS-DIFAL. ILEGITIMIDADE PASSIVA DA AUTORIDADE COATORA... Alternatives: a) Direito Administrativo b) Direito Civil c) Direito Constitucional ... j) Direito Tributário Answer: Direito Tributário ``` Before inclusion, labels that would reveal the answer inside the excerpt were removed from the prompt text. --- ### 3. Binary Legal Entailment (`binary_entailment`) The model receives a short factual-legal scenario and a legal hypothesis. It must decide whether the hypothesis is **true** or **false** in light of the scenario. Example: ```text Area: Direito Civil Statement: Lucas, com 16 anos e emancipado pelos pais, celebrou contrato de locação residencial sem a presença ou autorização de seus pais ou responsáveis legais. Hypothesis: O contrato de locação residencial celebrado por Lucas é válido e plenamente eficaz, considerando sua condição de emancipado. Task: Esta hipótese é verdadeira ou falsa? Answer: verdadeira ``` This task evaluates legal inference and the ability to apply rules to concrete facts. --- ### 4. Closed-Book Rule Recall (`closed_book_qa`) The model receives the text of a legal provision and must identify the corresponding legal article or reference without retrieval. Example: ```text Question: Qual é o artigo da Constituição Brasileira de 1988 com o texto: "É vedado aos Estados, ao Distrito Federal e aos Municípios estabelecer diferença tributária entre bens e serviços, de qualquer natureza, em razão de sua procedência ou destino."? Answer: Art. 152, CF/88 ``` This task evaluates memorized legal knowledge and susceptibility to hallucinated legal citations. The closed-book subset covers provisions from: | Legal source | Abbreviation | |---|---| | Constituição da República Federativa do Brasil de 1988 | CF/88 | | Código Civil, Lei 10.406/2002 | CC | | Código Penal, Decreto-Lei 2.848/1940 | CP | | Código de Processo Civil, Lei 13.105/2015 | CPC | | Código Tributário Nacional, Lei 5.172/1966 | CTN | | Consolidação das Leis do Trabalho, Decreto-Lei 5.452/1943 | CLT | | Código Florestal, Lei 12.651/2012 | CFlo | | Lei de Licitações e Contratos Administrativos, Lei 14.133/2021 | NLLCA | --- ## Dataset Structure Each example contains the following fields: | Field | Description | |---|---| | `id` | Unique example identifier | | `type` | Task type: `multiple_choice_qa`, `text_classification`, `binary_entailment`, or `closed_book_qa` | | `legal_area` | Area of Brazilian Law associated with the example | | `messages` | Chat-completion formatted messages, usually with `system` and `user` roles | | `answer` | Gold answer: alternative letter, class label, boolean string, or legal article reference | Example schema: ```json { "id": "civil_001", "type": "binary_entailment", "legal_area": "Direito Civil", "messages": [ { "role": "system", "content": "Você é um avaliador jurídico especializado em Direito Brasileiro." }, { "role": "user", "content": "..." } ], "answer": "verdadeira" } ``` --- ## Loading the Dataset ```python from datasets import load_dataset dataset = load_dataset("celsowm/legalbench.br", split="train") print(dataset[0]) ``` Using pandas: ```python from datasets import load_dataset df = load_dataset("celsowm/legalbench.br", split="train").to_pandas() print(df.head()) ``` Filtering by task: ```python mcqa = dataset.filter(lambda x: x["type"] == "multiple_choice_qa") entailment = dataset.filter(lambda x: x["type"] == "binary_entailment") classification = dataset.filter(lambda x: x["type"] == "text_classification") closed_book = dataset.filter(lambda x: x["type"] == "closed_book_qa") ``` --- ## Suggested Evaluation Protocol LegalBench.BR is designed for deterministic or low-temperature evaluation. Recommended generation settings: ```text temperature = 0.0 top_p = 1.0 max_new_tokens = 128 ``` For multiple-choice tasks, models should output only the selected alternative, such as: ```text c ``` For binary entailment tasks, models should output: ```text verdadeira ``` or ```text falsa ``` For legal-area classification tasks, models should output the target legal area. For closed-book rule-recall tasks, models should output the article reference, such as: ```text Art. 152, CF/88 ``` --- ## Metrics Recommended metrics by task: | Task | Primary metric | Optional metrics | |---|---|---| | `multiple_choice_qa` | Accuracy | Exact match, normalized accuracy | | `text_classification` | Accuracy | Macro-F1, per-area F1 | | `binary_entailment` | Accuracy | Precision, recall, F1 | | `closed_book_qa` | Exact Match | Normalized exact match, citation error rate | For model papers, we recommend reporting: - overall score; - score by task family; - score by legal area; - error analysis for hallucinated or unsupported legal references; - comparison against the base model when evaluating a fine-tuned model. --- ## Data Creation and Review LegalBench.BR combines synthetic legal tasks and excerpts from Brazilian legal material. The synthetic questions were designed to evaluate legal reasoning, conceptual understanding, and rule application in Brazilian Law. The court-excerpt classification subset uses real judicial text excerpts, with answer-leaking labels removed from the prompt. Synthetic instances underwent legal review to verify: - correctness of the legal answer; - clarity of the statement or question; - plausibility of alternatives and distractors; - consistency with Brazilian legal terminology; - absence of misleading or unsupported answer keys. During review, approximately **15%** of the synthetic questions required correction, such as answer-key fixes, terminology adjustments, or rewriting for greater legal fidelity. --- ## Intended Uses LegalBench.BR is intended for: - evaluating LLMs on Brazilian legal tasks; - comparing base and fine-tuned legal language models; - measuring legal-area classification performance; - testing rule recall and citation accuracy; - studying hallucination risks in Brazilian legal contexts; - benchmarking open and proprietary models under a common protocol. --- ## Out-of-Scope Uses LegalBench.BR should not be used as: - a substitute for professional legal advice; - a source of authoritative legal interpretation; - a training set for models that will later be evaluated on the same benchmark without proper disclosure; - a basis for automated legal decision-making affecting rights or obligations. --- ## Limitations - Some benchmark instances are synthetic and may not capture the full complexity of real legal practice. - LegalBench.BR is not a complete representation of Brazilian Law. - Closed-book rule recall evaluates memorized legal references and does not replace retrieval-based legal verification. - The dataset may contain label variants and residual imperfections. - Legal norms may change over time; models evaluated on this benchmark should still be checked against current official sources. - The benchmark does not measure all dimensions of legal competence, such as drafting long legal briefs, strategic litigation, or full procedural reasoning. --- ## Relationship to Open-Advogado LegalBench.BR can be used as an evaluation benchmark for Brazilian legal language models, including models trained with the Open-Advogado pipeline and the Legal BR SFT dataset. Related resources: - **LegalBench.BR:** - **Legal BR SFT:** - **Open-Advogado code:** - **qwen3.5-4b-legal-br:** --- ## Citation If you use LegalBench.BR, please cite the dataset and related paper when available. ```bibtex @misc{fontes2026legalbenchbr, title = {LegalBench.BR: A Benchmark for Evaluating Language Models in Brazilian Law}, author = {Fontes, Celso}, year = {2026}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/datasets/celsowm/legalbench.br}}, note = {Dataset for Brazilian legal NLP evaluation} } ``` Suggested citation text: > Fontes, C. (2026). LegalBench.BR: A Benchmark for Evaluating Language Models in Brazilian Law. Hugging Face Dataset. https://huggingface.co/datasets/celsowm/legalbench.br --- ## License This dataset is released under the **Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)** license. See: --- ## Disclaimer LegalBench.BR is a research benchmark. It does not provide legal advice and should not be used as the sole basis for legal decisions. Outputs produced by models evaluated with this benchmark must be independently verified by qualified legal professionals before practical use.