模型简介
模型特点
模型能力
使用案例
语言:
-
英文 许可证: apache-2.0 标签:
-
句子转换器
-
句子相似度
-
特征提取
-
训练生成
-
数据集大小:5822
-
损失函数:MatryoshkaLoss
-
损失函数:MultipleNegativesRankingLoss 基础模型: nomic-ai/modernbert-embed-base 小部件:
-
源句: >- 这部分关于两份文件的信息因审议过程特权而被部分保留
128
在编号11-444中,参见First Lutz声明附件DD第17、141页,但对决策权限的描述是通用的,说明被保留的信息是“来自[FOIA]分析员向其主管的推荐”,同上第17页,以及“来自 句子:
- 原告对中央情报局不准确陈述提出了什么主张?
-
-
-
源句: |- Artificial Intelligence, Corp.并通过合同为该公司的生产部门提供服务。 辩称,无需向被上诉方申请使用其肖像的授权,因为已为制作多个企业宣传视频支付了报酬。
在多次事件发生后 句子:- 谁有责任在上诉时提供充分的记录?
-
- 引用了哪些章节编号以获取更多信息?
-
源句: >- 受保护企业的提交。SHS MJAR第28–30页;VCH MJAR第28–30页(相同)。原告认为这违反了第125.8(e)条,因为据称使受保护企业面临比一般投标者更高的评估标准,并使导师-受保护企业合资企业更难与拥有更多历史项目经验的大型公司竞争。SHS MJAR第28– 句子:
-
- 原告主张违反了哪一条款?
- 当事人寻求保留多少页的内容?
-
-
源句: >- 从中央情报局的提交开始,中央情报局在编号11-445中提交的声明中表示,“根据豁免(b)(5)保留信息的一些记录包含中央情报局工作人员与中央情报局总法律顾问办公室律师之间关于处理某些FOIA请求的保密通信。” Third Lutz 句子:
-
-
- 文件的参考编号是什么?
-
-
源句: >- contracting/contracting-assistance-programs/sba-mentor-protege-program(最后访问于2023年4月19日)。
5
受保护企业必须证明新增的导师-受保护关系不会对任一受保护企业的发展产生不利影响(例如,第二家企业不得是第一家企业的竞争对手)。” 13 C.F.R. § 125.9(b)(3). 句子:
-
- 受保护企业必须证明导师-受保护关系的什么方面?
- 与原告指控相关的豁免有哪些? 管道标签: 句子相似度 库名称: sentence-transformers 指标:
-
-
余弦准确率@1
-
余弦准确率@3
-
余弦准确率@5
-
余弦准确率@10
-
余弦精确率@1
-
余弦精确率@3
-
余弦精确率@5
-
余弦精确率@10
-
余弦召回率@1
-
余弦召回率@3
-
余弦召回率@5
-
余弦召回率@10
-
余弦归一化折损累积增益@10
-
余弦平均倒数排名@10
-
余弦平均精度@100 模型索引:
-
名称: ModernBERT Embed base Legal Matryoshka 结果:
- 任务:
类型: 信息检索
名称: 信息检索
数据集:
名称: 维度 768
类型: dim_768
指标:
- 类型: 余弦准确率@1 值: 0.5285935085007728 名称: 余弦准确率@1
- 类型: 余弦准确率@3 值: 0.5718701700154559 名称: 余弦准确率@3
- 类型: 余弦准确率@5 值: 0.6646058732612056 名称: 余弦准确率@5
- 类型: 余弦准确率@10 值: 0.7310664605873262 名称: 余弦准确率@10
- 类型: 余弦精确率@1 值: 0.5285935085007728 名称: 余弦精确率@1
- 类型: 余弦精确率@3 值: 0.5141679546625451 名称: 余弦精确率@3
- 类型: 余弦精确率@5 值: 0.3941267387944359 名称: 余弦精确率@5
- 类型: 余弦精确率@10 值: 0.2329211746522411 名称: 余弦精确率@10
- 类型: 余弦召回率@1 值: 0.17877382792375063 名称: 余弦召回率@1
- 类型: 余弦召回率@3 值: 0.4894384337970118 名称: 余弦召回率@3
- 类型: 余弦召回率@5 值: 0.6120556414219475 名称: 余弦召回率@5
- 类型: 余弦召回率@10 值: 0.7184441009788768 名称: 余弦召回率@10
- 类型: 余弦归一化折损累积增益@10 值: 0.6300476733345887 名称: 余弦归一化折损累积增益@10
- 类型: 余弦平均倒数排名@10 值: 0.5741100561811532 名称: 余弦平均倒数排名@10
- 类型: 余弦平均精度@100 值: 0.6186392686743281 名称: 余弦平均精度@100
- 任务:
类型: 信息检索
名称: 信息检索
数据集:
名称: 维度 512
类型: dim_512
指标:
- 类型: 余弦准确率@1 值: 0.5162287480680062 名称: 余弦准确率@1
- 类型: 余弦准确率@3 值: 0.5486862442040186 名称: 余弦准确率@3
- 类型: 余弦准确率@5 值: 0.6414219474497682 名称: 余弦准确率@5
- 类型: 余弦准确率@10 值: 0.7171561051004637 名称: 余弦准确率@10
- 类型: 余弦精确率@1 值: 0.5162287480680062 名称: 余弦精确率@1
- 类型: 余弦精确率@3 值: 0.4981968057702215 名称: 余弦精确率@3
- 类型: 余弦精确率@5 值: 0.38083462132921175 名称: 余弦精确率@5
- 类型: 余弦精确率@10 值: 0.22720247295208656 名称: 余弦精确率@10
- 类型: 余弦召回率@1 值: 0.17400824317362185 名称: 余弦召回率@1
- 类型: 余弦召回率@3 值: 0.47346728490468826 名称: 余弦召回率@3
- 类型: 余弦召回率@5 值: 0.5910613086038125 名称: 余弦召回率@5
- 类型: 余弦召回率@10 值: 0.702344152498712 名称: 余弦召回率@10
- 类型: 余弦归一化折损累积增益@10 值: 0.6137901932050573 名称: 余弦归一化折损累积增益@10
- 类型: 余弦平均倒数排名@10 值: 0.5592913569343243 名称: 余弦平均倒数排名@10
- 类型: 余弦平均精度@100 值: 0.6021884440021203 名称: 余弦平均精度@100
- 任务:
类型: 信息检索
名称: 信息检索
数据集:
名称: 维度 256
类型: dim_256
指标:
- 类型: 余弦准确率@1 值: 0.482225656877898 名称: 余弦准确率@1
- 类型: 余弦准确率@3 值: 0.5285935085007728 名称: 余弦准确率@3
- 类型: 余弦准确率@5 值: 0.598145285935085 名称: 余弦准确率@5
- 类型: 余弦准确率@10 值: 0.678516228748068 名称: 余弦准确率@10
- 类型: 余弦精确率@1 值: 0.482225656877898 名称: 余弦精确率@1
- 类型: 余弦精确率@3 值: 0.46986089644513135 名称: 余弦精确率@3
- 类型: 余弦精确率@5 值: 0.35857805255023184 名称: 余弦精确率@5
- 类型: 余弦精确率@10 值: 0.21468315301391033 名称: 余弦精确率@10
- 类型: 余弦召回率@1 值: 0.16267387944358577 名称: 余弦召回率@1
- 类型: 余弦召回率@3 值: 0.4492529623905203 名称: 余弦召回率@3
- 类型: 余弦召回率@5 值: 0.5569294178258629 名称: 余弦召回率@5
- 类型: 余弦召回率@10 值: 0.6642194744976816 名称: 余弦召回率@10
- 类型: 余弦归一化折损累积增益@10 值: 0.5781404945062661 名称: 余弦归一化折损累积增益@10
- 类型: 余弦平均倒数排名@10 值: 0.5249122936139936 名称: 余弦平均倒数排名@10
- 类型: 余弦平均精度@100 值: 0.5698418441661705 名称: 余弦平均精度@100
- 任务:
类型: 信息检索
名称: 信息检索
数据集:
名称: 维度 128
类型: dim_128
指标:
- 类型: 余弦准确率@1 值: 0.41576506955177744 名称: 余弦准确率@1
- 类型: 余弦准确率@3 值: 0.4435857805255023 名称: 余弦准确率@3
- 类型: 余弦准确率@5 值: 0.5363214837712519 名称: 余弦准确率@5
- 类型: 余弦准确率@10 值: 0.6105100463678517 名称: 余弦准确率@10
- 类型: 余弦精确率@1 值: 0.41576506955177744 名称: 余弦精确率@1
- 类型: 余弦精确率@3 值: 0.3992787223080887 名称: 余弦精确率@3
- 类型: 余弦精确率@5 值: 0.31282843894899537 名称: 余弦精确率@5
- 类型: 余弦精确率@10 值: 0.19242658423493045 名称: 余弦精确率@10
- 类型: 余弦召回率@1 值: 0.14258114374034003 名称: 余弦召回率@1
- 类型: 余弦召回率@3 值: 0.3835651725914477 名称: 余弦召回率@3
- 类型: 余弦召回率@5 值: 0.48776403915507466 名称: 余弦召回率@5
- 类型: 余弦召回率@10 值: 0.5963420917053066 名称: 余弦召回率@10
- 类型: 余弦归一化折损累积增益@10 值: 0.5108672198469205 名称: 余弦归一化折损累积增益@10
- 类型: 余弦平均倒数排名@10 值: 0.4573213365717227 名称: 余弦平均倒数排名@10
- 类型: 余弦平均精度@100 值: 0.5029873598412773 名称: 余弦平均精度@100
- 任务:
类型: 信息检索
名称: 信息检索
数据集:
名称: 维度 64
类型: dim_64
指标:
- 类型: 余弦准确率@1 值: 0.312210200927357 名称: 余弦准确率@1
- 类型: 余弦准确率@3 值: 0.3508500772797527 名称: 余弦准确率@3
- 类型: 余弦准确率@5 值: 0.43585780525502316 名称: 余弦准确率@5
- 类型: 余弦准确率@10 值: 0.47913446676970634 名称: 余弦准确率@10
- 类型: 余弦精确率@1 值: 0.312210200927357 名称: 余弦精确率@1
- 类型: 余弦精确率@3 值: 0.3091190108191654 名称: 余弦精确率@3
- 类型: 余弦精确率@5 值: 0.250386398763524 名称: 余弦精确率@5
- 类型: 余弦精确率@10 值: 0.14976816074188565 名称: 余弦精确率@10
- 类型: 余弦召回率@1 值: 0.10497166409067489 名称: 余弦召回率@1
- 类型: 余弦召回率@3 值: 0.2954662545079856 名称: 余弦召回率@3
- 类型: 余弦召回率@5 值: 0.3930963420917053 名称: 余弦召回率@5
- 类型: 余弦召回率@10 值: 0.46805770221535287 名称: 余弦召回率@10
- 类型: 余弦归一化折损累积增益@10 值: 0.39563928784117025 名称: 余弦归一化折损累积增益@10
- 类型: 余弦平均倒数排名@10 值: 0.3508985304580356 名称: 余弦平均倒数排名@10
- 类型: 余弦平均精度@100 值: 0.3939277813526489 名称: 余弦平均精度@100 数据集:
- 任务:
类型: 信息检索
名称: 信息检索
数据集:
名称: 维度 768
类型: dim_768
指标:
-
AdamLucek/legal-rag-positives-synthetic
ModernBERT Embed base Legal Matryoshka
这是一个基于nomic-ai/modernbert-embed-base微调的sentence-transformers模型,训练数据来自AdamLucek/legal-rag-positives-synthetic。它将句子和段落映射到768维密集向量空间,可用于语义文本相似度、语义搜索、复述挖掘、文本分类、聚类等任务。
模型详情
模型描述
- 模型类型: 句子转换器
- 基础模型: nomic-ai/modernbert-embed-base
- 最大序列长度: 8192个标记
- 输出维度: 768维
- 相似度函数: 余弦相似度
- 训练数据集:
- 语言: 英文
- 许可证: apache-2.0
完整模型架构
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: ModernBertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
使用
直接使用(Sentence Transformers)
首先安装Sentence Transformers库:
pip install -U sentence-transformers
然后可以加载此模型并运行推理。
from sentence_transformers import SentenceTransformer
# 从🤗 Hub下载
model = SentenceTransformer("AdamLucek/ModernBERT-embed-base-legal-MRL")
# 运行推理
sentences = [
'contracting/contracting-assistance-programs/sba-mentor-protege-program (last visited Apr. 19, \n2023). \n5 \n \nprotégé must demonstrate that the added mentor-protégé relationship will not adversely affect the \ndevelopment of either protégé firm (e.g., the second firm may not be a competitor of the first \nfirm).” 13 C.F.R. § 125.9(b)(3).',
'What must the protégé demonstrate about the mentor-protégé relationship?',
'What discretion do district courts have regarding a defendant’s invocation of FOIA exemptions?',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# 获取嵌入的相似度分数
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
评估
指标
信息检索
- 数据集:
dim_768
,dim_512
,dim_256
,dim_128
和dim_64
- 使用
InformationRetrievalEvaluator
评估
指标 | dim_768 | dim_512 | dim_256 | dim_128 | dim_64 |
---|---|---|---|---|---|
余弦准确率@1 | 0.5286 | 0.5162 | 0.4822 | 0.4158 | 0.3122 |
余弦准确率@3 | 0.5719 | 0.5487 | 0.5286 | 0.4436 | 0.3509 |
余弦准确率@5 | 0.6646 | 0.6414 | 0.5981 | 0.5363 | 0.4359 |
余弦准确率@10 | 0.7311 | 0.7172 | 0.6785 | 0.6105 | 0.4791 |
余弦精确率@1 | 0.5286 | 0.5162 | 0.4822 | 0.4158 | 0.3122 |
余弦精确率@3 | 0.5142 | 0.4982 | 0.4699 | 0.3993 | 0.3091 |
余弦精确率@5 | 0.3941 | 0.3808 | 0.3586 | 0.3128 | 0.2504 |
余弦精确率@10 | 0.2329 | 0.2272 | 0.2147 | 0.1924 | 0.1498 |
余弦召回率@1 | 0.1788 | 0.174 | 0.1627 | 0.1426 | 0.105 |
余弦召回率@3 | 0.4894 | 0.4735 | 0.4493 | 0.3836 | 0.2955 |
余弦召回率@5 | 0.6121 | 0.5911 | 0.5569 | 0.4878 | 0.3931 |
余弦召回率@10 | 0.7184 | 0.7023 | 0.6642 | 0.5963 | 0.4681 |
余弦归一化折损累积增益@10 | 0.63 | 0.6138 | 0.5781 | 0.5109 | 0.3956 |
余弦平均倒数排名@10 | 0.5741 | 0.5593 | 0.5249 | 0.4573 | 0.3509 |
余弦平均精度@100 | 0.6186 | 0.6022 | 0.5698 | 0.503 | 0.3939 |
训练详情
AdamLucek/legal-rag-positives-synthetic
- 数据集: AdamLucek/legal-rag-positives-synthetic
- 大小: 5,822个训练样本
- 列:
positive
和anchor
- 基于前1000个样本的近似统计:
positive anchor 类型 字符串 字符串 详情 - 最小: 15个标记
- 平均: 97.6个标记
- 最大: 153个标记
- 最小: 8个标记
- 平均: 16.68个标记
- 最大: 41个标记
- 样本:
positive anchor 基础设施安全信息”,所涉信息如果披露“必须揭示国防部关键基础设施的漏洞”。10 U.S.C. § 130e(f)。国防部最接近的断言是信息“单独或总体上,将能够
披露时必须揭示哪种类型的信息漏洞?
他们已投标。”口头辩论记录第42:18–20页。原告还主张,如果本法院要求北极星招标在IDIQ级别考虑价格,这种调整“增加了一项招标要求,必然改变GSA在授予IDIQ合同时必须进行的整体评估结构。”口头辩论记录第43:3–5页;参见上文讨论部分
关于该主张的进一步讨论在文件的哪个部分可以找到?
另一方。Fernández v. San Juan Cement Co., Inc., 118 DPR 713,
718-719 (1987)。我们的最高法庭已规定,
征收律师费的能力是最好的武器
22同上。
23 Andamios de PR v. Newport Bonding, 179 DPR 503, 520 (2010); Pérez Rodríguez
v. López Rodríguez, supra; SLG González -Figueroa v. Pacheco Romero, supra;引用编号118 DPR 713的案件是什么?
- 损失函数:
MatryoshkaLoss
参数如下:{ "loss": "MultipleNegativesRankingLoss", "matryoshka_dims": [ 768, 512, 256, 128, 64 ], "matryoshka_weights": [ 1, 1, 1, 1, 1 ], "n_dims_per_step": -1 }
训练超参数
非默认超参数
eval_strategy
: epochper_device_train_batch_size
: 32per_device_eval_batch_size
: 16gradient_accumulation_steps
: 16learning_rate
: 2e-05num_train_epochs
: 4lr_scheduler_type
: cosinewarmup_ratio
: 0.1bf16
: Truetf32
: Trueload_best_model_at_end
: Trueoptim
: adamw_torch_fusedbatch_sampler
: no_duplicates
训练日志
周期 | 步数 | 训练损失 | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 | dim_64_cosine_ndcg@10 |
---|---|---|---|---|---|---|---|
0.8791 | 10 | 5.6528 | - | - | - | - | - |
1.0 | 12 | - | 0.5926 | 0.5753 | 0.5457 | 0.4687 | 0.3455 |
1.7033 | 20 | 2.4543 | - | - | - | - | - |
2.0 | 24 | - | 0.6195 | 0.6066 | 0.5778 | 0.4998 | 0.3828 |
2.5275 | 30 | 1.7455 | - | - | - | - | - |
3.0 | 36 | - | 0.6292 | 0.6135 | 0.5765 | 0.5057 | 0.3928 |
3.3516 | 40 | 1.5499 | - | - | - | - | - |
3.7033 | 44 | - | 0.63 | 0.6138 | 0.5781 | 0.5109 | 0.3956 |
- 加粗行表示保存的检查点。
框架版本
- Python: 3.11.11
- Sentence Transformers: 3.3.1
- Transformers: 4.48.0
- PyTorch: 2.5.1+cu121
- Accelerate: 1.2.1
- Datasets: 3.2.0
- Tokenizers: 0.21.0
引用
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
MatryoshkaLoss
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
MultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}







