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