Skip to content

Add instructor models (base, large, xl)#4883

Open
11shafayet wants to merge 4 commits into
embeddings-benchmark:mainfrom
11shafayet:add-instructor-models
Open

Add instructor models (base, large, xl)#4883
11shafayet wants to merge 4 commits into
embeddings-benchmark:mainfrom
11shafayet:add-instructor-models

Conversation

@11shafayet

Copy link
Copy Markdown

Adds hkunlp/instructor-base, instructor-large, and instructor-xl to the model registry. Fixes #1996. The previous attempt (#2876) was closed unmerged; this implementation is validated against the paper.

Uses InstructSentenceTransformerModel with apply_instruction_to_passages=True, since Instructor applies its instruction to both queries and passages (unlike E5, which instructs queries only). The template "{instruction} " matches the model card's "Represent the [domain] [text_type] for [task_objective]: <text>" format.

Validation: instructor-base on Banking77Classification0.76 (paper reports ~0.77), within expected variance.

Metadata notes:

  • All three models are 768-dim — verified empirically. The T5 2_Dense layer projects large/xl from d_model=1024 down to 768 (out_features=768).
  • License is apache-2.0 per the model card.
  • memory_usage_mb computed via calculate_memory_usage_mb() for base (420) and large (1278); xl (4900) is an estimate pending a full-weights download.

Checklist

  • I have filled out the ModelMeta object to the extent possible
  • I have ensured that my model can be loaded using
    • mteb.get_model(model_name, revision) and
    • mteb.get_model_meta(model_name, revision)
  • I have tested the implementation works on a representative set of tasks.
  • The model is public
  • I reproduced results from the original paper on at least one benchmark, included above.

Implements hkunlp/instructor-{base,large,xl} using InstructSentenceTransformerModel
with instructions applied to both queries and passages. All three output 768-dim
embeddings (T5 2_Dense projection). Validated instructor-base on
Banking77Classification: 0.76 (paper reports ~0.77).

@Samoed Samoed left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you run tasks to reproduce scores?

open_weights=True,
revision="ce48b213095e647a6c3536364b9fa00daf57f436",
release_date="2023-01-21",
n_parameters=1_300_000_000,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you fill n_embedding_parameters? You can calculate them by ModelMeta.from_hub(...).n_embedding_parameters

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done on both counts:
Reproduced scores (instructor-base):

Banking77Classification: 0.764 (paper ~0.77)
STS12: 0.741 (paper ~0.75)

n_embedding_parameters: added for all three models (24,652,800 — shared T5 vocab embedding layer). Thanks for the review!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you also run retrieval tasks?

@Samoed Samoed added the new model Questions related to adding a new model to the benchmark label Jul 6, 2026
Comment thread mteb/models/model_implementations/instructor_models.py Outdated
open_weights=True,
revision="ce48b213095e647a6c3536364b9fa00daf57f436",
release_date="2023-01-21",
n_parameters=1_300_000_000,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you also run retrieval tasks?

Co-authored-by: Roman Solomatin <samoed.roman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new model Questions related to adding a new model to the benchmark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add instructor models

2 participants