TLINet: Differentiable Neural Network Temporal Logic Inference

Danyang Li, Mingyu Cai, Cristian-Ioan Vasile, Roberto TronarXiv 2024

TL;DR

TLINet is a new neuro-symbolic framework that learns human-readable Signal Temporal Logic (STL) formulas from time-series data using gradient-based optimization. By introducing novel differentiable approximations for logical operators, it achieves state-of-the-art classification accuracy while remaining significantly faster and more interpretable than traditional decision-tree or black-box neural network approaches.

What Problem Does This Paper Address?

In safety-critical domains like autonomous robotics, we need to understand why a system classifies a behavior as "safe" or "dangerous." While deep learning models like LSTMs or Transformers are excellent at processing time-series data, they are "black boxes"—their internal logic is opaque to humans.

Signal Temporal Logic (STL) offers a solution by providing a formal language to describe spatial-temporal properties (e.g., "the drone must always stay 5 meters away from the building"). However, automatically "inferring" these formulas from raw data is traditionally hard. Existing methods often rely on decision trees, which don't scale well to large datasets, or "template-based" neural networks that require a human to guess the formula's structure beforehand. TLINet aims to learn both the structure and the parameters of these formulas automatically and efficiently.

Methods

The authors propose TLINet, a neural network architecture where each layer corresponds to a specific STL operation. To make this work, they introduce several innovations:

  • Vectorized STL (vSTL): They translate STL into a vectorized format suitable for neural network computation, using binary weights to toggle specific sub-formulas or time intervals on and off.
  • Differentiable Modules: The network consists of three main building blocks:
  • Predicate Modules: Learn spatial boundaries (e.g., $x > 0.9$).
  • Temporal Modules: Learn time intervals for "always" ($\square$) and "eventually" ($\diamond$) operators using a differentiable time function.
  • Boolean Modules: Learn how to combine properties using "and" ($\wedge$) or "or" ($\vee$).
  • Sound Max Approximations: Standard "max" and "min" functions have zero gradients almost everywhere, which kills neural network training. TLINet introduces two new approximations:
  • Sparse Softmax: Used for temporal operators to ensure "soundness" (meaning the sign of the calculated robustness correctly indicates if the formula is satisfied).
  • Averaged Max: Used for Boolean operators to provide smoother gradients and better stability during training.
Fig. 1: An example of a 5-layer TLINet.

Datasets

The framework was evaluated on three distinct time-series classification benchmarks:

  1. Naval Surveillance Scenario: 2,000 trajectories of vessels. The goal is to distinguish normal behavior (approaching a port through a specific channel) from anomalous behavior (straying toward an island).
  2. Obstacle Avoidance: 2,000 trajectories of a robot navigating toward a target while avoiding a central obstacle.
  3. Periodic Signals: 2,000 synthetic sinusoidal waves where classes are defined by their period (20 vs. 40 time steps), testing the model's ability to capture complex temporal patterns.

Key Insights and Ideas

  • The "Aha" Moment on Soundness: Most differentiable logic frameworks use standard softmax, but the authors realized this can lead to "unsound" results where the network thinks a property is satisfied when it isn't. Their Sparse Softmax fixes this by ensuring the approximation never flips the sign of the robustness value.
  • Operator-Specific Approximations: One size doesn't fit all. They found that temporal operators (which select over time) benefit from Sparse Softmax, while Boolean operators (which select between sub-formulas) perform better with an Averaged Max approach that treats operator selection as a probabilistic draw.
  • Interpretability through Sparsity: By adding a penalty for "complex" formulas (L1 regularization on Boolean weights), the network naturally discards redundant logic, resulting in "concise" formulas that a human engineer can easily verify.

Key Results

  • Perfect Accuracy: TLINet achieved a 0.00 misclassification rate (MCR) across all three case studies, outperforming several decision-tree-based baselines (like BCDT and DAG).
  • Speed: In the Naval Surveillance task, TLINet-1 trained in just 27 seconds, compared to nearly 2,000 seconds for the Boosted Concise Decision Tree (BCDT) baseline.
  • Human-Readable Output: For the naval task, the model produced a simple formula: $\diamond_{[55,60]}(x < 25.89) \wedge \square_{[0,16]}(y > 23.77)$. Translated: "The vessel eventually reaches the port area at the end and always stays clear of the island's y-coordinate early on."
Fig. 7: The structure of the Boolean module.

Limitations and Future Work

While TLINet is powerful for supervised classification, it currently requires labeled data (e.g., "this trajectory is good, this one is bad"). The authors acknowledge this and suggest that extending the framework to unsupervised learning—where the model discovers interesting behaviors in unlabeled data—is a key next step. Additionally, while the formulas are compact, very deep TLINets might still produce complex nested logic that requires further simplification for human consumption.

Summary updated

BibTeX
@misc{li2024tlinet,
  author = {Danyang Li and Mingyu Cai and Cristian-Ioan Vasile and Roberto Tron},
  title = {{TLINet: Differentiable Neural Network Temporal Logic Inference}},
  year = {2024},
  eprint = {2405.06670},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.06670},
}
Figure