← All questions
Data, Privacy & LegalHard· Compliance· Dense Retrieval· System Design

Legal requires verbatim citations for all search result...

The constraint is a business requirement that changes the design. Since dense retrieval cannot satisfy a verbatim guarantee, you should implement a hybrid system: route queries with quoted strings or specific tokens through a sparse index with hard filtering, and use dense retrieval for the rest. If the routed fraction is too high, you must renegotiate the legal guarantee rather than shipping a system that violates it.

Code playground (Python)