agentleFS
tim-osterhustim-osterhus/millrace-skills/skills/train-sentence-transformers/SKILL.md

train-sentence-transformers

Skill0 starsChanged 7 months agoApache-2.0View on GitHub

Guardrail for training sentence-transformers bi-encoders, cross-encoders, and sparse encoders with correct loss, evaluator, hard-negative, and publishing choices.

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use huggingface-datasets.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Hugging FaceSkill

    huggingface-datasets

    Use this skill for Hugging Face Dataset Viewer API workflows that fetch subset/split metadata, paginate rows, search text, apply filters, download parquet URLs, and read size or statistics.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not synthesize a training script from memory when production templates or examples exist.

    line 37
  2. Distinctive:

    Do not train without baseline evaluation.

    line 38
  3. Distinctive:

    Do not use cached losses with incompatible gradient-checkpointing settings.

    line 39
  4. Distinctive:

    Do not use a reranker when first-pass recall is too weak.

    line 40
  5. Distinctive:

    Do not publish models or cards containing private data.

    line 41
  6. Distinctive:

    Keep run logs, seeds, model names, data versions, and primary metrics reproducible.

    line 42
  7. Distinctive:

    Run training and log baseline plus final metrics.

    line 63
  8. Distinctive:

    Start with model type and data shape.

    line 74

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Train Sentence Transformers

Purpose

Help agents train or fine-tune sentence-transformers models for retrieval, similarity, reranking, learned sparse retrieval, clustering, classification, paraphrase mining, or deduplication.

Quick Start

  1. Identify model type: bi-encoder SentenceTransformer, CrossEncoder reranker, or SparseEncoder.
  2. Match loss function to data shape.
  3. Choose the evaluator that matches the task and primary metric.
  4. Smoke-test with a tiny slice before long training.
  5. Capture baseline score before training and emit an end-of-run verdict.
  6. Push or publish only after validation.

Operating Constraints

  • Do not synthesize a training script from memory when production templates or examples exist.
  • Do not train without baseline evaluation.
  • Do not use cached losses with incompatible gradient-checkpointing settings.
  • Do not use a reranker when first-pass recall is too weak.
  • Do not publish models or cards containing private data.
  • Keep run logs, seeds, model names, data versions, and primary metrics reproducible.

Inputs This Skill Expects

  • Task type and model class.
  • Dataset shape: pairs, triplets, query-positive-negative, labels, rankings, or sparse targets.
  • Base model, language/domain, hardware, and Hub policy.
  • Evaluator and baseline metric.
  • Hard-negative mining plan when relevant.

Output Contract

  • State model type, loss, evaluator, data shape, metric, and training command.
  • Include smoke-test command and baseline evaluation.
  • Report verdict: win, marginal, or regression.
  • State publish, iterate, or reject decision with metric evidence.

Procedure

  1. Classify the model type from task wording.
  2. Inspect dataset columns and labels.
  3. Choose loss and evaluator from data shape and task.
  4. Prepare training script/config from a known-good template.
  5. Run smoke test.
  6. Run training and log baseline plus final metrics.
  7. Publish or archive artifacts only after the verdict is acceptable.

Pitfalls And Gotchas

  • Choosing a loss that silently mismatches columns or labels.
  • Evaluating rerankers with first-pass retrieval metrics.
  • Forgetting named-evaluator metric keys.
  • Skipping hard-negative quality checks.
  • Reporting high scores despite sparse dimension collapse.

Progressive Disclosure

Start with model type and data shape. Expand into hard-negative mining, LoRA, Matryoshka, distillation, multilingual transfer, sparse regularization, or cloud execution only when the training objective needs it.

Verification Pattern

  • Confirm model type, loss, evaluator, and metric align.
  • Confirm baseline evaluation ran before training.
  • Confirm smoke test passed.
  • Confirm final verdict compares baseline and trained model.
  • Confirm publication respects privacy and artifact policy.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.