gnn-modeling
Design, train, debug, and smoke-test PyTorch Geometric GNN modules with MessagePassing, common convolution layers, pooling, metrics, and compile/JIT-aware workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- gnn-modeling
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Design, train, debug, and smoke-test PyTorch Geometric GNN modules with MessagePassing, common convolution layers, pooling, metrics, and compile/JIT-aware workflows.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/modeling-api.md6.5 KB
- 参考文档references/training-workflows.md6.5 KB
- 参考文档references/troubleshooting.md6.1 KB
- 脚本scripts/tiny_gcn_smoke.py6.6 KB
03 SKILL.md 正文
GNN Modeling
Use this sub-skill when building or troubleshooting PyTorch Geometric neural network modules: custom MessagePassing layers, homogeneous GNN stacks, graph-level pooling models, link prediction scorers, metrics, profiling, torch.compile, TorchScript/JIT migration, and tiny deterministic training checks.
Do not use this sub-skill for heterogeneous graph data modeling details, explainability configuration, distributed or multi-GPU training, dataset construction, or sampling-loader design. Route those to sibling sub-skills when present.
Start Here
- Read
references/modeling-api.mdwhen selecting PyG neural network APIs, implementing a customMessagePassingoperator, choosing a convolution/pooling layer, or checking tensor contracts. - Read
references/training-workflows.mdwhen writing node classification, graph classification, link prediction, metric, profiling,torch.compile, or TorchScript-aware training loops. - Read
references/troubleshooting.mdwhen a model fails onedge_index, feature dimensions, cached convolutions, sparse optional extensions, dynamic compilation, or over-smoothing. - Run
scripts/tiny_gcn_smoke.py --epochs 8before or after editing model code to prove the installed PyG runtime can train a tiny synthetic GCN without downloads, GPUs, or external data.
Common Tasks
- Build a homogeneous node model with
GCNConv,GATConv,SAGEConv, or higher-level models such asGCN,GraphSAGE,GIN, then validateout.shape == [num_nodes, num_classes]for node classification. - Implement a custom layer by subclassing
MessagePassing, callingsuper().__init__(aggr=...), validatingedge_indexastorch.longwith shape[2, num_edges], and usingpropagate(edge_index, x=x, ...). - Add graph-level prediction by applying convolution layers to node features, then pooling with
global_mean_pool,global_add_pool, orglobal_max_poolusing the mini-batchbatchvector. - Add link prediction by encoding nodes with a GNN, scoring endpoint embeddings, and evaluating ranking/classification metrics from
torch_geometric.metricswhere applicable. - Keep smoke tests tiny and deterministic: use synthetic
Data, fixed seeds, CPU tensors, one or a few optimizer steps, and assertions on loss finiteness and tensor shapes.
Safe Validation
python scripts/tiny_gcn_smoke.py --epochs 8
python scripts/tiny_gcn_smoke.py --help
Expected output includes initial/final loss, predicted labels for a six-node synthetic graph, and tiny_gcn_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).