llm-finetune
Operate RD-Agent FT-Agent workflows for benchmark-driven LLM data processing, fine-tuning, merge, evaluation, and feedback loops.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- llm-finetune
- license
- MIT
- metadata
- { "disco-role": "operating", "parent-skill": "rd-agent" }
- description
- Operate RD-Agent FT-Agent workflows for benchmark-driven LLM data processing, fine-tuning, merge, evaluation, and feedback loops.
- disable-model-invocation
- true
02 资源文件 2
- 参考文档references/fine-tune-contract.md1.2 KB
- 脚本scripts/validate_ft_env.py845 B
03 SKILL.md 正文
RD-Agent LLM fine-tuning
Use this sub-skill for rdagent llm_finetune, FT-Agent datasets/benchmarks, LLaMA-Factory training configuration, OpenCompass evaluation, batch jobs, and the fine-tune UI.
Prerequisites and cost gate
A realistic run can download models and datasets, call an LLM provider, start Docker or conda training environments, and consume GPU hours. Before running, confirm Linux, a usable Docker/conda backend, NVIDIA/CUDA capacity when required, Hugging Face access, provider credentials, and a stable FT_FILE_PATH. A missing prerequisite is a blocked run, not a reason to substitute a toy score.
Keep the main settings explicit and secret-free in the shell or a private .env:
BACKEND
CHAT_MODEL
OPENAI_API_KEY / OPENAI_API_BASE
EMBEDDING_MODEL
FT_FILE_PATH
FT_Coder_CoSTEER_env_type=docker|conda
FT_TARGET_BENCHMARK
FT_BENCHMARK_DESCRIPTION
FT_BASE_MODEL
FT_UPPER_DATA_SIZE_LIMIT
FT_API_MAX_WORKERS
FT_STRONG_MODELS / FT_WEAK_MODELS
HF_TOKEN (only when required)
Use validate_ft_env.py to print presence only; it never prints values.
Single-task workflow
Start with help and a bounded configuration:
rdagent llm_finetune --help
rdagent llm_finetune \
--benchmark <benchmark> \
--benchmark-description "<task and output format>" \
--base-model <huggingface-model-id> \
--loop-n 1 \
--timeout <short-budget>
The checked-in implementation follows this progression:
- inspect the benchmark and registered raw datasets;
- generate data-processing code and a training config;
- fail fast on schema/config/runtime errors;
- fine-tune the target model;
- evaluate with the configured evaluation stack;
- feed validation feedback into the next iteration while keeping test results for final reporting.
The --dataset option selects the agent's dataset after registered resources are prepared; it does not necessarily avoid initial dataset preparation. Reuse a stable FT_FILE_PATH when intentionally caching assets.
Batch jobs and UI
For repeatable multi-task runs, copy the checked-in task template to a private file, copy the private .env into the job directory, and run the bundled job shell script only after inspecting its commands. The Streamlit fine-tune UI is a reporting/interaction surface, not proof that training or evaluation succeeded. Preserve training config, dataset schema, checkpoint path, merge/evaluation output, and validation metric.
Failure boundaries
- dataset/download/license failure → data/provider block;
- generated data schema failure → fix processing before training;
- Docker/CUDA/model-load failure → backend block;
- training completes but evaluation cannot consume the checkpoint → artifact/evaluator failure;
- provider quota or context failure → provider failure, not a model-quality result.
Read fine-tune-contract.md before a costly run and the parent troubleshooting guide for recovery.
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).