Datasets:
messages listlengths 3 3 | client_id int64 0 4 | task_type stringclasses 3
values | language stringclasses 1
value | example_id stringlengths 16 16 |
|---|---|---|---|---|
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the following Terms of Service clause and list all applicable unfairness categories. If none apply, ... | 2 | multi_label_classification | en | 1f2f68d6829ce7be |
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the legal provision and list the applicable contract clause categories. Provision: Where the followi... | 0 | classification | en | ef551988d1f0e32e |
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the legal provision and list the applicable contract clause categories. Provision: The Agent shall h... | 0 | classification | en | 91ec3ee21c0f8e51 |
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the following U.S. Supreme Court case excerpt and classify it into the correct legal issue area. Exc... | 3 | classification | en | e985ddf32bd60c57 |
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the case excerpt and choose the best holding from the options. Case excerpt: adverse action. Davis v... | 1 | multiple_choice | en | c632bd6ff9992cb9 |
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the legal provision and list the applicable contract clause categories. Provision: Executive agrees ... | 0 | classification | en | 897ad32cb9210d8f |
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the case excerpt and choose the best holding from the options. Case excerpt: economic loss doctrine ... | 1 | multiple_choice | en | 28fe7ba6852b5f1c |
[
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the case excerpt and choose the best holding from the options. Case excerpt: BIA’s decision as the f... | 1 | multiple_choice | en | b6c53c3951723bbf |
[{"role":"system","content":"You are a legal assistant. Answer concisely and accurately. When legal (...TRUNCATED) | 3 | classification | en | cbab96c4bab0125d |
[{"role":"system","content":"You are a legal assistant. Answer concisely and accurately. When legal (...TRUNCATED) | 0 | classification | en | 47ee46e15cd866ef |
Dataset Card for Fed-Legal
Dataset Description
Fed-Legal is an English-only, five-silo, federated supervised fine-tuning (SFT) dataset for legal language tasks. It converts selected legal benchmark datasets into a shared chat-style schema suitable for instruction tuning and federated learning experiments.
Each silo corresponds to a different legal task family or dataset source.
The dataset is intentionally non-IID by construction: each client_id represents a different legal task distribution rather than a random shard of one homogeneous corpus.
Dataset Summary
The dataset is built from:
- LexGLUE / LEDGAR: legal provision classification.
- LexGLUE / CaseHOLD: multiple-choice case holding selection.
- LexGLUE / Unfair-ToS: consumer terms-of-service unfairness classification.
- LexGLUE / SCOTUS: U.S. Supreme Court issue-area classification.
- LegalBench / Contract NLI: contract natural language inference and legal reasoning tasks.
All examples are normalized into chat messages with a system prompt, user instruction, and assistant answer.
The output dataset contains global train, valid, and test splits created by concatenating each client's per-silo split.
Source Datasets
This dataset is derived from the following Hugging Face datasets:
This dataset is a reformatted and federated derivative intended for legal SFT and federated learning research.
Languages
- English (
en)
Dataset Structure
Data Instances
Each row contains one chat-style supervised example:
{
"messages": [
{
"role": "system",
"content": "You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts."
},
{
"role": "user",
"content": "Read the legal text and complete the requested legal classification task..."
},
{
"role": "assistant",
"content": "The target label or answer."
}
],
"client_id": 0,
"task_type": "classification",
"language": "en",
"example_id": "deterministic_hash_or_source_id"
}
Data Fields
messages: a list of chat messages, each with:role: one ofsystem,user, orassistant.content: message text.
client_id: integer silo identifier in{0, 1, 2, 3, 4}.task_type: task family. Values include:classificationmultiple_choicemulti_label_classification
language: language code; alwaysen.example_id: deterministic identifier generated from the source ID when available, otherwise from hashed message content.
Data Splits
The dataset contains three global splits:
| Split | Description |
|---|---|
train |
Concatenation of each client's 90% training partition |
valid |
Concatenation of each client's 5% validation partition |
test |
Concatenation of each client's 5% test partition |
Splitting is performed independently for each client/silo. The validation and test splits are therefore balanced at the client level by construction, not globally stratified by label.
Federated Silos
client_id |
Source | Configuration(s) | Task | Sampling |
|---|---|---|---|---|
| 0 | LexGLUE | ledgar |
Legal provision classification | 50% |
| 1 | LexGLUE | case_hold |
Multiple-choice case holding selection | 50% |
| 2 | LexGLUE | unfair_tos |
Consumer ToS unfairness multi-label classification | 100% |
| 3 | LexGLUE | scotus |
U.S. Supreme Court issue-area classification | 100% |
| 4 | LegalBench | merged contract_nli_* configurations |
Contract NLI / legal reasoning | 100% |
The LegalBench silo merges the following configurations:
contract_nli_confidentiality_of_agreementcontract_nli_limited_usecontract_nli_no_licensingcontract_nli_notice_on_compelled_disclosurecontract_nli_sharing_with_employeescontract_nli_sharing_with_third-partiescontract_nli_survival_of_obligations
Dataset Creation
Curation Rationale
Fed-Legal was created to support federated learning and instruction-tuning experiments in the legal domain. Instead of randomly partitioning a single dataset, this dataset uses task-defined silos so that each client has a distinct distribution, reflecting a common federated learning challenge: heterogeneous local data.
Source Data
The dataset is generated programmatically from public Hugging Face datasets.
For each configured silo, all available upstream splits are merged, transformed into chat-style SFT records, deduplicated by example_id, optionally downsampled, and then split into train, valid, and test partitions.
Data Processing
Processing steps include:
- Load the configured upstream datasets.
- Merge all upstream splits for each source configuration.
- Convert task-specific examples into a common
messagesschema. - Deduplicate records by
example_id. - Apply deterministic downsampling for selected large silos:
- LEDGAR: 50%
- CaseHOLD: 50%
- Split each client into:
- 90% train
- 5% validation
- 5% test
- Concatenate per-client partitions into global
train,valid, andtestsplits.
System Prompt
All examples use the following system prompt:
You are a legal assistant. Answer concisely and accurately. When legal text is provided, rely on it and do not invent facts.
Intended Uses
This dataset is intended for:
- federated supervised fine-tuning research;
- benchmarking non-IID legal-domain federated learning methods;
- legal instruction-following experiments;
- multi-task legal classification and reasoning experiments;
- evaluating cross-silo generalization across heterogeneous legal tasks.
Out-of-Scope Uses
This dataset should not be used as a substitute for professional legal advice. Models trained on this dataset may produce incorrect or incomplete legal analysis. Any use in real legal workflows should include expert review and appropriate safeguards.
Considerations for Using the Data
Legal and Ethical Considerations
The examples are derived from legal benchmark datasets and may reflect legal systems, jurisdictions, annotations, and task assumptions from the upstream sources.
Biases and Limitations
- The dataset is English-only.
- The silos are task-defined and may not correspond to real organizations, clients, law firms, or courts.
- Label spaces differ across clients, so global label stratification is not meaningful.
- The dataset is designed for supervised fine-tuning and evaluation, not legal advice generation.
- Some upstream datasets may focus heavily on U.S. law or contract-law tasks.
Loading the Dataset
from datasets import load_dataset
ds = load_dataset("flwrlabs/fed-legal")
print(ds)
print(ds["train"][0])
To filter a specific federated client:
from flwr_datasets import FederatedDataset
from flwr_datasets.partitioner import NaturalIdPartitioner
fds = FederatedDataset(
dataset="flwrlabs/fed-legal",
partitioners={"train": NaturalIdPartitioner(partition_by="client_id")},
)
partition = fds.load_partition(partition_id=0)
Citation
Please cite the upstream datasets and associated papers when using this derivative dataset. If you're using this dataset with Flower Datasets, you can cite Flower.
@inproceedings{chalkidis2022lexglue,
title={LexGLUE: A benchmark dataset for legal language understanding in English},
author={Chalkidis, Ilias and Jana, Abhik and Hartung, Dirk and Bommarito, Michael and Androutsopoulos, Ion and Katz, Daniel and Aletras, Nikolaos},
booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
pages={4310--4330},
year={2022}
}
@article{guha2023legalbench,
title={Legalbench: A collaboratively built benchmark for measuring legal reasoning in large language models},
author={Guha, Neel and Nyarko, Julian and Ho, Daniel and R{\'e}, Christopher and Chilton, Adam and Chohlas-Wood, Alex and Peters, Austin and Waldon, Brandon and Rockmore, Daniel and Zambrano, Diego and others},
journal={Advances in neural information processing systems},
volume={36},
pages={44123--44279},
year={2023}
}
@article{DBLP:journals/corr/abs-2007-14390,
author = {Daniel J. Beutel and
Taner Topal and
Akhil Mathur and
Xinchi Qiu and
Titouan Parcollet and
Nicholas D. Lane},
title = {Flower: {A} Friendly Federated Learning Research Framework},
journal = {CoRR},
volume = {abs/2007.14390},
year = {2020},
url = {https://arxiv.org/abs/2007.14390},
eprinttype = {arXiv},
eprint = {2007.14390},
timestamp = {Mon, 03 Aug 2020 14:32:13 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2007-14390.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
Dataset Card Contact
In case of any doubts, please contact Flower Labs.
- Downloads last month
- 57