Standard Vision Transformers (ViTs) are "flat-earthers" by design. They treat every image as a Euclidean grid, which works perfectly for photos of cats but fails miserably when the "image" is a global weather map or a 360-degree astronomical survey. When you project a sphere onto a flat plane—like the common equirectangular maps we see in geography—distances get distorted, the poles become infinitely stretched, and the left edge of the map is actually right next to the right edge.
A new paper under review for ICLR 2026 introduces SpRePE (Spherical Reflection Position Embedding), a lightweight, geometry-aware method to help Transformers understand the true shape of the world.
TL;DR
SpRePE is a lightweight position embedding that uses Householder reflection matrices to encode spherical geometry directly into the Transformer's attention mechanism. It outperforms standard methods like RoPE and APE on spherical tasks like weather forecasting and image classification while maintaining high computational efficiency.
What Problem Does This Paper Address?
Transformers are inherently permutation-invariant; they don't know the order or position of tokens unless we tell them. We usually solve this with Position Embeddings (PEs). However, most popular PEs (like APE, RPE, or RoPE) assume a flat, linear, or 2D grid.
On a sphere, these assumptions break down due to two main issues:
- The Pole Problem: Near the poles, a tiny longitudinal step covers a much smaller physical distance than at the equator. Standard PEs treat these steps as equal, leading to massive geometric distortion.
- The Wrap-Around Problem: In a flat projection, the prime meridian (0° longitude) looks like a boundary, but on a sphere, it’s just another point. Standard PEs don't "know" that the far-left and far-right tokens are neighbors.
Existing spherical solutions often require complex custom layers or heavy computational overhead. The authors sought a "drop-in" replacement that is both mathematically rigorous and fast.
Methods
The core innovation of SpRePE is the use of Householder reflections.
- 3D Reflection: Instead of treating coordinates as 2D $(x, y)$ indices, SpRePE converts them to 3D Cartesian coordinates on a unit sphere. It then uses a Householder matrix—a linear transformation that reflects a vector across a plane—to encode the absolute position of a token.
- Relative via Absolute: The magic happens in the attention mechanism. When the model calculates the inner product between a Query and a Key, the math naturally simplifies into a 3D rotation matrix. This rotation represents the exact relative distance and direction between two points on the sphere.
- Efficiency: While 3D matrices sound heavy, the authors use a sparse matrix trick to implement the embedding as simple element-wise multiplications. This gives SpRePE the same $O(N)$ time and space complexity as the popular RoPE (Rotary Position Embedding).
- Degeneracy Mitigation: To prevent "over-aggregation" in dense areas (like the poles of a grid), they introduce a masking strategy that only applies the spherical embedding to a subset of the feature dimensions.
Datasets
The authors evaluated SpRePE on two distinct challenges:
- Spherical MNIST: A version of the classic digit dataset where digits are placed near the South Pole to specifically test how well the model handles extreme geometric distortion.
- ERA5 Global Weather Forecasting: A massive real-world dataset containing decades of atmospheric data (temperature, wind, geopotential). The model was tasked with predicting global weather patterns up to 10 days (+240h) into the future.
Key Insights and Ideas
- Geometry as Inductive Bias: By using reflections, the model doesn't have to learn that the earth is round; the math of the attention layer forces it to respect spherical distances.
- Faithful Attention Patterns: Visualization shows that while standard RoPE creates "strip-like" attention artifacts at the poles, SpRePE creates localized, circular attention maps that decay smoothly with actual geodesic distance.
- Long-Range Superiority: The benefits of SpRePE grow over time. In weather forecasting, the gap between SpRePE and other methods widened as the lead time increased, suggesting that correct geometry is crucial for maintaining physical coherence in long-term simulations.
Key Results
- Accuracy: On Spherical MNIST, SpRePE achieved 96.74% Top-1 accuracy, significantly beating RoPE (95.86%) and ALiBi (86.69%).
- Weather Forecasting: SpRePE consistently outperformed all baselines in predicting variables like Temperature (T2M) and Geopotential (Z500). Notably, at the 240-hour mark, it overtook RoPE across all tested variables.
- Robustness: The model proved much more robust to rigid rotations. If you "tilt" the input data, SpRePE’s performance stays stable, whereas standard PEs degrade because they are tied to specific grid indices.
Limitations and Future Work
- Dimension Constraints: The current formulation partitions the embedding space into 3D subspaces, meaning the hidden dimension of the Transformer must be a multiple of three.
- Grid Specifics: While the method is grid-agnostic, the experiments focused heavily on equirectangular projections. Testing on other spherical tilings (like HEALPix or Cubed-Sphere) would further prove its versatility.
- Future Directions: The authors suggest exploring how this geometric awareness could be applied to other non-Euclidean manifolds beyond the sphere, potentially opening doors for Transformers in complex physics or manifold learning.
Summary updated