financial-legal-synthetic-retrieval
收藏资源简介:
金融与法律合成检索对数据集是一个大规模合成数据集,专门为训练非对称检索嵌入模型而设计,专注于法律和金融文档领域。它旨在解决在对称条款匹配数据上训练的领域模型在实际检索任务(即用简短自然语言查询检索长篇幅答案段落)中表现不佳的问题。数据内容由人工构造的(查询 → 段落)训练对组成,涵盖广泛的金融和法律文档类型,如保密协议、投资管理协议、信贷协议、并购协议、金融科技/SaaS合同、衍生品、证券、房地产金融以及监管文件等。每条数据样本是一个三元组,包括一个自然语言查询、一个正向相关段落和一个困难负样本(即看起来相似但未回答查询的段落),这种结构为对比学习提供具有挑战性的训练信号。数据通过大语言模型(Qwen/Qwen3.6-35B-A3B-FP8)生成,采用分类法驱动的提示方法,基于一个庞大的分类体系(10个主要类别 × 75种文档类型 × 106个条款主题),并交叉采样行业、管辖法律、主要参与方和交易背景等维度,确保内容多样性和广泛覆盖。每个生成调用产生一个包含一段正文和三个不同粒度查询的簇,从而每个段落可衍生出三个训练三元组。数据集格式为JSON Lines,每条记录包含anchor(带[QUERY]前缀的查询)、positive(带[PASSAGE]前缀的答案段落)、negative_0(带[PASSAGE]前缀的LLM生成的困难负样本,可能缺失)、label(段落ID)、source(来源标识)和meta(元数据,包含类别、子类型和条款信息)等字段。这些前缀旨在让模型明确区分查询和段落。该数据集主要用于法律和金融检索场景下的句子嵌入模型的对比学习或Matryoshka训练,特别适合与sentence-transformers库中的损失函数结合使用,利用批内负样本和困难负样本进行训练。重要注意事项:数据集内容是模型生成的合成数据,具有 plausibility 但非真实的法律文书,可能包含事实、法律或数字上的不准确以及风格痕迹,因此不可作为法律或财务建议,也不能替代真实文档;其核心价值在于为检索模型的几何表示学习提供高质量训练信号,其中近似的真实性和困难的负样本比绝对的权威正确性更为重要。
The Financial and Legal Synthetic Retrieval Pairs Dataset is a large-scale synthetic dataset specifically constructed for training asymmetric retrieval embedding models, focusing on the legal and financial document domains. It aims to address the poor performance of domain models trained on symmetric clause-matching data in real-world retrieval tasks (i.e., retrieving long answer paragraphs with short natural language queries). The data consists of artificially constructed (query → passage) training pairs covering a wide range of financial and legal document types, including but not limited to confidentiality agreements, investment management agreements, credit agreements, merger and acquisition agreements, fintech/SaaS contracts, derivatives, securities, real estate finance, and regulatory documents. Each data sample is a triplet containing: a natural language query, a positively relevant passage that answers the query, and a hard negative sample (a passage that appears similar, such as from adjacent clauses or related document types, but does not actually answer the query). This structure is designed to provide challenging training signals for contrastive learning. The data is generated using a large language model (Qwen/Qwen3.6-35B-A3B-FP8) with a taxonomy-driven prompting approach. The generation process is based on an extensive taxonomy (10 main categories × 75 document types × 106 clause topics) and cross-samples dimensions such as industry, governing law, key parties, and transaction context, ensuring diversity and broad coverage. Each generation call produces a cluster containing one passage and three queries of varying granularity, allowing each passage to derive three training triplets. The dataset format is JSON Lines. Each record includes the following fields: anchor (query with a [QUERY] prefix), positive (answer passage with a [PASSAGE] prefix), negative_0 (LLM-generated hard negative sample with a [PASSAGE] prefix, possibly missing), label (passage ID), source (source identifier, e.g., synth_<category>), and meta (metadata containing category, subtype, and clause information). These prefixes are intended to help models clearly distinguish between queries and passages. This dataset is primarily used for contrastive learning or Matryoshka training of sentence embedding models in legal and financial retrieval scenarios, particularly suitable for use with loss functions in the sentence-transformers library (such as MultipleNegativesRankingLoss, CachedMultipleNegativesRankingLoss, MatryoshkaLoss), leveraging in-batch negatives and hard negatives for training. Important note: The dataset content is model-generated synthetic data with plausibility but is not authentic legal documentation; it may contain factual, legal, or numerical inaccuracies and stylistic artifacts. Therefore, it should not be used as legal or financial advice and cannot replace real documents. Its core value lies in providing high-quality training signals for geometric representation learning in retrieval models, where approximate authenticity and hard negative samples are more important than absolute authoritative correctness.
数据集概述
Financial & Legal Synthetic Retrieval Pairs 是一个面向金融和法律文档领域的合成检索训练数据集,专门用于训练非对称检索(asymmetric retrieval)的嵌入模型。
核心内容
- 数据对结构:每条数据包含一个三元组:查询(query)、正例段落(positive passage)和难负例(hard negative)。难负例是看似相似但不包含查询答案的段落。
- 数据格式:JSON Lines 格式,每行包含
anchor(查询,带有[QUERY]前缀)、positive(正例段落,带有[PASSAGE]前缀)、negative_0(可选难负例,带有[PASSAGE]前缀)、label(段落级 ID)、source(数据来源,格式为synth_<category>)和meta(包含 category、subtype、clause 等元信息)。 - 数据规模:超过 100K 条但少于 1M 条(100K < n < 1M)。
领域与分类
- 语言:英文。
- 文档类型覆盖:包含 10 个类别,涵盖金融和法律文档的核心领域:
- M&A(并购)
- Investment Management(投资管理)
- Lending & Credit(借贷与信用)
- NDAs & Confidentiality(保密协议)
- Fintech & Technology(金融科技与技术)
- Corporate & Securities(公司治理与证券)
- Derivatives & Structured(衍生品与结构化产品)
- Real Estate & Project Finance(房地产与项目融资)
- Regulatory & Compliance(监管与合规)
- Asset Management Ops(资产管理运营)
- 生成多样性:基于 10 个类别 × 75 种文档类型 × 106 个条款主题的矩阵,结合行业、管辖法律、主要当事人和交易背景进行条件生成,形成约 2070 万个不同的提示组合。
生成方式
- 生成模型:使用 Qwen/Qwen3.6-35B-A3B-FP8(35B 参数混合专家模型,约 3B 活跃参数),通过 vLLM 本地服务。
- 生成策略:基于分类树驱动的提示工程,一次调用生成一个聚类,返回一个包含段落、三个查询(按粒度分为具体事实型、主题关键词型、实务从业者提问型)和一个难负例的 JSON 对象。
- 温度设置:0.9,以增加同一细胞内的多样性。
预期用途
- 训练目标:用于法律和金融领域的句子嵌入模型的对比学习或 Matryoshka 训练。
- 兼容框架:可直接用于
sentence-transformers框架,支持MultipleNegativesRankingLoss、CachedMultipleNegativesRankingLoss和MatryoshkaLoss等损失函数。 - 训练信号:为检索几何(retrieval geometry)提供训练信号,注重近似真实性和难负例的重要性。
限制与责任声明
- 合成性质:所有段落均为模型生成,可能包含事实、法律或数字上的不准确及风格化痕迹,不构成法律或财务建议,不能替代真实文档。
- 偏见问题:内容反映了生成模型的知识和偏见;管辖权和行业标签仅作为提示条件,不保证准确性。
- 使用意图:仅供检索模型训练使用,不适用于权威性文档的替代。
许可证与来源
- 许可证:Apache-2.0。
- 生成模型:Qwen3.6-35B-A3B(Apache-2.0 许可)。
- 关联项目:作为开源法律/金融领域 ModernBERT 嵌入项目的一部分,项目地址为:
https://github.com/sakshamio/legal-financial-modernbert-150m。





