All models

PatchTransformerAggregation

STHN's patch encoder as a PyG aggregator: group elements into patches, attend across them, pool.

Graphs and geometry · 74 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (11 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
121.2K
Operations
74
Framework
PyTorch
Recurrent
No
Published
CIKM 2023
Cited by
4 (as of 18 October 2026)
Authors
Ce Li, Rongpei Hong, Xovee Xu and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m2164
Graph hash
62ea3f49cf064a73ae3503b8e64dbacc0d986ede561afe5a8ca92a5448f64a97
Skeleton hash
e0aa87d08bd2575a1a0c6b9401bd484a6f3c281e71a4c1663e0096fcc2ae3d06
Architecture hash
373d2ef4655e06dadd9caa8037daea1a0c24fc1985f24c8d429275782a69139d
Diagram SHA-256
b887bbbb8c76c8baf20e1d6add6475d92318e08ec22f80cf5002d81d71ac51a8
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

PatchTransformerAggregation is an aggregation operator in which the elements to aggregate are processed by multi-head attention blocks across patches, following the paper Simplifying Temporal Heterogeneous Network for Continuous-Time Link Prediction. In that model, STHN, sequential representations are divided into different patches, which are set as the token input of the encoder, and average mean pooling compresses the patch embeddings into a single vector.

The PyTorch Geometric module first projects each element with a linear layer and pads every group out to a multiple of the patch size. A second linear layer, the pad projector, squeezes each flattened patch back to the hidden width, and a positional encoding is added over the patch index. The patch tokens then pass through one or more multi-head attention blocks. Finally the tokens are pooled with one or more reductions, mean by default, and a last linear layer maps the result to the output size. The code carries a frank TODO: if groups are heavily unbalanced, this will create a lot of empty patches.

The official STHN repository ships Movielens data for testing and expects an edge list of streaming edges for any heterogeneous graph of your own. In the full model the representations of the two endpoint nodes are combined and the link predictor makes link prediction with an FC layer and CrossEntropy loss.

Key idea. Treating a node's interaction history as patches of tokens for a small transformer encoder, then mean-pooling the patch embeddings into one vector.

  • PatchTransformerAggregation
  • STHN
  • STHN patch encoder
  • patch transformer aggregation
  • Simplifying Temporal Heterogeneous Network
  • continuous-time link prediction
  • temporal heterogeneous network
  • PyTorch Geometric
  • semantic patches fusion

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@inproceedings{Li_2023, series={CIKM ’23}, title={Simplifying Temporal Heterogeneous Network for Continuous-Time Link prediction}, url={http://dx.doi.org/10.1145/3583780.3615059}, DOI={10.1145/3583780.3615059}, booktitle={Proceedings of the 32nd ACM International Conference on Information and Knowledge Management}, publisher={ACM}, author={Li, Ce and Hong, Rongpei and Xu, Xovee and Trajcevski, Goce and Zhou, Fan}, year={2023}, month=Oct, pages={1288–1297}, collection={CIKM ’23} }