T-RoPE: Time-Aware Rotary Position Embedding for Sequential Recommendation
Organizations: Shopify · Massachusetts Institute of Technology · Liquid AI
Abstract
Large-scale recommenders increasingly adopt the sequential generative recipe behind large language models, bringing the Transformer into recommendation along with design choices made for text, including Rotary Position Embedding (RoPE). In language models, RoPE encodes token indices for relative position reasoning, but in recommendation, an interaction index records only event order, saying nothing about elapsed time, behavioral cycles across scales, or calendar phase. We revisit this choice and propose T-RoPE, a time-aware RoPE for sequential generative recommendation that replaces index-only rotation with timestamp-based angles, learnable temporal coefficients, multiscale frequency banks, shifted query alignment, and non-stationary key rotation. We prove that standard RoPE, even on timestamps, remains time-translation invariant and cannot distinguish seasonal contexts, and that T-RoPE breaks this invariance while preserving the RoPE interface. Across five public benchmarks, T-RoPE achieves the best result on every metric on every dataset, improving over the strongest baseline by 78--130% in HR@10 on the sparse PixelRec data and 8--12% across metrics on Amazon Books. On an industrial-scale e-commerce dataset with more than 6B interactions, it improves every metric over the HSTU + Time RAB backbone by 13--82%, with ablations attributing the largest gains to multiscale frequencies ( NDCG@50) and non-stationary keys (). An online A/B test in the Shop app yields positive lifts in conversion rate () and order count (). We also provide forward and backward algorithms whose added cost is linear in sequence length and head dimension, keeping time-aware RoPE practical for large generative recommenders.
Figures & tables
| Method | Timestamp | Learnable | Multiscale | Shifted | Non-stationary |
| Standard RoPE ( Su et al., 2024 ) | × | × | × | × | × |
| TiSASRec ( Li et al., 2020 ) | Partial | × | × | × | × |
| TO-RoPE ( Wei et al., 2025 ) | ✓ | Partial | ✓ | × | × |
| T-RoPE (ours) | ✓ | ✓ | ✓ | ✓ | ✓ |
| Method | |||||||
| Dataset | Metric | SASRec | TiSASRec | HSTU | HSTU+ Time RAB | HSTU+ TO-RoPE | HSTU+ T-RoPE (ours) |
| ML-20M | HR@10 | 31.36 | 31.97 | 30.87 | 32.05 | 31.19 | 32.37 +1.0% |
| HR@50 | 56.87 | 57.50 | 56.19 | 58.01 | 56.69 | 58.55 +0.9% | |
| NDCG@10 | 18.04 | 18.38 | 17.84 | 18.47 | 17.93 | 18.62 +0.8% | |
| NDCG@50 | 23.68 | 24.04 | 23.44 | 24.20 | 23.57 | 24.42 +0.9% | |
| MRR | 15.42 | 15.68 | 15.31 | 15.79 | 15.32 | 15.91 +0.8% | |
| Configuration | Recall@50 | NDCG@50 | Recall@200 | NDCG@200 | MRR |
| T-RoPE | 31.41 | 22.94 | 41.77 | 24.82 | 23.14 |
| - Non-Stationary (§ 3.5 ) | 30.97 ( 1.40%) | 22.02 ( 4.01%) | 40.49 ( 3.06%) | 23.29 ( 6.16%) | 21.88 ( 5.45%) |
| - shifted (§ 3.4 ) | 30.90 ( 1.62%) | 20.59 ( 10.24%) | 40.92 ( 2.03%) | 22.55 ( 9.15%) | 20.90 ( 9.68%) |
| - multiscale freq. bank (§ 3.3 ) | 25.36 ( 19.26%) | 13.23 ( 42.33%) | 36.98 ( 11.47%) | 15.42 ( 37.87%) | 11.96 ( 48.31%) |
| - abs. time embedding (§ 3.1 + § 3.2 ) | 25.68 ( 18.24%) | 13.81 ( 39.80%) | 37.00 ( 11.42%) | 15.96 ( 35.70%) | 12.70 ( 45.12%) |
| - Shifted Query RoPE | 30.87 ( 1.72%) | 21.54 ( 6.10%) | 40.50 ( 3.04%) | 23.42 ( 5.64%) | 22.46 ( 2.94%) |
| Metric | Definition | Relative lift | P-Value |
| CVR | Conversion rate | ||
| Shop orders | Count of orders placed on the Shop app |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset example | Model | Training it/s | Validation it/s |
| Pixel1M | Baseline HSTU | ||
| Pixel1M | HSTU + TO-RoPE | ||
| Pixel1M | HSTU + T-RoPE | ||
| Shop | Baseline HSTU | ||
| Shop | HSTU + TO-RoPE | ||
| Shop | HSTU + T-RoPE |
| Dataset | #User | #Item | #Interaction |
| ML-20M ( Harper and Konstan, 2015 ) | 138,493 | 26,744 | 20,000,263 |
| Amazon Books ( Hou et al., 2026 ) | 776,370 | 495,063 | 9,488,297 |
| Pixel200K ( Cheng et al., 2024 ) | 200,000 | 96,282 | 3,965,656 |
| Pixel1M ( Cheng et al., 2024 ) | 1,001,822 | 100,541 | 19,886,579 |
| Pixel8M ( Cheng et al., 2024 ) | 8,886,078 | 407,082 | 158,488,682 |
| Method | RAB | Bkts | RoPE | |||
| SASRec | 512 | 4 | — | — | — | — |
| TiSASRec | 512 | 4 | — | — | — | — |
| HSTU | 512 | 4 | 128 | Pos | — | — |
| HSTU+Time RAB | 512 | 4 | 128 | T+P | 128 | — |
| HSTU+TO-RoPE | 512 | 4 | 128 | T+P | 128 | TO-RoPE |
| HSTU+T-RoPE | 512 | 4 | 128 | T+P | 128 | T-RoPE |
Rotary Positional Embeddings
Rotary positional embeddings (RoPE) encode token positions by rotating attention features, supporting relative-position reasoning in language and multimodal models.
See all 98 papers