Add instructor models (base, large, xl)#4883
Open
11shafayet wants to merge 4 commits into
Open
Conversation
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
reviewed
Jul 3, 2026
Samoed
left a comment
Member
There was a problem hiding this comment.
Can you run tasks to reproduce scores?
| open_weights=True, | ||
| revision="ce48b213095e647a6c3536364b9fa00daf57f436", | ||
| release_date="2023-01-21", | ||
| n_parameters=1_300_000_000, |
Member
There was a problem hiding this comment.
Can you fill n_embedding_parameters? You can calculate them by ModelMeta.from_hub(...).n_embedding_parameters
Author
There was a problem hiding this comment.
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!
Member
There was a problem hiding this comment.
Can you also run retrieval tasks?
Samoed
reviewed
Jul 6, 2026
| open_weights=True, | ||
| revision="ce48b213095e647a6c3536364b9fa00daf57f436", | ||
| release_date="2023-01-21", | ||
| n_parameters=1_300_000_000, |
Member
There was a problem hiding this comment.
Can you also run retrieval tasks?
Co-authored-by: Roman Solomatin <samoed.roman@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
hkunlp/instructor-base,instructor-large, andinstructor-xlto the model registry. Fixes #1996. The previous attempt (#2876) was closed unmerged; this implementation is validated against the paper.Uses
InstructSentenceTransformerModelwithapply_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
Banking77Classification→ 0.76 (paper reports ~0.77), within expected variance.Metadata notes:
2_Denselayer projects large/xl fromd_model=1024down to 768 (out_features=768).memory_usage_mbcomputed viacalculate_memory_usage_mb()for base (420) and large (1278); xl (4900) is an estimate pending a full-weights download.Checklist
mteb.get_model(model_name, revision)andmteb.get_model_meta(model_name, revision)