Building and Evaluating Legal AI at Scale with Domain Expert Integration

harvey · Legal · year n/a · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: legal AI product development and evaluation

Harvey needed to build and evaluate legal AI products where documents are complex, legal quality is nuanced and subjective, mistakes can be career-impacting, and sensitive customer data makes ordinary feedback, bug reports, and benchmark construction difficult.

Constraints:

Architecture

Harvey combines a legal AI product platform with embedded lawyer expertise and a three-layer evaluation stack. The product layer includes a general assistant, document extraction, domain-specific workflows, agentic search, personalization/memory, long-running tasks, firm-specific knowledge, templates, and citations. The development layer embeds lawyers with engineers and product teams through use-case discovery, dataset collection, rubric writing, UI iteration, and end-to-end testing. The evaluation layer combines human preference ratings, domain-expert-authored LLM-as-judge rubrics such as Big Law Bench, component-level evaluation for RAG and workflows, LangSmith routine evals, custom human-rater tooling, product-specific tests, and internal dogfooding before launch.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  legal_professional_user["Legal professional user"] --> harvey_assistant_and_workflows["Harvey assistant and workflows"]
  firm_knowledge_and_templates["Firm knowledge and templates"] --> harvey_assistant_and_workflows
  document_corpus["Document corpus"] --> harvey_assistant_and_workflows
  harvey_assistant_and_workflows --> citation_and_verification_layer["Citation and verification layer"]
  citation_and_verification_layer --> legal_professional_user
  lawyer_in_the_loop_product_team["Lawyer-in-the-loop product team"] --> ai_prototyping_stack["AI prototyping stack"]
  ai_prototyping_stack --> harvey_assistant_and_workflows
  lawyer_in_the_loop_product_team --> human_preference_evaluation_tooling["Human preference evaluation tooling"]
  lawyer_in_the_loop_product_team --> big_law_bench_and_llm_judge["Big Law Bench and LLM judge"]
  harvey_assistant_and_workflows --> component_evaluation_harness["Component evaluation harness"]
  document_corpus --> component_evaluation_harness
  citation_and_verification_layer --> component_evaluation_harness
  component_evaluation_harness --> langsmith_and_custom_eval_tools["LangSmith and custom eval tools"]
  human_preference_evaluation_tooling --> product_specific_tests_and_dogfooding["Product-specific tests and dogfooding"]
  big_law_bench_and_llm_judge --> product_specific_tests_and_dogfooding
  product_specific_tests_and_dogfooding --> lawyer_in_the_loop_product_team
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Legal professional user Lawyer or professional-services user who asks questions, drafts documents, verifies answers, and evaluates output quality. Harvey assistant and workflows, Citation and verification layer, Human preference evaluation tooling
Harvey assistant and workflows General assistant, document drafting/summarization tools, domain-specific workflows, agentic search, memory, and long-running tasks. Firm knowledge and templates, Document corpus, Citation and verification layer, Component evaluation harness
Firm knowledge and templates Customer-specific knowledge bases and templates used to customize legal output. Harvey assistant and workflows
Document corpus Contracts, emails, case law, legislation, trial documents, discovery materials, and other legal documents. Harvey assistant and workflows, Component evaluation harness
Citation and verification layer Grounds generated statements in verifiable sources so users can inspect whether summaries and answers are acceptable. Harvey assistant and workflows, Legal professional user, Component evaluation harness
Lawyer-in-the-loop product team Embedded lawyers who identify use cases, collect datasets, create eval rubrics, iterate UI, run end-to-end tests, demo to customers, and translate feedback. AI prototyping stack, Human preference evaluation tooling, Big Law Bench and LLM judge, Product-specific tests and dogfooding
AI prototyping stack Internal tooling for rapid iteration on prompts, algorithms, workflows, and UI before productization. Lawyer-in-the-loop product team, Harvey assistant and workflows
Human preference evaluation tooling Side-by-side rater workflow that collects relative preference, 1-7 ratings, and qualitative feedback. Lawyer-in-the-loop product team, Legal professional user, Product-specific tests and dogfooding
Big Law Bench and LLM judge Harvey's custom benchmark and domain-expert-crafted rubrics for open-ended legal tasks. Lawyer-in-the-loop product team, Product-specific tests and dogfooding
Component evaluation harness Evaluates individual workflow steps such as query rewriting, retrieval, answer generation, and citation creation. Harvey assistant and workflows, Document corpus, Citation and verification layer, LangSmith and custom eval tools
LangSmith and custom eval tools External and internal evaluation tooling used for routine component evals and human-rater-focused workflows. Component evaluation harness, Human preference evaluation tooling
Product-specific tests and dogfooding Additional datasets and internal qualitative review used to find regressions before customer rollout. Big Law Bench and LLM judge, Human preference evaluation tooling, Lawyer-in-the-loop product team

Data flow

Customer legal documents, firm knowledge bases, templates, and workflow context enter Harvey's assistant, document-analysis, and agentic workflow products. Lawyers and product teams build prototypes and evaluation datasets, then collect side-by-side human preference ratings, run Big Law Bench and product-specific automated evaluations, decompose RAG/workflow components such as query rewriting, retrieval, answer generation, and citation creation, and use qualitative dogfooding/customer feedback to decide whether new models, prompts, algorithms, or product changes are ready for customers.

3 supporting quotes
“Our AI can leverage firm specific information such as firm internal firm internal knowledge bases or their templates to customize the output.”transcript, stated
“lawyers would collaborate with engineers and product to build out the algorithm and the eval data set.”transcript, stated
“Typical steps for rag may include first you rewrite the query, then you find the matching chunks and docs using a search or retrieval system.”transcript, stated

Why this architecture

Harvey's architecture reflects the legal domain's high quality bar: factual correctness alone is insufficient, domain experts must define nuance and taste, and multi-step legal work needs both source-grounded citations and component-level evaluation. The combination of lawyers, prototypes, human preferences, LLM judges, custom benchmarks, component evals, and dogfooding reduces the risk that an apparently strong model fails in a customer-specific legal workflow.

3 supporting quotes
“mistakes can literally be career impacting. So, verification is key.”transcript, stated
“human preference judgments and human evals remain our highest quality signal.”transcript, stated
“breaking the problem down into components enables us to evaluate each of these steps separately”transcript, stated

Models used: state-of-the-art LLMs · GPT-4.1 · LLM-as-judge · RAG systems · agentic search · multi-step agents and workflows

Scale

Alternatives considered (roads not taken)

Rely on model capability without domain expert integration

Rejected because: Legal nuance and user empathy require lawyers to be embedded throughout use-case selection, datasets, rubrics, UI, testing, demos, and feedback translation.

“we really include lawyers at every stage of the product development process.”transcript, stated
“their domain expertise and their user empathy are really critical”transcript, stated

Use PRDs and specs as the main development artifact

Rejected because: Harvey believes legal AI product quality emerges faster through frequent prototypes and iteration with experts.

“third prototype over PRD. PRD is a product requirement dock or any kind of spec dog really.”transcript, stated
“the actual work of building great products in this domain and probably many other domains happens through frequent prototyping and iteration.”transcript, stated

Depend only on human evaluations

Rejected because: Human evals are the best signal but are time-consuming and expensive, so Harvey supplements them with model-driven and component evals.

“human preference judgments and human evals remain our highest quality signal.”transcript, stated
“human eval is very timeconuming and expensive uh especially since we're leveraging domain experts like trained attorneys”transcript, stated

Use simple academic legal benchmarks as the main automated eval

Rejected because: LegalBench-style yes/no questions do not reflect real legal work, so Harvey built Big Law Bench for open-ended subjective tasks.

“It's called legal bench. And you'll see that the question here is fairly simple in that it's a simple yes no answer”transcript, stated
“we actually built our own eval benchmark called big lawbench which contains complex open-ended tasks with subjective answers”transcript, stated

Evaluate complex workflows only end to end

Rejected because: Breaking workflows into components makes evaluation tractable and enables more automated evaluation.

“workflows and agents are really multi-step processes and breaking the problem down into components enables us to evaluate each of these steps separately”transcript, stated
“Each of these can be evaluated as its own step and the same idea applies to complex workflows, citations etc etc.”transcript, stated

Launch GPT-4.1 after strong benchmark and human-rater results

Rejected because: Additional product-specific tests and dogfooding caught off-brand response regressions before customer rollout.

“We could have just launched it at this point, but in addition to that, we ran a lot of additional tests”transcript, stated
“4.1 was much more likely to start every response with the word certainly exclamation mark which is not really what we were going for”transcript, stated

Patterns

human-in-the-loop-gate (domain expert integration)

Harvey embeds lawyers throughout product development and uses trained legal experts as raters, rubric authors, dogfooders, demo participants, and feedback translators.

“lawyer in the loop. So we really include lawyers at every stage of the product development process.”transcript, stated
“Lawyers also play a really important part of our go to market strategy.”transcript, stated

eval-driven-development (legal quality evaluation)

Harvey ties product development to human preference evals, Big Law Bench, LLM-as-judge rubrics, product-specific datasets, component evals, dogfooding, and launch decisions.

“the best eval are tightly integrated into the product development process”transcript, stated
“then we use this to make launch decisions, whether to ship a new model, a new prompt or algorithm.”transcript, stated

rag-retrieval (legal corpus QA)

The canonical component-eval example decomposes RAG over legal corpora into query rewriting, chunk/document retrieval, answer generation, and citation creation.

“one canonical canonical example for this is rag. Let's say for QA over a large corpus.”transcript, stated
“then you find the matching chunks and docs using a search or retrieval system. Then you generate the answer from the sources”transcript, stated

structured-output-contract (document analysis outputs)

Harvey's workflows generate tables, structured analysis, citations, and rubric-scored outputs, and document extraction can output table results.

“Harvey can analyze hundreds or thousands of documents at once and output to a table or summarize the results.”transcript, stated
“is the response formatted as a table with columns X, Y, and Z?”transcript, stated

observability-tracing (evaluation tooling)

Harvey uses LangSmith extensively for routine evaluation of broken-down tasks while combining it with custom human-rater tools.

“we leverage Langmith extensively for some subset of our evals.”transcript, stated
“we've also built some of our own tools for some of the more human raider focused evaluations.”transcript, stated

agent-memory (personalization)

Harvey describes agentic capabilities that include personalization and memory alongside multi-step search and long-running tasks.

“multi-step agentic search, more personalization in memory, and the ability to execute longunning tasks.”transcript, stated

Tradeoffs

Embed lawyers throughout development.

Chose Lawyer-in-the-loop product development over Engineering-led AI development with domain review only at the end.

Rationale: Legal products require domain expertise and user empathy in use cases, datasets, rubrics, UI, testing, demos, and feedback.

“lawyers work sidebyside with engineers, designers, product managers and so on on all aspects of building the product”transcript, stated
“from identifying use cases to data set collection to eval rubric uh creation to UI iteration and endto-end testing.”transcript, stated

Iterate through prototypes.

Chose Prototype over PRD over Spec-first product requirements documents.

Rationale: Prototypes make legal AI workflows tangible and help lawyers, engineers, and product teams iterate on real outputs.

“prototype over PRD. PRD is a product requirement dock or any kind of spec dog really.”transcript, stated
“Specs can be helpful, but prototypes really make the work tangible and easier to gro. And the quicker we can build these, the quicker we can iterate and learn.”transcript, stated

Use human ratings for launch decisions.

Chose Side-by-side preference, 1-7 ratings, and qualitative expert feedback over Automated model metrics alone.

Rationale: Legal quality is nuanced and subjective enough that expert preference remains the highest-quality signal.

“We'll typically ask them, okay, which of these do you prefer just relatively speaking?”transcript, stated
“then we use this to make launch decisions, whether to ship a new model, a new prompt or algorithm.”transcript, stated

Build a legal-work benchmark.

Chose Big Law Bench with open-ended subjective tasks over LegalBench-style yes/no questions.

Rationale: Real legal work requires analysis over external materials and paragraphs of subjective text, not simple classification.

“we actually built our own eval benchmark called big lawbench”transcript, stated
“analyze these trial documents draft an analysis of conflicts gaps contradictions etc etc and the output here is probably paragraphs of text.”transcript, stated

Decompose workflow evaluation.

Chose Component-level evaluation for RAG, workflows, and citations over Only evaluating final workflow output.

Rationale: Breaking each step into an eval unit makes multi-step legal agents more tractable to automate and debug.

“breaking the problem down into components enables us to evaluate each of these steps separately”transcript, stated
“Each of these can be evaluated as its own step and the same idea applies to complex workflows, citations etc etc.”transcript, stated

Gotchas (what bit them)

Legal correctness is not enough to capture quality.

Root cause: Two answers can both be factually correct and non-hallucinatory, while lawyers prefer one because of nuance and definition detail.

Resolution: Use domain-expert human preference judgments and qualitative feedback in addition to automated metrics.

“They're actually both factually correct. Neither of them have any hallucinations.”transcript, stated
“answer two was actually strongly preferred by our in-house lawyers”transcript, stated

Sensitive legal work makes datasets and feedback difficult to obtain.

Root cause: Customer legal work is confidential, limiting reliable datasets, bug reports, and product feedback.

Resolution: Invest in in-house domain experts, internal dogfooding, custom tooling, and careful evaluation workflows.

“our customers work is very sensitive in nature.”transcript, stated
“Obtaining reliable data sets, product feedback or even bug reports can be pretty challenging for us.”transcript, stated

Academic legal benchmarks can be too simple.

Root cause: Real legal work is open-ended, context-rich, and subjective, unlike yes/no questions with no external material.

Resolution: Build Big Law Bench with complex open-ended legal tasks and domain-expert-crafted rubrics.

“the question here is fairly simple in that it's a simple yes no answer or simple yes no question”transcript, stated
“complex open-ended tasks with subjective answers that much more closely how lawyers do work in the real world.”transcript, stated

Human evals do not scale cheaply.

Root cause: The highest-quality legal evaluations require trained attorneys and nuanced review.

Resolution: Improve rater-tool throughput and supplement human evals with model-driven and component-level evaluations where possible.

“human eval is very timeconuming and expensive uh especially since we're leveraging domain experts like trained attorneys”transcript, stated
“we want to leverage automated and model driven evals wherever possible.”transcript, stated

Model launch gates can miss product-style regressions.

Root cause: A model can score well on benchmark and rater evaluations while adopting off-brand wording or other qualitative regressions.

Resolution: Run product-specific datasets and internal dogfooding before customer rollout.

“This actually helped us catch a few regressions.”transcript, stated
“4.1 was much more likely to start every response with the word certainly exclamation mark which is not really what we were going for”transcript, stated

The process data needed for legal agents often has not been captured.

Root cause: Complex legal work is learned through projects, conversations, and marginalia rather than formal playbooks.

Resolution: Treat process-data extraction as a future foundation for better domain-specific agentic workflows.

“the most important data doesn't exist yet.”transcript, stated
“It's often captured in hallway conversations or maybe handwritten margins in a document that says this is how we do this here.”transcript, stated

Evaluation

Harvey evaluates through side-by-side expert ratings, 1-7 absolute scores, qualitative comments, Big Law Bench, LLM-as-judge rubrics crafted by in-house lawyers, component-level RAG/workflow/citation evals, LangSmith routine evals, product-specific datasets, and internal dogfooding before customer rollout.

Metrics: just under 400 customers · one-third of the largest 100 US law firms · eight out of the largest ten US law firms · hundreds or thousands of documents analyzed at once · 1-7 human rating scale · GPT-4.1 evaluated before customer rollout · evaluation tooling paid back about tenfold · M&A process data can span months or years and hundreds of subtasks

3 supporting quotes
“we ask human raiders to evaluate two responses to the same query.”transcript, stated
“all of the exact evaluation criteria here were crafted by our in-house domain experts”transcript, stated
“we leverage Langmith extensively for some subset of our evals.”transcript, stated

Outcomes

The source cites just under 400 customers, one-third of the top 100 US law firms, eight of the top ten law firms, hundreds or thousands of documents analyzed at once, a 1-7 rating scale, GPT-4.1 launch evaluation, tenfold evaluation-tooling payback, and M&A workflows lasting months or years across hundreds of subtasks.

3 supporting quotes
“We've built dozens of workflows this way”transcript, stated
“It became much easier to run eval which meant that more teams started using them and used them more often”transcript, stated
“and as such the iteration speed and our product quality really improved as well as our own confidence in our product quality”transcript, stated