The Problem
Law firms manage large archives of filings, briefs, contracts, rulings and scanned documents. Research is still mostly manual, and preparing briefs or legal opinions requires hours of cross-reading. Generic LLMs cannot be used as-is: they produce unverifiable statutory and case-law citations, misread legal terminology, and offer no source traceability — unacceptable in a professional domain where every statement must be traceable to a source.
- Manual search across heterogeneous document archives (paper, PDF, email)
- Generic LLMs hallucinate legal citations with no traceability
- Professional secrecy and GDPR rule out public cloud services
- No automatic distinction between established, disputed and hypothetical facts in case documents
Constraints
- • Inbound documents are mostly scanned: internal OCR required, no external services
- • Italian NLP resources with heterogeneous licenses (commercial, non-commercial, research-only): per-source compliance
- • Every generated paragraph must link to a verifiable fact → source → application chain
- • Integration with the document editing suite already used in the firm
- • GDPR and professional secrecy: data never leaves the dedicated infrastructure (EU hosting)
- • Mandatory final human review by the lawyer on every output
- • Audit trail of sources and retrieval decisions
The Solution
Architecture
Self-hosted platform for a law firm: internal document OCR, hybrid indexing (BM25 full-text + semantic search) over briefs, case files, rulings and codes, and a layered legal semantic engine. Specialized agents (codes and statutes, rulings, general assistance) cooperate through MCP tools routed by the backend, keeping audit, validation and permissions centralized. The LEX layer turns each document chunk into an auditable structure (speech act, event, semantic roles, temporality, factuality) with a declared license policy per resource. A citation validator checks statute and case law before text reaches the lawyer, and an argument miner reconstructs the fact → issue → rule → application → counterargument structure. Final drafting happens in the integrated document suite, with mandatory human approval.
Key Decisions
- Verifiable chain for every output: case fact → legal issue → source → principle → application → validated citation → lawyer approval
- Specialized non-autonomous agents: they work only on verifiable sources (source hashing), declare missing sources, and leave critical states pending until human review
- MCP tools routed by the backend, never with direct access to external sources: audit, permissions and validation stay centralized
- Citation validator as a separate component (structural anti-hallucination, not prompt-only)
- Separation between the semantic layer (what the document says) and legal weight (what it means): semantic memory first, legal memory after
- Per-resource NLP source policy (license, commercial use, attribution) verified before runtime enablement
- OCR fully inside the infrastructure to keep confidential documents away from third parties
- Incremental architecture: each pilot phase validates schema and success criteria before the next
Approach
Phased development with deterministic verification: first ingestion and hybrid search over the existing corpus, then the semantic core with chunk registry, then the pilot on Italian semantic repositories. Verified citation drives the whole design: the system must produce drafts and analyses, not generic answers.
def validate_citation(draft):
# Structural anti-hallucination: no claim ships
# without a traceable, hashed source.
for p in draft.paragraphs:
if p.claim and p.source_hash not in index:
p.status = "pending" # never invent a citation
human_review.add(p)
return draftMeasurable Results
Overall Impact
Ongoing project (incremental development): measurable results — document research time, indexed corpus coverage, share of validated citations — are being collected during the pilot, with validation at each phase before the next one starts.
My Role
- End-to-end platform architecture (backend, AI pipeline, frontend)
- Multi-agent architecture and MCP tool design (codes, rulings, assistance agents)
- Legal semantic engine and verifiability chain design
- OCR + ingestion + hybrid indexing pipeline implementation
- Citation validation and argument mining
- Italian semantic repository pilot with per-resource license analysis
- Integration with document drafting and the lawyer approval flow
