Abstract
Modeling asynchronous event sequences is a fundamental challenge in various domains, from social media to finance and healthcare. Traditional approaches like the Neural Hawkes Process (NHP) rely on Recurrent Neural Networks (RNNs), which suffer from vanishing memory and sequential processing bottlenecks. This paper introduces the Transformer Hawkes Process (THP), which leverages self-attention and temporal encodings to capture long-term dependencies efficiently. By replacing recurrence with a non-recurrent architecture, THP achieves significant improvements in both predictive accuracy and training speed across multiple real-world datasets.
Introduction
In our hyper-connected world, data often arrives as a "stream of events"—a series of timestamps and actions, like a sequence of tweets, stock trades, or medical diagnoses. Modeling these sequences is tricky because they are asynchronous: the time interval between events is just as important as the order in which they happen. Traditionally, researchers used Hawkes Processes (mathematical models for self-exciting events) or Recurrent Neural Networks (RNNs). However, RNNs struggle with long-term dependencies and are notoriously slow to train. The Transformer Hawkes Process (THP) brings the power of self-attention to the world of continuous-time event modeling.
Problem Statement: The Limitations of Recurrence
Most real-world event data exhibits complex dependencies. A tweet today might be influenced by a news event from weeks ago or a reply from minutes ago. Existing models like the Neural Hawkes Process (NHP) rely on LSTMs, which face two major flaws:
- Vanishing Memory: RNNs struggle to maintain information over long sequences; the influence of an old event decays exponentially as new events are processed.
- Sequential Bottleneck: RNNs must process events one by one, making them impossible to parallelize during training and difficult to scale.
Methodology
The Transformer Hawkes Process adapts the Transformer architecture to handle continuous time.
Temporal Encoding and Self-Attention
In standard Transformers, positional encoding tells the model the order of words. THP uses a temporal encoding based on trigonometric functions to represent the actual time $t_j$ an event occurred. This allows the model to understand the distance between events in absolute time. Instead of passing a hidden state through a chain, THP allows every event in a sequence to attend to all previous events simultaneously, directly solving the fading memory problem.
Continuous Intensity Function
Point processes require a conditional intensity function $\lambda(t)$, representing the "rate" of events. Since Transformers produce discrete outputs, the authors designed a novel interpolation method. The intensity at time $t$ is calculated based on the hidden representation of the most recent event, adjusted by a "current influence" term that evolves until the next event occurs.
Experiments and Results
The model was evaluated on seven diverse datasets, including social media (Retweets, MemeTrack), finance, healthcare (MIMIC-II), and geospatial data (911-Calls, Earthquakes).
Key Findings
- Performance: THP achieved significantly higher log-likelihoods than NHP and RMTPP. On the Retweets dataset, THP scored -2.04 vs. NHP's -5.60.
- Efficiency: THP is non-recurrent, enabling a ~2x speedup in training compared to RNN-based models. It is also more parameter-efficient; a THP model with 200k parameters often outperformed an NHP model with 1,000k parameters.
- Attention Patterns: Visualization shows that different attention heads learn distinct temporal scales—some focus on recent events while others capture long-term history.
Conclusion
The Transformer Hawkes Process represents a significant step forward in neural point processes. By moving away from recurrent architectures, it provides a more scalable and accurate framework for modeling the pulse of real-world events. Future work may extend this to dynamic graphs where relationships between event sources evolve over time.
Summary updated