evaluation-and-training
Route sentence-transformers evaluation and training tasks across SentenceTransformer, CrossEncoder, and SparseEncoder trainers, losses, evaluators, dataset shapes, samplers, smoke tests, and safe training scaffolding.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- evaluation-and-training
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route sentence-transformers evaluation and training tasks across SentenceTransformer, CrossEncoder, and SparseEncoder trainers, losses, evaluators, dataset shapes, samplers, smoke tests, and safe training scaffolding.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/evaluation-reference.md6.8 KB
- 参考文档references/loss-routing.md7.8 KB
- 参考文档references/training-reference.md8.2 KB
- 参考文档references/troubleshooting.md6.9 KB
- 脚本scripts/training_plan_check.py13.4 KB
03 SKILL.md 正文
Evaluation and Training
Use this sub-skill when a task asks how to evaluate, fine-tune, smoke-test, or debug training for SentenceTransformer, CrossEncoder, or SparseEncoder models.
Keep this file as the router. Open the references before writing code or giving final training advice.
Route by request
| Request | Read first | Use for |
|---|---|---|
| Build a safe training workflow | references/training-reference.md |
Trainer classes, training args, datasets, samplers, model cards, baseline eval, smoke tests |
Pick evaluator or metric_for_best_model |
references/evaluation-reference.md |
Evaluator families, primary metric keys, baseline/final eval practice |
| Match data shape to loss | references/loss-routing.md |
Dense, reranker, sparse, distillation, pair/list/triplet routing |
| Diagnose failures | references/troubleshooting.md |
Install extras, API misuse, metrics, samplers, optional backends/services |
| Validate a proposed plan without training | scripts/training_plan_check.py |
Static checks for model type, data shape, loss, evaluator, sampler, and extras |
Model-type routing
- Use
SentenceTransformerTrainerfor dense bi-encoders: retrieval embeddings, STS, clustering, paraphrase mining, distillation, Matryoshka, static embeddings, and most vector-search fine-tuning. - Use
CrossEncoderTrainerfor rerankers or pair classifiers: pair scoring, top-K reranking, NLI-style classification, BCE/ranking/listwise reranker losses. - Use
SparseEncoderTrainerfor SPLADE-style learned sparse retrieval: sparse vectors, inverted-index retrieval, FLOPS regularization, sparse/distillation losses. - If the task is really about choosing model architecture, prompts, multimodal support, reranking inference, sparse search, or backend export, route to the relevant model or backend sub-skill first, then return here for evaluation/training details.
Non-negotiable training checks
- Install the training stack before training:
pip install "sentence-transformers[train]"; addimage,audio, orvideoextras only for multimodal data. - Use
datasets.DatasetorDatasetDict; label columns must be namedlabel,labels,score, orscores; other columns are inputs and their order matters. - Run the evaluator once before
trainer.train()to record a baseline, then compare final or best-checkpoint metrics against it. - For contrastive dense/sparse losses, set
batch_sampler=BatchSamplers.NO_DUPLICATES; for batch triplet losses, useBatchSamplers.GROUP_BY_LABEL. - For multi-dataset training, set
multi_dataset_batch_sampler=MultiDatasetBatchSamplers.PROPORTIONALorROUND_ROBINdeliberately. - Smoke-test every long run with a tiny dataset slice and
max_steps=1before committing GPU time.
Script quick check
Run the bundled checker to catch common plan mismatches before writing a full script:
python sub-skills/evaluation-and-training/scripts/training_plan_check.py \
--model-type cross-encoder \
--data-shape pair-binary \
--loss BinaryCrossEntropyLoss \
--evaluator CrossEncoderRerankingEvaluator
The checker is static and does not import or train sentence-transformers; it validates routing assumptions and prints warnings to carry into the real script.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).