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