Add sparse edge attribute bias to graph transformer#675
Draft
yliu2-sc wants to merge 1 commit into
Draft
Conversation
zfan3-sc
approved these changes
Jun 17, 2026
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.
Summary
Add an opt-in sparse edge-attribute attention-bias path for Graph Transformer.
This introduces
edge_attr_attention_bias_mode="sparse_linear"onGraphTransformerEncoder, while preserving the default"none"behavior. When enabled, GT uses sampled edge features as sparse per-head additive attention-logit bias.Changes
edge_attr_attention_bias_modetoGraphTransformerEncoder."sparse_linear"mode using positive dims fromedge_type_to_feat_dim_map.Linear(edge_feat_dim -> num_heads, bias=True)per positive-dim edge type.heterodata_to_graph_transformer_input(...)to return sparse edge-attr payloads:pairwise_edge_attr_indices:(batch_idx, query_pos, key_pos)pairwise_edge_attr_values: raw matchededge_attrrowsindex_put_(..., accumulate=True)into attention bias.src -> dstmaps tokey=src,query=dst.Tests
Validation
ruff checkpassed on touched files.git diff --checkpassed.Where is the documentation for this feature?: N/A
Did you add automated tests or write a test plan?
Updated Changelog.md? NO
Ready for code review?: NO