Add ppr_relation_features token input to the PPR Graph Transformer path - #767
Draft
mkolodner-sc wants to merge 1 commit into
Draft
Add ppr_relation_features token input to the PPR Graph Transformer path#767mkolodner-sc wants to merge 1 commit into
mkolodner-sc wants to merge 1 commit into
Conversation
Introduce a reserved `ppr_relation_features` anchor-relative token input for sequence_construction_method='ppr'. The columns of the PPR edge_attr beyond the scalar weight are laid out per (anchor, neighbor) into a per-token feature tensor, so relation-aware downstream channels can consume the original edge features carried on PPR edges. Neighbors stay ordered by descending PPR weight and the relation-feature rows are permuted in lockstep to stay aligned. Factor the reserved-feature validation (placement of ppr_weight / ppr_relation_features and the method requirement) into a single _validate_reserved_anchor_feature_usage helper shared by heterodata_to_graph_transformer_input and GraphTransformerEncoder, replacing the duplicated check blocks in the transform and the encoder.
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.
What
Adds a reserved
ppr_relation_featuresanchor-relative token input to the PPRGraph Transformer path, and consolidates the reserved-feature validation shared
by the transform and the encoder.
Details
transforms/graph_transformer.pyPPR_RELATION_FEATURES_NAMEtoken input: the columns of the PPRedge_attrbeyond the scalar weight (col 0) are gathered per (anchor,neighbor) into a
(batch, max_seq_len, k)feature tensor in_build_sequence_layout_from_ppr_edgesand exposed through the anchorfeature composers.
reordered by the same permutation so they remain aligned with their edges.
_validate_ppr_sequence_inputso the batch may also carry theoriginal relation edge types (which feed the relation-message channel); only
the
"ppr"edges drive the sequence._validate_reserved_anchor_feature_usagehelper centralizes theplacement/method checks for
ppr_weightandppr_relation_features, replacingthe duplicated blocks in
heterodata_to_graph_transformer_inputandGraphTransformerEncoder.Testing
ruff check/ruff formatclean; module compiles.PPR sequences are weight-ordered with relation features aligned to their edges;
truncation to
max_seq_lenkeeps the top-weight neighbors.