combined_kd_objective
Combine supervised, output distillation, and RAIL intermediate losses with validated RAIL-KD lambda weights.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- combined_kd_objective
- description
- Combine supervised, output distillation, and RAIL intermediate losses with validated RAIL-KD lambda weights.
02 资源文件 2
- 脚本scripts/kd_objective.py2.2 KB
- 脚本tests/test_kd_objective.py657 B
03 SKILL.md 正文
Combined KD Objective
Use this skill when constructing a RAIL-KD training or proxy recovery objective. It preserves the paper's equation (4): the student minimizes a weighted sum of supervised task loss, output-logit knowledge distillation loss, and the randomized intermediate representation loss. Do not use this skill as a replacement for computing the RAIL representation loss itself.
Inputs
ce_loss: finite scalar for supervised cross-entropy/task loss.kd_loss: finite scalar for output prediction distillation.rail_loss: finite scalar from RAIL-KDl or RAIL-KDc.lambdas: three non-negative weights(lambda1, lambda2, lambda3)that sum to one.
Outputs
- Total scalar objective.
- Weighted contribution dictionary for audit logs.
- Validation status or an exception for invalid inputs.
Workflow
- Validate that all loss components are finite numeric scalars.
- Validate that all lambda weights are non-negative and sum to one within tolerance.
- Compute the total weighted objective.
- Return component contributions so recovery can report what the optimizer minimized.
Validation
Run:
python scripts/kd_objective.py --ce 0.4 --kd 0.3 --rail 0.2 --lambdas 0.2 0.3 0.5
python -m pytest tests
Limitations
This skill computes scalar composition only. Production training code still needs a differentiable implementation for framework tensors, but the same validation and contribution reporting should be preserved.
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).