Text Classification
sentence-transformers
Safetensors
multilingual
cross-encoder
reranker
affiliation-matching
scholarly-metadata
custom_code
Instructions to use cometadata/jina-reranker-v2-multilingual-affiliations-comet-training-only with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use cometadata/jina-reranker-v2-multilingual-affiliations-comet-training-only with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("cometadata/jina-reranker-v2-multilingual-affiliations-comet-training-only", trust_remote_code=True) query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
metadata
language:
- multilingual
license: cc-by-nc-4.0
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:13717
- loss:BinaryCrossEntropyLoss
base_model: jinaai/jina-reranker-v2-base-multilingual
pipeline_tag: text-ranking
library_name: sentence-transformers
metrics:
- map
- mrr@10
- ndcg@10
model-index:
- name: cometadata/jina-reranker-v2-multilingual-affiliations
results:
- task:
type: cross-encoder-reranking
name: Cross Encoder Reranking
dataset:
name: affiliation val
type: affiliation-val
metrics:
- type: map
value: 0.9294
name: Map
- type: mrr@10
value: 0.9294
name: Mrr@10
- type: ndcg@10
value: 0.9564
name: Ndcg@10
cometadata/jina-reranker-v2-multilingual-affiliations
This is a Cross Encoder model finetuned from jinaai/jina-reranker-v2-base-multilingual using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
Model Details
Model Description
- Model Type: Cross Encoder
- Base model: jinaai/jina-reranker-v2-base-multilingual
- Maximum Sequence Length: 1024 tokens
- Number of Output Labels: 1 label
- Language: multilingual
- License: cc-by-nc-4.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Documentation: Cross Encoder Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Cross Encoders on Hugging Face
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("cometadata/jina-reranker-v2-multilingual-affiliations")
# Get scores for pairs of texts
pairs = [
["Centre sur le handicap et l'intégration, School of Economics and Political Science Université de Saint‐Gall", "College of Saint Benedict and Saint John's University, Collegeville, MN, United States"],
['Swiss Federal Institute of Technology (ETH) Zurich, Institute of Quantum Electronics, Laser Spectroscopy and Sensing Laboratory, Hoenggerberg, HPF D19, CH-8093\u2009Zurich, Switzerland', 'Laboratory of Crystallography, ETH Zurich, CH-8093 Zurich, Switzerland'],
['Swiss Federal Institute of Technology (ETH) Zurich, Institute of Quantum Electronics, Laser Spectroscopy and Sensing Laboratory, Hoenggerberg, HPF D19, CH-8093\u2009Zurich, Switzerland', "Laboratoire d'Electrochimie Physique et Analytique, École Polytechnique Fédérale de Lausanne Station 6, CH-1015 Lausanne, Switzerland"],
['Institute for Advanced Study, Technische Universität München 2 , Lichtenbergstr. 2a, D-85748 Garching, Germany', 'Department of Surgery, Technical University of Munich, School of Medicine, Munich, Germany'],
['Institute for Advanced Study, Technische Universität München 2 , Lichtenbergstr. 2a, D-85748 Garching, Germany', 'Lehrstuhl für BioMolekulare Optik, Ludwig-Maximilians-Universität München, Oettingenstrasse 67, 80538 München (Germany)'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
"Centre sur le handicap et l'intégration, School of Economics and Political Science Université de Saint‐Gall",
[
"College of Saint Benedict and Saint John's University, Collegeville, MN, United States",
'Laboratory of Crystallography, ETH Zurich, CH-8093 Zurich, Switzerland',
"Laboratoire d'Electrochimie Physique et Analytique, École Polytechnique Fédérale de Lausanne Station 6, CH-1015 Lausanne, Switzerland",
'Department of Surgery, Technical University of Munich, School of Medicine, Munich, Germany',
'Lehrstuhl für BioMolekulare Optik, Ludwig-Maximilians-Universität München, Oettingenstrasse 67, 80538 München (Germany)',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
Evaluation
Metrics
Cross Encoder Reranking
- Dataset:
affiliation-val - Evaluated with
CrossEncoderRerankingEvaluatorwith these parameters:{ "at_k": 10, "always_rerank_positives": true }
| Metric | Value |
|---|---|
| map | 0.9294 (-0.0706) |
| mrr@10 | 0.9294 (-0.0706) |
| ndcg@10 | 0.9564 (-0.0436) |
Training Details
Training Dataset
Unnamed Dataset
- Size: 13,717 training samples
- Columns:
query,document, andlabel - Approximate statistics based on the first 1000 samples:
query document label type string string int details - min: 6 characters
- mean: 86.53 characters
- max: 273 characters
- min: 8 characters
- mean: 88.5 characters
- max: 509 characters
- 0: ~50.00%
- 1: ~50.00%
- Samples:
query document label Department of Otolaryngology-Head and Neck Surgery; National Defense Medical College; Saitama Japan. Department of Otolaryngology-Head and Neck Surgery, National Defense Medical College, Japan.1Department of Otolaryngology-Head and Neck Surgery; National Defense Medical College; Saitama JapanEOG Resources, Inc0School of Science and Engineering The Chinese University of Hong Kong,Shenzhen,ChinaSchool of Science and Engineering, The Chinese University of Hong Kong, Shenzhen, China,1 - Loss:
BinaryCrossEntropyLosswith these parameters:{ "activation_fn": "torch.nn.modules.linear.Identity", "pos_weight": null }
Evaluation Dataset
Unnamed Dataset
- Size: 2,421 evaluation samples
- Columns:
query,document, andlabel - Approximate statistics based on the first 1000 samples:
query document label type string string int details - min: 10 characters
- mean: 100.92 characters
- max: 508 characters
- min: 5 characters
- mean: 103.02 characters
- max: 504 characters
- 0: ~50.00%
- 1: ~50.00%
- Samples:
query document label Centre sur le handicap et l'intégration, School of Economics and Political Science Université de Saint‐GallCollege of Saint Benedict and Saint John's University, Collegeville, MN, United States0Swiss Federal Institute of Technology (ETH) Zurich, Institute of Quantum Electronics, Laser Spectroscopy and Sensing Laboratory, Hoenggerberg, HPF D19, CH-8093 Zurich, SwitzerlandLaboratory of Crystallography, ETH Zurich, CH-8093 Zurich, Switzerland1Swiss Federal Institute of Technology (ETH) Zurich, Institute of Quantum Electronics, Laser Spectroscopy and Sensing Laboratory, Hoenggerberg, HPF D19, CH-8093 Zurich, SwitzerlandLaboratoire d'Electrochimie Physique et Analytique, École Polytechnique Fédérale de Lausanne Station 6, CH-1015 Lausanne, Switzerland0 - Loss:
BinaryCrossEntropyLosswith these parameters:{ "activation_fn": "torch.nn.modules.linear.Identity", "pos_weight": null }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepsper_device_train_batch_size: 16per_device_eval_batch_size: 16learning_rate: 2e-05warmup_ratio: 0.1bf16: Trueload_best_model_at_end: Truepush_to_hub: Truehub_model_id: cometadata/jina-reranker-v2-multilingual-affiliations
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 3max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_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: Falsebf16: Truefp16: 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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: cometadata/jina-reranker-v2-multilingual-affiliationshub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_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: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonemulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss | Validation Loss | affiliation-val_ndcg@10 |
|---|---|---|---|---|
| -1 | -1 | - | - | 0.8997 (-0.1003) |
| 0.0012 | 1 | 0.0941 | - | - |
| 0.1166 | 100 | 0.3775 | - | - |
| 0.2331 | 200 | 0.2667 | - | - |
| 0.3497 | 300 | 0.2155 | - | - |
| 0.4662 | 400 | 0.212 | - | - |
| 0.5828 | 500 | 0.2277 | 0.6306 | 0.9465 (-0.0535) |
| 0.6993 | 600 | 0.2825 | - | - |
| 0.8159 | 700 | 0.2932 | - | - |
| 0.9324 | 800 | 0.3123 | - | - |
| 1.0490 | 900 | 0.2608 | - | - |
| 1.1655 | 1000 | 0.0833 | 0.5776 | 0.9543 (-0.0457) |
| 1.2821 | 1100 | 0.0938 | - | - |
| 1.3986 | 1200 | 0.1492 | - | - |
| 1.5152 | 1300 | 0.1651 | - | - |
| 1.6317 | 1400 | 0.1842 | - | - |
| 1.7483 | 1500 | 0.2407 | 0.5891 | 0.9555 (-0.0445) |
| 1.8648 | 1600 | 0.288 | - | - |
| 1.9814 | 1700 | 0.3352 | - | - |
| 2.0979 | 1800 | 0.1082 | - | - |
| 2.2145 | 1900 | 0.0758 | - | - |
| 2.3310 | 2000 | 0.1072 | 0.5725 | 0.9563 (-0.0437) |
| 2.4476 | 2100 | 0.1437 | - | - |
| 2.5641 | 2200 | 0.153 | - | - |
| 2.6807 | 2300 | 0.2176 | - | - |
| 2.7972 | 2400 | 0.2513 | - | - |
| 2.9138 | 2500 | 0.2949 | 0.5721 | 0.9564 (-0.0436) |
| -1 | -1 | - | - | 0.9564 (-0.0436) |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.12.12
- Sentence Transformers: 5.2.0
- Transformers: 4.57.3
- PyTorch: 2.9.1+cu128
- Accelerate: 1.12.0
- Datasets: 4.4.2
- Tokenizers: 0.22.1
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}