explainability
Configure PyTorch Geometric Explainer workflows, explanation algorithms, masks, thresholds, metrics, and explainability failure recovery.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- explainability
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Configure PyTorch Geometric Explainer workflows, explanation algorithms, masks, thresholds, metrics, and explainability failure recovery.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/explainer-api.md5.5 KB
- 参考文档references/explanation-workflows.md5.9 KB
- 参考文档references/troubleshooting.md5.5 KB
- 脚本scripts/tiny_explainer_smoke.py6.7 KB
03 SKILL.md 正文
Explainability
Use this sub-skill when configuring torch_geometric.explain.Explainer, choosing algorithms such as GNNExplainer, generating homogeneous or heterogeneous explanations, applying mask thresholds, evaluating explanation metrics, or recovering from explainability-specific configuration failures.
Do not use this sub-skill for training a production base model from scratch, designing generic GNN architectures, building heterogeneous graph schemas, sampling at scale, or dataset construction. Route those to sibling sub-skills when present, then return here once the model exposes a stable forward signature to explain.
Start Here
- Read
references/explainer-api.mdwhen choosingExplainer,GNNExplainer,Explanation,HeteroExplanation,ModelConfig, mask types, threshold types, or metric APIs. - Read
references/explanation-workflows.mdwhen implementing node, graph, link, or heterogeneous explanation workflows and deciding how to passtarget,index,batch, or typed dictionaries. - Read
references/troubleshooting.mdwhen errors mentionmodel_config, missing mask types, invalid thresholds, unavailable masks, hetero routing, repeated backward passes, or slow explainer epochs. - Run
scripts/tiny_explainer_smoke.py --epochs 2to verify a CPU-only syntheticGNNExplainerpath without downloads, GPUs, credentials, or long training.
Common Tasks
- Wrap a trained PyG model with
Explainer(model, algorithm=GNNExplainer(...), explanation_type='model', model_config=..., node_mask_type=..., edge_mask_type=...). - Match
model_configto actual model output:modeisbinary_classification,multiclass_classification, orregression;task_levelisnode,edge, orgraph;return_typeisraw,probs, orlog_probs. - Use at least one mask type:
node_mask_type='attributes','common_attributes', or'object';edge_mask_type='object'orNone. - Explain a specific node or output row with
explanation = explainer(x, edge_index, index=node_index)and inspectexplanation.available_explanations,explanation.node_mask, andexplanation.edge_mask. - Evaluate classification explanations with metrics such as
fidelity(explainer, explanation)orunfaithfulness(explainer, explanation)after confirming the explanation has the masks those metrics need.
Safe Validation
python scripts/tiny_explainer_smoke.py --epochs 2
python scripts/tiny_explainer_smoke.py --epochs 1 --threshold-topk 3 --node-index 2
python scripts/tiny_explainer_smoke.py --help
Expected output includes available explanation mask names, node/edge mask shapes, finite mask sums, model prediction for the explained node, and tiny_explainer_smoke: ok.
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).