🚀 BGE large Legal Spanish 2
BGE large Legal Spanish 2 是一个用于句子相似度计算和特征提取的模型,基于 BAAI/bge-m3
基础模型训练而来。它可以在法律相关的文本中检索信息,帮助用户快速找到与问题相关的答案。
🚀 快速开始
本模型可用于句子相似度计算和信息检索任务。通过输入源句子和一组候选句子,模型能够计算源句子与每个候选句子之间的相似度,从而找出最相关的句子。
✨ 主要特性
- 多任务支持:支持句子相似度计算、特征提取和信息检索等任务。
- 丰富的指标评估:使用多种余弦相似度相关的指标进行评估,如
cosine_accuracy
、cosine_precision
、cosine_recall
等。
- 特定领域适用:基于法律领域的数据集训练,适用于法律文本的处理。
📦 安装指南
文档中未提及安装步骤,若需使用该模型,可参考 sentence-transformers
库的官方安装文档。
💻 使用示例
文档中未提供具体的代码示例,以下是一个使用 sentence-transformers
库的简单示例,展示如何使用该模型进行句子相似度计算:
from sentence_transformers import SentenceTransformer
import numpy as np
model = SentenceTransformer('your_model_path')
source_sentence = "¿Qué tipo de obras no dan derecho a practicar la deducción en viviendas?"
sentences = [
"en el Real Decreto 2066/2008, de 12 de diciembre, por el que se regula el Plan Estatal de Vivienda y Rehabilitación 2009-2012...",
"s/kilogramo. apartado 3. Materias inhibidoras (MI): 725.42 pesetas~k-equitox...",
]
source_embedding = model.encode(source_sentence)
sentence_embeddings = model.encode(sentences)
similarities = []
for embedding in sentence_embeddings:
similarity = np.dot(source_embedding, embedding) / (np.linalg.norm(source_embedding) * np.linalg.norm(embedding))
similarities.append(similarity)
most_similar_index = np.argmax(similarities)
most_similar_sentence = sentences[most_similar_index]
print("最相似的句子是:", most_similar_sentence)
📚 详细文档
数据集
- pablosi/boe_sintetic_question_context:模型基于该数据集进行训练,该数据集可能包含法律相关的问题和上下文信息。
指标评估
模型使用了多种余弦相似度相关的指标进行评估,具体指标如下:
指标名称 |
含义 |
cosine_accuracy@1 |
前 1 个预测结果的准确率 |
cosine_accuracy@3 |
前 3 个预测结果的准确率 |
cosine_accuracy@5 |
前 5 个预测结果的准确率 |
cosine_accuracy@10 |
前 10 个预测结果的准确率 |
cosine_precision@1 |
前 1 个预测结果的精确率 |
cosine_precision@3 |
前 3 个预测结果的精确率 |
cosine_precision@5 |
前 5 个预测结果的精确率 |
cosine_precision@10 |
前 10 个预测结果的精确率 |
cosine_recall@1 |
前 1 个预测结果的召回率 |
cosine_recall@3 |
前 3 个预测结果的召回率 |
cosine_recall@5 |
前 5 个预测结果的召回率 |
cosine_recall@10 |
前 10 个预测结果的召回率 |
cosine_ndcg@10 |
前 10 个预测结果的归一化折损累积增益 |
cosine_mrr@10 |
前 10 个预测结果的平均倒数排名 |
cosine_map@100 |
前 100 个预测结果的平均准确率均值 |
模型结果
任务 |
数据集 |
指标 |
值 |
信息检索 |
dim 1024 |
cosine_accuracy@1 |
0.22023809523809523 |
信息检索 |
dim 1024 |
cosine_accuracy@3 |
0.7599206349206349 |
信息检索 |
dim 1024 |
cosine_accuracy@5 |
0.8293650793650794 |
信息检索 |
dim 1024 |
cosine_accuracy@10 |
0.8928571428571429 |
信息检索 |
dim 1024 |
cosine_precision@1 |
0.22023809523809523 |
信息检索 |
dim 1024 |
cosine_precision@3 |
0.2533068783068783 |
信息检索 |
dim 1024 |
cosine_precision@5 |
0.16587301587301587 |
信息检索 |
dim 1024 |
cosine_precision@10 |
0.08928571428571429 |
信息检索 |
dim 1024 |
cosine_recall@1 |
0.22023809523809523 |
信息检索 |
dim 1024 |
cosine_recall@3 |
0.7599206349206349 |
信息检索 |
dim 1024 |
cosine_recall@5 |
0.8293650793650794 |
信息检索 |
dim 1024 |
cosine_recall@10 |
0.8928571428571429 |
信息检索 |
dim 1024 |
cosine_ndcg@10 |
0.6077419119275815 |
信息检索 |
dim 1024 |
cosine_mrr@10 |
0.5113906210632401 |
信息检索 |
dim 1024 |
cosine_map@100 |
0.5158300046236625 |
信息检索 |
dim 768 |
cosine_accuracy@1 |
0.20238095238095238 |
信息检索 |
dim 768 |
cosine_accuracy@3 |
0.753968253968254 |
信息检索 |
dim 768 |
cosine_accuracy@5 |
0.8293650793650794 |
信息检索 |
dim 768 |
cosine_accuracy@10 |
0.8988095238095238 |
信息检索 |
dim 768 |
cosine_precision@1 |
0.20238095238095238 |
信息检索 |
dim 768 |
cosine_precision@3 |
0.2513227513227513 |
信息检索 |
dim 768 |
cosine_precision@5 |
0.16587301587301587 |
信息检索 |
dim 768 |
cosine_precision@10 |
0.0898809523809524 |
信息检索 |
dim 768 |
cosine_recall@1 |
0.20238095238095238 |
信息检索 |
dim 768 |
cosine_recall@3 |
0.753968253968254 |
信息检索 |
dim 768 |
cosine_recall@5 |
0.8293650793650794 |
信息检索 |
dim 768 |
cosine_recall@10 |
0.8988095238095238 |
信息检索 |
dim 768 |
cosine_ndcg@10 |
0.6077419119275815 |
信息检索 |
dim 768 |
cosine_mrr@10 |
0.5113906210632401 |
信息检索 |
dim 768 |
cosine_map@100 |
0.5158300046236625 |
🔧 技术细节
文档中未提供具体的技术实现细节。
📄 许可证
本模型采用 Apache-2.0
许可证。