← All questions
System DesignHard· LLM· Embeddings· Legal Search· Synthetic Data

We are porting this stack to legal contract search. No...

In a resource-constrained environment (no logs, six weeks, one engineer), the goal is to generate high-quality training data. An LLM rewriter is effective at capturing intent but adds significant latency and risks hallucinating constraints. A relevance-trained embedding is more efficient but requires training data. The staff-level solution is to use the LLM offline to generate synthetic queries for contract clauses, validate them against a retriever, and use the successful pairs to train the embedding. This minimizes per-query costs while providing the necessary supervision.

Code playground (Python)