rag-retrieval
Use RAG-Retrieval for RAG reranker inference plus bundled preparation for embedding, reranker, and ColBERT retrieval-model training workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- rag-retrieval
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use RAG-Retrieval for RAG reranker inference plus bundled preparation for embedding, reranker, and ColBERT retrieval-model training workflows.
- disable-model-invocation
- true
02 资源文件 12
- 参考文档references/package-overview.md4.7 KB
- 参考文档references/repo-provenance.md1.7 KB
- 参考文档references/repo-routing-metadata.json516 B
- 参考文档references/research-benchmarks.md2.8 KB
- 参考文档references/troubleshooting.md5.2 KB
- 脚本scripts/accelerate_configs/deepspeed/deepspeed_zero0.yaml400 B
- 脚本scripts/accelerate_configs/deepspeed/deepspeed_zero1.yaml400 B
- 脚本scripts/accelerate_configs/deepspeed/deepspeed_zero2.yaml400 B
- 脚本scripts/accelerate_configs/deepspeed/deepspeed_zero3.yaml453 B
- 脚本scripts/accelerate_configs/default_fsdp.yaml539 B
- 脚本scripts/accelerate_configs/xlmroberta_default_config.yaml545 B
- 脚本scripts/check_rag_retrieval_install.py3.5 KB
03 SKILL.md 正文
RAG-Retrieval
Use this repo skill when a user asks about RAG-Retrieval, rag_retrieval, RAG passage reranking, retrieval-model fine-tuning, BGE/BCE reranker scoring, embedding training, reranker distillation, or ColBERT-style late-interaction training.
RAG-Retrieval has two important surfaces:
- The installed
rag_retrievalpackage exposes a lightweight reranker inference API centered onReranker. - The embedding, reranker, ColBERT, and distillation training workflows are source-code workflows; this skill bundles adapted snapshots and command builders because the current package metadata does not declare those training folders as installed packages.
Route by Task
- Rerank documents or score query-document pairs: Use
sub-skills/inference/SKILL.mdforReranker,compute_score,rerank,RankedResults, model type selection, long-document handling, and no-download API checks. - Fine-tune embedding models: Use
sub-skills/embedding-training/SKILL.mdfor pair/triplet/pair-score JSONL, MRL,training_embedding.yaml, FSDP/DeepSpeed choices, bundled training snapshots, and preflight validation. - Distill teacher embeddings: Use
sub-skills/embedding-training/SKILL.mdfor teacher text JSONL, float32 memmap shape checks, teacher embedding merge helpers, anddistill_embedding.yamlvalidation. - Train BERT or LLM rerankers: Use
sub-skills/reranker-training/SKILL.mdfor pointwise/grouped JSONL,loss_type, BERT vs LLM decoder configs, RankNet/listwise losses, and LLM-to-BERT distillation planning. - Train ColBERT-style models: Use
sub-skills/colbert-training/SKILL.mdfor triplet JSONL,neg_nums,colbert_dim, FSDP layer choices, and the current package ColBERT inference limitation. - Investigate MyopicTrap or positional-bias experiments: Read
references/research-benchmarks.md; those scripts are research evidence and usually require external datasets, optional packages, credentials, or long benchmark runs.
Start Here
- Determine whether the user wants installed-package inference or bundled training preparation.
- For installed-package inference, install the public package when needed:
pip install rag-retrieval - Run the no-download package surface check when import/API drift matters:
python scripts/check_rag_retrieval_install.py - For inference tasks, never instantiate a Hugging Face model just to inspect API shape; use the inference smoke script first.
- For training tasks, validate configs and JSONL data with the owning sub-skill script before launching
accelerate. - Treat model downloads, GPU jobs, benchmarks, and distillation data generation as expensive actions that need explicit user intent.
Important Current Limitations
Reranker(model_type="colbert")is not a working installed-package inference path in the inspected version: the mapping name exists, but the available ranker registry contains cross-encoder and LLM rankers only.- The public factory class is spelled internally as
CorssEncoderRanker; use the publicmodel_type="cross-encoder"route in user-facing code. - Empty
rerankinputs can return a legacy dict instead ofRankedResults; callers should handle that edge case. - Training execution requires ML training dependencies and user data/model paths; this skill bundles selected training script snapshots and validation/command-building helpers, while an external current checkout can still be used explicitly for repo maintenance.
Reference Map
references/package-overview.md: Project surfaces, dependency notes, public APIs, and bundled training split.references/troubleshooting.md: Cross-cutting install/import, model download, optional dependency, data/config, GPU/backend, and routing failures.references/research-benchmarks.md: MyopicTrap and other benchmark/data-generation evidence that should usually stay reference-only.references/repo-provenance.md: Source commit, package version, evidence paths, and refresh baseline.references/repo-routing-metadata.json: Structured router metadata for managed import.scripts/check_rag_retrieval_install.py: Safe package/import/API surface check.
Validation Defaults
- Prefer no-download checks first: package import, signatures, YAML parsing, JSONL schema validation, and helper
--helpoutput. - Run native tests only after the whole skill is integrated and only when model caches, GPU availability, and expected runtime are acceptable.
- Skip or explicitly gate MyopicTrap, FlashRAG synthetic data generation, model downloads, LLM scoring, and full training runs unless the user authorizes expensive dependencies and runtime.
Sub-Skill Boundaries
inferenceowns installed-packageRerankerbehavior and result interpretation.embedding-trainingowns embedding fine-tuning, teacher embedding distillation, MRL, bundled training snapshots, and teacher-array helpers.reranker-trainingowns BERT/LLM reranker fine-tuning, ranking losses, pointwise/grouped data, bundled training snapshots, and LLM-to-BERT distillation planning.colbert-trainingowns bundled ColBERT training snapshots and explicitly routes packaged ColBERT inference questions back to the current inference limitation.
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).