From a plain question to a cited answer.
Every Lex.NY answer is the output of a four-stage pipeline, and each stage produces a verifiable artifact: an embedding, a ranked list of real sources, a citation-graph traversal, and a streamed draft tied to numbered authorities. No stage can hallucinate, because nothing reaches the model that wasn’t pulled from a real document first. Try it on the right →
Embed the question
Your question is converted into a 1024-dimensional vector by mxbai-embed-large — the same model used to embed every document in the corpus. Embedding the question the identical way is what lets retrieval match on meaning instead of keywords.
Search the corpus with pgvector on Aurora
The vector becomes an approximate-nearest-neighbor query against a 3.5-million-row pgvector index living in AWS Aurora PostgreSQL. It returns the closest opinions (1.32M indexed) and statute sections (~40K indexed) by cosine distance, blended with a keyword score so an exact section number still ranks. Pre-warmed into memory, this is sub-second.
Expand the citation graph — in the same database
Pure vector search finds documents that read alike. The citation graph finds the ones that control. Every opinion's CITES (4.9M opinion-to-opinion) and APPLIES (648K opinion-to-statute) edges are stored as relational tables in the same Aurora database and traversed with recursive CTEs — surfacing a controlling Court of Appeals case that keyword similarity would have buried. No separate graph database to drift out of sync.
Draft under a strict-citation prompt
Everything retrieved becomes a numbered context block. A fast hosted model drafts the answer under a system prompt that requires a [n] marker after every factual claim and forbids inventing a case name, citation, or statute number. If the context didn't cover the question, the model must say so. The answer streams back token-by-token.
Why this pipeline, not just “ask a chatbot”
A general chatbot has read most published NY cases but has no way to know which still control — it will confidently cite a decision reversed in 2019. Lex.NY retrieves the actual documents first; the model only summarizes what was already pulled, with markers.
Vector search rewards textual similarity. Real research rewards citation centrality. Traversing the CITES / APPLIES edges in Aurora is how Lex.NY surfaces controlling precedent that pure similarity would rank below a similar-sounding but rarely-cited dissent.
Embeddings, the relational citation graph, and full-text search all live in a single AWS Aurora cluster. Fewer moving parts means nothing falls out of sync, and the whole retrieval path is one IAM-authenticated connection.
The model is told, with no wiggle room, that every factual claim about NY law needs a [n] marker pointing into the context block, and that inventing a citation is forbidden. When the context doesn't cover the question, it must say so plainly.
By the numbers
The latency budget
When Lex.NY refuses to answer
If the best vector similarity in step 2 falls below threshold and the citation graph surfaces nothing on point, Lex.NY skips the model entirely and tells you the corpus doesn’t cover your question.
That’s deliberate. A model that always answers is a model that sometimes invents. The abstain branch is what makes the strict-citation guarantee real.
Built on AWS Aurora PostgreSQL · Deployed on Vercel · github.com/banksythequantLab/lex-ny