linear_calibration_ranking
Fit non-negative layer calibration weights for LPIPS-style distances using bounded 2AFC ranking feedback.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- linear_calibration_ranking
- description
- Fit non-negative layer calibration weights for LPIPS-style distances using bounded 2AFC ranking feedback.
02 资源文件 3
03 SKILL.md 正文
Linear Calibration Ranking
Use this skill when a recovery or evaluation needs to apply or fit the LPIPS paper's shallow human-judgment calibration over per-layer distances.
Do not use it to train or fine-tune a trunk network. This skill updates only calibration weights.
Inputs
- Items with
layers0,layers1, andjudge. layers0andlayers1are equal-length lists of per-layer distances forref-p0andref-p1.judge = 0meansp0should score closer;judge = 1meansp1should score closer.- Optional initial weights, step count, and learning rate.
Outputs
- Non-negative calibrated weights.
- Loss/accuracy before and after calibration.
params_beforeandparams_afterfor recovery validation.
Workflow
- Validate layer vectors and labels.
- Score each candidate by weighted layer-distance sum.
- Compute logistic ranking loss over
score0 - score1. - Run bounded gradient steps on calibration weights.
- Project weights to non-negative values after each step.
- Emit a trace with before/after loss, accuracy, and weights.
Validation
Run:
python scripts/calibrate_ranking.py --self-test
python tests/test_calibrate_ranking.py
Limitations
The script is intentionally small and deterministic. It is suitable for reduced recovery and unit tests, not full-scale LPIPS training.
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).