Stanford
University
  • Stanford Home
  • Maps & Directions
  • Search Stanford
  • Emergency Info
  • Terms of Use
  • Privacy
  • Copyright
  • Trademarks
  • Non-Discrimination
  • Accessibility
© Stanford University.  Stanford, California 94305.
Skip to content
  • About

    • About
    • People
    • Get Involved with HAI
    • Support HAI
    • Subscribe to Email
  • Research

    • Research
    • Research Programs
    • Grants
    • Marlowe (opens in new tab)
    • Student Affinity Groups
    • Centers & Labs
    • Research Publications
    • Research Partners
  • Education

    • Education
    • Executive and Professional Education
    • Government and Policymakers
    • K-12
    • Stanford Students
  • Policy

    • Policy
    • Policy Publications
    • Policymaker Education
    • Student Opportunities
  • AI Index

    • AI Index
    • AI Index Report
    • Global Vibrancy Tool
    • People
  • News
  • Events
  • Industry
  • Centers & Labs
Navigate
  • About
  • Events
  • AI Glossary
  • Careers
  • Search
Participate
  • Get Involved
  • Support HAI
  • Contact Us

Stay Up To Date

Get the latest news, advances in research, policy work, and education program updates from HAI in your inbox weekly.

Sign Up For Latest News

Making Local Law Legible: LLM-Assisted Detection of Discrimination | Stanford HAI
policyPolicy Brief

Making Local Law Legible: LLM-Assisted Detection of Discrimination

Date
September 08, 2026
Topics
Government, Public Administration
Ethics, Equity, Inclusion
Read Paper
abstract

This brief demonstrates the potential of LLM-assisted review to accelerate legal reform.

In collaboration with

Key Takeaways

  • Understanding local law can be overwhelming. Historically, reformers have hired large teams of researchers and lawyers to sift through federal and state codes, but that is particularly infeasible for thousands of cities, counties, and towns across the United States. 

  • Stanford HAI and RegLab researchers gathered 9,623 jurisdictions’ local laws (amounting to 3 billion words of code) and developed an LLM-assisted review pipeline to demonstrate the potential of AI for legal reform. Together, these laws govern in jurisdictions that are home to roughly 252 million Americans. 

  • We identify patently discriminatory laws. Shockingly, we document dozens of jurisdictions that formally still mandate racial segregation, impose poll taxes, and deny women the right to vote, practices that have long been held unconstitutional. A particularly prevalent category is unwarranted citizenship-based discrimination for occupational licenses. 

  • These methods empower lawyers, local governments, and citizens to understand and target reform efforts. LLM-assisted statutory surveys have the potential to update and make the legal code legible again. 

The Problem

Local law matters. Across the United States, local law draws lines determining who can vote, who can hold particular jobs, who can attend which schools, and who can be detained or punished. Historically, local lawmakers have often drawn those lines unjustly across protected categories like race, sex, and religion. Ridding codes of these laws removes enforcement risks and public misunderstanding and clears historical stains.

However, making local law legible takes time. Until recently, reformers combed through codes by hand with small armies of researchers and lawyers. In the 1950s, Pauli Murray compiled over 700 pages of segregation laws — a volume Thurgood Marshall called the “bible” of Brown v. Board of Education. In the 1970s, then-Professor Ruth Bader Ginsburg led an effort to excise sex bias from federal law, searching the law using just 59 gender-related keywords. In the 2000s, law professor Gabriel “Jack” Chin and his team cataloged vestigial Jim Crow provisions in state statutes, triggering repeals in several states — while acknowledging they likely missed unusually phrased laws. As recently as 2019, a Virginia commission compiled 60 years of discriminatory state laws only by mobilizing law students from three universities, the governor’s staff, practicing attorneys, and a sitting judge. The time and labor required for these painstaking searches are significant. No comparable effort has ever been possible across local codes. There are simply too many.

In our paper “Hidden in Plain Text: LLM-Assisted Detection of Discriminatory Local Laws,” we present the first effort to develop AI assistance for surveying discriminatory provisions at scale and systematically across local codes. We gathered the largest dataset of local laws to date — spanning 9,623 jurisdictions and 75% of the U.S. population — and used large language models (LLMs) to flag likely instances of discriminatory laws for subsequent human verification. 

We found plainly discriminatory laws across the United States in nearly every protected category we searched. These laws can be viewed on our paper’s companion website. We present our approach as a promising solution to a search problem that has hindered code cleanup efforts for decades — and as a foundation for further work on statutory surveys that turn on legal, rather than topical, questions. 

The Solution

In previous work from the Stanford RegLab, our colleagues used LLMs for statutory and regulatory research and found outdated, obsolete, and cumbersome legal requirements. Yet those statutory surveys did not assess the potential for AI systems to assist in determining the constitutionality of legal provisions, an inquiry whose answers bear on people’s legal rights and equal civic standing.

Here, we introduce a new LLM-assisted method specifically for identifying unconstitutionally discriminatory laws. The method draws on LLM and human judgment, and focuses on laws that are discriminatory in ways that are identifiable from the text itself when read against current constitutional doctrine. (We focus on “disparate treatment” and not facially neutral laws with discriminatory effects.) This necessarily requires developing an approach that is more attuned to antidiscrimination law and legal reasoning than prior work.

We first assembled a corpus of local laws — covering roughly 75% of the U.S. population, spanning 9,623 jurisdictions, and totaling 3 billion words of code—by scraping and parsing codes from two major codification providers. The dataset contains approximately 9 million law sections.

We then used an LLM to label each legal section based on whether it references a protected category — such as race, religion, or gender — and whether the law imposes differential treatment based on that category. We grouped laws by the type of treatment they impose, allowing reviewers to filter out laws where differentiation may be used for accommodations or remedial purposes. Finally, an LLM scored the remaining provisions on five attributes drawn from antidiscrimination doctrine — attributes that signify the presence of discriminatory treatment without a recognized justification. We used multiple LLMs to assign a priority rating based on LLM agreement to direct human review.

Read Paper
Share
Link copied to clipboard!
Authors
  • Dan Bateyko
    Dan Bateyko
  • Yasmine Mabene
    Yasmine Mabene
  • Derek Ouyang
    Derek Ouyang
  • Dan Ho headshot
    Daniel E. Ho
Related
  • Cleaning Up Policy Sludge: An AI Statutory Research System
    Faiz Surani, Lindsey A. Gailmard, Allison Casasola, Varun Magesh, Emily J. Robitschek, Christine Tsang, Derek Ouyang, Daniel E. Ho
    Quick ReadJun 18
    policy brief

    This brief introduces a novel AI tool that performs statutory surveys to help governments—such as the San Francisco City Attorney Office—identify policy sludge and accelerate legal reform.

Related Publications

How Can AI Support Language Digitization and Digital Inclusion?
Juan N. Pava, Thomas S. Mullaney, Caroline Meinhardt, Audrey Gao, Diyi Yang
Deep DiveFeb 26, 2026
White Paper

This white paper analyzes the varying ways AI tools can advance language digitization work, and provides recommendations for responsibly realizing the potential of AI in supporting the digital inclusion of digitally disadvantaged languages.

White Paper

How Can AI Support Language Digitization and Digital Inclusion?

Juan N. Pava, Thomas S. Mullaney, Caroline Meinhardt, Audrey Gao, Diyi Yang
Ethics, Equity, InclusionInternational Affairs, International Security, International DevelopmentNatural Language ProcessingDeep DiveFeb 26

This white paper analyzes the varying ways AI tools can advance language digitization work, and provides recommendations for responsibly realizing the potential of AI in supporting the digital inclusion of digitally disadvantaged languages.

Moving Beyond the Term "Global South" in AI Ethics and Policy
Evani Radiya-Dixit, Angèle Christin
Quick ReadNov 19, 2025
Issue Brief

This brief examines the limitations of the term "Global South" in AI ethics and policy, and highlights the importance of grounding such work in specific regions and power structures.

Issue Brief

Moving Beyond the Term "Global South" in AI Ethics and Policy

Evani Radiya-Dixit, Angèle Christin
Ethics, Equity, InclusionInternational Affairs, International Security, International DevelopmentQuick ReadNov 19

This brief examines the limitations of the term "Global South" in AI ethics and policy, and highlights the importance of grounding such work in specific regions and power structures.

Increasing Fairness in Medicare Payment Algorithms
Marissa Reitsma, Thomas G. McGuire, Sherri Rose
Quick ReadSep 01, 2025
Policy Brief

This brief introduces two algorithms that can promote fairer Medicare Advantage spending for minority populations.

Policy Brief

Increasing Fairness in Medicare Payment Algorithms

Marissa Reitsma, Thomas G. McGuire, Sherri Rose
Ethics, Equity, InclusionHealthcareQuick ReadSep 01

This brief introduces two algorithms that can promote fairer Medicare Advantage spending for minority populations.

Mind the (Language) Gap: Mapping the Challenges of LLM Development in Low-Resource Language Contexts
Juan N. Pava, Caroline Meinhardt, Haifa Badi Uz Zaman, Toni Friedman, Sang T. Truong, Daniel Zhang, Elena Cryst, Vukosi Marivate, Sanmi Koyejo
Deep DiveApr 22, 2025
White Paper

This white paper maps the LLM development landscape for low-resource languages, highlighting challenges, trade-offs, and strategies to increase investment; prioritize cross-disciplinary, community-driven development; and ensure fair data ownership.

White Paper

Mind the (Language) Gap: Mapping the Challenges of LLM Development in Low-Resource Language Contexts

Juan N. Pava, Caroline Meinhardt, Haifa Badi Uz Zaman, Toni Friedman, Sang T. Truong, Daniel Zhang, Elena Cryst, Vukosi Marivate, Sanmi Koyejo
International Affairs, International Security, International DevelopmentNatural Language ProcessingEthics, Equity, InclusionDeep DiveApr 22

This white paper maps the LLM development landscape for low-resource languages, highlighting challenges, trade-offs, and strategies to increase investment; prioritize cross-disciplinary, community-driven development; and ensure fair data ownership.