Preventing Conflicting Gradients in Neural Marked Temporal Point Processes

Tanguy Bosser, Souhaib Ben Taieb

TL;DR

Neural Marked Temporal Point Processes (MTPPs) often suffer from "conflicting gradients" because they attempt to learn event timing and event types using a single set of shared parameters. This paper introduces a novel framework that decouples these tasks into disjoint parametrizations, allowing for separate optimization that significantly boosts predictive accuracy and model calibration across diverse real-world datasets.

What Problem Does This Paper Address?

Marked Temporal Point Processes (MTPPs) are the mathematical workhorses used to model sequences of events happening in continuous time—think of a user’s clickstream on a website or a series of seismic shocks. A "mark" is simply the label or type of the event (e.g., which button was clicked).

Modern "neural" MTPPs use deep learning to capture complex patterns in these sequences. However, these models typically treat predicting the time of the next event and the type (mark) of that event as a joint task with shared parameters. The authors identify a major bottleneck here: conflicting gradients. During training, the update required to improve time prediction might be diametrically opposed to the update needed for mark prediction. When these gradients point in opposite directions, the model ends up following an "average" gradient that serves neither task well, leading to degraded performance.

Figure 1: Conflicting gradients

Methods

The authors propose moving away from joint modeling toward Disjoint Parametrizations. They introduce two main architectural setups:

  1. Base+ (Shared Encoder, Disjoint Decoders): The model uses a single history encoder (like a GRU or Transformer) to represent past events but uses two completely separate "decoder" networks to predict the next time and mark.
  2. Base++ (Fully Disjoint): The model uses two separate history encoders and two separate decoders. This allows the model to learn different historical features for timing versus mark prediction.

Crucially, their approach does not assume that time and marks are independent. Their mark prediction model $p^*(k|t)$ still takes the arrival time $t$ as an input, preserving the essential inter-dependency between "when" and "what" while allowing the underlying weights to be optimized independently.

This decoupling enables Disjoint Training, where each task can have its own early-stopping criteria. If the time prediction task starts to overfit, it can stop training while the mark prediction task continues to improve.

Datasets

The framework was evaluated on five diverse, real-world event sequence datasets:

  • LastFM: Music listening history (marks are artists).
  • MOOC: Student activities in an online course.
  • Github: Developer actions on repositories.
  • Reddit: User posts across different subreddits.
  • Stack Overflow: Badges received by users over time.

Key Insights and Ideas

  • Conflicts are Ubiquitous: By analyzing common baselines (like THP and RMTPP), the authors proved that conflicting gradients occur frequently during standard training. In some datasets, like MOOC, nearly 80-90% of gradient updates involved conflicts for certain models.
  • The "Time" Bias: Optimization tends to favor the time prediction task. The authors used a "Time Priority Index" (TPI) to show that when conflicts arise, the model usually prioritizes reducing the timing loss at the expense of the mark prediction accuracy.
  • Decoupling works better than scaling: A common "quick fix" for multi-task learning is to scale the losses (e.g., $L = \alpha L_{time} + L_{mark}$). The authors show this is inefficient; while it can shift priority to the mark task, it often causes the timing performance to "crash." Disjoint parametrizations improve both tasks simultaneously.
Figure 2: Distribution of cos ϕT M during training for the different baselines on MOOC and LastFM. CG refers to the proportion of cos ϕT M < 0 observed during training. The distribution is obtained by pooling the values of ϕT M over 5 training runs, and gradients that are conflicting correspond to the red bars.

Key Results

The authors transformed several state-of-the-art models (THP, SAHP, RMTPP, etc.) into their "++" versions. The results were striking:

  • Consistent Gains: The "++" versions outperformed the base models on almost every metric across all five datasets.
  • Mark Accuracy: Improvements were particularly significant for mark prediction. For example, on the LastFM dataset, the SAHP++ model reduced the mark negative log-likelihood ($L_M$) from 825.5 to 654.8.
  • Better Calibration: The models became "more honest" about their uncertainty. Probabilistic calibration errors (PCE and ECE) dropped significantly, meaning the model's predicted probabilities better matched actual observed frequencies.

Limitations and Future Work

  • Categorical Focus: This study focused exclusively on categorical marks (discrete labels). Future work is needed to see if these insights hold for continuous marks or more complex structures like graphs.
  • Computational Cost: The "++" setup requires training two separate encoders, which increases the memory footprint and execution time (though the authors argue this is a fair trade-off for the performance gains).
  • Scoring Rules: The analysis was limited to models trained using Negative Log-Likelihood. Exploring how other scoring rules (like the Brier score or CRPS) interact with gradient conflicts remains an open question.

Summary updated

Abstract

Neural Marked Temporal Point Processes (MTPP) are flexible models to capture complex temporal inter-dependencies between labeled events. These models inherently learn two predictive distributions: one for the arrival times of events and another for the types of events, also known as marks. In this study, we demonstrate that learning a MTPP model can be framed as a two-task learning problem, where both tasks share a common set of trainable parameters that are optimized jointly. We show that this often leads to the emergence of conflicting gradients during training, where task-specific gradients are pointing in opposite directions. When such conflicts arise, following the average gradient can be detrimental to the learning of each individual tasks, resulting in overall degraded performance. To overcome this issue, we introduce novel parametrizations for neural MTPP models that allow for separate modeling and training of each task, effectively avoiding the problem of conflicting gradients. Through experiments on multiple real-world event sequence datasets, we demonstrate the benefits of our framework compared to the original model formulations.
BibTeX
@article{bosser2025preventing,
  author = {Tanguy Bosser and Souhaib Ben Taieb},
  title = {{Preventing Conflicting Gradients in Neural Marked Temporal Point Processes}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2025},
}
Figure