We will be undergoing planned maintenance on Oct 7th 6:00AM UTC / Oct 7th 2:00AM ET

Inspiration

Generative AI can produce legal statements that sound confident and convincing even when they are incomplete, unsupported, or wrong.

In law, that is especially risky because users may not know which part of an AI-generated answer should be trusted. I wanted to build something that does not simply ask another AI model, “Does this sound correct?” Instead, I wanted the system to go back to the primary legal source and show the evidence.

That idea became LexProof: an evidence-first verification layer for AI-generated legal claims.

The current prototype focuses on the EU General Data Protection Regulation (GDPR), using the official legal text from EUR-Lex.

What it does

LexProof lets a user enter a legal claim and verifies it against authoritative primary law.

It retrieves the most relevant GDPR provisions and returns one of three verdicts:

  • Supported — the primary legal evidence supports the claim.
  • Contradicted — the primary law directly conflicts with the claim.
  • Insufficient Evidence — relevant law may be found, but it does not establish or directly disprove the claim.

The result also shows the relevant GDPR article, page number, quoted legal text, confidence information, and a link to the official EUR-Lex source.

For example:

  • A claim about a 72-hour breach notification deadline is Supported by Article 33.
  • Changing that deadline to 24 hours produces Contradicted, because LexProof detects the explicit 24-hour vs. 72-hour conflict.
  • A claim that every company must give customers a free laptop after a data breach returns Insufficient Evidence rather than incorrectly treating the absence of support as a direct contradiction.

How I built it

I built the backend with Python and FastAPI.

LexProof parses the official GDPR PDF using PyMuPDF and preserves useful legal structure such as article number, chapter, section, page number, and legal text.

LexProof splits the GDPR into legally meaningful passages and indexes them using the multilingual embedding model:

intfloat/multilingual-e5-small

When a user submits a claim, LexProof creates a query embedding and retrieves the most semantically relevant GDPR passages.

I then evaluate those passages using:

MoritzLaurer/multilingual-MiniLMv2-L6-mnli-xnli

The verifier combines multilingual natural-language inference with deterministic checks for explicit conflicts such as numerical deadlines.

For example, if a claim says “24 hours” while the retrieved provision states “72 hours,” LexProof can identify that mismatch directly instead of relying only on model probabilities.

I built the frontend with Next.js, TypeScript, and Tailwind CSS.

I deployed the production frontend on Vercel, while the FastAPI backend, legal retrieval index, and open-source language models run on Modal.

LexProof does not depend on a paid legal API.

Challenges I ran into

One of the biggest challenges was distinguishing a real contradiction from a lack of evidence.

If a user enters an unrelated or nonsensical claim, the system should not automatically say it is contradicted simply because the GDPR does not support it. That led me to the three-way verdict design: Supported, Contradicted, and Insufficient Evidence.

Another challenge was context dilution in natural-language inference.

For a claim about the right to object to direct marketing, LexProof correctly retrieved GDPR Article 21, but evaluating too much surrounding text weakened the entailment signal. I improved the verifier so it can evaluate complete numbered legal paragraphs alongside larger passages while preserving the correct source metadata.

Deployment was also challenging because the backend needs PyTorch, two language models, the GDPR corpus, and a persisted semantic index. I configured the production Modal deployment so that the legal index is restored automatically when a container starts.

Accomplishments that I'm proud of

LexProof now performs the entire verification pipeline end-to-end:

  • official legal PDF ingestion
  • structured legal parsing
  • preservation of article and page metadata
  • multilingual semantic retrieval
  • natural-language inference
  • deterministic legal conflict detection
  • three-way evidence-based verdicts
  • quoted primary-law evidence
  • links to official legal sources
  • automated regression testing
  • public deployment

I am especially proud that the system does not force every claim into a simple true/false answer.

For legal verification, being able to say “there is not enough evidence to establish this claim” is just as important as identifying a direct contradiction.

I am also proud that I built regression cases for important examples such as GDPR Article 21 on direct marketing and Article 33 on breach notification deadlines.

What I learned

The biggest lesson I learned is that legal verification is very different from general question answering.

Good retrieval alone is not enough.

A legal verification system needs to preserve document structure, retain important qualifications such as “where feasible,” distinguish contradiction from missing evidence, handle explicit numerical conflicts carefully, and expose the underlying primary-law evidence to the user.

I also learned that confidence should not replace transparency. A user should be able to inspect the exact legal provision behind the result instead of trusting a score or another generated explanation.

AI-assisted development

I used AI coding assistants, including ChatGPT/Codex, during development. All core project design, implementation decisions, testing, integration, and deployment were completed during the hackathon, and I can explain the code and architecture used in LexProof.

What's next for LexProof

The current prototype validates the concept using the EU GDPR.

My next step would be to expand LexProof to support multiple jurisdictions and additional legal sources, including statutes, regulations, and court decisions.

Future versions could also include:

  • automatic jurisdiction detection
  • legal-domain detection
  • larger legal corpora
  • improved confidence calibration
  • case-law verification
  • citation graph analysis
  • automatic verification of complete AI-generated legal answers
  • an API that other legal AI systems can use before presenting legal claims to users

My long-term goal is to make LexProof an evidence layer between generative AI and primary law.

Don't just generate legal claims. Prove them.

Built With

Share this project:

Updates

Submission history