Manuscript Offprint
arXiv:2610.10154HySPE: Positional Encoding via Symplectic Dual Shears
Abstract
We introduce Hyperbolic Symplectic Positional Encoding (HySPE), grounding positional attention in non-compact symplectic transformations. While canonical Rotary Position Embedding (RoPE) parameterizes the compact, elliptic branch of Sp(2, ) via rotations, HySPE operationalizes its hyperbolic branch via a damped symmetric composition of dual shears, yielding a conformally symplectic contraction with two spectral decay rates per channel pair. To eliminate the exponential representation drift inherent to naive absolute factorizations, we diagonalize the operator in its invariant eigenbasis and introduce blockwise coordinate rebasing with adaptive centered execution. This guarantees length-independent numerical bounds while matching cached RoPE forward latency (7.21 ms on an RTX 4090). On TinyShakespeare, HySPE-UltraLong maintains an invariant perplexity of 4.810 up to 16× zero-shot extrapolation (L = 4096), whereas RoPE degrades to 131.198. Scaled to a 51M-parameter subword Transformer on WikiText-103 ( ), HySPE closely matches RoPE in-domain while robustly extrapolating to length 8192, reducing tail perplexity by 83.9% over RoPE. While these controlled experiments establish HySPE’s extrapolation robustness and numerical stability, evaluating its scaling behavior on large-scale foundation models remains an important direction for future investigation.
1 Introduction
Positional encodings dictate how self-attention mechanisms in Transformers [1] represent relative token displacements. Rotary Position Embedding (RoPE) [2] establishes relative-position dependence through pairwise orthogonal rotations of query and key projections. In two dimensions, these rotations correspond to the elliptic subgroup of the real symplectic group . While volume-preserving and isometric, elliptic orbits are bounded and non-dissipative; consequently, extending sequence length beyond the pretraining horizon exposes unobserved phase domains, precipitating phase aliasing and attention entropy collapse [3, 4].
In this work, we propose Hyperbolic Symplectic Positional Encoding (HySPE), exploring the complementary hyperbolic branch of Sp(2, ). Motivated by dissipative dynamical systems and hyperbolic geometric flows [5, 6], HySPE constructs relative position operators via symmetric dual shears. The composition of two transverse elementary shears generates a symmetric hyperbolic operator with reciprocal positive real eigenvalues. When modulated by an exponential decay envelope, the relative attention kernel becomes contractive and conformally symplectic, satisfying for the standard symplectic form . This endows each channel pair with two distinct spectral attenuation rates, providing anisotropic distance filtering directly within the representation space.
Crucially, we uncover and resolve a fundamental tension between the continuum algebraic kernel and its finite-precision realization. Although the relative operator is strictly bounded, expressing it via separated absolute query and key matrices forces the key operator to diverge exponentially as , causing severe numerical overflow in float precision and corrupting KV-cache representation scales.
We overcome this representation divergence without modifying the mathematical kernel. By diagonalizing the dual-shear operator into its invariant eigenbasis, we factorize the bilinear interaction into decoupled decay modes and introduce spectral block rebasing. This local gauge transformation anchors intermediate scales to query-block origins, bounding maximum positive exponents to small constants regardless of sequence length. To eliminate kernel dispatch overhead, we design an adaptive centered blocking scheme that executes long-sequence attention in few kernel calls.
Across rigorous, multi-seed experiments on a byte-level Transformer trained on TinyShakespeare at length 256, HySPE achieves marked in-domain perplexity gains and zero-shot extrapolation up to 4096 tokens (16× extension) with zero quality degradation. Identical-checkpoint interventions verify that the stable spectral formulation completely recovers the predictive capacity lost to floating-point truncation in naive factorization. Furthermore, optimized HySPE forward latency reaches 7.21 ms at length 4096, matching cached RoPE (7.20 ms) on an RTX 4090. HySPE demonstrates that hyperbolic symplectic geometry provides an expressive, numerically robust alternative to canonical rotations for foundation sequence models.
Attractor dynamics, hyperbolic geometry, and Lorentz boosts. The formulation of HySPE is motivated by recent advances in non-Euclidean representation learning, notably contractive torus attractors in Ananke [5] and closed-form hyperbolic flows in Minkowski Attractor Networks [6]. In language modeling, HoPE [8] recently explored continuous Lorentz rotations in hyperbolic geometry to enforce monotonic attention decay. However, parameterizing continuous Lorentz boosts in Euclidean attention without coordinate stabilization introduces severe representation divergence (exponential key-norm explosion) over long contexts. In contrast, HySPE establishes an exact, discrete relative positional kernel via dual shears that preserves conformal symplectic invariants, analytically resolving representation drift through invariant eigenbasis rebasing and centered block execution.
Decayed and recurrent attention. RetNet [9] and ALiBi [10] introduce scalar distance penalties into linear retention and softmax attention, respectively. In contrast to scalar attention biases that penalize all channels indiscriminately, HySPE operates directly on 2D feature subspaces via hyperbolic shears, providing content-dependent, anisotropic decay. Moreover, HySPE retains exact quadratic causal attention rather than relying on linear-attention approximations.
Exact attention and memory-efficient execution. FlashAttention [11] highlights the primacy of tiling and IO awareness in Transformer efficiency. Our stable implementations operate within standard scaled dot-product attention (SDPA), optimizing positional coordinate scales and block scheduling to match native rotary efficiency on modern hardware.
3 Symplectic Dual-Shear Attention
3.1 Symplectic Group Perspective and Dual-Shear Construction
Linear transformations on two-dimensional phase space preserving the canonical symplectic form constitute the real symplectic group:
Elements of Sp(2, ) fall into three conjugacy classes based on their trace :
-
Elliptic ( ): Conjugate to standard Euclidean rotations SO(2). The eigenvalues reside on the unit circle . This class underpins RoPE [2]. Its bounded orbits lack geometric dissipation.
-
Parabolic ( ): Unipotent shears of the form . They represent degenerate, shear-like transitions without spectral separation.
-
Hyperbolic ( ): Real reciprocal eigenvalues . They induce distinct expansive and contractive axes, defining hyperbolic boosts.
HySPE investigates the hyperbolic symplectic branch. For a parameter , let . We construct the fundamental operator via a symmetric composition of two elementary parabolic shears:
Direct calculation verifies that , and consequently:
The matrix is symmetric positive definite with . Its eigenvalues are precisely and .
3.2 Conformally Symplectic Attention Kernel
To ensure contractive attention over arbitrary distances, we introduce dissipation rate , where . We modulate row-vector query and key representations at positions and through dual contragredient actions:
For causal displacement , their bilinear inner product satisfies:
Design dichotomy: Absolute vs. relative shear modulations. An appealing computational property of elementary shears is that their action involves only a single fused multiply-add (FMA) instruction, bypassing transcendental evaluations (cos, sin, cosh, sinh) entirely. A natural aspiration is to directly substitute RoPE's orthogonal rotations with such unipotent shears. However, direct symmetric application fails to produce a relative kernel. For an elementary shear , its non-orthogonality implies that the symmetric bilinear form couples absolute coordinates:
which explicitly depends on rather than .
This distinction leads to two divergent architectural strategies: (1) absolute shear modulation, which exploits ultra-cheap FMA operators while accepting coordinate cross-coupling, and (2) relative dual-shear modulation, which restores exact shift invariance by pairing a composed symmetric shear with its contragredient dual . In this paper, we focus strictly on the latter, developing HySPE as a principled relative positional framework.
Proposition 1 (Conformal Symplectic Property and Contractive Spectrum). The relative positional transfer operator satisfies the conformal symplectic identity:
Furthermore, let denote the orthogonal eigendecomposition of . Then:
Proof. Since , , by induction . Thus:
Substituting and into Eq. (5) directly yields Eq. (8). The operator norm is given by the dominant eigenvalue .
For head dimension with pairs, the complete attention score evaluates as:
HySPE introduces zero additional learned parameters; the values, projections, and causal softmax retain standard Transformer forms.
3.3 The Representation Divergence Dilemma
Proposition 1 reveals a critical numerical dichotomy. While the composite operator is contractive ( ), the naive absolute key factors in Eq. (4) diverge exponentially. Specifically, the key transformation matrix possesses eigenvalues:
Its spectral radius grows as and its condition number scales as . At , intermediate activations blow up beyond , triggering immediate exponent overflow in standard 16-bit floating-point formats and severe rounding truncation in FP32. Computing relative scores through separated absolute matrices destroys precision, obscuring the true performance of the underlying mathematical kernel.
4 Numerically Stable Evaluation of HySPE
4.1 Exact Spectral Rebasing
We resolve representation divergence by eliminating absolute coordinate scaling entirely. Let denote the paired spectral decay rates, and let represent an arbitrary coordinate anchor. For each channel pair, we project queries and keys into the invariant eigenbasis and rebase them to :
Because , their inner product in the rotated frame satisfies:
This algebraic equivalence holds identically for any choice of c in real arithmetic.
In our stable reference implementation (S), queries are partitioned into contiguous blocks of length at most 128, and we set . Each block attends to the full causal key history . The maximum positive exponent evaluated anywhere in keys is strictly bounded by , completely independent of absolute sequence position or . Non-initial rectangular blocks enforce causality via explicit offset masks.
4.2 Adaptive Centered Block Evaluation
While reference S provides numerical stability, invoking SDPA over 128-token blocks induces high kernel dispatch overhead for long sequences. We design an optimized fast path (F) by combining centered coordinate anchoring with adaptive block sizing:
By setting the anchor at the block midpoint, positive exponents in both queries and keys are bounded by . At FP32, , which resides well within the normal float range without underflow or overflow.
Positional geometry and masks are precomputed and cached per sequence length. At context length 4096, HySPE-UltraLong requires only a single SDPA dispatch per layer, while HySPE-v1 requires two, compared to 32 calls in reference S. The fast path retains exact quadratic causal attention, maintaining mathematical equivalence to S while matching RoPE execution speed.
5 Length Extrapolation on TinyShakespeare
Model architecture and data. We evaluate HySPE on an autoregressive byte-level Transformer (V = 256, 4.8M parameters) featuring 6 layers, hidden dimension d = 256, 4 attention heads ( ), SwiGLU FFN dimension , and pre-RMSNorm with tied embeddings. Models are trained on the 90/10 contiguous byte split of the TinyShakespeare benchmark [12]. No artificial QK-normalization or external attention biases are applied.
Training configuration. All configurations are trained at context length for 2,400 steps using AdamW with batch size 32, weight decay 0.01, gradient clipping at 1.0, and cosine learning-rate decay from to . Experiments are replicated across seeds 42, 43, and 44, sharing initial weights and training sequence samplers. Computations use FP32 with TF32 disabled on an NVIDIA RTX 4090.
The frequency spectrum derives from and for . We examine three spectral configurations:
• HySPE-v1: , balanced attenuation;
• HySPE-v2: , aggressive shear deformation;
• HySPE-UltraLong: , conservative long-range spectrum.
Configurations are trained under the original matrix factorization (M); HySPE-v1 and HySPE-UltraLong are additionally trained directly with stable spectral rebasing (S), yielding 18 trained checkpoints.
Evaluation metrics. Validation perplexity (PPL) is evaluated across 120 shared endpoints at context lengths . We report both full-context PPL (mean NLL over all tokens) and matched-tail PPL (evaluated strictly over the final 256 tokens at each endpoint to isolate long-range context benefit). Reported metrics denote mean and sample standard deviation over three seeds.
Benchmarking and diagnostics. Latency is measured via synchronized PyTorch CUDA events on the RTX 4090 (PyTorch 2.6.0, CUDA 12.4). Measurements record median group latency across 30 iterations following 3 warmup passes. High-precision numerical audits compare FP32 implementations (M, S, F) against an independent FP64 double-precision reference (D) evaluated on promoted model parameters.
5.1 In-Domain Quality and Zero-Shot Length Extrapolation
As illustrated in Figure 1(a), every evaluated HySPE variant improves in-domain predictive quality over the matched RoPE baseline at L = 256. The zero-shot context extension trajectory across extrapolation horizons is
(a) In-domain prediction

(b) Zero-shot length extrapolation

Figure 1: Prediction quality and zero-shot context extrapolation on TinyShakespeare. All models are trained at for 2,400 steps; HySPE configurations are trained and evaluated using the stable spectral formulation (S). Points and error bars indicate mean and sample standard deviation across seeds 42, 43, and 44 over 120 shared validation endpoints. (a) In-domain perplexity at length 256; percentage annotations denote relative PPL reductions over standard RoPE. (b) Full-context PPL across context lengths up to on a logarithmic vertical axis. While RoPE diverges past , HySPE-v1 exhibits stable scaling and HySPE-UltraLong maintains a flat trajectory near 4.81 throughout. Numerical details are in Table 1.
visualized in Figure 1(b). Standard RoPE experiences immediate, catastrophic phase confusion once the sequence length exceeds the pretraining window, climbing steeply from 5.015 to 131.198 at . In sharp contrast, HySPE variants maintain remarkably flat scaling curves. Notably, stable-trained HySPE-UltraLong preserves an invariant perplexity of 4.810 across all evaluation lengths from 256 to 4096, demonstrating that hyperbolic symplectic transformations provide an intrinsic inductive bias against long-range attention entropy explosion.
Table 1: Zero-shot context extrapolation perplexity up to training length (). All HySPE evaluations use the stable reference implementation (S); the training column denotes the training factorization. Values denote mean sample standard deviation across three random seeds.
| Method | Training | 256 (1×) | 512 (2×) | 1024 (4×) | 2048 (8×) | 4096 (16×) |
|---|---|---|---|---|---|---|
| RoPE | Standard | 5.015 ± 0.149 | 11.567 ± 0.949 | 33.125 ± 5.311 | 71.650 ± 15.399 | 131.198 ± 34.882 |
| HySPE-v1 | Matrix (M) | 4.680 ± 0.113 | 4.767 ± 0.101 | 4.746 ± 0.091 | 4.741 ± 0.100 | 5.241 ± 0.387 |
| HySPE-v1 | Stable (S) | 4.688 ± 0.063 | 4.778 ± 0.071 | 4.761 ± 0.070 | 4.757 ± 0.072 | 5.201 ± 0.276 |
| HySPE-v2 | Matrix (M) | 4.726 ± 0.093 | 4.832 ± 0.091 | 4.787 ± 0.078 | 4.808 ± 0.027 | 5.015 ± 0.154 |
| HySPE-UltraLong | Matrix (M) | 4.762 ± 0.033 | 4.843 ± 0.026 | 4.810 ± 0.035 | 4.782 ± 0.041 | 4.761 ± 0.056 |
| HySPE-UltraLong | Stable (S) | 4.810 ± 0.039 | 4.891 ± 0.039 | 4.850 ± 0.034 | 4.831 ± 0.032 | 4.810 ± 0.032 |
As shown in Table 1, every HySPE variant outperforms the baseline RoPE model in-domain (). Stable-trained HySPE-v1 reduces perplexity from 5.015 to 4.688, representing a relative reduction (paired seed improvements: , , and ). Under length extrapolation, standard RoPE exhibits severe degradation, escalating from 5.015 at to 131.198 at . In contrast, HySPE models remain completely stable. HySPE-UltraLong exhibits an entirely flat perplexity curve, recording precisely 4.810 at both length 256 and length 4096. At , its tail perplexity evaluates to , compared to for RoPE. Stable training confirms that this scale invariance is an intrinsic property of the hyperbolic symplectic operator, persisting when representation divergence is eliminated throughout training.
5.2 Identical-Checkpoint Interventions
To isolate algorithmic formulation from training dynamics, we conduct implementation interventions on fixed checkpoints (Table 2). Switching the evaluation kernel of matrix-trained HySPE-v1 from naive (M) to stable (S) drops length-4096 perplexity from 105.96 to 5.24, and tail perplexity from 436.82 to 7.68. Conversely, evaluating stable-trained HySPE-v1 with naive matrix factorization degrades perplexity from 5.20 to 111.42.
Table 2: Identical-checkpoint implementation intervention at length 4096. Evaluated on the exact same trained weights. Values denote mean sample standard deviation across three seeds.
| Method | Training | Full-context PPL (L = 4096) | Matched-Tail PPL (L = 4096) | ||
|---|---|---|---|---|---|
| Naive (M) Eval | Stable (S) Eval | Naive (M) Eval | Stable (S) Eval | ||
| HySPE-v1 | Matrix (M) | 105.96 ± 13.30 | 5.24 ± 0.39 | 436.82 ± 73.80 | 7.68 ± 2.51 |
| HySPE-v1 | Stable (S) | 111.42 ± 15.61 | 5.20 ± 0.28 | 512.55 ± 102.56 | 7.89 ± 3.17 |
| HySPE-v2 | Matrix (M) | 165.84 ± 23.67 | 5.02 ± 0.15 | 418.40 ± 101.89 | 5.96 ± 0.55 |
| HySPE-UltraLong | Matrix (M) | 44.77 ± 9.91 | 4.76 ± 0.06 | 427.39 ± 136.66 | 4.76 ± 0.09 |
An operator-level numerical audit measuring dot products at position 4096 against double-precision ground truth reveals a maximum absolute error of for naive , compared to for stable . In double precision, the output of agrees with the exact operator to within . This establishes that the observed extrapolation degradation in naive implementations is purely a numerical artifact of representation divergence, fully cured by spectral rebasing.
The catastrophic degradation observed in naive dual implementations is purely an artifact of representation divergence rather than a deficiency of the mathematical kernel. As shown in Figure 2(a) and Table 2, switching solely the evaluation path from the naive absolute factorization to the stable spectral rebased kernel on the exact same checkpoint drops length-4096 perplexity from 105.96 to 5.24 for HySPE-v1, and from 44.77 to 4.76 for HySPE-UltraLong. Conversely, running naive evaluation on weights trained with the stable kernel degrades performance to PPL 111.42, confirming that spectral rebasing is indispensable at inference time regardless of training trajectory.
(a) Same weights, stable evaluation

(b) Optimized full-model forward

Figure 2: Numerical factorization recovery and forward execution latency. Values report mean sample standard deviation across three seeds. (a) Same-checkpoint intervention at context length 4096: evaluating identical trained weights with the stable spectral kernel , blue) entirely recovers low perplexity compared to the naive absolute matrix factorization , grey; vertical axis on log scale). Training modes are indicated below each model. (b) Full-model forward pass latency on an RTX 4090 (, , FP32): centered adaptive evaluation () achieves an speedup over the reference implementation (), reaching 7.21 ms and matching cached RoPE at 7.20 ms. Detailed timing protocols and precision diagnostics are reported in Section 5 and Table 4.
5.3 Execution Latency and Benchmarking
Figure 2(b) benchmarks full-model forward pass latency at context length 4096 on an NVIDIA RTX 4090. While the reference implementation (S) incurs dispatch overhead due to its fine-grained 128-token query tiling (evaluating at 61.322 ms), the centered adaptive implementation (F) reduces latency to 7.212 ms. This corresponds to an speedup, placing HySPE within of cached RoPE (7.197 ms). As summarized in Table 3, training throughput (forward plus backward at , ) is similarly on par, with HySPE-UltraLong (17.558 ms) matching RoPE (17.394 ms) within . Centered block scheduling thus effectively closes the efficiency gap between hyperbolic symplectic operators and standard rotary embeddings.
Table 3: Full-model execution latency on NVIDIA RTX 4090 in milliseconds (mean ± standard deviation across three checkpoints). Forward-backward excludes optimizer overhead.
| Method / Kernel | Forward (, ) | Forward (, ) | Fwd+Bwd (, ) |
|---|---|---|---|
| RoPE (Standard) | |||
| RoPE (Cached) | |||
| HySPE-v1 / Reference () | |||
| HySPE-v1 / Centered () | |||
| HySPE-UltraLong / Reference () | |||
| HySPE-UltraLong / Centered () |
Table 3 presents runtime benchmarks on the RTX 4090. For HySPE-UltraLong at length 4096, centered adaptive evaluation () reduces forward latency from 61.322 ms to 7.212 ms (an 8.50× speedup over reference ), closely matching cached RoPE (7.197 ms). Training throughput (Forward+Backward at , ) reaches 17.558 ms for HySPE-UltraLong, within 0.9% of cached RoPE (17.394 ms). Thus, HySPE introduces negligible runtime overhead while conferring robust length extrapolation.
5.4 Numerical Precision Diagnostics
Table 4: Precision diagnostics at length 4096 using stable-trained weights. denotes FP64 double-precision reference. TV denotes token Total Variation; KL denotes Kullback-Leibler divergence. Top-1 changes evaluate across 36,864 tokens.
| Method | Candidate / Reference | Max Logit Error | Mean TV | Mean KL | Top-1 Discrepancies |
|---|---|---|---|---|---|
| HySPE-v1 | Fast () / Reference () | ||||
| HySPE-UltraLong | Fast () / Reference () | ||||
| HySPE-UltraLong | Reference () / FP64 () | ||||
| HySPE-UltraLong | Fast () / FP64 () |
Full-dataset validation confirms that across all 45 evaluated checkpoints and context lengths, the mean NLL difference between fast path and reference never exceeds . Fine-grained diagnostics at length 4096 (Table 4) confirm high fidelity: for HySPE-UltraLong, mean KL divergence between and is , and top-1 predictions agree on 36,862 of 36,864 tokens (99.995% agreement), with a maximum logit discrepancy of at the two disagreeing positions. Reference provides maximal numerical fidelity, while centered achieves near-RoPE runtime efficiency with indistinguishable validation loss.
6 Length Extrapolation on WikiText-103
6.1 Experimental Setup
We evaluate on WikiText-103 [13] (wikitext-103-raw-v1) using its standard splits. Text is tokenized with the GPT-2 byte-pair encoding (50,257 tokens). All models share a 51M-parameter decoder-only Transformer: 8 layers, hidden dimension 512, 8 attention heads (), SwiGLU intermediate dimension 1,376, pre-RMSNorm, and tied embeddings. Models are trained at context length 512 for 15,000 steps using AdamW (, , weight decay 0.1). The learning rate peaks at after a 100-step linear warmup and decays via a cosine schedule to . Computations use BF16 autocast with torch.compile on an NVIDIA RTX 4090, while positional operations are executed in FP32.
We compare RoPE against two HySPE configurations: default HySPE with and HySPE-v2 with (0.012, 0.0008). Channel pairs derive spectral rates via Eq. (14).
For zero-shot length extrapolation (), we evaluate the same checkpoints across 64 fixed endpoints without position interpolation. We report both Full PPL (averaged over all tokens) and Tail PPL (evaluated strictly on the final 512 targets to isolate the effect of extended context on identical tokens).
6.2 Results and Extrapolation Analysis
Table 5: In-domain results on WikiText-103 (, 15,000 steps). Validation PPL uses native BF16; standard test PPL uses FP32 stable evaluation.
| Method | Validation PPL | Test PPL | ||
|---|---|---|---|---|
| RoPE | — | — | ||
| HySPE | ||||
| HySPE-v2 |
Table 5 presents in-domain performance at context length 512. RoPE achieves a test PPL of 29.95, while default HySPE reaches 31.23 (a 4.28% gap). Increasing the shear magnitude in HySPE-v2 reduces test PPL to 30.78, narrowing the gap to 2.79%.
In-domain dynamics: Character vs. subword modeling. Unlike character-level modeling where metric dissipation acts as an immediate regularizer against high-frequency token repetition, subword modeling over dense BPE vocabularies relies heavily on RoPE's unattenuated orthogonal phases for short-range syntactic coordinate distinction. Strengthening the shear deformation in HySPE-v2 partially recovers this local discriminability, substantially closing the in-domain gap.
Table 6: Zero-shot length extrapolation on WikiText-103 (). Full PPL scores the entire context; Tail PPL scores the final 512 targets across all context lengths.
| Scale | RoPE | HySPE | HySPE-v2 | ||||
|---|---|---|---|---|---|---|---|
| Full | Tail | Full | Tail | Full | Tail | ||
| 512 | 1× | ||||||
| 1024 | 2× | ||||||
| 2048 | 4× | ||||||
| 4096 | 8× | ||||||
Extrapolation up to 8× length. As context extends beyond the training horizon, the relative performance inverts decisively (Table 6). While RoPE experiences immediate phase breakdown—its Tail PPL surging to 97.68 at 2× and 361.59 at 8×—HySPE exhibits strong contractive stability.
Crucially, expanding context actively improves prediction quality for HySPE: default HySPE's Tail PPL drops from 29.10 at to 26.00 at (a 10.66% improvement on identical targets), remaining at 28.07 at . At 8× extrapolation, default HySPE reduces Full and Tail PPL by 85.54% and 92.24% relative to RoPE. HySPE-v2 performs best up to 2× context, while default HySPE provides superior stability at 4× and 8×, reflecting the trade-off governed by the dissipation rates.
Stress test at 16× length (). To probe the operational limits, we evaluate models on a long-document cohort up to length 8192 without position interpolation (Table 7).
At 16× extrapolation, RoPE diverges entirely (Tail PPL 502.51). In contrast, default HySPE retains strong coherence, achieving Full PPL 36.49 and Tail PPL 80.83 (an 83.91% reduction over RoPE). Although attenuation across 8,000 steps introduces moderate tail degradation, HySPE preserves predictive utility where rotary mechanisms experience catastrophic failure.
Table 7: Matched 16× stress test (L = 8192) on long document segments. Full PPL scores the complete context; Tail PPL scores the final 512 tokens.
| L | Scale | RoPE | HySPE | HySPE-v2 | |||
|---|---|---|---|---|---|---|---|
| Full | Tail | Full | Tail | Full | Tail | ||
| 512 | 1× | 28.72 | 28.72 | 29.99 | 29.99 | 29.63 | 29.63 |
| 1024 | 2× | 51.51 | 96.28 | 27.89 | 27.07 | 27.61 | 26.83 |
| 2048 | 4× | 112.24 | 243.21 | 28.20 | 27.33 | 28.21 | 27.59 |
| 4096 | 8× | 181.14 | 340.75 | 28.38 | 29.27 | 32.22 | 53.29 |
| 8192 | 16× | 292.87 | 502.51 | 36.49 | 80.83 | 69.94 | 186.72 |
7 Discussion and Future Directions
HySPE demonstrates that positional attention benefits substantially from the rich geometric structure of non-compact symplectic groups. By deriving the contractive conformal symplectic kernel and resolving representation divergence via spectral rebasing, HySPE simultaneously achieves in-domain improvements or approximations and length extrapolation up to 16× pretraining context without learned decay parameters or heuristic windowing.
The symplectic framing provides a clear roadmap for architectural scaling:
-
Symplectic Hybrids and Complexification: In this work, the pure hyperbolic branch of Sp(2, ) demonstrates strong length extrapolation. To bridge periodic phase discrimination with monotonic dissipation, one natural progression is to compose elliptic (rotational) and hyperbolic (shear) generators within Sp(2, ). Beyond real subgroup composition, extending the framework to its complexification Sp(2, ) ≃ SL(2, ) systematically incorporates continuous oscillatory phases into contractive shear orbits, unifying high-frequency local discriminability with invariant long-context stability.
-
Hardware-Fused Kernels: The centered adaptive block formulation maps directly onto modern tiled attention algorithms. Developing dedicated FlashAttention-style CUDA/Triton kernels that fuse the spectral basis rotation and coordinate rebasing into online SRAM loading will enable sub-quadratic KV-cache decoding.
-
Retrieval Dynamics at Scale: While perplexity remains invariant up to 4096 tokens, factual retrieval across long contexts involves distinct attention dynamics. Scaling HySPE to billion-parameter models and evaluating on extensive retrieval suites (e.g., Needle-In-A-Haystack, LongBench) will further clarify the interplay between contractive spectral rates and long-range associative recall.
8 Conclusion
We have presented HySPE (Hyperbolic Symplectic Positional Encoding), a principled positional encoding scheme grounded in symplectic dual shears and contractive conformal dynamics. By identifying and resolving the representation divergence inherent in naive factorizations through invariant spectral rebasing and centered block attention, HySPE reconciles non-compact geometric transformations with strict floating-point stability and hardware efficiency. Empirical evaluations demonstrate marked in-domain perplexity reductions or approximations and invariant 16× context extrapolation at forward latencies matching standard RoPE. HySPE provides an expressive, mathematically rigorous foundation for long-context sequence modeling in modern Transformer architectures.
References
[1] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems (NeurIPS), volume 30, 2017.
[2] Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. RoFormer: Enhanced Transformer with Rotary Position Embedding. arXiv:2104.09864, 2021. https://arxiv.org/abs/2104.09864.
[3] Amirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das, and Siva Reddy. The Impact of Positional Encoding on Length Generalization in Transformers. In Advances in Neural Information Processing Systems (NeurIPS), 2023. Also available as arXiv:2305.19466. https://arxiv.org/abs/2305.19466.
[4] Shouyuan Chen, Sherman Wong, Liangjian Chen, and Yuandong Tian. Extending Context Window of Large Language Models via Positional Interpolation. arXiv:2306.15595, 2023. https://arxiv.org/abs/2306.15595.
[5] Zhongping Ji. Ananke: Contractive Torus Attractor Networks. arXiv:2609.24737, 2026. https://arxiv.org/abs/2609.24737.
[6] Zhongping Ji. Minkowski Attractor Networks: Closed-Form Hyperbolic Flows for Visual Representations. arXiv:2609.37817, 2026. https://arxiv.org/abs/2609.37817.
[7] Yutao Sun, Li Dong, Barun Patra, Shuming Ma, Shaohan Huang, Alon Benhaim, Vishrav Chaudhary, Xia Song, and Furu Wei. A length-extrapolatable transformer. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 14590–14604, 2023. https://aclanthology.org/2023.acl-long.816/.
[8] Chang Dai, Hongyu Shan, Mingyang Song, and Di Liang. HoPE: Hyperbolic Rotary Positional Encoding for Stable Long-Range Dependency Modeling in Large Language Models. arXiv:2509.05218, 2025. https://arxiv.org/abs/2509.05218.
[9] Yutao Sun, Li Dong, Shaohan Huang, Shuming Ma, Yuqing Xia, Jilong Xue, Jianyong Wang, and Furu Wei. Retentive Network: A Successor to Transformer for Large Language Models. arXiv:2307.08621, 2023. https://arxiv.org/abs/2307.08621.
[10] Ofir Press, Noah A. Smith, and Mike Lewis. Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation. arXiv:2108.12409, 2021. https://arxiv.org/abs/2108.12409.
[11] Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness. arXiv:2205.14135, 2022. https://arxiv.org/abs/2205.14135.
[12] Andrej Karpathy. Tiny Shakespeare corpus, char-rnn repository. https://github.com/karpathy/char-rnn/tree/master/data/tinyshakespeare.
[13] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer Sentinel Mixture Models. arXiv:1609.07843, 2016. https://arxiv.org/abs/1609.07843.