Track: Track1; Team name: Kajolya; Model: GSN - #407
Open
lettlini wants to merge 40 commits into
Open
Conversation
Edge layer now keeps real-edge messages and only scales self-loops by (1+eps). Swap the UP-MLP builder for the shared helpers (fixes the single-hidden-layer dim bug and drops the stray final ReLU), add an edge/encoding alignment check, and fill in docstrings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Edge layer can now take original edge features alongside the GSN edge encodings (edge_dim, with a zero dummy block for self-loops), with guards that edge_dim and edge_attr stay consistent and that node mode rejects edge_dim>0. Also make initial_eps configurable, drop the dead V-layer edge_attr branch, and refresh the docstrings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Implements the GIN-with-virtual-node scheme (Eqs. 10/11) in GSN-v additive form: per-layer h~ = h + G + W_V·x, pre-update virtual-node aggregation G' = MLP(G + sum_u h~_u), and a shared d_embed dataflow. Node mode only.
… in forward call)
Move the expensive GSN orbit-count encoding out of the training loop. The `GSNFeatureEncoder.forward` previously recomputed subgraph-isomorphism counts on every batch of every epoch, even though the encodings are a fixed function of graph topology. - Add a `GSNEncodings` data-manipulation transform (a thin subclass of `GSNFeatureEncoder`) that computes the encodings once per graph. Applied as a `pre_transform` by `PreProcessor`, results are cached to disk and reused across epochs and runs. - Auto-attach it for `model=graph/gsn` via `transforms/model_defaults/gsn.yaml`. - Make the model's feature encoder a pure passthrough: `forward` returns the batch when the encodings are already present and raises otherwise, rather than silently recomputing. The heavy path lives in `_encode`, driven by the transform. `substructures` is now optional so the passthrough needs none. - Drop the substructure list from the model config; it lives only in the transform config now. - Point the encoder unit tests at `_encode` and add coverage for the new passthrough / raise contract.
Track 1/gsn precompute transform
…g all mentioned / presented in the paper
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Author
|
The remaining test failure is happening in |
lettlini
marked this pull request as ready for review
July 31, 2026 10:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This submission implements Graph Substructure Networks (GSN) — a GIN + virtual-node
message-passing model whose node/edge features are augmented with structural encodings
that count how often each node and edge participates in the automorphism orbits of a
fixed collection of substructures (motifs).
What's implemented / changed:
GSNFeatureEncoder(topobench/nn/encoders/gsn_encoder.py) — the core structuralencoder. For each substructure it computes node/edge automorphism orbits once (with a
global, contiguous orbit numbering), then for an input graph counts every subgraph-
isomorphic embedding per node/edge orbit and normalizes counts by the number of
automorphisms. Includes robust PyG ⇄ NetworkX round-tripping, dtype/device consistency
handling, and guards for edgeless/nodeless graphs.
joblib: subgraph-isomorphism matching is parallelizedover substructures (
n_jobs, default-1), since the NetworkX matching is thebottleneck. A unit test asserts the parallel result is identical to the serial one.
GSNEncodingspre-transform (topobench/transforms/data_manipulations/gsn_encodings.py)— a cached data-manipulation transform (subclassing
GSNFeatureEncoder) that computesthe encodings once during preprocessing rather than inside the training loop
(see disclaimer below). The model-side
forwardis a passthrough; if encodings aremissing it warns and recomputes on the fly as a fallback.
topobench/nn/backbones/graph/gsn.py):GSNGINVirtualNodeLayerV— a single GIN + virtual-node message-passing layer(node and edge modes; tolerates
edge_attrwhenedge_dim == 0).GSNGINVirtualNodeModel— stacks the layers, injects a per-graph virtual node andthe additive GSN encodings at each layer, with BatchNorm + Dropout between layers.
mlp_builderhelper.GSNWrapper(topobench/nn/wrappers/graph/gsn_wrapper.py) — routes theprecomputed
gsn_embeddings(and correct tensors) from the batch into the backbone.configs/model/graph/gsn.yaml, plus the transform configsconfigs/transforms/data_manipulations/gsn_encodings.yamlandconfigs/transforms/model_defaults/gsn.yaml(auto-attaches the pre-transform).into the pipeline test;
run_evaluation.ipynbupdated to benchmark this model.Disclaimer
This submission implements the
GSNFeatureEncoder, but since the annotation of subgraph isomorphism counts is implemented in existing dependencies (i.e.networkx) the processing of graphs tends to be relatively slow making the repeated re-annotation inside the training loop unfeasible. For this reason, we chose to alter the data preprocessing since that is where the GSN encodings should ideally be calculated - they are static during model training and inference anyways. This might not be allowed according to the challenge's rules and invalidate this submission.Checklist