Skip to content
RAG Repo

Pile of Law gathers legal and administrative text from dozens of public sources into a single, consistently formatted corpus of around 256 GB. It spans court opinions, statutes and regulations, contracts, administrative rulings, and legislative records, drawn mostly from the United States and split into named subsets so you can always see where a document originated. Released in 2022, it was assembled partly as a study of how legal text can be used responsibly to train models.

The corpus lives on the Hugging Face Hub as JSONL, one JSON record per line, so you can stream it with the datasets library or pull only the subsets you need instead of the full 256 GB. That subset structure is genuinely handy: if you want only case law, or only contracts, you load that slice directly. Legal documents run long, so for retrieval, favour structure-aware chunking that splits on sections or paragraphs over fixed-size windows, and carry the subset and source through as metadata so you can filter retrieval by document type.

It makes a sensible first stop for a US legal assistant or a contract-analysis prototype, because the sourcing and cleaning are already handled and you can start measuring retrieval quality before you invest in primary-record pipelines.

Licensing is the main thing to watch. The underlying sources carry different terms, so the licence really does vary by subset, and the dataset card records which applies where. US primary legal texts such as statutes and court opinions are generally free of copyright, but some included material is not, so commercial use is not blanket-safe: check the subset terms before you ship. The text also carries the biases and dated language of the legal record, which matters when your system surfaces it to users.

For live, authoritative lookups you will still want primary sources such as CourtListener or official legislation sites. Pile of Law is the broad, ready- cleaned base you prototype on before that.

legalenglishuspretrainingresearch

Related sources