Langcache Crossencoder V1 Ms Marco MiniLM L6 V2
这是一个基于Cross Encoder架构的模型,专门用于文本对分类任务,在Quora问题对数据集上微调而来,适用于语义相似性判断和语义搜索场景。
下载量 338
发布时间 : 6/19/2025
模型简介
该模型基于Cross Encoder架构,能够有效处理文本对分类任务,在Quora问题对数据集上进行微调,主要用于计算文本对的相似度得分。
模型特点
高效文本对处理
基于Cross Encoder架构,专门优化了文本对分类任务的性能
Quora数据集微调
在Quora问题对数据集上进行了专门微调,特别适合问答场景的语义相似性判断
多指标评估
支持准确率、F1值等多种评估指标,可全面评估模型性能
模型能力
文本对相似度计算
语义相似性判断
问答对匹配
语义搜索
使用案例
问答系统
相似问题识别
识别用户提出的问题是否与已有问题相似
准确率69.56%,F1值59.47%
语义搜索
搜索结果排序
根据查询与文档的语义相似度对搜索结果进行排序
🚀 Redis语义缓存CrossEncoder模型(在Quora问题对上微调)
这是一个基于Cross Encoder的模型,它在Quora问题对LangCache训练集上,从cross-encoder/ms-marco-MiniLM-L6-v2微调而来。该模型可以计算文本对的得分,可用于句子对分类任务。
✨ 主要特性
- 基于Cross Encoder架构,能够有效处理文本对分类任务。
- 在Quora问题对数据集上进行微调,适用于语义相似性判断、语义搜索等场景。
- 支持多种评估指标,如准确率、F1值等,可全面评估模型性能。
📦 安装指南
首先,你需要安装Sentence Transformers库:
pip install -U sentence-transformers
💻 使用示例
基础用法
安装完Sentence Transformers库后,你可以加载该模型并进行推理:
from sentence_transformers import CrossEncoder
# 从🤗 Hub下载模型
model = CrossEncoder("aditeyabaral-redis/langcache-crossencoder-v1-ms-marco-MiniLM-L6-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 |
基础模型 | cross-encoder/ms-marco-MiniLM-L6-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
评估指标
交叉编码器分类
- 数据集:
quora-eval
- 评估方法:使用
CrossEncoderClassificationEvaluator
进行评估
指标 | 值 |
---|---|
准确率 | 0.6956 |
准确率阈值 | 4.1688 |
F1值 | 0.5947 |
F1阈值 | 3.3412 |
精确率 | 0.4834 |
召回率 | 0.7727 |
平均精确率 | 0.6229 |
训练详情
训练数据集
Quora Question Pairs LangCache Train Set
- 数据集:Quora Question Pairs LangCache Train Set
- 规模:363,861个训练样本
- 列信息:
sentence1
、sentence2
和label
- 基于前1000个样本的近似统计信息:
句子1 句子2 标签 类型 字符串 字符串 整数 详情 - 最小长度: 15个字符
- 平均长度: 60.22个字符
- 最大长度: 229个字符
- 最小长度: 14个字符
- 平均长度: 60.0个字符
- 最大长度: 274个字符
- 0: ~63.50%
- 1: ~36.50%
- 样本示例:
句子1 句子2 标签 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个样本的近似统计信息:
句子1 句子2 标签 类型 字符串 字符串 整数 详情 - 最小长度: 13个字符
- 平均长度: 59.91个字符
- 最大长度: 266个字符
- 最小长度: 13个字符
- 平均长度: 59.51个字符
- 最大长度: 293个字符
- 0: ~63.80%
- 1: ~36.20%
- 样本示例:
句子1 句子2 标签 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-L6-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-L6-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.3913 | 0.3302 | 0.5603 |
0.1759 | 1000 | 0.3408 | 0.3220 | 0.5932 |
0.2638 | 1500 | 0.3318 | 0.3249 | 0.6144 |
0.3517 | 2000 | 0.3235 | 0.3027 | 0.6280 |
0.4397 | 2500 | 0.3173 | 0.2944 | 0.6233 |
0.5276 | 3000 | 0.3049 | 0.3009 | 0.6685 |
0.6155 | 3500 | 0.3071 | 0.2908 | 0.6221 |
0.7035 | 4000 | 0.3015 | 0.2854 | 0.6143 |
0.7914 | 4500 | 0.2944 | 0.2759 | 0.6361 |
0.8794 | 5000 | 0.2984 | 0.2854 | 0.6616 |
0.9673 | 5500 | 0.2898 | 0.3002 | 0.6109 |
1.0552 | 6000 | 0.2552 | 0.2800 | 0.6466 |
1.1432 | 6500 | 0.2352 | 0.2821 | 0.6305 |
1.2311 | 7000 | 0.2366 | 0.2778 | 0.5699 |
1.3190 | 7500 | 0.2332 | 0.2831 | 0.6076 |
1.4070 | 8000 | 0.2366 | 0.2783 | 0.6003 |
1.4949 | 8500 | 0.2391 | 0.2716 | 0.6195 |
1.5828 | 9000 | 0.241 | 0.2685 | 0.6229 |
1.6708 | 9500 | 0.2359 | 0.2804 | 0.6410 |
1.7587 | 10000 | 0.2374 | 0.2819 | 0.6448 |
1.8466 | 10500 | 0.2387 | 0.2750 | 0.6479 |
1.9346 | 11000 | 0.2343 | 0.2734 | 0.6034 |
2.0225 | 11500 | 0.2193 | 0.3168 | 0.6384 |
2.1104 | 12000 | 0.1741 | 0.3011 | 0.6189 |
2.1984 | 12500 | 0.1732 | 0.2988 | 0.6412 |
2.2863 | 13000 | 0.1814 | 0.2839 | 0.6156 |
2.3743 | 13500 | 0.1815 | 0.2930 | 0.5520 |
2.4622 | 14000 | 0.1774 | 0.3461 | 0.6195 |
2.5501 | 14500 | 0.1886 | 0.3033 | 0.6113 |
2.6381 | 15000 | 0.1831 | 0.2925 | 0.5815 |
2.7260 | 15500 | 0.1889 | 0.2801 | 0.5701 |
2.8139 | 16000 | 0.1869 | 0.2893 | 0.6090 |
2.9019 | 16500 | 0.1896 | 0.3038 | 0.6142 |
2.9898 | 17000 | 0.1967 | 0.2791 | 0.5967 |
3.0777 | 17500 | 0.1395 | 0.3119 | 0.5672 |
3.1657 | 18000 | 0.1392 | 0.3052 | 0.5876 |
3.2536 | 18500 | 0.1411 | 0.3030 | 0.6064 |
3.3415 | 19000 | 0.1356 | 0.3064 | 0.5535 |
3.4295 | 19500 | 0.14 | 0.3144 | 0.5978 |
3.5174 | 20000 | 0.1461 | 0.3332 | 0.5961 |
3.6053 | 20500 | 0.1468 | 0.3179 | 0.5975 |
3.6933 | 21000 | 0.1487 | 0.3327 | 0.5932 |
3.7812 | 21500 | 0.1479 | 0.3340 | 0.5888 |
3.8692 | 22000 | 0.1458 | 0.3172 | 0.5478 |
3.9571 | 22500 | 0.1566 | 0.3036 | 0.5926 |
4.0450 | 23000 | 0.1257 | 0.3552 | 0.5941 |
4.1330 | 23500 | 0.1004 | 0.3886 | 0.5067 |
4.2209 | 24000 | 0.1061 | 0.3682 | 0.5654 |
4.3088 | 24500 | 0.1087 | 0.3212 | 0.5556 |
4.3968 | 25000 | 0.11 | 0.3348 | 0.5628 |
4.4847 | 25500 | 0.1108 | 0.3740 | 0.5046 |
4.5726 | 26000 | 0.1169 | 0.3092 | 0.5882 |
4.6606 | 26500 | 0.1156 | 0.3498 | 0.4988 |
4.7485 | 27000 | 0.1232 | 0.3042 | 0.5801 |
4.8364 | ... | ... | ... | ... |
📄 许可证
本模型使用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