Fine-Tuning Retrieval Models for Legal Research
Improving open-weight retrieval models so legal research agents cite more relevant cases and use fewer tokens.
With Trajectory and NVIDIA, we fine-tuned NVIDIA's Nemotron 3.5 Embed 8B and Nemotron 3.5 Rerank 8B on synthetic research questions, starting from NVIDIA's open synthetic data and fine-tuning recipe. We then measured both retrieval quality and resulting improvements on an agent that answers with citations.
Our results show that a targeted fine-tuning recipe for a particular domain improves retrieval and the answers built on it. Specifically, we find:
- The fine-tuned models retrieve more relevant cases. With both models fine-tuned, recall and NDCG improve by 12.7% and 13.6% respectively on a US Case Law dataset. These also strongly outperform OpenAI's text-embedding-3-large.
- Better retrieval leads to better-cited answers at lower cost. An agent using the fine-tuned models cites more than 30% more of the relevant cases than the baseline at every token budget tested.
- The recipe carries over to other legal retrieval tasks. Fine-tuning on the Massive Legal Embedding Benchmark (MLEB), a separate set of legal corpora from six jurisdictions, improves held-out NDCG@10 by 4.6%.
NVIDIA presented this work at GTC DC in its post-training demo and in the session Building the Knowledge Foundation for Enterprise Agents. The sections below cover why retrieval matters in Harvey, our results, and how we fine-tuned the models.
Retrieval for legal research
Most work in Harvey starts with finding the right material. More than 75% of threads in Harvey's Assistant search at least one source before answering. Those sources span more than 500 legal knowledge sources, the files users attach to a conversation, Vaults that hold up to 100,000 documents each, and more than 90 connectors to legal and business software. An agent grounds its answers in what it retrieves, so high-quality retrieval models are critical to providing accurate and reliable answers.
To measure retrieval quality on a well-defined legal task, we used a Delaware subset of US case law, paired with an expert-curated evaluation set.
A typical semantic retrieval pipeline runs in two stages (Figure 1). First, an embedding model is used to find the most similar candidates within a large corpus. Then, a reranker reads each candidate together with the question and reorders them by relevance. We fine-tuned both models and measured performance improvements on Recall and NDCG.

More information about the corpus, evaluation set, and metrics can be found in the Appendix.
Results
Figure 2 compares four retrievers, from OpenAI's text-embedding-3-large by itself to both Nemotron Embed+Rerank models fine-tuned. Fine-tuning adds 6.1 percentage points, and NDCG@10 rises from 0.317 to 0.360, so the relevant cases also rank higher.

The two models contribute in different ways. The fine-tuned embedder gives most of the recall gain, so more labeled cases make it into the initial token window. The fine-tuned reranker gives most of the NDCG@10 gain, so relevant cases move up the list. Recall improved on about a third of the questions in the evaluation set.
Figure 3 shows example movements. For the question "When does the business judgment rule apply to controller squeeze-out mergers?", the base models rank the three most relevant cases 8th, 11th and 15th. After fine-tuning they all rank within the top 7, and NDCG@10 rises from 0.089 to 0.548. This means an agent using the improved models doesn't need to sort through as many irrelevant cases, and can use a smaller top-k for improved token efficiency, which we also show in the next section.

We also applied our recipe to MLEB, a public legal retrieval benchmark. Training the embedder the same way raised NDCG@10 on its held-out queries from 0.826 to 0.865, over 1,271 queries in 12 tasks. This suggests the recipe carries over to other legal corpora.
Better-cited answers with fewer tokens
Retrieval metrics matter because of what an agent does with the results. To measure that, we gave the same Nemotron Super agent one search tool and changed the retrieval models behind it. The agent researched each question under six search settings and cited cases in its answer.
We score each answer by the share of labeled cases it cites. Figure 4 plots that score against the total tokens the agent read and wrote. The curve for the fine-tuned models shows improvement over the baseline at every token budget, citing more of the labeled cases for the same number of tokens.

Training
We started from NVIDIA's open Nemotron embedding recipe on GitHub, which covers synthetic data generation, hard-negative mining, fine-tuning and evaluation for Nemotron retrieval models. NVIDIA walks through it in Build a Domain-Specific Embedding Model in Under a Day. Together with Trajectory, we adapted the data generation step for long legal opinions and fine-tuned both models.
Data
Nemotron 3 Ultra generated and checked 1,000 research questions, working through a REPL over the case files so it could find and read the cases each question should retrieve. Ten questions without their labels were used as a seed to serve as style examples. Those questions were randomly selected and then excluded from the evaluation set. We found the small initial seeded set to be important, compared to a broad unsupervised run generating 195,000 across the entire corpus.
Embedding model
We trained a rank-16 LoRA on Nemotron 3.5 Embed 8B with a contrastive loss that scores each question's supporting case above 8 randomly sampled negative cases. A second loss term, a KL penalty, keeps document embeddings close to the base model's.
Reranker model
We fine-tuned all parameters of Nemotron 3.5 Rerank 8B with a pairwise loss. Each supporting case is scored against 2 hard negatives (cases the retriever ranks highly that do not support the question) and 6 random negative cases.

What's next
Retrieval is an essential component behind all knowledge work. In a more complex real-world environment, the agent also chooses which sources to search, writes the queries, reads the results, cites them, and we decide how to evaluate the answer. We plan to broaden training to other corpora spanning different jurisdictions, practice areas, and retrieval tasks, and to measure performance across a wider array of benchmarks.
This work is part of Harvey's research mission to build frontier legal intelligence on open-weight models, which spans improvements across the entire agent stack.
We did not use customer data to train or evaluate these models.
Appendix
Evaluation set
The 99 questions are lawyer-written research questions and expected cases about Delaware corporate law. They have 581 labeled question–case pairs, an average of 5.9 per question, of which 82 are marked mandatory and 499 relevant.
Metrics
For each question, the embedder retrieves its top 100 chunks, and applies the reranker, where there is one. Recall@32K tokens truncates the ranked chunks at 32,000 tokens. Recall is the share of the question’s labeled cases among the chunks kept. NDCG@10 is normalized discounted cumulative gain over the first 10 distinct cases in rank order, with a gain of 2 for mandatory cases and 1 for relevant cases. We report the mean over the evaluation set.
Corpus
The corpus is 32,468 Delaware opinions from CourtListener filed before March 2024, split into 166,537 chunks. We cut it off at that date for label fidelity with this particular evaluation set, whose queries and labels were created with that time frame restriction. A retriever that surfaces newer relevant law is therefore not scored as wrong for finding cases the labels could not include.
We split each opinion into chunks of 1,000 tokens, with 250 tokens of overlap between consecutive chunks. That gives about 5 chunks per opinion on average. Before embedding, each chunk is prefixed with its case's title and metadata. Retrieval ranks chunks, but our metrics and the agent's search tool count each case once, at its highest-ranked chunk.
Retrieval results
Embedder | Reranker | Recall@32K tokens | NDCG@10 |
|---|---|---|---|
OpenAI text-embedding-3-large | None | 36.3% | 0.242 |
Nemotron 3.5 Embed 8B, base | Nemotron 3.5 Rerank 8B, base | 48.0% | 0.317 |
Nemotron 3.5 Embed 8B, fine-tuned | Nemotron 3.5 Rerank 8B, base | 51.7% | 0.326 |
Nemotron 3.5 Embed 8B, fine-tuned | Nemotron 3.5 Rerank 8B, fine-tuned | 54.1% | 0.360 |
Agent evaluation
The agent is Nemotron Super with the same system prompt for every retriever. Its one tool, search_case_law(query), sends the query to the retrieval system being tested, and returns the top k cases, each with its court, year and best-matching excerpt. We used search caps of 1 or 4 searches and k of 3, 6 or 10, for six settings, and ran each question 3 times per setting. The agent was told to answer in under 250 words. An answer's score is the share of the question's labeled cases it names, with no penalty or cap on the number of citations. Case names are matched exactly, without an LLM judge or fuzzy matching. Figure 4 also leaves out OpenAI's costliest setting, at about 13.9K tokens per question. It cites about 0.22 of the labeled cases, the same to two decimal places as the 11.1K-token setting shown.
Training details
Embedder | Reranker | |
|---|---|---|
Starting model | Nemotron-3.5-Embed-8B | Nemotron-3.5-Rerank-8B |
Method | LoRA, rank 16, all projections | Full fine-tune |
Learning rate | 5e-5 | 2e-6 |
Global batch | 8 | 4 |
Schedule | 1 epoch, 125 updates | 7 epochs, 1,750 updates |
Loss | Softmax cross-entropy against 8 random negatives, plus a term keeping document embeddings near the base model's | Pairwise logistic loss against 2 mined hard negatives and 6 random negatives |








