Legal Contract Review Dataset Template
Template for building datasets that train AI models to identify clauses, flag risks, and classify provisions in legal contracts.
ClassificationOverview
Legal contract review datasets train AI models to analyze contracts by identifying specific clause types, flagging potentially risky provisions, extracting key terms, and classifying contract sections according to their legal function. These datasets enable organizations to automate the initial triage of contracts, reducing the time lawyers spend on routine document review while ensuring that high-risk provisions receive appropriate human attention.
The dataset structure must reflect the hierarchical nature of legal documents. Contracts contain sections, clauses, and sub-clauses, each serving a specific legal purpose. Training data should include examples of common clause types — limitation of liability, indemnification, termination, confidentiality, governing law, assignment, force majeure, and intellectual property provisions. Each clause should be labeled with its type, risk level (standard, favorable, unfavorable, missing), and any specific concerns such as one-sided indemnification obligations or unusually broad non-compete provisions.
Contract review AI is particularly sensitive to training data quality because errors can have serious legal and financial consequences. The dataset must be reviewed by qualified legal professionals who understand the nuances of contract language. Context matters enormously — the same clause wording can be standard in one type of agreement and highly unusual in another. Training data should cover multiple contract types (NDAs, service agreements, employment contracts, licensing agreements, partnership agreements) to ensure the model generalizes appropriately across document categories.
Dataset Schema
interface ContractClauseExample {
instruction: string;
input: string; // The contract clause or section text
output: string; // Classification, risk assessment, or extraction result
metadata: {
contract_type: "NDA" | "MSA" | "SaaS" | "Employment" | "License" | "Partnership";
clause_type: string;
risk_level: "standard" | "favorable" | "unfavorable" | "critical";
jurisdiction: string;
};
}Sample Data
[
{
"instruction": "Classify the following contract clause and assess its risk level for the receiving party.",
"input": "The Receiving Party shall indemnify, defend, and hold harmless the Disclosing Party from and against any and all claims, damages, losses, costs, and expenses (including reasonable attorneys' fees) arising from or related to any breach of this Agreement by the Receiving Party, including but not limited to any unauthorized disclosure or use of Confidential Information.",
"output": "Clause Type: Indemnification\nRisk Level: Standard\n\nAnalysis: This is a standard one-way indemnification clause in an NDA context. The Receiving Party indemnifies the Disclosing Party for breaches of confidentiality obligations. The scope is reasonable — it covers damages arising from breach of the agreement, specifically unauthorized disclosure. The inclusion of attorneys' fees is standard. No unusual or overly broad provisions detected.\n\nRecommendation: Acceptable as-is for standard NDA.",
"metadata": {
"contract_type": "NDA",
"clause_type": "indemnification",
"risk_level": "standard",
"jurisdiction": "US-General"
}
},
{
"instruction": "Identify any concerning provisions in this limitation of liability clause.",
"input": "IN NO EVENT SHALL PROVIDER BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, REGARDLESS OF THE CAUSE OF ACTION OR THE THEORY OF LIABILITY. PROVIDER'S TOTAL AGGREGATE LIABILITY UNDER THIS AGREEMENT SHALL NOT EXCEED THE FEES PAID BY CUSTOMER IN THE TWELVE (12) MONTH PERIOD IMMEDIATELY PRECEDING THE EVENT GIVING RISE TO THE CLAIM. THIS LIMITATION SHALL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.",
"output": "Clause Type: Limitation of Liability\nRisk Level: Unfavorable (for Customer)\n\nConcerns Identified:\n1. **No carve-outs**: The limitation applies universally with no exceptions for gross negligence, willful misconduct, IP infringement, or confidentiality breaches. Industry standard is to carve out at least IP indemnification and confidentiality obligations.\n2. **Low liability cap**: 12-month trailing fees may be insufficient for enterprise agreements. Consider negotiating 24-month or a fixed dollar floor.\n3. **Failure of essential purpose language**: The final sentence attempts to preserve the limitation even when a remedy fails its essential purpose, which may be unenforceable in some jurisdictions but signals aggressive positioning.\n\nRecommendation: Negotiate carve-outs for IP, confidentiality, and data breach. Consider a higher liability cap or a super-cap for critical obligations.",
"metadata": {
"contract_type": "SaaS",
"clause_type": "limitation-of-liability",
"risk_level": "unfavorable",
"jurisdiction": "US-General"
}
}
]Data Collection Guide
Source training data from your organization's historical contract review memos, redline comments, and clause libraries. Legal teams typically maintain databases of approved clause language, negotiation playbooks, and risk assessment templates — these are excellent sources for training examples. Convert clause library entries into instruction-response pairs where the instruction asks the model to classify or assess a clause and the output provides the analysis that a junior attorney would produce.
PII redaction is critical for legal training data. Contract texts contain party names, addresses, financial terms, and other confidential business information. Use Ertas Data Suite's PII redaction to replace company names with generic placeholders (Party A, Party B), mask specific dollar amounts while preserving relative magnitudes, and remove addresses and contact information. Preserve clause structure and legal terminology while removing identifying information.
Engage practicing attorneys to review and validate training examples, particularly risk assessments. The difference between a "standard" and "unfavorable" clause often depends on context, jurisdiction, and deal dynamics that require legal expertise to evaluate. Plan for at least two attorney reviewers per example to establish consistent quality standards, and resolve disagreements through a senior attorney's review.
Quality Criteria
Legal accuracy is the paramount quality criterion. Every risk assessment, clause classification, and recommendation in the training data must be legally sound. Have qualified attorneys validate that clause types are correctly identified, risk levels accurately reflect the party's exposure, and recommendations align with reasonable legal practice. Incorrect legal analysis in training data will produce a model that gives dangerously wrong advice.
Ensure coverage across contract types, clause types, and jurisdictions. The dataset should include examples from at least 5-6 contract types with representation of all common clause categories (10-15 types). Include examples of both well-drafted and poorly drafted clauses — the model needs to recognize poor drafting as a risk factor. Include examples of missing clauses (identifying that a contract lacks a standard provision) as this is one of the most valuable capabilities of contract review AI.
Validate that the output format is consistent across examples. Every analysis should follow the same structure (Clause Type, Risk Level, Analysis, Recommendation) to train the model to produce predictable, parseable outputs. Test that the model's outputs can be integrated into downstream legal workflow tools that expect structured risk assessments.
Using This Template with Ertas
Import contract texts into Ertas Data Suite for PII redaction, removing party names, financial terms, and other confidential details while preserving the legal language and clause structure. The data lineage tracking documents every redaction, providing the audit trail that legal compliance teams require. Export the cleaned dataset in Alpaca or JSONL format for fine-tuning.
The on-premise architecture is particularly important for legal data, which is typically subject to attorney-client privilege and stringent confidentiality obligations. Processing contract texts through Ertas Data Suite's air-gapped environment ensures that privileged information never leaves your organization's infrastructure.
Recommended Model
Legal contract review benefits from larger models that can handle the complex reasoning required for risk assessment. Start with a 13B-14B parameter model such as Llama 3.1 14B for better nuanced analysis. For simpler clause classification tasks (identifying clause types without risk assessment), a 7B-8B model provides adequate performance with faster inference.
Consider domain-adaptive pre-training on a large corpus of legal text before supervised fine-tuning on your contract review dataset. Models pre-trained on general text may struggle with legal terminology, citation formats, and the complex sentence structures common in contracts.
Related Resources
Ship AI that runs on your users' devices.
Early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.