AI system design interview: design a legal citation verifier
Run two checks on every citation. Existence: extract and normalise the citation, then look it up in legal databases and compare across sources. Support: retrieve the cited case and check whether it says what the brief claims, which is the harder and more valuable check. Combine both into a confidence score per citation, return results with an audit trail, and have a lawyer review everything flagged.
Question
Lawyers are filing briefs with AI-generated case citations that don't exist. Design an API that checks a brief before it's filed.
Clarify
- Jurisdictions and which legal databases are licensed.
- Document formats and size.
- How results are used: a report for the lawyer, or a blocking check before filing?
- Languages, since many jurisdictions don't work in English.
Architecture
| Stage | Component |
|---|---|
| Extraction | Find citations in the document, normalise their format |
| Existence | Look up each citation in one or more legal databases, compare results |
| Retrieval | Fetch the cited case text |
| Support | Compare the brief's claim with what the case holds, flag unsupported or contradictory uses |
| Scoring | Confidence per citation, lower for recent cases or jurisdictions sources don't cover |
| Output | JSON report per citation with sources checked and timestamps |
| Audit | Hash-chained log of every check |
| Review | A lawyer reviews everything flagged |
Deep dive: existence vs support
Existence is a lookup: either a case with that citation exists or it doesn't, although formats vary and databases differ in coverage. Support is a judgment: the case exists, but does it hold what the brief says it holds? That needs the case text and a model comparing claim and holding, which can be wrong, so it produces a flag for a lawyer, not a verdict.
Failure modes
| Failure | Mitigation |
|---|---|
| Real case marked fake (coverage gap) | Check several sources, mark "not found" instead of "fake" |
| Fake case passes (similar real citation) | Compare party names and year, not just the reporter citation |
| Unsupported claim passes | Support check, human review |
| Overconfidence on recent cases | Lower confidence where sources lag |
Evals
A set of briefs with known fabricated citations, real citations used correctly, and real citations used for claims they don't support, scored separately for existence and support.
What interviewers listen for
Two separate checks, honest confidence where sources are incomplete, an audit trail, and a person making the final call.
From the floor
This came from a company that reached out to me, related to what Harvey does for enterprise legal teams but aimed at individual lawyers, and when I researched the problem, I found that citations from AI tools can't easily be verified, and a lawyer who files an unverified fake citation can face penalties from the judge, so we built a hallucination citation verifier in AI Engineer HQ.