AGENT SKILL

sentence-transformers

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.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
sentence-transformers
license
Apache 2.0
metadata
{ "disco-role": "operating" }
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

02 资源文件 4

03 SKILL.md 正文

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:

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:

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.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351