WhoBuilt

Connect AI to Billions of Legal Documents

Sep 16, 2026· 21 min· 14K views·Watch on YouTube

Speakers

Jacob Lauritzen, an engineer at Legora, and Simon Eskildsen, CEO and co-founder of Turbopuffer, explain how they built search for legal documents at scale in an AI Engineer talk.

Two kinds of legal search

Legora supports project search across documents for a matter and legal research across laws, cases, and regulations. Projects can range from tens of documents to millions, while legal research requires broad searches and heavy filtering.

Scaling project search

Legora began with one Elasticsearch cluster, then separated deployments by region to meet data residency requirements. For enterprise customers needing isolated data and customer-managed encryption keys, the team tried Postgres with pgvector and 4,000 partitions. As usage grew, hot and cold projects shared partitions, causing cache thrashing and pushing P99 search and ingestion latency from 100 milliseconds to 20 seconds.

Turbopuffer’s storage and isolation model

At about 400 million documents, Legora moved project search to Turbopuffer, using one namespace per project for BM25 search, lower costs, and simpler operations. Simon describes writes going to object storage, with indexes built in the background and queries served from memory, NVMe, or object storage. Separate buckets and encryption keys support customer isolation; disabling the NVMe cache for some workloads also met Legora’s isolation requirements.

Handling legal research at scale

Legora’s legal research corpus was approaching 10 billion vectors, with query fan-out and filtering across jurisdictions and time-sensitive legal relationships. Turbopuffer lets frequently queried namespaces, such as EU law, stay hot while less-used jurisdictions remain in blob storage, where a 500-millisecond cold fetch can be acceptable. Simon explains how clustered vector indexes and text indexes are designed to limit expensive storage round trips.

Results and operating lessons

Jacob says retrieval is central to legal reasoning and that Turbopuffer supports more than 70 tenants with data residency and customer-managed encryption keys. Its cost model suits workloads with many cold indexes and occasional latency trade-offs. The team says it can spend more time on the product and less on search infrastructure.

Takeaways

  • Separate frequently queried data from a long tail of cold data when the workload can tolerate slower cold reads.
  • Treat data residency, tenant isolation, and customer-managed keys as core search architecture requirements.
  • Measure cache behavior under uneven project activity; shared partitions can make hot and cold workloads interfere.
  • Choose search storage based on the workload: object-storage-backed designs can reduce costs when writes can be slower.
  • For legal research, model jurisdiction and temporal relationships in retrieval filters, not just in the underlying documents.

Mentioned in this talk

Search inside this talk

What was claimed 17

Show all 17 facts

Related talks