universal-embedder-eval
Language Models are Universal Embedders — Xin Zhang et al. (2023) (arXiv:2310.08232, 2023)
What this evaluates
Evaluates the cross-lingual and cross-domain generalization of decoder-based language models finetuned via contrastive learning on English data. Probes the model's ability to generate unified embeddings for natural language and code retrieval, semantic textual similarity, and intent classification across diverse languages and domains.
Datasets
- MTEB — total ?; splits: test (-1)
- CodeSearchNet — total ?; splits: test (-1)
- Multi-CPR — total ?; splits: test (-1)
- MASSIVE — total ?; splits: test (-1)
- STS-17 & STS-22 — total ?; splits: test (-1)
- MIRACL — total ?; splits: test (-1)
- BUCC — total ?; splits: test (-1)
Metrics
Spearman correlation (primary) — range: [-1, 1]
- Rank correlation between cosine similarity of sentence embeddings and human-annotated STS scores (1–5).
MTEB average score — range: [0, 1]
- Arithmetic mean of task-specific scores (accuracy, Spearman correlation, or Recall@k/MRR@k) across all 56 datasets in the MTEB benchmark.
nDCG@10 — range: [0, 1]
- Normalized Discounted Cumulative Gain at rank 10 for multilingual retrieval tasks.
MRR@10 — range: [0, 1]
- Mean Reciprocal Rank at top 10 for domain-specific retrieval benchmarks.
Accuracy — range: [0, 1]
- Proportion of correctly predicted intent labels in linear-probe classification setups.
F1 score — range: [0, 1]
- Harmonic mean of precision and recall for cross-lingual sentence pair retrieval.
Input / output format
Input: Sentence pairs (query, document) for retrieval; sentence pairs for semantic similarity; single sentences for classification.
Output: Continuous embedding vectors; for classification, predicted class labels.
Scoring recipe
def compute_metrics(predictions, golds, task_type):
if task_type == 'classification':
return accuracy_score(golds, predictions)
elif task_type == 'sts':
return spearmanr(cosine_similarity(predictions), golds).correlation
elif task_type == 'retrieval':
return recall_at_k(golds, predictions, k=100)
return mean([compute_metrics(p, g, t) for p, g, t in zip(preds, golds, tasks)])
Common pitfalls
- Averaging heterogeneous metrics (accuracy, Spearman, Recall) across 56 datasets can mask task-specific weaknesses.
- Evaluating on languages outside the model's pre-training vocabulary without controlling for parameter scaling.
- Comparing against proprietary APIs (e.g., Cohere) that may have been trained on or exposed to evaluation data.
Evidence (verbatim from paper)
Following the STS evaluation protocol of MTEB, we use the Spearman correlation between the cosine similarity of the sentence embeddings and the human-annotated scores (from 1 to 5) as the main metric.
Citation
@misc{zhang2023language,
title={Language Models are Universal Embedders},
author={Xin Zhang et al. (2023)},
year={2023},
note={arXiv:2310.08232}
}
1---2name: universal-embedder-eval3description: Evaluates the cross-lingual and cross-domain generalization of decoder-based language models finetuned via contrastive learning on English data. Probes the model's ability to generate unified embeddings for natural language and code retrieval, semantic textual similarity, and intent classification across diverse languages and domains. Use when the user wants to benchmark on MTEB, CodeSearchNet, Multi-CPR, MASSIVE, STS-17 & STS-22, MIRACL, BUCC, or asks about evaluating this task. Reports Spearman correlation.4---56# universal-embedder-eval78> Language Models are Universal Embedders — Xin Zhang et al. (2023) (arXiv:2310.08232, 2023)910## What this evaluates1112Evaluates the cross-lingual and cross-domain generalization of decoder-based language models finetuned via contrastive learning on English data. Probes the model's ability to generate unified embeddings for natural language and code retrieval, semantic textual similarity, and intent classification across diverse languages and domains.1314## Datasets1516- **MTEB** — total ?; splits: test (-1)17- **CodeSearchNet** — total ?; splits: test (-1)18- **Multi-CPR** — total ?; splits: test (-1)19- **MASSIVE** — total ?; splits: test (-1)20- **STS-17 & STS-22** — total ?; splits: test (-1)21- **MIRACL** — total ?; splits: test (-1)22- **BUCC** — total ?; splits: test (-1)2324## Metrics2526- `Spearman correlation` **(primary)** — range: [-1, 1]27 - Rank correlation between cosine similarity of sentence embeddings and human-annotated STS scores (1–5).28- `MTEB average score` — range: [0, 1]29 - Arithmetic mean of task-specific scores (accuracy, Spearman correlation, or Recall@k/MRR@k) across all 56 datasets in the MTEB benchmark.30- `nDCG@10` — range: [0, 1]31 - Normalized Discounted Cumulative Gain at rank 10 for multilingual retrieval tasks.32- `MRR@10` — range: [0, 1]33 - Mean Reciprocal Rank at top 10 for domain-specific retrieval benchmarks.34- `Accuracy` — range: [0, 1]35 - Proportion of correctly predicted intent labels in linear-probe classification setups.36- `F1 score` — range: [0, 1]37 - Harmonic mean of precision and recall for cross-lingual sentence pair retrieval.3839## Input / output format4041**Input**: Sentence pairs (query, document) for retrieval; sentence pairs for semantic similarity; single sentences for classification.4243**Output**: Continuous embedding vectors; for classification, predicted class labels.4445## Scoring recipe4647```python48def compute_metrics(predictions, golds, task_type):49 if task_type == 'classification':50 return accuracy_score(golds, predictions)51 elif task_type == 'sts':52 return spearmanr(cosine_similarity(predictions), golds).correlation53 elif task_type == 'retrieval':54 return recall_at_k(golds, predictions, k=100)55 return mean([compute_metrics(p, g, t) for p, g, t in zip(preds, golds, tasks)])56```5758## Common pitfalls5960- Averaging heterogeneous metrics (accuracy, Spearman, Recall) across 56 datasets can mask task-specific weaknesses.61- Evaluating on languages outside the model's pre-training vocabulary without controlling for parameter scaling.62- Comparing against proprietary APIs (e.g., Cohere) that may have been trained on or exposed to evaluation data.6364## Evidence (verbatim from paper)6566> Following the STS evaluation protocol of MTEB, we use the Spearman correlation between the cosine similarity of the sentence embeddings and the human-annotated scores (from 1 to 5) as the main metric.6768## Citation6970```bibtex71@misc{zhang2023language,72 title={Language Models are Universal Embedders},73 author={Xin Zhang et al. (2023)},74 year={2023},75 note={arXiv:2310.08232}76}77```7879- arXiv: 2310.08232