Individual skill
train-sentence-transformers
Train or fine-tune sentence-transformers models across `SentenceTransformer` (bi-encoder, dense or static embedding model for retrieval, similarity, clustering, classification, paraphrase mining, dedup, multimodal), `CrossEncoder` (reranker, pair scoring for two-stage retrieval / pair classification), `SparseEncoder` (SPLADE, sparse embedding model for learned-sparse retrieval), and `MultiVectorEncoder` (ColBERT / late-interaction, per-token embeddings scored with MaxSim). Covers loss selection, hard-negative mining, evaluators, distillation, LoRA, Matryoshka, and Hugging Face Hub publishing. Use for any sentence-transformers training task.
skills/train-sentence-transformers/SKILL.md
Source commit 25910b3d0ba31a2ba102f901cdc9e008c278a69c
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Network or broad shell
- Last checked
- Nov 9, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 11,304
- Repository last updated
- Oct 30, 2026
- License
- Apache-2.0
Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.
- engineering Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
SKILL.mdcore · 10,502 bytesSKILL.mdcore · 10,502 bytesreferences/base_model_selection.mddoc · 7,647 bytesreferences/dataset_formats.mddoc · 6,484 bytesreferences/evaluators_cross_encoder.mddoc · 5,602 bytesreferences/evaluators_multi_vector_encoder.mddoc · 6,734 bytesreferences/evaluators_sentence_transformer.mddoc · 5,986 bytesreferences/evaluators_sparse_encoder.mddoc · 5,024 bytesreferences/hardware_guide.mddoc · 6,031 bytesreferences/hf_jobs_execution.mddoc · 7,279 bytesreferences/losses_cross_encoder.mddoc · 9,736 bytesreferences/losses_multi_vector_encoder.mddoc · 10,723 bytesreferences/losses_sentence_transformer.mddoc · 10,980 bytesreferences/losses_sparse_encoder.mddoc · 5,174 bytesreferences/model_architectures.mddoc · 9,176 bytesreferences/prompts_and_instructions.mddoc · 6,540 bytesreferences/training_args.mddoc · 15,388 bytesreferences/troubleshooting.mddoc · 13,237 bytesscripts/mine_hard_negatives.pyruns · 8,460 bytesscripts/train_cross_encoder_distillation_example.pyruns · 9,412 bytesscripts/train_cross_encoder_example.pyruns · 9,232 bytesscripts/train_cross_encoder_listwise_example.pyruns · 10,411 bytesscripts/train_multi_vector_encoder_example.pyruns · 9,017 bytesscripts/train_sentence_transformer_distillation_example.pyruns · 12,232 bytesscripts/train_sentence_transformer_example.pyruns · 7,722 bytesscripts/train_sentence_transformer_make_multilingual_example.pyruns · 11,825 bytesscripts/train_sentence_transformer_matryoshka_example.pyruns · 7,302 bytesscripts/train_sentence_transformer_multi_dataset_example.pyruns · 10,115 bytesscripts/train_sentence_transformer_static_embedding_example.pyruns · 10,517 bytesscripts/train_sentence_transformer_with_lora_example.pyruns · 10,567 bytesscripts/train_sparse_encoder_distillation_example.pyruns · 9,655 bytesscripts/train_sparse_encoder_example.pyruns · 8,259 bytes
Read excerpt
# Train a sentence-transformers Model
**This SKILL.md is a router, not a manual.** It tells you which references and example scripts to load for your task. The actual content (recommended losses, evaluators, training-script structure, model selection, training-arg knobs, troubleshooting) lives in `references/` and `scripts/`.
**Do not synthesize a training script from this file alone.** Open the per-type production template (`scripts/train_<type>_example.py`) and copy it as your starting point. The templates contain load-bearing scaffolding (autocast helper, model-card class, logger silencing list, `force=True`, `seed`, TF32, version-compatible imports, named-evaluator metric handling) that prior agent runs have repeatedly missed when rolling their own from a synthesized snippet.
## 1. Identify the model type
| Tag | Class | What it does | When to pick |
|---|---|---|---|
| **[SentenceTransformer]** | `SentenceTransformer` (bi-encoder) | Maps each input to a fixed-dim dense vector | Retrieval, similarity, clustering, classification, paraphrase mining, dedup |
| **[CrossEncoder]** | `CrossEncoder` (reranker) | Scores `(query, passage)` pairs jointly | Two-stage retrieval (rerank top-100 from bi-encoder), pair classification |
| **[SparseEncoder]** | `SparseEncoder` (SPLADE) | Sparse vectors over the vocabulary | Learned-sparse retrieval, inverted-index backends (Elasticsearch / OpenSearch / Lucene) |
| **[MultiVectorEncoder]** | `MultiVectorEncoder` (ColBERT) | One embedding per token, scored with MaxSim | Late-interaction retrieval, recall gains over bi-encoders at higher storage cost, multimodal (ColPali / ColQwen2) |