Source-linked AI summary

Pile of Law: Learning Responsible Data Filtering from the Law and a 256GB Open-Source Legal Dataset

Peter Henderson, Mark S. Krass, Lucia Zheng, Neel Guha, Christopher D. Manning, Dan Jurafsky, Daniel E. Ho

arXiv:2207.00220v2cs.CLcs.CY

TL;DR

Large-language-model training faces difficult privacy and toxicity-filtering choices because harmfulness and privacy depend on context. The paper addresses this gap by releasing the Pile of Law, extracting legal filtering norms, and learning sanitization rules from the dataset; it reports that these materials enable new filtering research, while current filters remain limited in robustness and value alignment.

  • Problem

    Filtering pretraining data for private and toxic content is difficult because existing practices are uneven and content judgments depend heavily on context.

  • Method

    The paper releases the Pile of Law, surveys legal and administrative filtering norms, and uses the dataset to learn implicit sanitization rules.

  • Results

    The Pile of Law supports contextual privacy-rule prediction and reveals disagreement and instability among toxicity filters across tools, time, and context.

  • Takeaways & Limitations

    Legal standards and legal data provide a basis for developing more nuanced, context-sensitive filtering mechanisms for language-model pretraining.

  • Takeaways & Limitations

    The demonstrated filters likely require additional work before applying reliably to significantly out-of-domain data, and existing filters may not be robust or value-aligned.

Abstract

from arXiv · show

One concern with the rise of large language models lies with their potential for significant harm, particularly from pretraining on biased, obscene, copyrighted, and private information. Emerging ethical approaches have attempted to filter pretraining material, but such approaches have been ad hoc and failed to take context into account. We offer an approach to filtering grounded in law, which has directly addressed the tradeoffs in filtering material. First, we gather and make available the Pile of Law, a 256GB (and growing) dataset of open-source English-language legal and administrative data, covering court opinions, contracts, administrative rules, and legislative records. Pretraining on the Pile of Law may help with legal tasks that have the promise to improve access to justice. Second, we distill the legal norms that governments have developed to constrain the inclusion of toxic or private content into actionable lessons for researchers and discuss how our dataset reflects these norms. Third, we show how the Pile of Law offers researchers the opportunity to learn such filtering rules directly from the data, providing an exciting new research direction in model-based processing.

1 Introduction

Large-language-model pretraining data contains private and toxic content, but filtering remains uneven because harmfulness and privacy are deeply contextual and filtering entails trade-offs. The paper proposes grounding filtering mechanisms in legal and administrative standards.

  • Filtering practices vary widely because reliable, transparent filtering at scale is difficult and context-dependent.Whether content is toxic or private can depend on speakers, readers, sharing expectations, and country-specific privacy norms.
  • Toxicity and privacy filtering can create trade-offs involving representation, downstream bias, and application accuracy.The paper cites possible effects on dataset representation and downstream outputs, as well as errors associated with broad privacy filtering.
  • Legal and administrative actors have developed standards for balancing open-source transparency against potential harms.
  • The paper curates the ∼256GB Pile of Law, catalogs legal norms, and demonstrates learning implicit sanitization rules from the data.It presents the dataset as an exploratory tool for evaluating data-processing mechanisms and future filtering research.

2 Pile of Law

The Pile of Law is an open-source legal and administrative dataset assembled at scale to represent varied filtering norms and support legal-domain language-model research. Its scope is broad, but the paper focuses on U.S. legal standards and acknowledges possible sensitive material.

  • The dataset contains ∼256GB of legal and administrative text for studying filtering norms and pretraining legal-domain language models.Its stated utility is both aggregating sources with different legal standards and supporting future access-to-justice initiatives.
  • Pile of Law compiles material from 35 sources, including court documents, government publications, contracts, statutes, regulations, and casebooks.
  • The underlying content is public and mostly permissively licensed, but its implicit legal filters may not remove all sensitive material.
  • An initial BERT-large equivalent trained on Pile of Law achieved results comparable to smaller, highly context-specific legal models.
  • The paper focuses on the U.S. legal system because of the authors’ expertise and data availability.

3 What Can the Law Teach Us About Content Filtering?

The paper surveys how legal systems balance privacy and transparency, arguing that these context-sensitive norms can inform filtering for language-model training. It also examines how legal materials encode differing approaches to privacy and toxicity.

  • Privacy: Baseline redactions widely protect minors, financial account numbers, dates of birth, and identity numbers across jurisdictions.These bright-line protections are directly applicable to text corpora.
  • Privacy: Privacy norms diverge across value systems: U.S., Chinese, and Canadian courts generally disclose ordinary civil litigants’ names, unlike German courts.Criminal-record access and expungement practices also differ substantially across these jurisdictions.
  • Privacy: Legal and administrative filtering decisions balance privacy against transparency, often using context-sensitive judgments rather than uniform rules.Agencies may protect immigration and disability applications, while courts consider public availability and extenuating circumstances.
  • Implications for Pile of Law: Pile of Law subsets already embody jurisdiction-specific privacy norms, while further filtering could align the full dataset with one subset’s standards.The dataset’s legal sources therefore provide examples of existing privacy-filtering practices.
  • Toxicity: The paper distinguishes toxic-speech definitions ranging from intentional insults to implicit prejudice or any profanity, producing different treatment of quoted language.An intent-based rule may permit a profane quotation, whereas a profanity-based rule may classify it as toxic.
  • Implications for Pile of Law: In the corpus, explicit offensive terms are often quotations, mentions, or historical material, but implicit bias and offensive stereotyping remain difficult to quantify.The paper also notes that elected officials are not bound by the same professional norms as attorneys.

4 What Can We Learn from Legal Text?

The Pile of Law encodes contextual privacy and toxicity judgments that models can learn, but experiments reveal disagreement, value misalignment, and sensitivity to document context. These findings support more nuanced filtering rather than uniform automated removal.

  • Privacy rules: The Pile of Law contains contextual privacy decisions that can support learning nuanced filtering recommendations.The authors use legal examples to model when pseudonymity or name removal is appropriate.
  • Privacy rules: A distill-BERT model achieved ∼80% F1 predicting pseudonymity in immigration-court paragraphs.Perturbations involving asylum or torture were more likely to trigger pseudonymity predictions.
  • Privacy rules: Causal lexicon terms associated with pseudonymity clustered around asylum, mental competency, immigration status, and criminal proceedings.The analysis also found general legal language, suggesting residual confounding and a need for further causal-attribution research.
  • Toxicity filtering: The authors identify disagreement, value misalignment, and document-length sensitivity as central challenges for toxicity filtering.They conclude that more robust, value-aligned filters are needed for long-document and out-of-distribution settings.
  • Toxicity filtering: Toxicity filters often disagree and may encode different concepts of toxicity, especially for historical and civil-rights cases.The filters’ low sentence-level agreement and divergent treatment of quoted racist laws illustrate the risk of deleting legally important material.
  • Toxicity filtering: Longer context reduced toxicity scores by 55-57% (absolute, 95% CI) for sentences initially labeled toxic by Toxigen.The result shows that filtering outcomes can change substantially with the context window.

5 Conclusion

The paper argues that law and legal data can inform responsible data-filtering practices for large language model training, while providing the Pile of Law and identifying directions for future research.

  • The paper examines how law and legal data can inform data-filtering practices for responsible large language model training.
  • The Pile of Law is presented as an extensive legal dataset supporting this research agenda.
  • The paper illustrates new research directions for future work in responsible language-model data processing.

Checklist

The paper reports compliance with the listed NeurIPS ethics and reproducibility requirements, including disclosure of limitations, societal impacts, data practices, and experimental details.

  • The authors report that the paper’s claims, limitations, and potential negative societal impacts are addressed.
  • The authors report providing code, data, training details, error bars, and compute information for experimental reproducibility.
  • The paper reports citing existing assets, identifying licenses, and discussing consent, personally identifiable information, and offensive content.
  • The appendix limits its checklist discussion to the nine points explicitly mentioned in the 2022 NeurIPS Ethical Guidelines.

1. Does the data contain any personally identifiable information or sensitive personally identifiable information?

The dataset contains personally identifiable information and potentially sensitive or offensive material, while the paper describes jurisdiction-specific privacy norms, filtering mechanisms, and reasons for preserving contextual legal content.

  • The dataset contains personally identifiable information because documents generally follow the privacy norms of their originating jurisdictions.
  • The authors follow CourtListener’s approach by filtering SSNs and providing stakeholder takedown mechanisms.
  • The authors do not redact further because noisy anonymization could remove factual information or legal citations and undermine source accuracy.
  • The dataset remains largely unfiltered beyond the described mechanisms, partly because upstream licenses may prohibit additional restrictions on use.
  • The data may contain biased, toxic, violent, or otherwise sensitive content, including material describing discriminatory legal regimes and criminal-case facts.
  • Public legal materials are retained because they reflect governmental decisions and may remain important for understanding civil rights law.

B Limitations

Licensing restrictions concentrate the judicial portion of the dataset on U.S. texts, while the experiments are demonstrative and may require further work for substantially out-of-domain data.

  • Licensing restrictions make the judicial collection predominantly U.S.-focused, despite inclusion of some international sources.
  • The authors encourage future efforts to improve the geographic coverage of freely available English-language legal texts.
  • The experiments are demonstrative and intended to set a research agenda rather than provide a comprehensive evaluation.
  • The learned filters may require more work to apply to significantly out-of-domain data, although perturbation analysis shows some robustness.

C Carbon Impact Statement

The paper estimates the energy and carbon impacts of its experiments, while noting that precise emissions could not be calculated from hardware counters.

  • The BERT experiments used roughly 8 weeks of RDU usage at full capacity across 8 RDUs.This estimate includes debugging, hyperparameter optimization, and experimental iterations.

D Code and Data Availability

The authors provide trained model checkpoints and experiment data through Hugging Face, and release experiment and data-collection code on GitHub.

  • The main Pile of Law BERT checkpoint and an additional checkpoint with a different random seed are available on Hugging Face.Intermediate checkpoints are available on request.
  • Experiment and data-collection code, including preprocessing code, will be available on GitHub.The authors do not provide pretraining code because they used SambaNova’s out-of-the-box pretraining tool without modifications beyond preprocessing.

E Pile of Law Data Description

The Pile of Law aggregates diverse legal and administrative sources, including opinions, filings, agency decisions, regulations, legislative materials, contracts, and historical legal texts.

  • Organization: The data description groups the curated sources by logical similarity.The dataset includes the source categories described throughout the section.
  • Legal case opinions and filings: The dataset includes U.S. and international court opinions, docket entries, filings, and administrative decisions.Sources include CourtListener, ECHR, Canadian appellate courts, the Supreme Court, BVA, FTC, NLRB, immigration authorities, Tax Court, ECAB, OLC, and Inspector General reports.
  • Statutes and regulations: The corpus contains U.S. statutes, regulations, procedural rules, proposed bills, and Federal Register materials.These sources support learning statutory and regulatory construction.
  • International and historical materials: The dataset also includes founders’ letters, world constitutions, and European Union legal documents.These additions provide historical, constitutional, European, and international legal context.
  • Contracts: Contract-oriented sources include credit card agreements, terms of service, Edgar Contracts, and Atticus Contracts.These materials may support contract-based machine-learning tasks such as contract review.

F Models

The authors train an initial BERT-large model on a 30GB sample of the Pile of Law using customized preprocessing and stable distributed training choices. The model does not significantly outperform a smaller, highly in-domain case-law baseline on CaseHOLD, while matching prior reported performance and improving over BERT-Large.

  • Training setup: The authors train an initial BERT-large baseline from scratch using SambaNova’s Dataflow-as-a-Service platform and customized preprocessing.The training platform uses RDU chips optimized for data-intensive transformer workflows.
  • Training setup: A 29k-token WordPiece vocabulary is supplemented with legal terms from Black’s Law Dictionary for a 32k-token vocabulary.The vocabulary is fit to the Pile of Law training split.
  • Training setup: The model uses RoBERTa-style pretraining with 512-token sequences, 80-10-10 masking, replication rate 20, and LexNLP sentence segmentation.Sentences are combined until they comprise 256 tokens before sequence construction.
  • Training setup: The training sample is a randomly generated ∼30GB subset sampled evenly across Pile of Law data sources.Some subsets are included in full while others contribute only a small portion of their data.
  • Training setup: 5e-6 learning rate and batch size 128 yielded stable training after shuffled data failed to converge reliably.The model trained for roughly two weeks to 1.7M timesteps, with data sources distributed evenly across shards.
  • Results: The Pile of Law model does not significantly outperform a BERT-base model trained exclusively on case law with a highly in-domain vocabulary on CaseHOLD.The authors report roughly the same performance as prior work and improvement over a BERT-Large model.
  • Interpretation: The authors suggest that vocabulary, pretraining duration, and data selection may influence adaptation, and identify the BERT-large model as an initial baseline.They did not complete a full epoch over the data.

G Copyright

The Pile of Law is largely public-domain or permissively licensed, but several sources may contain copyrighted or ambiguously licensed material. Users seeking maximum caution can omit the affected subsets.

  • Most Pile of Law subsets are public domain or under permissive licenses, but CourtListener docket entries may include copyrighted exhibits submitted to courts.Attorneys may have submitted copyrighted material as exhibits in docket entries.
  • Several third-party or publicly available sources have uncertain underlying licensing despite being distributed under Creative Commons or without a stated license.This includes advice forums, contracts, bar-exam outlines, and Terms of Service contracts.
  • Users who want to be extremely cautious may omit subsets with uncertain licensing, although the paper characterizes their infringement risk as low and invokes fair-use standards in the United States.

H Experiment Details

The experiments construct privacy labels from EOIR opinions and examine toxicity across dated Supreme Court opinions using multiple filters. The analyses include contextual effects, model agreement, and qualitative examples from the legal dataset.

  • EOIR Privacy: EOIR opinions are split into paragraphs, references to respondents are masked, and regex extraction identifies whether each opinion uses a pseudonym.
  • EOIR Privacy: A DistilBERT model predicts whether masked EOIR paragraphs should be pseudonymized, using labels derived from the extracted pseudonym status.The masked and labeled dataset and the fine-tuned model are released through Hugging Face.
  • EOIR Privacy: The EOIR privacy analysis includes a causal lexicon manually sorted by topic with contextual information, while controlling for year.
  • Toxicity Experiments: For toxicity experiments, Supreme Court opinion text is associated with dates using Harvard Case Law Access Project metadata.
  • Toxicity Experiments: For each Supreme Court opinion since 1875, the experiments select the 97.5th-percentile toxicity sentence for each of four filters and average those scores by issue type and year.The 2.5% most extreme cases are excluded to reduce sampling variability.
  • Toxicity Results: Toxicity scores rise around the late-1940s Civil Rights Era despite cases containing highly toxic sentences that helped dismantle official segregation; Brown v. Board of Education received .535 from Perspective API at the 97.5th percentile.
Loading 2207.00220v2…