Add hop-prioritized graph transformer sequences - #759
Open
yliu2-sc wants to merge 1 commit into
Open
Conversation
yliu2-sc
requested review from
kmontemayor2-sc,
mkolodner-sc,
nshah-sc,
svij-sc,
xgao4-sc and
zfan3-sc
as code owners
August 25, 2026 23:44
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
prioritize_hop_ordermode for k-hop graph transformer sequence construction.prioritize_hop_order=Truewith PPR sequence construction because PPR already uses weight ordering.Efficiency
(batch_size, num_nodes)hop-distance state.(batch, node)keys, current frontier, and output sequence tensors.max_seq_len.Efficiency vs. existing k-hop path
The default k-hop implementation is unchanged. It computes the full sparse reachable set for each anchor up to
hop_distance, then lays out/truncates that set intomax_seq_len. That path is simple and sparse-matmul dominated, but it may still materialize reachable nodes that are later dropped by sequence truncation.The new
prioritize_hop_order=Truepath keeps the same sparse-adjacency/sparse-matmul shape, but expands one hop frontier at a time and stops expanding batches once their sequences are full. This avoids any dense(batch_size, num_nodes)hop-distance matrix and keeps persistent extra state to the current frontier, visited(batch, node)keys, and the(batch_size, max_seq_len)outputs.Worst-case time is still sparse expansion dominated, with some extra per-hop bookkeeping/sorting for deterministic hop-local ordering. In the common tight-
max_seq_lencase, it can be cheaper than the existing path because it avoids carrying/laying out reachable nodes that cannot be selected.Validation
max_seq_len.py_compile, targetedty,make format_py,make check_format_py, andgit diff --check.Notes
cmake,graphlearn_torch, andtorchrec.