training-and-distillation
Train or fine-tune ColBERT models, prepare and validate triples, use scored distillation examples, and plan GPU/resource settings. Use when tasks mention ColBERT Trainer, fine-tuning checkpoints, training triples, distillation scores, nway/bsize/accumsteps choices, or training-file validation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- training-and-distillation
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Train or fine-tune ColBERT models, prepare and validate triples, use scored distillation examples, and plan GPU/resource settings. Use when tasks mention ColBERT Trainer, fine-tuning checkpoints, training triples, distillation scores, nway/bsize/accumsteps choices, or training-file validation.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md5.1 KB
- 参考文档references/training-workflows.md5.0 KB
- 参考文档references/troubleshooting.md4.6 KB
- 脚本scripts/training_template.py7.9 KB
- 脚本scripts/validate_training_files.py10.9 KB
03 SKILL.md 正文
ColBERT Training And Distillation
Use this sub-skill when the user needs to configure or troubleshoot ColBERT training. It covers the Trainer API, JSONL examples/triples, scored distillation examples, resource planning, and safe helper scripts. Do not use it for post-training indexing/search, evaluation benchmarks, or tokenizer internals.
Route Tasks
- For a runnable training starting point, read
references/training-workflows.mdand generate a script withscripts/training_template.py. - For API details, checkpoint precedence, data shapes, and config fields, use
references/api-reference.md. - For validation before GPU work, run
scripts/validate_training_files.pyagainst triples, queries, and collection files. - For launch, data, scored-example, OOM, and dependency failures, use
references/troubleshooting.md. - For indexing or searching a trained checkpoint, switch to the
indexing-and-searchsub-skill. - For ranking metrics, LoTTE/MS MARCO evaluation, qrels, and dataset conventions outside training, switch to the
data-and-evaluationsub-skill. - For tokenization behavior, max lengths, dimensions, and model architecture details, switch to the
modeling-and-tokenizationsub-skill.
Core API
The verified public training entry point is:
from colbert import Trainer
from colbert.infra import ColBERTConfig, Run, RunConfig
with Run().context(RunConfig(nranks=1, experiment="my-training-run")):
config = ColBERTConfig(bsize=32, nway=2, accumsteps=1)
trainer = Trainer(triples="triples.train.jsonl", queries="queries.train.tsv", collection="collection.tsv", config=config)
trainer.train(checkpoint="bert-base-uncased")
checkpoint_path = trainer.best_checkpoint_path()
Important behavior: Trainer.train(checkpoint=...) is the checkpoint source used by training. If ColBERTConfig(checkpoint=...) is also set, the explicit train(checkpoint=...) argument wins.
Bundled Helpers
scripts/validate_training_files.pychecks JSONL triples/examples plus query and collection TSV files for parseability, ID references, duplicate IDs, scored-example shape, and likelynwaymismatches before launching training.scripts/training_template.pyemits a safe argparse-based ColBERT training script template and warns about resource choices such asbsize % nranks, largenway, and GPU expectations.
Training Scope
Basic ColBERTv1-style training usually uses unscored [qid, positive_pid, negative_pid] JSONL examples with nway=2. Advanced ColBERTv2-style training often uses many-way examples such as 64-way scored JSONL, use_ib_negatives=True, distillation_alpha, doc_maxlen=180, dim=128, and a source checkpoint such as colbert-ir/colbertv1.9.
Practical training requires CUDA/GPU resources. CPU-only environments are useful for imports, file validation, and template generation, but real fine-tuning, distillation scoring, and distributed training are GPU-heavy.
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).