In the world of machine learning, time series data is often treated as a clean sequence of numbers sampled at regular intervals. However, real-world data—such as electronic health records (EHR), high-frequency trading logs, or cybersecurity audits—is rarely so polite. These are event sequences: they occur at irregular times, and each event comes with a "mark" (metadata) that can be a complex mix of categories (discrete) and measurements (continuous).
A new paper from researchers at UC Irvine and the Chan-Zuckerberg Initiative, titled "Transformers for Mixed-type Event Sequences," introduces FlexTPP, a framework designed to handle this heterogeneity without the usual compromises.
The Challenge of Mixed-Type Data
The standard mathematical tool for modeling irregular time series is the Marked Temporal Point Process (MTPP). However, traditional MTPPs struggle with "mixed-type" data.
Imagine a patient's medical history:
- Day 1: A "Lab Result" (discrete type) shows "Glucose: 116.0 mg/dL" (continuous value).
- Day 8: A "Procedure" (discrete type) occurs with no associated continuous value.
Existing models typically handle this by either tokenizing everything (e.g., turning "116.0" into a discrete bucket like "110-120," which loses precision) or ignoring the continuous parts entirely to enforce a consistent data structure. Furthermore, many models rely on "intensity functions" that require expensive numerical integration to predict when the next event will happen.
FlexTPP: A Unified Architecture
To overcome these limitations, the authors propose FlexTPP, which treats the entire event sequence as a single, flattened vector of mixed types.
1. The Unified Vector
Instead of treating time, event types, and marks as separate entities, FlexTPP flattens them into a sequence of scalars. Discrete event types act as "headers" that dictate how many continuous or discrete attributes follow, allowing the model to handle events of varying lengths in a single pass.
2. Autoregressive Transformer Backbone
The core of FlexTPP is a standard Transformer. Because it is autoregressive, it predicts the next element in the flattened sequence based on the entire preceding context.
3. Hybrid Prediction Heads
To handle the mixed data types natively, the model employs two distinct prediction heads:
- Discrete Head: A standard softmax classifier for categorical variables.
- Continuous Head: An expressive Normalizing Flow (specifically, Rational-Quadratic Splines). This allows the model to learn complex, multi-modal distributions for continuous values—like lab results or the time until the next event—without assuming they follow a simple Gaussian distribution.
4. Intensity-Free Modeling
By modeling the probability density of the next event time directly through the normalizing flow, FlexTPP avoids the "integration headache" of traditional Hawkes processes. This makes the model more computationally efficient and numerically stable.
Key Results and Insights
The researchers evaluated FlexTPP across three distinct domains: the EasyTPP Benchmark (standard discrete-only datasets), EHRSHOT (a large-scale medical dataset), and a Synthetic Harmonic Oscillator dataset.
- New State-of-the-Art Performance: FlexTPP set a new record for Negative Log-Likelihood (NLL) on 4 out of 5 EasyTPP datasets, outperforming both traditional intensity-based models and newer neural methods.
- Medical Precision: On the EHRSHOT data, the conditioned version of the model (FlexTPP-C) significantly outperformed Event Stream GPT (ESGPT). By accurately modeling the actual continuous lab values rather than just the occurrence of a test, the model became substantially better at predicting future medical procedures.
- The Power of Conditioning: The authors demonstrated that adding "static" context—such as a patient's age, gender, or baseline diagnosis—significantly improves the model's predictive capabilities, highlighting the value of Conditional MTPPs.
- Superior Annotation: In the synthetic annotation task, FlexTPP-C achieved near-perfect AUC-ROC scores (0.92 to 0.99), successfully detecting subtle events that standard CNN-based classifiers missed.
Limitations and Future Directions
While FlexTPP is highly effective, it shares the quadratic scaling limitation ($O(L^2)$) of standard Transformers with respect to sequence length. For extremely long patient histories or high-frequency trading logs, future iterations might benefit from linear-attention or state-space models. Additionally, while the framework handles scalars and small vectors well, it is not yet optimized for high-dimensional marks like images or audio snippets.
Overall, FlexTPP represents a significant step toward making point process models as flexible and powerful as modern large language models, bringing robust predictive capabilities to the messy, mixed-type data of the real world.
Summary updated