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

  • founded
    “the CEO and co-founder of Turbopuffer”
    YouTube
    Verified6 sources· Talk, Web· archived
  • works at
    Chief Technology Officer (previously Head of Engineering)
    “I'm an engineer at Legora.”
    YouTube
    Verified3 sources· Talk, Web· archived
  • ceo of
    CEO
    “Simon Eskildsen, founder and CEO of Turbopuffer”
    0:25inBuilding TurbopufferYouTube
    Verified2 sources· Talk
  • feature
    Legora: Collaborative AI platform for legal work, including contract review, contract creation, legal research, and collaboration
    “We're a collaborative AI platform for legal work.”
    YouTube
    Unverified1 source· Talk
  • uses
    Initially used a single cluster for search workloads
    “a single Elasticsearch cluster for all of our search workloads”
    YouTube
    Unverified1 source· Talk
  • uses
    Moved search workloads from Elasticsearch to Postgres
    “So we moved from Elasticsearch to Postgres.”
    YouTube
    Unverified1 source· Talk
  • uses
    Used DiskANN for vector search
    “The setup was pgvector, specifically DiskANN”
    YouTube
    Unverified1 source· Talk
  • metric
    Legora: Search and ingestion P99 rose from 100 milliseconds to 20 seconds on Postgres
    “search and ingestion P99 went from 100 milliseconds to 20 seconds”
    YouTube
    Unverified1 source· Talk
  • uses
    Moved to Turbopuffer at about 400 million documents
    “We moved to Turbopuffer when we had about 400 million documents.”
    YouTube
    Unverified1 source· Talk
  • feature
    Turbopuffer: Writes directly to object storage
    “we write directly to object storage”
    YouTube
    Unverified1 source· Talk
  • metric
    Turbopuffer: S3 P99 around 200 milliseconds for a one-megabyte blob
    “S3 has a P99 of around 200 milliseconds for a one-megabyte blob”
    YouTube
    Unverified1 source· Talk
  • feature
    Turbopuffer: Supports Amazon S3, Google Cloud Storage, and Azure Blob Storage
    “S3, GCS, and Azure Blob storage supported that”
    YouTube
    Unverified1 source· Talk
  • feature
    Turbopuffer: Supports namespace-level separation and encryption with different customer keys
    “every table could be encrypted with a different key, and every namespace could be in a different bucket”
    YouTube
    Unverified1 source· Talk
  • feature
    Legora: Legal research search fans out across queries to handle a large, hierarchical corpus with temporal validity constraints
    “For a legal research query, we'll fan it out to a bunch of different queries”
    YouTube
    Unverified1 source· Talk
  • metric
    Legora: Legal research corpus approaching 10 billion vectors
    “We're racing toward 10 billion vectors”
    YouTube
    Unverified1 source· Talk
  • feature
    Turbopuffer: Organizes vector data in nested clusters and a tree to reduce storage round trips
    “Turbopuffer creates clusters of clusters, and clusters of clusters of clusters”
    YouTube
    Unverified1 source· Talk
  • metric
    Legora: More than 70 tenants
    “We have more than 70 tenants”
    YouTube
    Unverified1 source· Talk

Related talks