Agent skill

Sentence Transformers Embeddings

by Orchestra-Research in Orchestra-Research/AI-Research-SKILLs

Generates text embeddings locally with the sentence-transformers library for RAG, semantic search, clustering and similarity, with model picks for general, multilingual and legal text.

MITAuto-check passedAI & LLM Engineering

Install Sentence Transformers Embeddings

skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill sentence-transformers -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Orchestra-Research/AI-Research-SKILLs sentence-transformers --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Orchestra-Research/AI-Research-SKILLs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/15-rag/sentence-transformers .claude/skills/sentence-transformers && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sentence-transformers
GitHub stars
13k
Used in
2 other repos
Token cost
~1.6k tokens
SKILL.md length
216 words
Files
2 (incl. references)
Skills in repo
96
Repo updated
First seen
Licence
MIT

At a glance

Generates text embeddings locally with the sentence-transformers library for RAG, semantic search, clustering and similarity, with model picks for general, multilingual and legal text.

  • Works in 8 steps: Start with all-MiniLM-L6-v2 - Good… → Normalize embeddings - Better for cosine… → Use GPU if available - 10× faster encoding → …
  • Embedding documents for a RAG system without paying for an API
  • SKILL.md covers When to use Sentence…, Quick start, Popular models and Semantic search, plus 9 more sections
  • Calls pip

What it does

Sentence Transformers is a Python framework that turns sentences and other text into embedding vectors without calling a hosted API. The skill covers installing it, loading a SentenceTransformer model, encoding text singly or in large batches, running semantic search with the util helpers, and scoring cosine similarity between embeddings. It names starter models such as all-MiniLM-L6-v2 for fast general use, a multilingual MiniLM variant, and a legal-domain BERT model.

It also shows fine-tuning with InputExample objects, losses and a PyTorch DataLoader, plus wrappers that plug the embeddings into LangChain and LlamaIndex. A model selection table compares dimensions, speed and quality. OpenAI embeddings, Instructor and Cohere Embed are listed as alternatives when you want an API or task-specific instructions. A reference file lists more models; the excerpt is cut off inside the selection table.

When your agent uses it

  • Embedding documents for a RAG system without paying for an API
  • Finding semantically similar sentences or duplicate questions
  • Clustering or classifying text by meaning
  • Fine-tuning an embedding model on your own sentence pairs

Example prompts

  • “Embed these support tickets with all-MiniLM-L6-v2 and find the five closest to a new one.”
  • “Pick a multilingual sentence-transformers model for our Spanish and German FAQ search.”
  • “Fine-tune an embedding model on our labeled sentence pairs.”
  • “Plug a local Sentence Transformers model into our LlamaIndex pipeline instead of OpenAI embeddings.”

Requirements

  • Python with the `sentence-transformers` package

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Start with all-MiniLM-L6-v2 - Good baseline
  2. Normalize embeddings - Better for cosine similarity
  3. Use GPU if available - 10× faster encoding
  4. Batch encoding - More efficient
  5. Cache embeddings - Expensive to recompute
  6. Fine-tune for domain - Improves quality
  7. Test different models - Quality varies by task
  8. Monitor memory - Large models need more RAM

What it can do on your machine

Read from SKILL.md and the folder at commit 773a529. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • huggingface.co
    • sbert.net

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sentence Transformers Embeddings loads about 1.6k tokens when it runs, and up to ~2.3k if it reads all its reference files. Until then it costs about 90 tokens; SKILL.md has 216 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~90
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Orchestra-Research/AI-Research-SKILLs at commit 773a529, republished under its MIT licence (© Orchestra-Research). 216 words, ~1,581 tokens.

Download SKILL.mdSave it as .claude/skills/sentence-transformers/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
sentence-transformers
description
Framework for state-of-the-art sentence, text, and image embeddings. Provides 5000+ pre-trained models for semantic similarity, clustering, and retrieval. Supports multilingual, domain-specific, and multimodal models. Use for generating embeddings for RAG, semantic search, or similarity tasks. Best for production embedding generation.
version
1.0.0
author
Orchestra Research
license
MIT
tags
Sentence Transformers, Embeddings, Semantic Similarity, RAG, Multilingual, Multimodal, Pre-Trained Models, Clustering, Semantic Search, Production
dependencies
sentence-transformers, transformers, torch

Sentence Transformers - State-of-the-Art Embeddings

Python framework for sentence and text embeddings using transformers.

When to use Sentence Transformers

Use when:

  • Need high-quality embeddings for RAG
  • Semantic similarity and search
  • Text clustering and classification
  • Multilingual embeddings (100+ languages)
  • Running embeddings locally (no API)
  • Cost-effective alternative to OpenAI embeddings

Metrics:

  • 15,700+ GitHub stars
  • 5000+ pre-trained models
  • 100+ languages supported
  • Based on PyTorch/Transformers

Use alternatives instead:

  • OpenAI Embeddings: Need API-based, highest quality
  • Instructor: Task-specific instructions
  • Cohere Embed: Managed service

Quick start

Installation
bash
pip install sentence-transformers
Basic usage
python
from sentence_transformers import SentenceTransformer

# Load model
model = SentenceTransformer('all-MiniLM-L6-v2')

# Generate embeddings
sentences = [
    "This is an example sentence",
    "Each sentence is converted to a vector"
]

embeddings = model.encode(sentences)
print(embeddings.shape)  # (2, 384)

# Cosine similarity
from sentence_transformers.util import cos_sim
similarity = cos_sim(embeddings[0], embeddings[1])
print(f"Similarity: {similarity.item():.4f}")
General purpose
python
# Fast, good quality (384 dim)
model = SentenceTransformer('all-MiniLM-L6-v2')

# Better quality (768 dim)
model = SentenceTransformer('all-mpnet-base-v2')

# Best quality (1024 dim, slower)
model = SentenceTransformer('all-roberta-large-v1')
Multilingual
python
# 50+ languages
model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2')

# 100+ languages
model = SentenceTransformer('paraphrase-multilingual-mpnet-base-v2')
Domain-specific
python
# Legal domain
model = SentenceTransformer('nlpaueb/legal-bert-base-uncased')

# Scientific papers
model = SentenceTransformer('allenai/specter')

# Code
model = SentenceTransformer('microsoft/codebert-base')
python
from sentence_transformers import SentenceTransformer, util

model = SentenceTransformer('all-MiniLM-L6-v2')

# Corpus
corpus = [
    "Python is a programming language",
    "Machine learning uses algorithms",
    "Neural networks are powerful"
]

# Encode corpus
corpus_embeddings = model.encode(corpus, convert_to_tensor=True)

# Query
query = "What is Python?"
query_embedding = model.encode(query, convert_to_tensor=True)

# Find most similar
hits = util.semantic_search(query_embedding, corpus_embeddings, top_k=3)
print(hits)

Similarity computation

python
# Cosine similarity
similarity = util.cos_sim(embedding1, embedding2)

# Dot product
similarity = util.dot_score(embedding1, embedding2)

# Pairwise cosine similarity
similarities = util.cos_sim(embeddings, embeddings)

Batch encoding

python
# Efficient batch processing
sentences = ["sentence 1", "sentence 2", ...] * 1000

embeddings = model.encode(
    sentences,
    batch_size=32,
    show_progress_bar=True,
    convert_to_tensor=False  # or True for PyTorch tensors
)

Fine-tuning

python
from sentence_transformers import InputExample, losses
from torch.utils.data import DataLoader

# Training data
train_examples = [
    InputExample(texts=['sentence 1', 'sentence 2'], label=0.8),
    InputExample(texts=['sentence 3', 'sentence 4'], label=0.3),
]

train_dataloader = DataLoader(train_examples, batch_size=16)

# Loss function
train_loss = losses.CosineSimilarityLoss(model)

# Train
model.fit(
    train_objectives=[(train_dataloader, train_loss)],
    epochs=10,
    warmup_steps=100
)

# Save
model.save('my-finetuned-model')

LangChain integration

python
from langchain_community.embeddings import HuggingFaceEmbeddings

embeddings = HuggingFaceEmbeddings(
    model_name="sentence-transformers/all-mpnet-base-v2"
)

# Use with vector stores
from langchain_chroma import Chroma

vectorstore = Chroma.from_documents(
    documents=docs,
    embedding=embeddings
)

LlamaIndex integration

python
from llama_index.embeddings.huggingface import HuggingFaceEmbedding

embed_model = HuggingFaceEmbedding(
    model_name="sentence-transformers/all-mpnet-base-v2"
)

from llama_index.core import Settings
Settings.embed_model = embed_model

# Use in index
index = VectorStoreIndex.from_documents(documents)

Model selection guide

ModelDimensionsSpeedQualityUse Case
all-MiniLM-L6-v2384FastGoodGeneral, prototyping
all-mpnet-base-v2768MediumBetterProduction RAG
all-roberta-large-v11024SlowBestHigh accuracy needed
paraphrase-multilingual768MediumGoodMultilingual

Best practices

  1. Start with all-MiniLM-L6-v2 - Good baseline
  2. Normalize embeddings - Better for cosine similarity
  3. Use GPU if available - 10× faster encoding
  4. Batch encoding - More efficient
  5. Cache embeddings - Expensive to recompute
  6. Fine-tune for domain - Improves quality
  7. Test different models - Quality varies by task
  8. Monitor memory - Large models need more RAM

Performance

ModelSpeed (sentences/sec)MemoryDimension
MiniLM~2000120MB384
MPNet~600420MB768
RoBERTa~3001.3GB1024

Resources

© Orchestra-Research, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in 15-rag/sentence-transformers of Orchestra-Research/AI-Research-SKILLs.

  • SKILL.md
  • references/models.md

Open the folder on GitHubat commit 773a529

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in Orchestra-Research/AI-Research-SKILLs, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Sentence Transformers Embeddings next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sentence Transformers Embeddings compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sentence Transformers Embeddings this skillOrchestra-Research/AI-Research-SKILLs13k2 repos~1.6kAutomated safety check: PassMIT
Langchain RAGlangchain-ai/langchain-skills1.3k—~3.9kAutomated safety check: PassMIT
RAG Skillsllama-farm/llamafarm836—~1.3kAutomated safety check: PassApache-2.0
Discover MLrand/cc-polymath181—~574Automated safety check: PassMIT
Neo4j Graphrag Skillneo4j-contrib/neo4j-skills114—~4.2kAutomated safety check: NotesMIT
Hugging Face Transformers Usagedavila7/claude-code-templates33k11 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • Langchain RAG

    langchain-ai/langchain-skills

    Official

    INVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system.

    1.3k GitHub stars~3.9k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • RAG Skills

    llama-farm/llamafarm

    RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers.

    836 GitHub stars~1.3k tokensUpdated 4 mo ago
    AI & LLM EngineeringAuto-check passed
  • Discover ML

    rand/cc-polymath

    Automatically discover machine learning and AI skills when working with machine learning, PyTorch, training, inference, RAG, embeddings, fine-tuning, LLM, DSPy, HuggingFace, or diffusion models.

    181 GitHub stars~574 tokensUpdated 7 mo ago
    AI & LLM EngineeringAuto-check passed
  • Neo4j Graphrag Skill

    neo4j-contrib/neo4j-skills

    Build GraphRAG retrieval pipelines on Neo4j using the neo4j-graphrag Python package (v1.22.0+).

    114 GitHub stars~4.2k tokensUpdated today
    Knowledge ManagementAuto-check: notes
  • Hugging Face Transformers Usage

    davila7/claude-code-templates

    Loads pre-trained Hugging Face Transformers models for text, vision and audio tasks, runs inference with pipelines and fine-tunes on custom datasets.

    33k GitHub starsUsed in 11 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • RAG Architect

    Jeffallan/claude-skills

    Designs retrieval-augmented generation systems: document chunking, embeddings, vector store setup, hybrid search, reranking and retrieval evaluation, with checks at each step.

    12k GitHub stars~2k tokensUpdated 6 days ago
    AI & LLM EngineeringAuto-check passed

More from Orchestra-Research/AI-Research-SKILLs

All 96 skills in this repo
  • AudioCraft Audio Generation

    Orchestra-Research/AI-Research-SKILLs

    Generates music from text descriptions with MusicGen and sound effects with AudioGen, using Meta's AudioCraft PyTorch library with melody and style conditioning.

    13k GitHub starsUsed in 8 repos~3.9k tokens
    Auto-check passed
  • LLM Benchmarking with lm-evaluation-harness

    Orchestra-Research/AI-Research-SKILLs

    Runs lm-evaluation-harness to benchmark language models on academic suites such as MMLU, GSM8K and HumanEval, compare models and track training checkpoints.

    13k GitHub starsUsed in 8 repos~3k tokens
    Auto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 8 repos~3.3k tokens
    Auto-check passed
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    Auto-check passed
  • CLIP Image-Text Matching

    Orchestra-Research/AI-Research-SKILLs

    Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.

    13k GitHub starsUsed in 7 repos~1.7k tokens
    Auto-check passed
  • Whisper Speech Recognition

    Orchestra-Research/AI-Research-SKILLs

    Transcribes audio with OpenAI's Whisper: 99 languages, translation to English, language detection, six model sizes and word-level timestamps, from Python or the CLI.

    13k GitHub starsUsed in 7 repos~1.9k tokens
    Auto-check: notes

Questions about Sentence Transformers Embeddings

What does Sentence Transformers Embeddings do?

Generates text embeddings locally with the sentence-transformers library for RAG, semantic search, clustering and similarity, with model picks for general, multilingual and legal text. Sentence Transformers is a Python framework that turns sentences and other text into embedding vectors without calling a hosted API. The skill covers installing it, loading a SentenceTransformer model, encoding text singly or in large batches, running semantic search with the util helpers, and scoring cosine similarity between embeddings.

When should I use Sentence Transformers Embeddings?

Sentence Transformers Embeddings fits situations like: embedding documents for a RAG system without paying for an API; finding semantically similar sentences or duplicate questions; clustering or classifying text by meaning; fine-tuning an embedding model on your own sentence pairs.

How do I install Sentence Transformers Embeddings in Claude Code?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill sentence-transformers -a claude-code`. Or copy the skill folder (15-rag/sentence-transformers in Orchestra-Research/AI-Research-SKILLs) into .claude/skills/sentence-transformers in your project. Claude Code loads it when a task matches its description.

How do I install Sentence Transformers Embeddings in Codex?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill sentence-transformers -a codex`. Or copy the skill folder (15-rag/sentence-transformers in Orchestra-Research/AI-Research-SKILLs) into .agents/skills/sentence-transformers in your project. Codex loads it when a task matches its description.

Can I use Sentence Transformers Embeddings in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill sentence-transformers -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sentence-transformers, .gemini/skills/sentence-transformers, .github/skills/sentence-transformers and .opencode/skills/sentence-transformers in your project.

What does Sentence Transformers Embeddings need to run?

Going by SKILL.md and its folder, Sentence Transformers Embeddings needs the command-line tools its instructions call (pip). Our summary lists: Python with the `sentence-transformers` package.

Does Sentence Transformers Embeddings access the network?

SKILL.md names 3 domains. As links in the text: github.com, huggingface.co and sbert.net. This is read from the text; nothing was executed.

Is Sentence Transformers Embeddings safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sentence Transformers Embeddings use?

Sentence Transformers Embeddings is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sentence Transformers Embeddings use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 732 tokens, read only when the agent opens those files.

What are the alternatives to Sentence Transformers Embeddings?

Skills that share tags, products or a category with Sentence Transformers Embeddings: Langchain RAG (langchain-ai/langchain-skills, 1.3k stars), RAG Skills (llama-farm/llamafarm, 836 stars), Discover ML (rand/cc-polymath, 181 stars) and Neo4j Graphrag Skill (neo4j-contrib/neo4j-skills, 114 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sentence Transformers Embeddings?

Orchestra-Research (a GitHub organization) maintains it in Orchestra-Research/AI-Research-SKILLs, which has 13,405 GitHub stars. The repository holds 96 skills in this directory. The repository was last updated on June 16, 2026.

Source: Orchestra-Research/AI-Research-SKILLs on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.