1. A developer is exploring the Hugging Face Hub and wants to find a suitable embedding model for a multilingual semantic search application. They filter by task type and notice that some models are listed under 'feature-extraction' while others are listed under 'sentence-similarity'. They select `intfloat/multilingual-e5-large` and call `model.encode()` on a batch of queries and documents. Which statement BEST describes the correct usage pattern for this model when computing similarity scores?
- A. Pass raw query and document strings directly to `model.encode()` and compute cosine similarity between the resulting embeddings — no special prefixes are needed.
- B. Prepend `'query: '` to each query string and `'passage: '` to each document string before encoding, then compute cosine similarity between the resulting embeddings.✓ Correct
- C. Use the model's `predict()` method with query-document pairs as input, because E5 models are cross-encoders that score pairs jointly rather than encoding them independently.
- D. Encode queries and documents separately, then use dot product (not cosine similarity) as the similarity metric, because E5 embeddings are not L2-normalized.
Explanation
**Correct: B.** The `multilingual-e5-large` model (and E5 models in general) are trained with task-specific instruction prefixes. Queries must be prefixed with `'query: '` and documents/passages with `'passage: '` before encoding. Omitting these prefixes degrades retrieval quality significantly because the model was fine-tuned to expect them. Cosine similarity is then computed between the resulting embeddings. **A is wrong** because E5 models require the `query:` and `passage:` prefixes — using raw strings without prefixes is a common mistake that leads to suboptimal results. **C is wrong** because `multilingual-e5-large` is a bi-encoder (it encodes queries and documents independently), not a cross-encoder; it has no `predict()` method for pairs. **D is wrong** because E5 embeddings *are* L2-normalized by default, making cosine similarity equivalent to dot product — but more importantly, the claim that cosine similarity should not be used is incorrect.