A new nationwide corpus unlocks local law for machine use: LOCUS collects ordinances from 9,239 U.S. cities and counties and provides a county-harmonized layer covering 2,309 counties, together with OCR processing, coverage metadata, and trained classifiers to analyze regulatory features such as opacity and paternalism.
Progress in legal AI increasingly depends on access to authoritative legal text at scale. Yet one of the most consequential layers of American law remains largely absent from existing machine-readable corpora: local ordinances. Local codes govern zoning, housing, business licensing, public health, noise, animal control, and many other domains of everyday regulation, but they are fragmented across vendor platforms designed for human browsing rather than bulk research access. We introduce LOCUS - the Local Ordinance Corpus for the United States - a comprehensive corpus and county-harmonized access layer for U.S. municipal and county ordinance codes. The raw corpus, available for release to researchers, represents nearly all publicly available municipal and county ordinance codes. The resulting raw corpus contains codes from 9,239 cities and counties. A smaller county-harmonized LOCUS access layer provides coverage for the largest 2,309 of 3,144 U.S. counties, accounting for a majority of the population. We use OCR to handle the myriad of document formats that have kept the law from being a public resource. We release the corpus with coverage metadata to support reproducibility, downstream legal AI research, and the incremental expansion of machine-readable access to local law. We train a collection of ModernBERT-based classifiers and scorers to facilitate analyzing U.S. local law among several dimensions, such as opacity and paternalism, that have not previously been studied at this scale. LOCUS-v1 and its derivative models are available at: https://huggingface.co/datasets/LocalLaws/LOCUS-v1
Summary
Main Finding
LOCUS (Local Ordinance Corpus for the United States) creates a nationwide, machine‑readable corpus and a county‑harmonized access layer of U.S. municipal and county ordinances, turning fragmented local law into reusable infrastructure for legal AI and empirical research. The release includes OCR’d text, per‑chunk function/topic labels, and continuous scores (opacity, paternalism, enforcement discretion, salience) produced by trained ModernBERT models. LOCUS-v1 covers 9,239 collected codes (∼7M PDF pages) in raw form and provides a county‑harmonized representation for the majority of U.S. population (codes chosen for ~2,309 counties), with annotated metadata and model outputs available to researchers.
Key Points
-
Coverage and scale
- Raw corpus: 9,239 valid PDFs, ≈7 million pages, ≈80 GB.
- Segmented into 2,211,516 text chunks; majority labeled substantive (rules/enforcement).
- County‑harmonized access layer: for each U.S. county choose the longest available local code between county and the county’s largest municipality; yields coverage for the largest ~2,309 of 3,144 counties and covers ≈94% of the U.S. population by their selection rule.
- Additional ∼7,000 documents collected but access restricted (release-to-researchers workflow analogous to MIMIC).
-
Processing pipeline
- OCR: LightOnOCR-2-1B (VLM fine-tuned on PDF pages) converts images to Markdown; pipeline strips headers, merges pages, segments sections.
- Extraction challenges: vendor platforms, nonstandard hosting, anti-bot measures, multi‑county cities — required targeted scraping and manual recovery for self‑hosted codes.
- Cost/scale note: OCR pipeline run on Modal; ≈$0.30 per 1,000 pages.
-
Annotation & models
- Initial labeling: GPT-5.4-nano used as a large-scale annotator for chunk classification (substantivity, function, topic). A subset of hard cases judged with a stronger GPT-5.4 run for validation.
- Classifiers: ModernBERT‑base encoder (≈100M params) trained on 100k GPT-annotated laws (80k train /10k dev /10k eval) to classify function/topic/substantivity and applied at corpus scale.
- Dimensional scorers: For four continuous axes — Enforcement Discretion, Opacity, Paternalism, Problem Salience — authors used 200k pairwise LLM (GPT-5.4-nano) matchups across 10k sampled ordinances to produce TrueSkill rankings; regression regressors (ModernBERT + linear head) were trained to predict z-scored TrueSkill values.
- Scorer performance: Pearson correlations between BERT regressors and TrueSkill on held-out test sets range ~0.82–0.94 across the four dimensions.
-
Release and reproducibility
- LOCUS-v1 and derivative models/datasets available on Hugging Face (LocalLaws/LOCUS-v1).
- Corpus released with coverage metadata to support reproducible research and incremental expansion.
- Design choice: county‑harmonized layer is a deliberately transparent simplification (longest-document proxy) and does not resolve legal hierarchy or controlling authority.
Data & Methods
-
Data collection
- Automated browser tooling + vendor‑specific extraction logic + manual collection for self‑hosted documents.
- Produced a raw archive of 9,239 PDFs (~7M pages) and additional withheld documents for controlled distribution.
-
OCR & preprocessing
- Page-level OCR to Markdown using LightOnOCR-2-1B.
- Artifact removal (repeated headers/footers), page-join heuristics (paragraphs/tables), segmentation into individual ordinance sections.
-
Labeling pipeline
- LLM‑as‑annotator: GPT-5.4-nano for large-scale zero‑shot labeling (function/topic/substantivity); higher-quality GPT-5.4 used for ~5.5% most challenging items.
- Training labels: 100k sampled laws annotated by GPT-5.4-nano; ModernBERT classifiers trained to scale labels across corpus.
-
Dimensional scoring
- Pairwise comparisons: 200k (A vs B) matchups over 10k sampled ordinances; each pair judged in both orders to mitigate order bias.
- Aggregation: TrueSkill used to produce latent continuous scores per ordinance.
- Regression: ModernBERT-base fine-tuned to predict normalized TrueSkill z-scores per axis (train 8k / val 1k / test 1k).
- Evaluation: Pearson correlation between predicted and TrueSkill scores (0.82–0.94).
-
Harmonized access layer
- For each county, compare county code and code of the county’s largest municipality; select the longer code as the representative artifact. This gives a reproducible geographic substrate but does not adjudicate legal primacy.
-
Limitations noted by authors
- Harmonized layer is a pragmatic proxy (length correlates with population but not legal authority).
- Reliance on LLM‑based annotation introduces noise and possible systematic bias; evaluation relies on model agreement and some manual checks.
- OCR and segmentation errors possible given heterogeneous source formats.
- Some jurisdictions remain self‑hosted or restricted; extra documents require controlled access.
Implications for AI Economics
-
New infrastructure for empirical regulatory economics
- LOCUS turns previously fragmented local regulatory text into a national dataset, enabling economists to measure and compare regulation at municipal/county granularity across domains (zoning, licensing, building codes, nuisance rules).
- Researchers can link LOCUS to Census, economic, geographic, and administrative data to estimate effects of local regulation on housing supply, firm entry, wages, firm location, compliance costs, and local public goods provision.
-
Quantifying heterogeneity and regulatory frictions
- The continuous dimensions (opacity, paternalism, enforcement discretion, salience) provide novel, quantifiable features to use as explanatory variables or instruments for causal analysis (e.g., opacity as a proxy for compliance cost or information friction; paternalism scores for consumer‑protection policy intensity).
- Cross‑jurisdictional variation can be exploited for difference‑in‑differences, RD, or synthetic control designs to evaluate local policy impacts.
-
Market and firm strategy implications
- Firms (especially regulated industries: construction, hospitality, short‑term rentals, local retail) can use LOCUS to map regulatory environments and adapt product design or compliance processes, reducing discovery costs and enabling targeted compliance investments.
- Startups and incumbents in legaltech or regulatory data services can build higher‑value products (automated permitting, local compliance checkers) with lower data acquisition costs; this could increase competition and lower service prices.
-
Effects on legal services and labor
- Improved machine access to local law could automate parts of regulatory research, changing demand for routine legal work and increasing the value of higher‑order advisory services (strategic interpretation, litigation).
- Local governments and consultants may face pressure to harmonize or simplify regulations; transparency could shift bargaining and enforcement dynamics.
-
Model training, evaluation, and policy for AI systems
- LOCUS supplies domain data for fine‑tuning legal LLMs, improving retrieval/Q&A over local law and enabling fairness/robustness evaluations that account for jurisdictional variation.
- Economists studying AI markets can use LOCUS to measure model coverage of local law, dataset biases, and the consequences of incomplete local legal data on downstream applications.
-
Cautions and potential negative externalities
- Harmonized simplification: using the longest-code proxy may misrepresent which authority controls on a particular issue; causal inference must account for this measurement error.
- Annotation/OCR noise and LLM‑bias: scores and labels derive from LLM judgments and OCR output; downstream analyses should account for measurement error and validate critical measures with manual review.
- Regulatory arbitrage risk: easier discovery of lenient jurisdictions could incentivize relocation or regulatory shopping; researchers and policymakers should consider spillovers.
- Legal/ethical access constraints: some documents are withheld and require controlled access; researchers must follow release conditions.
-
Practical suggestions for economists
- Link LOCUS records to county and municipality identifiers (FIPS, GEOIDs) and Census covariates to study outcomes like housing starts, rents, firm entry, and local labor markets.
- Use opacity and enforcement‑discretion scores as proxies for administrative burden or enforcement risk in regressions estimating compliance costs or firm behavior.
- Exploit spatial and temporal variation in ordinance text (where available) for quasi‑experimental designs—e.g., before/after local code amendments, or comparing neighboring jurisdictions.
- Validate classifiers/scores on focused samples (manual annotation) when precise legal interpretation matters for identification.
- Consider instrumenting for regulation using political or historical predictors of local code style (e.g., home‑rule prevalence, state preemption patterns) to address endogeneity.
In short, LOCUS materially lowers the data barrier to studying and building systems that depend on local regulation. For AI economists, it is both a new input for measurement and a potential source of insights about how regulatory heterogeneity shapes markets, firms, and the adoption of legal‑AI tools.
Assessment
Claims (10)
| Claim | Direction | Outcome | Confidence & Evidence | Details |
|---|---|---|---|---|
| Progress in legal AI increasingly depends on access to authoritative legal text at scale. Research Productivity | positive | dependence of legal AI progress on large-scale access to authoritative legal text |
Reading fidelity
medium
Study strength
speculative
|
not reported
|
| One of the most consequential layers of American law remains largely absent from existing machine-readable corpora: local ordinances. Research Productivity | negative | presence/absence of local ordinances in existing machine-readable legal corpora |
Reading fidelity
high
Study strength
medium
|
not reported
|
| We introduce LOCUS - the Local Ordinance Corpus for the United States - a comprehensive corpus and county-harmonized access layer for U.S. municipal and county ordinance codes. Research Productivity | positive | existence of a comprehensive corpus and county-harmonized access layer for U.S. local ordinances |
Reading fidelity
high
Study strength
medium
|
not reported
|
| The raw corpus, available for release to researchers, represents nearly all publicly available municipal and county ordinance codes. Adoption Rate | positive | coverage proportion of publicly available municipal and county ordinance codes |
Reading fidelity
medium
Study strength
medium
|
nearly all publicly available municipal and county ordinance codes
|
| The resulting raw corpus contains codes from 9,239 cities and counties. Adoption Rate | positive | number of cities and counties covered in raw corpus |
Reading fidelity
high
Study strength
high
|
n=9239
9,239 cities and counties
|
| A smaller county-harmonized LOCUS access layer provides coverage for the largest 2,309 of 3,144 U.S. counties, accounting for a majority of the population. Adoption Rate | positive | county coverage in harmonized access layer and population coverage |
Reading fidelity
high
Study strength
medium
|
n=2309
2,309 of 3,144 U.S. counties; accounts for a majority of the population
|
| We use OCR to handle the myriad of document formats that have kept the law from being a public resource. Research Productivity | positive | use of OCR preprocessing to convert diverse ordinance document formats into machine-readable text |
Reading fidelity
high
Study strength
high
|
not reported
|
| We release the corpus with coverage metadata to support reproducibility, downstream legal AI research, and the incremental expansion of machine-readable access to local law. Research Productivity | positive | availability of corpus plus coverage metadata to support reproducibility and downstream research |
Reading fidelity
high
Study strength
medium
|
not reported
|
| We train a collection of ModernBERT-based classifiers and scorers to facilitate analyzing U.S. local law among several dimensions, such as opacity and paternalism, that have not previously been studied at this scale. Research Productivity | positive | trained classifiers/scorers for dimensions like opacity and paternalism applied to local law |
Reading fidelity
high
Study strength
medium
|
not reported
|
| LOCUS-v1 and its derivative models are available at: https://huggingface.co/datasets/LocalLaws/LOCUS-v1 Research Productivity | positive | public availability of LOCUS-v1 dataset and derivative models at specified URL |
Reading fidelity
high
Study strength
high
|
available at https://huggingface.co/datasets/LocalLaws/LOCUS-v1
|