Evidence-linked investigation across documents and entities
Legal Discovery Graph
How can an investigator move from a large discovery record to evidence they can inspect and trace?
Combine vector and graph retrieval with cited evidence, structured entities, timelines, and calibrated refusal.
Connects documents, people, events, and citations in one inspectable investigation workflow.
AI engineer / Data engineer
I built the extraction, indexing, graph, hybrid retrieval, evaluation, and Streamlit delivery path.Reviewer or investigator working through a synthetic discovery record
Context and stakes
Large records hide relationships across documents.
Discovery work rarely lives in a single document. People, companies, events, and citations are distributed across a record, while the connections between them carry as much meaning as the passages themselves.
A similar-looking document is not enough when an investigator needs to trace why a person, event, or relationship matters. The system needed to return inspectable evidence and preserve the path between a question and the material used to answer it.
Approach
Connect retrieval paths, then show the evidence.
Combine vector retrieval for semantic similarity with a relationship graph for structure, then return cited evidence through one investigation workspace with a calibrated refusal path.
Design constraints
- Every document, person, company, amount, and event in the published corpus is synthetic and fictional.
- Evaluation results describe a reproducible templated corpus, not real legal matters.
- Graph and vector systems stay separate enough to support complementary retrieval paths.
Decision journey
A discovery corpus becomes an inspectable case view.
The workflow moves from fictional source material to structured, cited evidence a reviewer can trace.
- Data
Generate
Create the synthetic discovery corpus used for repeatable extraction and retrieval evaluation.
- AI
Extract
Structure entities and events so evidence can be connected across documents.
- Data
Index
Build the vector index used to find semantically related passages.
- Data
Connect
Load entities and relationships into the graph for traceable traversal.
- AI
Retrieve
Combine vector and graph paths, attach citations, and refuse when support is insufficient.
- Human
Investigate
Review evidence, entities, timelines, and relationship paths in the workspace.
Interactive architecture
Vector similarity and graph structure meet at evidence orchestration.
The architecture keeps semantic similarity and relationship structure as complementary retrieval paths. Select a stage to see the role it plays in the investigation flow.
Drag to pan / use controls to zoom / select any stageRead the architecture as text
- Discovery corpusSource / Synthetic documents
Provides the fictional, templated record used for repeatable extraction and evaluation.
- Entity extractionStructure / Python
Identifies the people, companies, events, and evidence units used by both retrieval paths.
- Vector indexSimilarity / PostgreSQL + pgvector
Retrieves passages by semantic similarity to the investigation question.
- Relationship graphConnection / Neo4j AuraDB
Preserves structured relationships and paths between entities and events.
- Hybrid retrievalEvidence / LangChain
Combines graph and vector results with cited evidence and calibrated refusal.
- Investigation viewReview / Streamlit + Plotly
Presents citations, entities, timelines, and relationship paths for human inspection.
Pivotal decisions
Two choices shape the investigation boundary.
Both choices trade broader claims for a system that can be inspected and evaluated honestly.
Keep graph and vector retrieval together
Find relevant language while preserving the relationships an investigator needs to trace.
- Constraints
- Semantic similarity does not describe every relationship.
- Graph traversal depends on structured extraction.
- Alternatives
- Vector retrieval only
- Graph traversal only
- Criteria
- Relevant passages / Inspectable relationships / Cited evidence / Calibrated refusal
- Selected
- Complementary pgvector and Neo4j retrieval paths
- Why
- Vector search finds semantically related material while the graph preserves explicit entity and event connections.
- Trade-off
- Maintaining two retrieval systems adds indexing and operational complexity.
- What supported it
- The published evaluation reports graph retrieval R@5 of 0.929 and relationship hit@5 of 0.833.
- Revisit when
- Reconsider the split if component-level evaluation shows one path no longer adds useful evidence.
Use a reproducible synthetic discovery corpus
Evaluate extraction and retrieval without publishing information from real legal matters.
- Constraints
- No real documents or personal data
- Repeatable evaluation
- Evidence must remain inspectable
- Alternatives
- Private matter data
- Unlabeled public documents
- Criteria
- Safe to publish / Fictional / Reproducible / Suitable for gold-label evaluation
- Selected
- Templated synthetic documents, people, companies, events, and amounts
- Why
- A controlled corpus makes extraction and retrieval behavior measurable while keeping the public boundary explicit.
- Trade-off
- Synthetic records cannot establish performance on the language, scale, or ambiguity of real discovery matters.
- What supported it
- Entity extraction strict F1 is reported at 0.889 on the reproducible corpus.
- Revisit when
- Expand the corpus before making any claim about broader document or matter coverage.
Results and evaluation
Measured retrieval on a disclosed synthetic corpus.
- Method
- The project reports retrieval and extraction metrics against its templated synthetic corpus.
- Meaning
- Within that disclosed evaluation boundary, relevant graph evidence appeared in the first five retrieved results at the reported rate.
- Limitation
- The result does not establish performance on real legal records, unseen matter types, production scale, or attorney work product.
Limitations and next steps
Useful evidence, bounded claims.
What this does not prove
- All published documents, people, companies, amounts, and events are synthetic and fictional.
- The evaluation describes a templated corpus and is not a claim about real legal matters.
- Maintaining graph and vector stores together adds indexing and operational complexity.
- A retrieved citation still requires human interpretation in the context of the investigation.
What I would do next
- Expand the synthetic corpus with harder entity, event, and relationship ambiguity.
- Measure the graph-only, vector-only, and hybrid paths separately before changing the retrieval mix.
- Define approved access, privacy, and matter-isolation controls before considering any real material.
This project demonstrates a connected investigation workflow without claiming behavior on real legal matters.
Explore the rest of the work