ms-marco-turkish-triplets
收藏MS MARCO Turkish Triplets 数据集概述
数据集基本信息
- 数据集名称:MS MARCO Turkish Triplets Dataset
- 许可证:Apache 2.0 License
- 主要任务类别:句子相似度(sentence-similarity)
- 语言:土耳其语(tr)
- 标签:dataset, sentence-similarity, tr, turkish, ms-marco, contrastive-learning
- 规模分类:1K<n<10K
数据集描述
土耳其语版本的原始MS MARCO数据集。该数据集包含专门为土耳其语对比学习任务准备的查询-段落三元组。此数据集从parsak/msmarco-tr格式化而来,用于基于三元组的对比学习。
数据集来源
- 来源:此数据集从parsak/msmarco-tr格式化而来,该数据集基于原始MS MARCO数据集。
数据结构
数据字段
- query_text:土耳其语查询文本
- pos_text:土耳其语正例段落文本
- neg_text:土耳其语负例段落文本
数据划分
该数据集包含以下划分:
- train:训练数据
使用方式
加载数据集
python from datasets import load_dataset dataset = load_dataset("newmindai/ms-marco-turkish-triplets") train_data = dataset[train]
推荐损失函数
该数据集针对以下损失函数进行了优化:
- MultipleNegativesRankingLoss
- CachedMultipleNegativesRankingLoss
- TripletLoss
MultipleNegativesRankingLoss(MNR)
- 目的:使相似示例更接近,同时将不同示例推远。当只有正例对(锚点,正例)并希望从批次内推导负例时使用。
- 数学公式:
L = - (1/N) * Σ log(exp(s(ai, pi) * scale) / Σ exp(s(ai, pj) * scale))
CachedMultipleNegativesRankingLoss
- 目的:与MNR数学原理相同,但内存效率更高。
- 关键区别:当大批次无法直接放入GPU内存时使用。预缓存嵌入然后计算损失,允许“虚拟”更大的批次内负例。
TripletLoss
- 目的:使锚点-正例对更接近,同时将锚点-负例对推远一个特定的边界。
- 数学公式:
L = max(0, d(a, p) - d(a, n) + m)
使用示例
使用Sentence Transformers与MultipleNegativesRankingLoss
python from sentence_transformers import SentenceTransformer, losses, InputExample model = SentenceTransformer(sentence-transformers/all-MiniLM-L6-v2) train_examples = [] for example in dataset[train]: train_examples.append(InputExample(texts=[example[query_text], example[pos_text]], label=1)) train_examples.append(InputExample(texts=[example[query_text], example[neg_text]], label=0)) train_loss = losses.MultipleNegativesRankingLoss(model) model.fit(train_objectives=[(train_examples, train_loss)], epochs=1, warmup_steps=100)
使用TripletLoss
python from sentence_transformers import SentenceTransformer, losses, InputExample train_examples = [] for example in dataset[train]: train_examples.append(InputExample(texts=[example[query_text], example[pos_text], example[neg_text]])) train_loss = losses.TripletLoss(model) model.fit(train_objectives=[(train_examples, train_loss)], epochs=1, warmup_steps=100)
数据集统计
- 语言:土耳其语(tr)
- 任务:句子相似度
- 来源:parsak/msmarco-tr(基于原始MS MARCO数据集)
- 格式:查询-段落三元组
- 使用场景:对比学习、句子嵌入
性能提示
- 批次大小:使用16-32的批次大小以获得最佳性能
- 学习率:从2e-5开始,根据验证性能进行调整
- 训练轮数:1-3轮通常足以进行微调
- 预热步骤:使用10%的预热步骤以确保训练稳定
引用
bibtex @article{msmarco2016, title={MS MARCO: A Human Generated MAchine Reading COmprehension Dataset}, author={Bajaj, Payal and Campos, Daniel and Craswell, Nick and Deng, Li and Gao, Jianfeng and Liu, Xiaodong and Majumder, Rangan and McNamara, Andrew and Mitra, Bhaskar and Nguyen, Tri and Rosenberg, Mir and Song, Xia and Stoica, Alina and Tiwary, Saurabh and Wang, Tong}, journal={arXiv preprint arXiv:1611.09268}, year={2018}, url={https://arxiv.org/abs/1611.09268}, doi={10.48550/arXiv.1611.09268} }
许可证
该数据集根据Apache 2.0许可证发布。
联系方式
如有问题请联系:info@newmind.ai




