Berkeley's LOCUS dataset puts 2.2 million U.S. local laws in one searchable corpus

LOCUS scrapes ordinances from 9,239 cities and counties, OCRs messy PDFs cheaply, and ships ModernBERT classifiers for paternalism, opacity, and enforcement discretion. Free on Hugging Face.

SaifullahSaifullah
4 min read
Berkeley's LOCUS dataset puts 2.2 million U.S. local laws in one searchable corpus

Federal statutes get the headlines. Local ordinances govern what you can actually build, rent, license, and noise-test on a Tuesday night. Zoning, short-term rentals, business permits, animal control, parking. All of it lives in city and county codes.

The problem is not secrecy. It is fragmentation. Thousands of vendor portals, PDF exports, and inconsistent formatting. Until now, there was no machine-readable corpus at national scale.

Researchers from UC Berkeley and collaborators just released LOCUS (Local Ordinance Corpus for the United States): roughly 2.2 million ordinance chunks from 9,239 jurisdictions, with labels and scorers you can plug into legal AI pipelines today.

What LOCUS contains

The paper Freeing the Law with LOCUS describes two layers:

LayerScopeUse case
Raw corpus9,239 cities and countiesMaximum coverage, research scale
County-harmonized access2,309 of 3,144 U.S. counties (majority of population)Cleaner county-level queries

The v1 dataset on Hugging Face (LocalLaws/LOCUS-v1) ships 2,211,516 chunk-level rows. Each eligible chunk gets:

  • A function label (legal role of the text)
  • is_substantive (binary filter for real rules vs boilerplate)
  • A topic tag for substantive provisions

That structure matters more than raw token count. Compliance and policy tools need to separate "definitions and recitals" from "you shall not operate after 10pm."

LOCUS pipeline from municipal PDFs through OCR to labeled ordinance chunks

How they solved the PDF mess

Collecting local law meant browser automation and vendor-specific download logic across thousands of sites. Many codes arrive as scanned PDFs or image-heavy exports.

The team ran documents through LightOnOCR-2-1B, a small vision model that reads document images and outputs clean text. Scale from the AlphaSignal coverage and paper context:

MetricApproximate value
Pages processed~7 million
OCR cost (LightOn)~$0.30 per 1,000 pages
AWS Textract comparison~$1.50 per 1,000 pages
Raw PDF storage~80 GB

For legal AI builders, the lesson is economic: specialized small OCR models can unlock corpora that were "public" but unusable at bulk cost.

The four axes Berkeley scored

Beyond chunk labels, researchers trained ModernBERT-based classifiers and scorers on dimensions that rarely get measured at scale:

DimensionWhat it captures
PaternalismHow much the rule controls behavior
OpacityHow hard the text is to understand
Enforcement discretionHow much leeway officials have
SalienceHow much the rule matters in practice

Those scores open research paths that federal corpora never supported. You can ask distributional questions about local governance style, not just retrieve a statute.

What you can build on top

LOCUS is not a finished product. It is infrastructure. Plausible downstream apps:

  1. Municipal compliance checker — "Does this STR listing violate noise ordinances in these ZIP codes?"
  2. Permit prep assistant — Surface licensing sections by topic filter before a contractor visits city hall.
  3. Policy analysis — Compare opacity or discretion scores across counties for housing reform research.
  4. RAG with citations — Chunk-level metadata beats dumping whole PDFs into a vector store.

If you already ship private-data RAG for clients, the pattern is familiar: authoritative source, structured chunks, metadata filters, then generation with citations. LOCUS supplies the authoritative local layer that most teams never had.

# Illustrative load pattern (Hugging Face datasets) from datasets import load_dataset ds = load_dataset("LocalLaws/LOCUS-v1", split="train") # Filter substantive zoning chunks, embed, index substantive = ds.filter(lambda r: r["is_substantive"] and r["topic"] == "zoning")

Swap in your embedding model and vector DB of choice. The dataset is the hard part.

Limits to respect

LOCUS covers publicly available municipal and county codes, not every jurisdiction on equal footing. Vendor gaps, incomplete uploads, and OCR errors still exist. The paper releases coverage metadata so you can audit what is missing before you ship a customer-facing tool.

Also: this is not legal advice. A retrieval stack over LOCUS still needs human review, jurisdiction confirmation, and effective-date handling. Local law changes. Your product needs update pipelines, not a one-time index.

Why this matters for applied AI

Most "legal AI" demos stop at federal case law or generic terms of service. Real operators hit local code first. Building owners, clinics, restaurants, and contractors all live in ordinance land.

LOCUS lowers the data barrier. The remaining work is product: freshness, citation UX, and workflows that fit how people actually ask compliance questions.

If you are exploring RAG over regulated text and want help scoping chunk strategy, evals, and deployment, book a free call. I ship private-knowledge systems for ops teams, not slide-deck demos.

Get the data

Share this post

Related posts