Neural Datalog Through Time: Informed Temporal Modeling via Logical Specification

Hongyuan Mei, Guanghui Qin, Minjie Xu, Jason Eisner

Introduction

Predicting future events from complex, irregularly timed sequences—such as user behavior on a platform or player actions in a sports match—is a notoriously difficult task. Standard neural models, like LSTMs or Neural Hawkes Processes (NHP), often struggle when the set of possible event types is massive. They tend to overfit to rare events, learn spurious correlations (e.g., associating a soccer goal in London with wheat sales in Chicago simply due to coincidental timing), and completely ignore hard physical or logical constraints (e.g., a player cannot pass a ball they do not possess).

To address these shortcomings, researchers have developed Neural Datalog Through Time (NDTT). NDTT is a neural-symbolic framework that uses logic programming to structure deep recurrent models for event prediction. By encoding domain knowledge as Datalog rules, the system automatically constructs a neural architecture that respects hard constraints and generalizes across entities, significantly outperforming "black-box" models in data efficiency and accuracy.

The NDTT Framework: Logic Meets Deep Learning

The core innovation of NDTT is the Temporal Deductive Database. Instead of relying on a single, monolithic hidden state vector, the model’s state is represented as a database of logical "facts," each associated with its own learned vector embedding.

Neural Datalog and Dynamic Architecture

The authors extend Datalog, a declarative logic programming language, so that every fact possesses a learned embedding. Rather than using a fixed neural network topology, the architecture is dynamically determined by the provenance (the proof tree) of the facts.

The framework utilizes two primary types of rules:

  • Deductive Rules (:-): These derive facts instantaneously based on current knowledge. For example, "A is a coworker of B if they share a boss." The embedding of the resulting "coworker" fact is computed as a function of the "boss" facts' embeddings.
  • Update Rules (<-): These handle state changes over time. When an event occurs (e.g., a "pass" in soccer), it triggers an update to the database (e.g., changing the fact of "who has the ball"). These temporal updates are modeled using an LSTM-like gating mechanism.

Continuous Time and Pooling

To model the intensity (instantaneous probability) of events occurring in continuous time, the framework integrates seamlessly with the Neural Hawkes Process. Additionally, NDTT introduces a novel differentiable pooling operator ($\bigoplus_\beta$). This allows the model to aggregate information when a fact can be proven in multiple ways (e.g., Alice and Bob are coworkers because they share multiple bosses), ensuring all logical pathways contribute to the final embedding.

Key Insights

  • Architecture as Logic: The most powerful paradigm shift in NDTT is that domain experts only need to write simple logical rules. The system automatically compiles these rules into a deep recurrent architecture. You design the logic, and the network wires itself.
  • Parameter Sharing via Variables: Because rules use variables (e.g., travel(A, C)), the model learns the generalized concept of an action. This concept applies to any person A and any city C, allowing the model to generalize even to rare entity pairs not frequently seen during training.
  • Hybrid Strength: The symbolic component handles hard constraints ("who is where" and "what is possible"), while the neural component captures nuanced, continuous patterns (e.g., how a user's preference for a specific genre evolves over time).

Experimental Results

The authors evaluated NDTT on three distinct domains: a synthetic superposition dataset (to test noise filtering), an IPTV dataset (real-world user watch histories with genre and release date constraints), and a RoboCup domain (highly dynamic soccer logs).

NDTT consistently achieved lower Negative Log-Likelihood and lower Root Mean Squared Error (RMSE) for time prediction compared to strong baselines like Know-Evolve and DyRep.

Log-likelihood per event for structured NHP vs. standard NHP across different training sequence sizes.

One of the most striking results is the model's data efficiency. Because NDTT does not have to learn the basic rules of the environment from scratch, it converges much faster. In synthetic tests, the structured NDTT model reached the same performance level as a standard Neural Hawkes Process using only 1/16th of the training data. Ablation studies further confirmed that removing either the logical tracking or the neural embeddings led to significant performance drops, validating the necessity of the hybrid approach.

Limitations and Future Work

While powerful, NDTT has a few current limitations:

  • Finiteness: The implementation assumes a finite set of entities defined in the program. Handling the dynamic creation of entirely new entities remains an area for future extension.
  • Logical Cycles: The system currently treats circular definitions (e.g., A is a friend of B, and B is a friend of A) as specification errors. Future iterations might handle this via fixed-point iteration.
  • Expert Burden: NDTT requires a human expert to write the initial Datalog rules. A promising direction for future research is "Structure Learning"—automatically discovering these logical rules directly from the data.

Summary updated

BibTeX
@inproceedings{mei2020neural,
  author = {Hongyuan Mei and Guanghui Qin and Minjie Xu and Jason Eisner},
  title = {{Neural Datalog Through Time: Informed Temporal Modeling via Logical Specification}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=JgAEHDfhWR},
}
Figure