Papers
Topics
Authors
Recent
Search
2000 character limit reached

Multiplicative GRAPE: Lie Group Position Encoding

Updated 9 December 2025
  • Multiplicative GRAPE is a Lie group-based positional encoding that leverages multiplicative rotations to provide norm-preserving, relative, and compositional mappings.
  • It employs a rank-2 skew generator and closed-form Rodrigues-type solutions to enforce exact relative attention laws with efficient O(d) complexity.
  • Empirical results demonstrate stable training and improved generalization in long-context models compared to traditional block-diagonal approaches.

Multiplicative GRAPE (GRAPE-M) is a positional encoding mechanism grounded in Lie group actions, specifically utilizing multiplicative rotations from the special orthogonal group SO(d)\mathrm{SO}(d). It provides a rigorous, parameterized family of norm-preserving, relative, and compositional position mappings for attention-based neural architectures. GRAPE-M generalizes and subsumes the Rotary Position Embedding (RoPE) by extending beyond canonical block-diagonal rotations to include learned multi-subspace rotations and compact mixtures of non-commuting group actions with tractable computational overhead. It is a central component of the GRAPE (Group RepresentAtional Position Encoding) framework for positional geometry in long-context models, admitting closed-form solutions and strict relative attention laws (Zhang et al., 8 Dec 2025).

1. Mathematical Construction: Rank-2 Skew Generator

At the core of Multiplicative GRAPE is a rank-2 skew-symmetric generator L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d), where a,b∈Rda, b \in \mathbb{R}^d. For a,ba, b fixed:

  • Compute α=∥a∥2\alpha = \|a\|^2, β=∥b∥2\beta = \|b\|^2, γ=a⊤b\gamma = a^\top b
  • Define Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 0, s=Δs = \sqrt{\Delta}
  • LL acts nontrivially only on L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)0 and satisfies L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)1, where L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)2 is the orthogonal projector onto L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)3

The spectrum of L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)4 is L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)5, ensuring that L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)6 is a rotation in L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)7 for frequency L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)8 and token index L(a,b)=ab⊤−ba⊤∈so(d)L(a,b) = a b^\top - b a^\top \in \mathfrak{so}(d)9 (or a,b∈Rda, b \in \mathbb{R}^d0 for continuous positions).

2. One-Parameter Subgroup, Relative Law, and Closed-Form Exponential

GRAPE-M defines the multiplicative positional map as a,b∈Rda, b \in \mathbb{R}^d1. The exponential map generates a one-parameter subgroup:

  • a,b∈Rda, b \in \mathbb{R}^d2
  • a,b∈Rda, b \in \mathbb{R}^d3
  • a,b∈Rda, b \in \mathbb{R}^d4

Applied to attention, if a,b∈Rda, b \in \mathbb{R}^d5 and a,b∈Rda, b \in \mathbb{R}^d6 are query and key embeddings at positions a,b∈Rda, b \in \mathbb{R}^d7 and a,b∈Rda, b \in \mathbb{R}^d8, GRAPE-M enforces

a,b∈Rda, b \in \mathbb{R}^d9

giving strictly relative positional dependence.

The matrix exponential yields a closed-form “Rodrigues”-type solution:

a,ba, b0

This formula achieves a planar rotation by a,ba, b1 in a,ba, b2 and identity outside a,ba, b3.

3. Recovery of RoPE and the Canonical Case

RoPE arises as a special case where a,ba, b4, with a,ba, b5 the canonical block-diagonal complex structure (a,ba, b6; 90° blocks). Taking a,ba, b7 and a,ba, b8 such that a,ba, b9, α=∥a∥2\alpha = \|a\|^20, and α=∥a∥2\alpha = \|a\|^21, the generator satisfies α=∥a∥2\alpha = \|a\|^22 and α=∥a∥2\alpha = \|a\|^23. The resulting position map is

α=∥a∥2\alpha = \|a\|^24

For α=∥a∥2\alpha = \|a\|^25 disjoint planes (canonical coordinate pairs) and per-plane frequencies α=∥a∥2\alpha = \|a\|^26,

α=∥a∥2\alpha = \|a\|^27

and α=∥a∥2\alpha = \|a\|^28 is block-diagonal. Log-uniform choice α=∥a∥2\alpha = \|a\|^29 exactly recovers the RoPE spectrum.

4. Extensions: Learned Commuting Subspaces and Non-Commuting Mixtures

Learned Commuting Subspaces

Multiplicative GRAPE naturally extends to learned multi-plane actions:

  • Let β=∥b∥2\beta = \|b\|^20 (orthogonal basis), select planes β=∥b∥2\beta = \|b\|^21 via β=∥b∥2\beta = \|b\|^22
  • β=∥b∥2\beta = \|b\|^23 (mutually orthogonal, β=∥b∥2\beta = \|b\|^24)
  • Aggregate β=∥b∥2\beta = \|b\|^25, β=∥b∥2\beta = \|b\|^26

This allows learning per-head or per-plane spectra while maintaining β=∥b∥2\beta = \|b\|^27 computational and memory cost per head. Each token's features are rotated independently in β=∥b∥2\beta = \|b\|^28 planes.

Compact Non-Commuting Mixtures

To capture cross-subspace structure, GRAPE-M provides compact mixtures of β=∥b∥2\beta = \|b\|^29 non-commuting rank-2 generators:

  • γ=a⊤b\gamma = a^\top b0 (span of all γ=a⊤b\gamma = a^\top b1 has dimension γ=a⊤b\gamma = a^\top b2)
  • Project features into the γ=a⊤b\gamma = a^\top b3-dimensional subspace using an orthonormal basis γ=a⊤b\gamma = a^\top b4
  • Compress γ=a⊤b\gamma = a^\top b5 to γ=a⊤b\gamma = a^\top b6, compute real-Schur decomposition γ=a⊤b\gamma = a^\top b7
  • Rotate in each γ=a⊤b\gamma = a^\top b8-plane by γ=a⊤b\gamma = a^\top b9

The operation requires Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 00 cost per head and enables non-commuting, coupled feature mixing beyond block-diagonal structure.

5. Pseudocode Overview

Two core algorithms underpin efficient implementation:

Algorithm Description Complexity
Algorithm 1 Commuting Multi-Subspace GRAPE-M: apply Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 01 planar rotations via orthogonal Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 02 Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 03 per head
Algorithm 2 Fast Non-Commuting via Schur: compress to Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 04-dim, Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 05, planar rotations in mixed subspaces Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 06 per head

Algorithmic Steps:

  1. For commuting case, rotate each coordinate pair by Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 07, Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 08, as parameterized by position and frequency.
  2. For non-commuting case, project to a lower-dimensional subspace, apply multiple coupled planar rotations, and project back.

6. Initialization, Stability, and Computational Considerations

  • Each plane generator is gauge-fixed with Δ=αβ−γ2≥0\Delta = \alpha\beta - \gamma^2 \geq 09, s=Δs = \sqrt{\Delta}0; scale is absorbed into s=Δs = \sqrt{\Delta}1.
  • Frequencies s=Δs = \sqrt{\Delta}2 or s=Δs = \sqrt{\Delta}3 can be fixed (e.g., log-uniform) or learned per head/plane.
  • The closed-form uses s=Δs = \sqrt{\Delta}4, s=Δs = \sqrt{\Delta}5 with Taylor expansions guarding s=Δs = \sqrt{\Delta}6 for numerical stability.
  • Differentiation with respect to s=Δs = \sqrt{\Delta}7, s=Δs = \sqrt{\Delta}8, s=Δs = \sqrt{\Delta}9 yields analytic, stable gradients.
  • Complexity: GRAPE-M achieves LL0 time, LL1 memory, and LL2 parameters per head (contrasted with LL3 and LL4 for full-matrix exponentials).
  • Compared to block-diagonal RoPE, GRAPE-M enables richer feature coupling without increasing leading-order cost.

7. Empirical Performance and Model Integration

In experiments on language modeling (nanoGPT/LLaMA base, FineWeb-Edu 100B), Multiplicative GRAPE shows:

  • Stable training curves by contrast with oscillations observed in RoPE.
  • Validation loss on par or improved relative to RoPE for both medium (355M) and large (770M) models.
  • In downstream zero-shot evaluation tasks (ARC, BoolQ, Hellaswag, OBQA, PIQA, WinoGrande, SciQ), both GRAPE-A (additive) and GRAPE-M outperform RoPE and the Forgetting Transformer (FoX) in average accuracy (see Tables A.1–A.2 of (Zhang et al., 8 Dec 2025)).

A plausible implication is that the additional expressivity and strict group-theoretic structure of Multiplicative GRAPE can enhance both training stability and generalization in long-context models, while preserving exact relative positional laws and LL5 efficiency.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Multiplicative GRAPE.