train-sentence-transformers
Train or fine-tune SentenceTransformer, CrossEncoder, and SparseEncoder models for retrieval, similarity, clustering, classification, reranking, and related embedding tasks.
Train a sentence-transformers Model
When to Use
Use this skill when you need 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...
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, paraphra |
Subscribers only
The full skill, its 28 bundled files and every download is included with every paid Complete AI plan.
Details
| Source | huggingface/skills |
|---|---|
| License | Apache-2.0 |
| Risk label | critical ("critical" means the skill may run commands or touch files — read before use) |
| Files | SKILL.md, references/base_model_selection.md, references/dataset_formats.md, references/evaluators_cross_encoder.md, references/evaluators_sentence_transformer.md, references/evaluators_sparse_encoder.md, references/hardware_guide.md, references/hf_jobs_execution.md, references/losses_cross_encoder.md, references/losses_sentence_transformer.md, references/losses_sparse_encoder.md, references/model_architectures.md, references/prompts_and_instructions.md, references/training_args.md, references/troubleshooting.md, scripts/mine_hard_negatives.py, scripts/train_cross_encoder_distillation_example.py, scripts/train_cross_encoder_example.py, scripts/train_cross_encoder_listwise_example.py, scripts/train_sentence_transformer_distillation_example.py, scripts/train_sentence_transformer_example.py, scripts/train_sentence_transformer_make_multilingual_example.py, scripts/train_sentence_transformer_matryoshka_example.py, scripts/train_sentence_transformer_multi_dataset_example.py, scripts/train_sentence_transformer_static_embedding_example.py, scripts/train_sentence_transformer_with_lora_example.py, scripts/train_sparse_encoder_distillation_example.py, scripts/train_sparse_encoder_example.py |
| Added | 2026-07-01 |
Related skills
advanced-evaluation
This skill should be used when the user asks to "implement LLM-as-judge", "compare model outputs", "create evaluation rubrics", "mitigate evaluation bias", or mentions direct scoring, pairwise comparison, position bias, evaluation pipelines, or automated quality assessment.
agent-creator
Create custom AI subagents with proper plugin structure, persona generation, and companion routing skills.
agent-framework-azure-ai-py
Build persistent agents on Azure AI Foundry using the Microsoft Agent Framework Python SDK.
agent-memory
A hybrid memory system that provides persistent, searchable knowledge management for AI agents.
agent-memory-mcp
A hybrid memory system that provides persistent, searchable knowledge management for AI agents (Architecture, Patterns, Decisions).
agent-orchestration-improve-agent
Systematic improvement of existing agents through performance analysis, prompt engineering, and continuous iteration.
