embedding-training
Prepare and validate bundled RAG-Retrieval embedding fine-tuning, MRL, and teacher-embedding distillation workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- embedding-training
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Prepare and validate bundled RAG-Retrieval embedding fine-tuning, MRL, and teacher-embedding distillation workflows.
- disable-model-invocation
- true
02 资源文件 15
- 参考文档references/configuration.md5.7 KB
- 参考文档references/data-formats.md4.9 KB
- 参考文档references/distillation.md4.3 KB
- 参考文档references/troubleshooting.md5.3 KB
- 参考文档references/workflows.md5.1 KB
- 脚本scripts/build_embedding_training_command.py3.6 KB
- 脚本scripts/merge_teacher_embeddings.py8.4 KB
- 脚本scripts/training_bundle/config/distill_embedding.yaml707 B
- 脚本scripts/training_bundle/config/training_embedding.yaml687 B
- 脚本scripts/training_bundle/data.py10.2 KB
- 脚本scripts/training_bundle/model_distill.py8.1 KB
- 脚本scripts/training_bundle/model.py18.2 KB
- 脚本scripts/training_bundle/train_embedding.py8.6 KB
- 脚本scripts/training_bundle/trainer.py10.7 KB
- 脚本scripts/validate_embedding_training_config.py22.1 KB
03 SKILL.md 正文
Embedding Training
Use this sub-skill when a user asks to fine-tune a RAG-Retrieval embedding model, train BGE/GTE-style embeddings, validate training_embedding.yaml or distill_embedding.yaml, configure MRL dimensions, create or merge teacher embeddings, or prepare teacher-embedding distillation.
This is a source-code training workflow, not an installed-package API. This skill bundles selected training scripts/configs under scripts/training_bundle/ and command builders under scripts/; use an external checkout only when the user explicitly wants a current repository checkout. Keep generated configs/data in user-controlled work directories.
Route by Task
- Validate config/data first: Run
scripts/validate_embedding_training_config.pybefore launching Accelerate. It checks YAML keys,train_type, JSONL schemas,neg_nums,prompt_for_query, teacher dimensions, and optional teacher array size. - Normal fine-tuning: Use
train_type: train, a pair/triplet/pair-score JSONL, and the bundledtraining_bundle/train_embedding.pyentrypoint via the command builder. Seereferences/workflows.mdandreferences/data-formats.md. - Teacher distillation: Use
train_type: distill, a text JSONL containing onequeryrow per teacher embedding row,train_dataset_vec,teacher_embedding_dim,use_mrl: true, and compatiblemrl_dims. Seereferences/distillation.md. - Merge teacher arrays: Use
scripts/merge_teacher_embeddings.pyto concatenate two float32 teacher embedding arrays with explicit row counts and dimensions; then setteacher_embedding_dimto the summed dimension. - Distributed launch choice: Prefer bundled FSDP Accelerate config for BERT-like embedding models and bundled DeepSpeed ZeRO config for LLM-like embedding models. Use
scripts/build_embedding_training_command.pyto build a path-checked command, then seereferences/configuration.md. - Reranker or ColBERT training: Do not cover those details here. Route to sibling training sub-skills such as
../reranker-training/SKILL.mdor../colbert-training/SKILL.mdif present; only the Accelerate/config validation pattern is shared.
Safe Default Sequence
- Confirm the user has an environment with training dependencies already installed; an external checkout is optional because the skill bundles the selected training code snapshot.
- Copy or create a working YAML from the embedding training examples; replace source-relative sample paths with the user's actual dataset/output paths.
- Validate the YAML and JSONL without downloading models:
python skills/rag-retrieval/sub-skills/embedding-training/scripts/validate_embedding_training_config.py \ --config /path/to/working_training_embedding.yaml \ --data /path/to/train.jsonl - For distillation, also validate the teacher array:
python skills/rag-retrieval/sub-skills/embedding-training/scripts/validate_embedding_training_config.py \ --config /path/to/working_distill_embedding.yaml \ --data /path/to/distill_text.jsonl \ --teacher-embeddings /path/to/teacher_embeddings.mmap - Only after validation, build a launch command with
scripts/build_embedding_training_command.py, review it, and run a small foreground smoke job before long training.
Reference Map
references/data-formats.md: Supported JSONL shapes, pair-score expansion,prompt_for_query, teacher memmap shape, and validation expectations.references/configuration.md: YAML keys, MRL options, logging, distributed config choice, bundled training snapshot, and optional checkout caveats.references/workflows.md: Normal fine-tuning, distillation fine-tuning, bundled launch-command building, validation sequence, and saved-model usage.scripts/build_embedding_training_command.py: Builds a path-checkedaccelerate launchcommand for embedding training without copying source scripts.references/distillation.md: Stella-style teacher embedding creation, safe teacher-array merge, optional synthetic data generation, and expensive/GPU caveats.references/troubleshooting.md: Common schema, memmap, MRL, download, distributed, and logging failures.
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).