Skip to content
Back to skills

Sentence Transformers

ASecurity

"Use Sentence Transformers for dense embeddings, semantic search,

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
ai-agentspythonbashapidatabasebackenddocumentation

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill sentence-transformers --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sentence Transformers?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sentence Transformers
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-sentence-transformers/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-sentence-transformers)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sentence-transformers
description: "Use Sentence Transformers for dense embeddings, semantic search,
  CrossEncoder reranking, SparseEncoder search, evaluation/training planning,
  and ONNX/OpenVINO backend optimization. Routes natural language tasks to
  focused sub-skills with bundled references and safe helper scripts."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# Sentence Transformers

Use this repo skill when a task involves the `sentence-transformers` package for embeddings, retrieval, reranking, sparse search, evaluation, fine-tuning plans, or inference backend optimization.

This root file is a router. Open the matching sub-skill and its linked references before writing code, recommending APIs, or diagnosing failures.

## Install and Verify

Use the smallest public install that matches the task:

```bash
pip install -U sentence-transformers
python - <<'PY'
import sentence_transformers
from sentence_transformers import SentenceTransformer, CrossEncoder, SparseEncoder
print(sentence_transformers.__version__)
print(SentenceTransformer.__name__, CrossEncoder.__name__, SparseEncoder.__name__)
PY
```

Optional extras are task-specific:

- Multimodal inputs: `pip install -U "sentence-transformers[image]"`, `[audio]`, or `[video]`.
- Training: `pip install -U "sentence-transformers[train]"`; add trackers such as `trackio` or `wandb` only when needed.
- ONNX: `pip install -U "sentence-transformers[onnx]"` for CPU or `[onnx-gpu]` for GPU providers.
- OpenVINO: `pip install -U "sentence-transformers[openvino]"`.

## Route by Task

| User request | Open this sub-skill | Why |
| --- | --- | --- |
| Compute dense embeddings, similarity scores, `encode_query`, `encode_document`, prompts, truncation, precision, multimodal inputs | `sub-skills/embeddings-and-similarity/SKILL.md` | Owns `SentenceTransformer` inference and output validation |
| Build semantic search over embeddings, retrieve then rerank, hard-negative mining, quantized embedding search, similarity helpers | `sub-skills/retrieval-and-utilities/SKILL.md` | Owns `sentence_transformers.util` retrieval utilities and orchestration |
| Score text pairs or rerank a candidate list with `CrossEncoder.predict` or `CrossEncoder.rank` | `sub-skills/reranking-cross-encoder/SKILL.md` | Owns reranker APIs, pair/list shapes, and activation/softmax pitfalls |
| Generate sparse embeddings, SPLADE-style search, sparse IR evaluation, sparse service integration | `sub-skills/sparse-encoder-search/SKILL.md` | Owns `SparseEncoder`, sparse vectors, active dims, and sparse-specific troubleshooting |
| Choose losses, evaluators, trainers, dataset shapes, samplers, smoke-test training plans | `sub-skills/evaluation-and-training/SKILL.md` | Owns training/evaluation planning across all three model families |
| Use `backend="onnx"` or `backend="openvino"`, optimize or quantize exported model artifacts | `sub-skills/backend-export-optimization/SKILL.md` | Owns backend extras, provider/file-name options, and export diagnostics |

## Common Decision Points

- Choose `SentenceTransformer` for first-stage retrieval, semantic similarity, clustering, classification via embeddings, and embedding precomputation.
- Choose `CrossEncoder` when scoring `(query, document)` pairs jointly is acceptable and reranking quality matters more than throughput.
- Choose `SparseEncoder` for learned sparse retrieval, lexical expansion, inverted-index-friendly scores, and SPLADE-style workflows.
- Use dense retrieval plus CrossEncoder reranking for high-quality search: retrieve top-k with embeddings, preserve `corpus_id`, then rerank selected texts.
- Keep optional services explicit. FAISS, USearch, Elasticsearch, OpenSearch, Qdrant, Seismic, ONNX Runtime, and OpenVINO require their own extras, packages, or running services.

## Bundled Checks

Run these safe helper scripts from inside this skill directory or pass an explicit script path from any project:

```bash
python sub-skills/retrieval-and-utilities/scripts/semantic_search_demo.py --toy-tensors
python sub-skills/backend-export-optimization/scripts/backend_export_check.py --signatures
python sub-skills/evaluation-and-training/scripts/training_plan_check.py --help
```

Model-loading smoke scripts intentionally require an explicit `--model`; they do not silently download a checkpoint by default.

## Troubleshooting First Reads

- Package install, optional extras, and broad workflow failures: `references/troubleshooting.md`.
- Source freshness and evidence baseline: `references/repo-provenance.md`.
- Workflow-specific failures: open the nearest sub-skill `references/troubleshooting.md`.

## Boundaries

- This skill is for using the public package and its documented APIs, not for maintainer release automation or documentation builds.
- Do not assume large models, Hub downloads, external vector databases, or GPU backends are available unless the user says so or the environment proves it.
- Do not run training, model export, service integration, or native examples as a smoke test unless the user explicitly requests those side effects and prerequisites are present.

Files in this skill

  • SKILL.md5 KB
  • references/repo-provenance.md2.2 KB
  • references/repo-routing-metadata.json529 B
  • references/troubleshooting.md3 KB
  • scripts/package_api_check.py1.9 KB
  • sub-skills/backend-export-optimization/SKILL.md3 KB
  • sub-skills/backend-export-optimization/references/backend-reference.md8 KB
  • sub-skills/backend-export-optimization/references/troubleshooting.md5.6 KB
  • sub-skills/backend-export-optimization/scripts/backend_export_check.py7.3 KB
  • sub-skills/embeddings-and-similarity/SKILL.md2.7 KB
  • sub-skills/embeddings-and-similarity/references/api-reference.md5.5 KB
  • sub-skills/embeddings-and-similarity/references/troubleshooting.md4.2 KB
  • sub-skills/embeddings-and-similarity/references/workflows.md3.9 KB
  • sub-skills/embeddings-and-similarity/scripts/dense_embedding_smoke.py4.9 KB
  • sub-skills/evaluation-and-training/SKILL.md3.6 KB
  • sub-skills/evaluation-and-training/references/evaluation-reference.md6.8 KB
  • sub-skills/evaluation-and-training/references/loss-routing.md7.8 KB
  • sub-skills/evaluation-and-training/references/training-reference.md8.2 KB
  • sub-skills/evaluation-and-training/references/troubleshooting.md6.9 KB
  • sub-skills/evaluation-and-training/scripts/training_plan_check.py13.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.