EulerFormer
A transformer for sequential recommendation whose attention rotates polar-form complex vectors.
Tabular and recommender · 303 operations Checked
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
- 311.4K
- Operations
- 303
- Framework
- PyTorch
- Recurrent
- No
- Published
- SIGIR 2024
- Cited by
- 9 (as of 28 October 2026)
- Authors
- Zhen Tian, Wayne Xin Zhao, Changwang Zhang and others
- Source
- GitHub: Ethan-TZ/EulerFormer
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m16473
- Graph hash
- ea4e66d59e1ee8ff1dbc4a8d6ec25a682870a1710bb71a2a22870d91b14a3766
- Skeleton hash
- 5e1e83b0b9c2034a780cb2e333f1b6c49bd765ce3facdeeb0513406694f4bd80
- Architecture hash
- ec5235495a64f8042d5c12f920867535d5de806b8e63ce37655182886119ff48
- Diagram SHA-256
- bcfff46fc793a25af97a36da6f9a04503b9b0e692ccff464cfe05ef72b8274bd
- 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
EulerFormer is a transformer variant with complex vector attention, built for modeling sequential user behavior in recommendation. Attention scores in such models depend on both the semantic difference and the positional difference between two tokens, and the paper argues that earlier work models the two in different ways, which limits expressive capacity.
EulerFormer first transforms token embeddings into polar-form complex vectors using Euler's formula, so that dot-product attention becomes a rotation in which semantic and positional differences are both angles. A differential rotation mechanism then adds a learnable adaptation function that adjusts the semantic rotation angles according to context. The paper states that rotary position embedding (RoPE) can be instantiated as a special case of this framework.
Training also uses a phase contrastive learning task intended to improve the isotropy of the contextual representations. On four public datasets, the paper reports that EulerFormer improves recommendation models such as SASRec and BERT4Rec when it replaces their transformer backbone.
Key idea. EulerFormer casts attention as a rotation of polar-form complex vectors, so semantic and positional differences are modeled in one unified form with a learnable adaptation function.
- EulerFormer
- complex vector attention
- sequential recommendation
- user behavior modeling
- Euler transformation
- positional encoding
- recommender transformer
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{tian2024eulerformersequentialuserbehavior,
title={EulerFormer: Sequential User Behavior Modeling with Complex Vector Attention},
author={Zhen Tian and Wayne Xin Zhao and Changwang Zhang and Xin Zhao and Zhongrui Ma and Ji-Rong Wen},
year={2024},
eprint={2403.17729},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2403.17729},
}