legalbench-deep
收藏资源简介:
LegalBench-Deep 是一个多文档法律AI基准数据集,旨在评估法律AI系统在真实尽职调查工作流中处理数百份文档时的表现。该数据集针对现有基准的局限性而设计,现有基准通常只测试单次、狭窄的合成任务,无法有效评估系统在跨文档交叉引用义务、跟踪定义术语或推理累积风险暴露等复杂场景下的性能。数据集包含五个核心任务,按认知深度递增排列:DD-Review(跨N份合同查找所有风险条款)、DD-Consistency(跨文档跟踪定义术语并标记不一致)、DD-Exposure(聚合投资组合中的定量风险)、DD-Conflict(检测主协议与补充协议之间的冲突义务)以及DD-Missing(识别缺失必需条款的合同,涉及否定推理)。这些任务采用深度评分公式(D = log₂(文档数) × 推理级别 × (1 + 合成级别))来生成深度-准确度曲线,揭示模型性能下降点。评估采用三轨隔离方法:Track A(原始)将所有文档置于上下文中以测试纯模型能力;Track B(RAG)要求系统自行检索文档以测试模型与检索能力;Track C(Oracle)提供黄金文档以测试模型与合成能力,排除检索噪声。这允许将性能分解为检索增益、合成增益和整体工具贡献。数据规模属于 10K<n<100K 类别,并包含两个生成的样本数据室:sample_dataroom_20(20份合同)和 sample_dataroom_50(50份合同)。每份合同包含18个部分,风险条款以10-38%的受控比例植入,涵盖五种类型:无限责任、自动续约、知识产权缺口、控制权变更和单方面修改。所有文档均为合成生成,并带有完美的黄金标注。该数据集适用于法律AI系统的基准测试,特别是在多文档尽职调查、风险分析、合同审查和一致性检查等场景中。
LegalBench-Deep is a multi-document legal AI benchmark dataset designed to evaluate the performance of legal AI systems in real-world due diligence workflows when handling hundreds of documents. This dataset addresses the limitations of existing benchmarks, which typically test only single, narrow synthetic tasks and fail to effectively assess system performance in complex scenarios such as cross-document cross-referencing of obligations, tracking defined terms, or reasoning about cumulative risk exposures. The dataset includes five core tasks, arranged in increasing order of cognitive depth: DD-Review (finding all risk clauses across N contracts), DD-Consistency (tracking defined terms across documents and flagging inconsistencies), DD-Exposure (aggregating quantitative risks in a portfolio), DD-Conflict (detecting conflicting obligations between master and supplemental agreements), and DD-Missing (identifying contracts missing essential clauses, involving negative reasoning). These tasks use a depth scoring formula (D = log₂(document count) × reasoning level × (1 + synthesis level)) to generate depth-accuracy curves, revealing model performance degradation points. Evaluation employs a three-track isolation method: Track A (raw) places all documents in context to test pure model capabilities; Track B (RAG) requires systems to retrieve documents themselves to test model and retrieval capabilities; Track C (oracle) provides gold documents to test model and synthesis capabilities, excluding retrieval noise. This allows performance to be decomposed into retrieval gain, synthesis gain, and overall tool contribution. The data scale falls into the 10K<n<100K category and includes two generated sample datarooms: sample_dataroom_20 (20 contracts) and sample_dataroom_50 (50 contracts). Each contract contains 18 sections, with risk clauses implanted at controlled rates of 10-38%, covering five types: unlimited liability, auto-renewal, intellectual property gaps, change of control, and unilateral modification. All documents are synthetically generated and come with perfect gold annotations. The dataset is suitable for benchmarking legal AI systems, particularly in scenarios such as multi-document due diligence, risk analysis, contract review, and consistency checks.
数据集概述
LegalBench-Deep 是一个面向法律领域的人工智能基准测试数据集,旨在评估 AI 系统在数百份文档的真实尽职调查工作流中的性能。
核心动机
现有法律 AI 基准测试仅针对单一、合成的“一问一答”任务,无法衡量系统在跨文档引用义务(如50+份合同)、追踪跨文件定义术语或分析投资组合累积风险暴露时的表现。LegalBench-Deep 专门设计用于测试这种复杂场景。
方法与任务
该基准包含五个任务,针对递增的认知深度:
| 任务 | 深度 | 测试内容 |
|---|---|---|
| DD-Review | 3 | 在N份合同中查找所有风险条款 |
| DD-Consistency | 4 | 跨文档追踪定义术语,标记不一致之处 |
| DD-Exposure | 5 | 跨投资组合聚合定量风险 |
| DD-Conflict | 4 | 检测主协议与补充函之间的冲突义务 |
| DD-Missing | 3 | 识别缺少必需条款的合同(否定推理) |
深度分数 公式为:D = log₂(N_docs) × reasoning_level × (1 + synthesis_level),可生成深度-准确率曲线,展示模型性能退化点。
三轨评估体系
系统将性能分解为三个维度:
- Track A (Raw):所有文档置于上下文中 → 纯模型容量
- Track B (RAG):系统自行检索文档 → 模型+检索框架
- Track C (Oracle):提供黄金标准文档 → 模型+框架综合,排除检索噪声
最终通过差值计算检索增益(B-A)、综合增益(C-A)和框架整体贡献(B-C)。
数据组成
数据集包含两个生成的示例数据室:
| 数据集 | 合同数 | 风险条款类型 | 黄金标注 |
|---|---|---|---|
| sample_dataroom_20 | 20 | 5种(无限责任、自动续约、知识产权缺口、控制权变更、单方修改) | 逐文档 + 清单 |
| sample_dataroom_50 | 50 | 5种(同上) | 逐文档 + 清单 |
每份合同包含18个章节,以10%-38%的控制率植入风险条款。所有文档均为合成生成,并具备完美的黄金标签。
仓库结构
├── METHODOLOGY.md # 完整方法论文档 ├── tasks/ │ └── dd_review/ │ ├── task_spec.py # 可运行评估框架 │ └── README.md # 任务文档 ├── data/ │ └── generate_dataset.py # 合成数据生成器 ├── evaluation/ │ └── metrics.py # 共享指标实现 ├── sample_dataroom_20/ # 20份合同样本数据集 └── sample_dataroom_50/ # 50份合同样本数据集
快速开始
可通过脚本自定义生成数据室并运行评估:
bash
生成自定义数据室
python data/generate_dataset.py --n-docs 100 --output ./dataroom --seed 42
运行 DD-Review 评估(存根模式,无需GPU)
python tasks/dd_review/task_spec.py --dataroom ./dataroom --clause-type uncapped_liability --track all --model stub




