Langcache Crossencoder V1 Ms Marco MiniLM L12 V2
基于Transformer架构的CrossEncoder模型,在Quora问题对数据集上微调,用于计算文本对得分,适用于语义相似度和语义搜索任务。
下载量 281
发布时间 : 6/19/2025
模型简介
本模型是基于Transformer架构的CrossEncoder模型,在Quora问题对数据集上进行了微调。它可以为文本对计算得分,适用于句子对分类任务,在语义相似度和语义搜索等场景中具有重要价值。
模型特点
Quora问题对微调
在Quora问题对数据集上进行微调,专门优化了问题对的语义相似度判断能力
多任务支持
适用于文本排名、句子对分类、语义相似度计算等多种任务
高效推理
基于MiniLM架构,在保持性能的同时提供高效的推理速度
模型能力
计算文本对相似度得分
语义相似度判断
问题对分类
文本排序
使用案例
问答系统
重复问题检测
识别Quora等问答平台上的重复或相似问题
准确率68.01%,F1值56.99%
信息检索
语义搜索
根据语义相似度对搜索结果进行排序
平均精确率58.77%
🚀 Redis语义缓存CrossEncoder模型(在Quora问题对上微调)
本模型是基于Transformer架构的CrossEncoder模型,在Quora问题对数据集上进行了微调。它可以为文本对计算得分,适用于句子对分类任务,在语义相似度和语义搜索等场景中具有重要价值。
🚀 快速开始
直接使用(Sentence Transformers)
首先,安装Sentence Transformers库:
pip install -U sentence-transformers
然后,你可以加载此模型并进行推理:
from sentence_transformers import CrossEncoder
# 从🤗 Hub下载
model = CrossEncoder("aditeyabaral-redis/langcache-crossencoder-v1-ms-marco-MiniLM-L12-v2")
# 获取文本对的得分
pairs = [
['How can I get a list of my Gmail accounts?', 'How can I find all my old Gmail accounts?'],
['How can I stop Quora from modifying and editing other people’s questions on Quora?', 'Can I prevent a Quora user from editing my question on Quora?'],
['How much does it cost to design a logo in india?', 'How much does it cost to design a logo?'],
['What is screenedrenters.com?', 'What is allmyapps.com?'],
['What are the best colleges for an MBA in Australia?', 'What are the top MBA schools in Australia?'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# 或者根据与单个文本的相似度对不同文本进行排序
ranks = model.rank(
'How can I get a list of my Gmail accounts?',
[
'How can I find all my old Gmail accounts?',
'Can I prevent a Quora user from editing my question on Quora?',
'How much does it cost to design a logo?',
'What is allmyapps.com?',
'What are the top MBA schools in Australia?',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
✨ 主要特性
- 微调模型:基于
cross-encoder/ms-marco-MiniLM-L12-v2
模型在Quora问题对数据集上进行微调。 - 多任务支持:适用于文本排名、句子对分类、语义相似度计算等多种任务。
- 指标丰富:在评估中使用了准确率、F1值、召回率等多种指标。
📦 安装指南
安装Sentence Transformers库:
pip install -U sentence-transformers
📚 详细文档
模型详情
模型描述
属性 | 详情 |
---|---|
模型类型 | Cross Encoder |
基础模型 | cross-encoder/ms-marco-MiniLM-L12-v2 |
最大序列长度 | 512 tokens |
输出标签数量 | 1个标签 |
训练数据集 | Quora Question Pairs LangCache Train Set |
语言 | 英语 |
许可证 | apache-2.0 |
模型资源
- 文档:Sentence Transformers文档
- 文档:Cross Encoder文档
- 仓库:GitHub上的Sentence Transformers
- Hugging Face:Hugging Face上的Cross Encoders
评估
指标
Cross Encoder分类
- 数据集:
quora-eval
- 使用
CrossEncoderClassificationEvaluator
进行评估
指标 | 值 |
---|---|
准确率 | 0.6801 |
准确率阈值 | 3.2522 |
F1值 | 0.5699 |
F1阈值 | 2.8498 |
精确率 | 0.4213 |
召回率 | 0.8806 |
平均精确率 | 0.5877 |
训练详情
训练数据集
Quora Question Pairs LangCache Train Set
- 数据集:Quora Question Pairs LangCache Train Set
- 大小:363,861个训练样本
- 列:
sentence1
、sentence2
和label
- 基于前1000个样本的近似统计信息:
sentence1 sentence2 label 类型 字符串 字符串 整数 详情 - 最小:15个字符
- 平均:60.22个字符
- 最大:229个字符
- 最小:14个字符
- 平均:60.0个字符
- 最大:274个字符
- 0:约63.50%
- 1:约36.50%
- 样本:
sentence1 sentence2 label Why do people believe in God and how can they say he/she exists?
Why do we kill each other in the name of God?
0
What are the chances of a bee sting when a bee buzzes around you?
How can I tell if my bees are agitated/likely to sting?
0
If a man from Syro Malankara church marries a Syro-Malabar girl, can they join a Syro-Malabar parish?
Is Malabar Hills of Mumbai anyhow related to Malabar of Kerala?
0
- 损失函数:
BinaryCrossEntropyLoss
,参数如下:
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
评估数据集
Quora Question Pairs LangCache Validation Set
- 数据集:Quora Question Pairs LangCache Validation Set
- 大小:40,429个评估样本
- 列:
sentence1
、sentence2
和label
- 基于前1000个样本的近似统计信息:
sentence1 sentence2 label 类型 字符串 字符串 整数 详情 - 最小:13个字符
- 平均:59.91个字符
- 最大:266个字符
- 最小:13个字符
- 平均:59.51个字符
- 最大:293个字符
- 0:约63.80%
- 1:约36.20%
- 样本:
sentence1 sentence2 label How can I get a list of my Gmail accounts?
How can I find all my old Gmail accounts?
1
How can I stop Quora from modifying and editing other people’s questions on Quora?
Can I prevent a Quora user from editing my question on Quora?
1
How much does it cost to design a logo in india?
How much does it cost to design a logo?
0
- 损失函数:
BinaryCrossEntropyLoss
,参数如下:
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
训练超参数
非默认超参数
eval_strategy
:stepsper_device_train_batch_size
:64per_device_eval_batch_size
:64learning_rate
:0.0002num_train_epochs
:15load_best_model_at_end
:Truepush_to_hub
:Truehub_model_id
:aditeyabaral-redis/langcache-crossencoder-v1-ms-marco-MiniLM-L12-v2
所有超参数
点击展开
overwrite_output_dir
:Falsedo_predict
:Falseeval_strategy
:stepsprediction_loss_only
:Trueper_device_train_batch_size
:64per_device_eval_batch_size
:64per_gpu_train_batch_size
:Noneper_gpu_eval_batch_size
:Nonegradient_accumulation_steps
:1eval_accumulation_steps
:Nonetorch_empty_cache_steps
:Nonelearning_rate
:0.0002weight_decay
:0.0adam_beta1
:0.9adam_beta2
:0.999adam_epsilon
:1e-08max_grad_norm
:1.0num_train_epochs
:15max_steps
:-1lr_scheduler_type
:linearlr_scheduler_kwargs
:{}warmup_ratio
:0.0warmup_steps
:0log_level
:passivelog_level_replica
:warninglog_on_each_node
:Truelogging_nan_inf_filter
:Truesave_safetensors
:Truesave_on_each_node
:Falsesave_only_model
:Falserestore_callback_states_from_checkpoint
:Falseno_cuda
:Falseuse_cpu
:Falseuse_mps_device
:Falseseed
:42data_seed
:Nonejit_mode_eval
:Falseuse_ipex
:Falsebf16
:Falsefp16
:Falsefp16_opt_level
:O1half_precision_backend
:autobf16_full_eval
:Falsefp16_full_eval
:Falsetf32
:Nonelocal_rank
:0ddp_backend
:Nonetpu_num_cores
:Nonetpu_metrics_debug
:Falsedebug
:[]dataloader_drop_last
:Falsedataloader_num_workers
:0dataloader_prefetch_factor
:Nonepast_index
:-1disable_tqdm
:Falseremove_unused_columns
:Truelabel_names
:Noneload_best_model_at_end
:Trueignore_data_skip
:Falsefsdp
:[]fsdp_min_num_params
:0fsdp_config
:{'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
:Noneaccelerator_config
:{'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
:Nonelabel_smoothing_factor
:0.0optim
:adamw_torchoptim_args
:Noneadafactor
:Falsegroup_by_length
:Falselength_column_name
:lengthddp_find_unused_parameters
:Noneddp_bucket_cap_mb
:Noneddp_broadcast_buffers
:Falsedataloader_pin_memory
:Truedataloader_persistent_workers
:Falseskip_memory_metrics
:Trueuse_legacy_prediction_loop
:Falsepush_to_hub
:Trueresume_from_checkpoint
:Nonehub_model_id
:aditeyabaral-redis/langcache-crossencoder-v1-ms-marco-MiniLM-L12-v2hub_strategy
:every_savehub_private_repo
:Nonehub_always_push
:Falsegradient_checkpointing
:Falsegradient_checkpointing_kwargs
:Noneinclude_inputs_for_metrics
:Falseinclude_for_metrics
:[]eval_do_concat_batches
:Truefp16_backend
:autopush_to_hub_model_id
:Nonepush_to_hub_organization
:Nonemp_parameters
:auto_find_batch_size
:Falsefull_determinism
:Falsetorchdynamo
:Noneray_scope
:lastddp_timeout
:1800torch_compile
:Falsetorch_compile_backend
:Nonetorch_compile_mode
:Noneinclude_tokens_per_second
:Falseinclude_num_input_tokens_seen
:Falseneftune_noise_alpha
:Noneoptim_target_modules
:Nonebatch_eval_metrics
:Falseeval_on_start
:Falseuse_liger_kernel
:Falseeval_use_gather_object
:Falseaverage_tokens_across_devices
:Falseprompts
:Nonebatch_sampler
:batch_samplermulti_dataset_batch_sampler
:proportional
训练日志
点击展开
轮次 | 步数 | 训练损失 | 验证损失 | quora-eval平均精确率 |
---|---|---|---|---|
0.0879 | 500 | 0.3912 | 0.3494 | 0.5710 |
0.1759 | 1000 | 0.3467 | 0.3193 | 0.5648 |
0.2638 | 1500 | 0.3403 | 0.3179 | 0.5698 |
0.3517 | 2000 | 0.3348 | 0.3045 | 0.6115 |
0.4397 | 2500 | 0.3275 | 0.3143 | 0.6306 |
0.5276 | 3000 | 0.3153 | 0.3034 | 0.5772 |
0.6155 | 3500 | 0.3196 | 0.2990 | 0.5759 |
0.7035 | 4000 | 0.3165 | 0.2924 | 0.5700 |
0.7914 | 4500 | 0.3052 | 0.2987 | 0.6343 |
0.8794 | 5000 | 0.3131 | 0.3184 | 0.5388 |
0.9673 | 5500 | 0.3053 | 0.2936 | 0.6038 |
1.0552 | 6000 | 0.2782 | 0.3003 | 0.6315 |
1.1432 | 6500 | 0.2599 | 0.2922 | 0.6226 |
1.2311 | 7000 | 0.2661 | 0.3477 | 0.6244 |
1.3190 | 7500 | 0.2578 | 0.3150 | 0.6438 |
1.4070 | 8000 | 0.2644 | 0.2915 | 0.6168 |
1.4949 | 8500 | 0.2635 | 0.2835 | 0.6427 |
1.5828 | 9000 | 0.266 | 0.2880 | 0.6556 |
1.6708 | 9500 | 0.2618 | 0.3050 | 0.6258 |
1.7587 | 10000 | 0.2651 | 0.2815 | 0.6488 |
1.8466 | 10500 | 0.2703 | 0.2803 | 0.5877 |
1.9346 | 11000 | 0.2601 | 0.2925 | 0.5998 |
2.0225 | 11500 | 0.2527 | 0.3401 | 0.6626 |
2.1104 | 12000 | 0.2173 | 0.2813 | 0.6109 |
2.1984 | 12500 | 0.2124 | 0.3034 | 0.6207 |
2.2863 | 13000 | 0.2221 | 0.3097 | 0.6164 |
2.3743 | 13500 | 0.2231 | 0.2929 | 0.5904 |
2.4622 | 14000 | 0.2247 | 0.3355 | 0.5872 |
2.5501 | 14500 | 0.226 | 0.3286 | 0.6354 |
2.6381 | 15000 | 0.2312 | 0.3024 | 0.5988 |
2.7260 | 15500 | 0.2382 | 0.2854 | 0.5627 |
2.8139 | 16000 | 0.2347 | 0.2991 | 0.5965 |
2.9019 | 16500 | 0.2283 | 0.2949 | 0.6256 |
2.9898 | 17000 | 0.2399 | 0.2849 | 0.6317 |
3.0777 | 17500 | 0.2024 | 0.3391 | 0.5659 |
3.1657 | 18000 | 0.1963 | 0.3010 | 0.6274 |
3.2536 | 18500 | 0.1932 | 0.3469 | 0.6255 |
3.3415 | 19000 | 0.2038 | 0.3331 | 0.6052 |
3.4295 | 19500 | 0.2005 | 0.3421 | 0.5648 |
3.5174 | 20000 | 0.2078 | 0.3266 | 0.6189 |
3.6053 | 20500 | 0.2033 | 0.3398 | 0.6279 |
3.6933 | 21000 | 0.2101 | 0.3149 | 0.6106 |
3.7812 | 21500 | 0.2255 | 0.3352 | 0.6362 |
3.8692 | 22000 | 0.2107 | 0.3216 | 0.6295 |
3.9571 | 22500 | 0.2269 | 0.2968 | 0.6251 |
4.0450 | 23000 | 0.2063 | 0.3329 | 0.5968 |
4.1330 | 23500 | 0.1872 | 0.3457 | 0.5843 |
4.2209 | 24000 | 0.1902 | 0.4201 | 0.5722 |
4.3088 | 24500 | 0.2043 | 0.3506 | 0.5670 |
4.3968 | 25000 | 0.1991 | 0.3146 | 0.5807 |
4.4847 | 25500 | 0.2061 | 0.3409 | 0.3265 |
4.5726 | 26000 | 0.2104 | 0.3690 | 0.5509 |
4.6606 | 26500 | 0.2122 | 0.3400 | 0.5678 |
4.7485 | 27000 | 0.213 | 0.3401 | 0.5678 |
📄 许可证
本模型采用apache-2.0许可证。
Distilbert Base Uncased Finetuned Sst 2 English
Apache-2.0
基于DistilBERT-base-uncased在SST-2情感分析数据集上微调的文本分类模型,准确率91.3%
文本分类 英语
D
distilbert
5.2M
746
Xlm Roberta Base Language Detection
MIT
基于XLM-RoBERTa的多语言检测模型,支持20种语言的文本分类
文本分类
Transformers 支持多种语言

X
papluca
2.7M
333
Roberta Hate Speech Dynabench R4 Target
该模型通过动态生成数据集来改进在线仇恨检测,专注于从最差案例中学习以提高检测效果。
文本分类
Transformers 英语

R
facebook
2.0M
80
Bert Base Multilingual Uncased Sentiment
MIT
基于bert-base-multilingual-uncased微调的多语言情感分析模型,支持6种语言的商品评论情感分析
文本分类 支持多种语言
B
nlptown
1.8M
371
Emotion English Distilroberta Base
基于DistilRoBERTa-base微调的英文文本情感分类模型,可预测埃克曼六种基本情绪及中性类别。
文本分类
Transformers 英语

E
j-hartmann
1.1M
402
Robertuito Sentiment Analysis
基于RoBERTuito的西班牙语推文情感分析模型,支持POS(积极)/NEG(消极)/NEU(中性)三类情感分类
文本分类 西班牙语
R
pysentimiento
1.0M
88
Finbert Tone
FinBERT是一款基于金融通讯文本预训练的BERT模型,专注于金融自然语言处理领域。finbert-tone是其微调版本,用于金融情感分析任务。
文本分类
Transformers 英语

F
yiyanghkust
998.46k
178
Roberta Base Go Emotions
MIT
基于RoBERTa-base的多标签情感分类模型,在go_emotions数据集上训练,支持28种情感标签识别。
文本分类
Transformers 英语

R
SamLowe
848.12k
565
Xlm Emo T
XLM-EMO是一个基于XLM-T模型微调的多语言情感分析模型,支持19种语言,专门针对社交媒体文本的情感预测。
文本分类
Transformers 其他

X
MilaNLProc
692.30k
7
Deberta V3 Base Mnli Fever Anli
MIT
基于MultiNLI、Fever-NLI和ANLI数据集训练的DeBERTa-v3模型,擅长零样本分类和自然语言推理任务
文本分类
Transformers 英语

D
MoritzLaurer
613.93k
204
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98