- Updated: March 11, 2026
- 6 min read
Mag-Mamba: Modeling Coupled spatiotemporal Asymmetry for POI Recommendation
Direct Answer
Mag‑Mamba introduces a novel, complex‑valued neural framework that treats the directional flow of people between points of interest (POIs) as a phase‑driven rotation in the complex plane. By embedding time‑conditioned magnetic Laplacians into a “Magnetic Phase Encoder” and coupling them with a “Complex‑valued Mamba” module, the model captures the highly asymmetric, time‑varying mobility patterns that traditional graph or sequence models miss—delivering markedly better next‑POI recommendations.
Background: Why This Problem Is Hard
Location‑based services (LBS) such as ride‑hailing, tourism apps, and urban planning tools rely on accurate next‑POI recommendation to keep users engaged and to optimize resource allocation. The core difficulty stems from two intertwined properties of human mobility:
- Spatiotemporal asymmetry: The likelihood of moving from location A to B is rarely the same as moving from B to A, and this imbalance shifts throughout the day, week, or season.
- Dynamic global directionality: Urban flows exhibit city‑wide currents—morning commutes toward business districts, evening returns to residential zones—that cannot be captured by static, symmetric graph operators.
Most existing POI recommenders fall into two camps:
- Graph‑based methods (e.g., GCN, GAT) that aggregate neighbor information with symmetric Laplacians, thereby erasing directional cues.
- Sequence‑based models (e.g., RNN, Transformer) that treat time as a linear sequence but still rely on real‑valued attention, which cannot encode a rotating “phase” that reflects changing direction.
Consequently, these approaches struggle to unify spatial asymmetry with temporal dynamics, leading to sub‑optimal recommendations, especially during peak traffic periods or in cities with irregular transit patterns.
What the Researchers Propose
Mag‑Mamba tackles the asymmetry problem by moving the computation into the complex domain, where a rotation naturally encodes direction. The framework consists of two tightly coupled components:
- Time‑conditioned Magnetic Phase Encoder (TMPE): Constructs a magnetic Laplacian on the geographic adjacency graph, assigning each edge a phase that varies with the time of day. The phase acts like a compass needle, pointing toward the dominant flow direction at that moment.
- Complex‑valued Mamba module (C‑Mamba): Extends the scalar decay mechanism of traditional state‑space models into a joint decay‑rotation operation. The module’s hidden state evolves as a complex vector, simultaneously shrinking (forgetting) and rotating (re‑orienting) according to the magnetic phases supplied by TMPE.
In essence, the model treats each user’s trajectory as a particle moving through a magnetic field that changes with time; the particle’s state rotates to follow the field, preserving the asymmetry that would otherwise be lost.
How It Works in Practice
The end‑to‑end workflow can be visualized as a pipeline:
- Data preprocessing: Raw check‑in logs are mapped onto a geographic adjacency graph where nodes represent POIs and edges connect spatially proximate locations.
- Phase computation: For each time slot (e.g., hour of day), TMPE calculates edge‑wise phase differences based on historical transition frequencies, producing a time‑conditioned magnetic Laplacian.
- Embedding lookup: POI identifiers are transformed into complex embeddings that serve as the initial state for the C‑Mamba.
- State evolution: As a user’s check‑in sequence unfolds, C‑Mamba updates its hidden state using a complex‑valued state‑space equation. The update incorporates:
- Decay factor (forgetting older visits)
- Rotation factor derived from the magnetic phases for the current time interval
- Prediction head: The final complex state is projected back to the real domain and passed through a softmax layer to rank candidate POIs for the next visit.
What sets this approach apart is the explicit modeling of direction as a phase angle, rather than an implicit bias learned through attention weights. The magnetic Laplacian guarantees that the phase information respects the underlying graph topology, while the complex‑valued dynamics ensure that temporal changes directly rotate the hidden representation.
Evaluation & Results
Mag‑Mamba was benchmarked on three publicly available LBS datasets covering different cities, user densities, and temporal granularities. The evaluation protocol followed standard next‑POI recommendation metrics (Recall@K, NDCG@K) and compared against a suite of strong baselines:
- Graph Convolutional Networks (GCN, GAT)
- Sequential models (GRU, Transformer‑based SASRec)
- Hybrid approaches (STGCN, GeoSAN)
Key findings include:
- Consistent gains: Mag‑Mamba outperformed the best baseline by 7–12% in Recall@10 across all datasets, indicating a more reliable capture of user intent.
- Temporal robustness: Performance improvements were most pronounced during peak commuting hours, where directional asymmetry is strongest.
- Ablation insights: Removing the magnetic phase component reduced accuracy to near‑baseline levels, confirming that phase‑driven rotation is the primary driver of gains.
- Efficiency: Despite operating in the complex domain, the model’s parameter count remained comparable to real‑valued counterparts, and inference latency stayed within real‑time constraints for production systems.
These results demonstrate that encoding spatiotemporal directionality as a magnetic phase is not just a theoretical curiosity—it translates into measurable improvements in real‑world recommendation tasks.
Why This Matters for AI Systems and Agents
For practitioners building AI‑driven location services, Mag‑Mamba offers a concrete pathway to bridge the gap between static graph analytics and dynamic sequential modeling. The implications are threefold:
- Enhanced personalization: By respecting the true asymmetry of user movement, recommendation engines can surface venues that align with a user’s likely direction, increasing click‑through and conversion rates.
- Better resource planning: Ride‑hailing platforms can anticipate demand surges along specific corridors, enabling smarter driver dispatch and dynamic pricing.
- Modular integration: The magnetic phase encoder can be plugged into existing pipelines as a preprocessing layer, while the complex‑valued Mamba can replace standard RNN/Transformer blocks without altering downstream APIs.
Developers can therefore leverage Mag‑Mamba within the UBOS platform to prototype next‑POI services, or embed the model into custom UBOS agents that act as autonomous recommendation bots. The approach also aligns with emerging trends in UBOS orchestration, where complex stateful components are coordinated across micro‑services to deliver real‑time, context‑aware experiences.
What Comes Next
While Mag‑Mamba marks a significant step forward, several avenues remain open for exploration:
- Scalability to city‑wide graphs: Extending the magnetic Laplacian to millions of POIs will require sparse‑matrix optimizations and possibly hierarchical graph constructions.
- Multi‑modal signals: Incorporating additional cues such as weather, events, or public transit schedules could enrich the phase computation, making the model even more responsive to external factors.
- Cross‑city transfer learning: Investigating whether magnetic phase patterns learned in one city can bootstrap recommendation performance in another, reducing data collection overhead.
- Interpretability tools: Visualizing the evolving phase field could provide city planners with actionable insights into mobility trends, turning the model into a decision‑support system.
Future research may also examine alternative complex‑valued architectures—such as quaternion or hyper‑complex networks—to capture higher‑order interactions beyond simple rotation.
For teams interested in experimenting with Mag‑Mamba, the full pre‑print is available on arXiv. The authors have released code and data pipelines that can be adapted to proprietary datasets, making it feasible to prototype within weeks.
By embracing phase‑driven dynamics, the next generation of POI recommendation systems can finally respect the true, time‑varying currents of urban movement—unlocking richer user experiences and more efficient city‑scale services.
