让旋转位置编码可学习,提升注意力模型的动态建模能力
Learning to Rotate: Temporal and Semantic Rotary Encoding for Sequential Modeling

- 用可学习的旋转空间替代固定的位置编码,融合时间与元数据信号
- 在社交新闻推荐任务中显著提升排序效果,计算开销几乎不变
- 适合关注注意力机制创新、序列建模优化的研究者
每个Transformer架构都投入大量容量学习语义嵌入空间中的丰富表示,但旋转位置编码(RoPE)所依赖的旋转流形一直被视为固定的手工设计结构,仅由离散序号填充。我们提出,这一旋转空间是注意力机制中被严重忽视的第二维表达力,其系统性探索可能为基于注意力的架构打开新路径。类比复数:引入虚轴——与实轴正交且独立——曾打破旧有代数限制;将旋转流形视为可学习、信号驱动的空间,为注意力开辟了正交自由度。此时,词元嵌入编码语义(实部)——即词的意义;而旋转编码动态(虚部)——即词与其他词在时间、位置和上下文中的关系。我们提出SIREN-RoPE,通过双分支正弦表示网络(SIREN)将连续时间戳、周期性时间模式和分类元数据等异质信号注入旋转维度。以大型社交平台的生产级新闻推荐数据集为测试基准,采用生成式推荐模型作为排序模型,验证表明激活该隐藏维度可在校准与排序目标上持续提升性能,且计算开销可忽略不计。我们呼吁社区将旋转空间视为未解的注意力轴,而非已解决的位置编码细节,其丰富结构或如虚数单位之于代数般深刻影响未来注意力模型。
原文摘要 · Abstract (English)
Every Transformer architecture dedicates enormous capacity to learning rich representations in semantic embedding space -- yet the rotation manifold acted upon by Rotary Positional Embeddings (RoPE) has been treated as a fixed, hand-crafted structure, populated only by discrete ordinal indices. We argue that this rotation space is a largely overlooked second dimension of expressivity in the attention mechanism, one whose systematic exploration may open a new door for attention-based architectures. The analogy to complex numbers is instructive: just as introducing the imaginary axis -- orthogonal to and independent of the real line -- unlocked new algebraic structure once believed impossible, treating the rotation manifold as a learnable, signal-conditioned space opens an orthogonal degree of freedom in attention. In this framing, the token embedding encodes the semantic (real) component of a representation -- what a token means -- while the rotation encodes its dynamic (imaginary) component -- how it relates to every other token across time, position, and context. We introduce SIREN-RoPE, a concrete instantiation of this idea, which populates the rotation dimension with heterogeneous signals -- continuous timestamps, cyclical temporal patterns, and categorical metadata -- via a dual-branch Sinusoidal Representation Network (SIREN). As a proof of concept, we evaluate on a production-scale news feed dataset from a major social network using a generative recommender as the ranking model, demonstrating that activating this hidden dimension yields consistent improvements across calibration and ranking objectives with negligible computational overhead. We invite the community to view the rotation space not as a solved positional-encoding detail, but as an untapped axis whose rich structure may prove as consequential for attention as the imaginary unit proved for algebra.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。