mteb-retrieve

Encode documents and queries with sentence-transformers, compute cosine similarities, and retrieve top-k results.

134|21|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/letta-ai/skills --skill mteb-retrieve
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mteb-retrieve
Source: https://github.com/letta-ai/skills/tree/main/ai/benchmarks/letta/terminal-bench-2/trajectory-feedback/mteb-retrieve
Command: npx skills add https://github.com/letta-ai/skills --skill mteb-retrieve

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides text embedding retrieval tasks, including encoding documents, computing similarities, and ranking documents by semantic similarity.

Core Features & Use Cases

  • Model loading & encoding: Use sentence-transformers to encode documents and query.
  • Similarity computation: Cosine similarity to rank documents by relevance.
  • Retrieval & verification: Retrieve top-k results and verify semantic alignment.

Quick Start

Example: encode a set of documents and a query, then retrieve the top-5 most similar documents by cosine similarity.

Frequently Asked Questions about mteb-retrieve

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I retrieve documents using semantic search with embeddings?

Semantic search with embeddings encodes documents and queries into vector representations, then ranks them by cosine similarity. Load your documents, encode them using an embedding model like sentence-transformers, compute cosine similarities between the query and all documents, and retrieve the top-k most similar results for your task.

What embedding model should I use for text similarity ranking?

Sentence-transformers models are designed for encoding text into dense vectors optimized for semantic similarity tasks. Choose a model based on your domain and language requirements, then use it consistently to encode both documents and queries so similarity comparisons are meaningful across your entire dataset.

How do I encode documents and queries for retrieval tasks?

Encoding converts raw text into vector embeddings using a pre-trained model. Load sentence-transformers, pass your documents and query text through the model to generate embeddings, then store or cache the document vectors for fast similarity computation and retrieval without re-encoding on every query.

Can I use cosine similarity to rank documents by relevance?

Yes, cosine similarity measures the angular distance between embedding vectors and directly indicates semantic relevance. Compute cosine similarity between your query embedding and each document embedding, then sort and retrieve the top-k documents with the highest similarity scores for your ranking needs.

How do I validate that retrieved documents are semantically relevant?

Inspect the top-k retrieved results and their similarity scores to verify semantic alignment with your query. Review the cosine similarity values and examine document content to ensure the embedding model captures the intended meaning, then adjust your model or parameters if results drift from expected relevance.

Does this approach work for the MTEB benchmark tasks?

Yes, this retrieval workflow aligns with MTEB (Massive Text Embedding Benchmark) evaluation tasks. Load benchmark datasets, encode documents and queries with your chosen embedding model, compute cosine similarities, retrieve top-k results, and validate performance against benchmark metrics to assess your retrieval system.