Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mteb/model_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class ModelMeta(BaseModel):
a benchmark as well as mark dataset contaminations.
adapted_from: Name of the model from which this model is adapted. For quantizations, fine-tunes, long doc extensions, etc.
superseded_by: Name of the model that supersedes this model, e.g., nvidia/NV-Embed-v2 supersedes v1.
is_cross_encoder: Whether the model can act as a cross-encoder or not.
modalities: A list of strings representing the modalities the model supports. Default is ["text"].
"""

Expand All @@ -114,6 +115,7 @@ class ModelMeta(BaseModel):
training_datasets: dict[str, list[str]] | None
adapted_from: str | None = None
superseded_by: str | None = None
is_cross_encoder: bool | None = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the default be False? Doesn't None signal that we don't know?

Copy link
Member Author

@Samoed Samoed Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, like don't know. I think we should specify True or False only if someone added this, because in other cases this might be misleading

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rephrased the definition slightly. I think this should make a boolean flag generally clearer. I would however still keep the default None.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is_cross_encoder: bool | None = None
is_cross_encoder: bool | None = True

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also the case for other generative models)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I make this True, it would be difficult to differentiate between encoder and cross-encoder models. The main goal of this pull request was to add the ability to filter for models that are cross-encoders. Perhaps we could create a list of possible models type, as was suggested in #1869 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No yea default to None (but True for generative models) - corrected it the wrong place

modalities: list[MODALITIES] = ["text"]

def to_dict(self):
Expand Down
3 changes: 3 additions & 0 deletions mteb/models/rerankers_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def loader_inner(**kwargs: Any) -> Encoder:
use_instructions=None,
training_datasets=None,
framework=["Sentence Transformers", "PyTorch"],
is_cross_encoder=True,
)

# languages unclear: https://huggingface.co/jinaai/jina-reranker-v2-base-multilingual/discussions/28
Expand All @@ -242,6 +243,7 @@ def loader_inner(**kwargs: Any) -> Encoder:
use_instructions=None,
training_datasets=None,
framework=["Sentence Transformers", "PyTorch"],
is_cross_encoder=True,
)

bge_reranker_v2_m3 = ModelMeta(
Expand Down Expand Up @@ -300,4 +302,5 @@ def loader_inner(**kwargs: Any) -> Encoder:
use_instructions=None,
training_datasets=bge_m3_training_data,
framework=["Sentence Transformers", "PyTorch"],
is_cross_encoder=True,
)
50 changes: 32 additions & 18 deletions mteb/models/rerankers_monot5_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def get_prediction_tokens(self, *args, **kwargs):
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

monot5_base = ModelMeta(
Expand All @@ -332,6 +333,7 @@ def get_prediction_tokens(self, *args, **kwargs):
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

monot5_large = ModelMeta(
Expand All @@ -357,6 +359,7 @@ def get_prediction_tokens(self, *args, **kwargs):
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

monot5_3b = ModelMeta(
Expand All @@ -382,6 +385,7 @@ def get_prediction_tokens(self, *args, **kwargs):
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

flant5_base = ModelMeta(
Expand All @@ -408,16 +412,17 @@ def get_prediction_tokens(self, *args, **kwargs):
"quasc": ["train"],
"qed": ["train"],
},
n_parameters=None,
n_parameters=248_000_000,
memory_usage_mb=944,
max_tokens=None,
embed_dim=None,
license=None,
embed_dim=768,
license="apache-2.0",
public_training_code=None,
public_training_data=None,
similarity_fn_name=None,
use_instructions=None,
use_instructions=True,
framework=["PyTorch"],
is_cross_encoder=True,
)

flant5_large = ModelMeta(
Expand All @@ -444,16 +449,17 @@ def get_prediction_tokens(self, *args, **kwargs):
"quasc": ["train"],
"qed": ["train"],
},
n_parameters=None,
n_parameters=783_000_000,
max_tokens=1024,
memory_usage_mb=2987,
max_tokens=None,
embed_dim=None,
license=None,
license="apache-2.0",
public_training_code=None,
public_training_data=None,
similarity_fn_name=None,
use_instructions=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

flant5_xl = ModelMeta(
Expand All @@ -480,16 +486,17 @@ def get_prediction_tokens(self, *args, **kwargs):
"quasc": ["train"],
"qed": ["train"],
},
n_parameters=None,
n_parameters=2_850_000_000,
memory_usage_mb=10871,
max_tokens=None,
embed_dim=None,
license=None,
embed_dim=2048,
license="apache-2.0",
public_training_code=None,
public_training_data=None,
similarity_fn_name=None,
use_instructions=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

flant5_xxl = ModelMeta(
Expand All @@ -516,16 +523,17 @@ def get_prediction_tokens(self, *args, **kwargs):
"quasc": ["train"],
"qed": ["train"],
},
n_parameters=None,
n_parameters=11_300_000_000,
memory_usage_mb=42980,
max_tokens=None,
embed_dim=None,
license=None,
embed_dim=4096,
license="apache-2.0",
public_training_code=None,
public_training_data=None,
similarity_fn_name=None,
use_instructions=None,
framework=["PyTorch"],
is_cross_encoder=True,
)


Expand All @@ -541,17 +549,18 @@ def get_prediction_tokens(self, *args, **kwargs):
open_weights=True,
revision="01c7f73d771dfac7d292323805ebc428287df4f9",
release_date="2023-07-18",
n_parameters=None,
n_parameters=6_740_000_000,
memory_usage_mb=None,
max_tokens=None,
embed_dim=None,
license=None,
license=None, # llama2
public_training_code=None,
public_training_data=None,
similarity_fn_name=None,
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

llama2_7b_chat = ModelMeta(
Expand All @@ -577,6 +586,7 @@ def get_prediction_tokens(self, *args, **kwargs):
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

mistral_7b = ModelMeta(
Expand All @@ -602,6 +612,7 @@ def get_prediction_tokens(self, *args, **kwargs):
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

followir_7b = ModelMeta(
Expand All @@ -617,16 +628,17 @@ def get_prediction_tokens(self, *args, **kwargs):
revision="4d25d437e38b510c01852070c0731e8f6e1875d1",
release_date="2024-04-29",
training_datasets={"jhu-clsp/FollowIR-train": ["train"]},
n_parameters=None,
n_parameters=7_240_000_000,
memory_usage_mb=13813,
max_tokens=None,
embed_dim=None,
license=None,
license="apache-2.0",
public_training_code=None,
public_training_data=None,
similarity_fn_name=None,
use_instructions=None,
framework=["PyTorch"],
is_cross_encoder=True,
)


Expand Down Expand Up @@ -751,12 +763,13 @@ def get_prediction_tokens(self, *args, **kwargs):
memory_usage_mb=None,
max_tokens=None,
embed_dim=None,
license=None,
license="mit",
public_training_code=None,
public_training_data=None,
similarity_fn_name=None,
use_instructions=None,
framework=["PyTorch"],
is_cross_encoder=True,
)

mt5_13b_mmarco_100k = ModelMeta(
Expand All @@ -782,4 +795,5 @@ def get_prediction_tokens(self, *args, **kwargs):
use_instructions=None,
training_datasets=None,
framework=["PyTorch"],
is_cross_encoder=True,
)
Loading