计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
lora_guided_importance【效率与协作】Compute LoRAPrune's LoRA-gradient-only Taylor importance estimate for structured pruning without frozen base-weight gradients.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when implementing or checking LoRAPrune-style pruning criteria for a LoRA-adapted linear module. Do not use it for ordinary magnitude pruning or for methods that explicitly require gradients of the frozen pretrained weights.
W0: frozen base matrix shaped (d, k).B: LoRA matrix shaped (d, r).A: LoRA matrix shaped (r, k).grad_B and grad_A: gradients from the current calibration batch.The contract deliberately has no grad_W0 input.
W0.uses_base_gradients: false and shape/rank metadata.BA = B @ A.dL/d(BA) as grad_B @ A + B @ grad_A - grad_B @ grad_A.((approx_grad) * (W0 + BA)) ** 2 elementwise.Run:
python /share/project/yuyang/workspace/Paper2Skills/Distiller/skills/module-to-skill/scripts/validate_skill_tree.py <this_skill_dir> --run-tests
The included tests verify the exact formula, zero-gradient behavior, and shape mismatch handling.
This skill implements the criterion, not the whole pruning loop. It assumes a dense matrix representation in small examples; large model implementations should call the same formula on tensor backends while preserving the no-base-gradient invariant.