[Paper Review] Teaching Temporal Logics to Neural Networks
This paper proposes training a Transformer model to generate traces for linear-time temporal logic (LTL) formulas end-to-end, using solutions from classical solvers as supervision. Despite being trained only on a subset of solutions, the model generalizes to both the semantics of LTL and larger, unseen formulas, achieving 83% correctness on a benchmark of timeout formulas, demonstrating strong neural-symbolic reasoning capabilities.
We study two fundamental questions in neuro-symbolic computing: can deep learning tackle challenging problems in logics end-to-end, and can neural networks learn the semantics of logics. In this work we focus on linear-time temporal logic (LTL), as it is widely used in verification. We train a Transformer on the problem to directly predict a solution, i.e. a trace, to a given LTL formula. The training data is generated with classical solvers, which, however, only provide one of many possible solutions to each formula. We demonstrate that it is sufficient to train on those particular solutions to formulas, and that Transformers can predict solutions even to formulas from benchmarks from the literature on which the classical solver timed out. Transformers also generalize to the semantics of the logics: while they often deviate from the solutions found by the classical solvers, they still predict correct solutions to most formulas.
Motivation & Objective
- To investigate whether deep learning can directly solve complex logical problems in formal verification, specifically LTL trace generation.
- To determine if neural networks can learn the semantic meaning of temporal logic without explicit symbolic supervision.
- To evaluate generalization to larger formulas and unseen logical patterns beyond training data.
- To assess whether Transformers can outperform or complement classical solvers in satisfiability and trace generation tasks.
Proposed method
- A Transformer architecture is trained to predict a trace (assignment of propositions over time) for a given LTL formula.
- Training data is generated using a DPLL-based solver, which provides one valid solution per formula, not all possible solutions.
- Tree positional encoding is used to preserve logical structure during sequence modeling, improving generalization.
- The model is fine-tuned on larger formulas and different formula classes (e.g., CNF) to test generalization.
- Syntactic and semantic accuracy are measured: syntactic match to the solver’s output and correctness of the trace under LTL semantics.
- The model is evaluated on a test set of formulas that timed out for the classical solver, assessing real-world applicability.
Experimental results
Research questions
- RQ1Can a neural network learn to generate correct LTL traces without explicit symbolic logic rules, relying only on supervised examples from classical solvers?
- RQ2Does the model generalize to the semantic meaning of LTL, even when its output differs from the solver’s specific solution?
- RQ3Can the model generalize to larger or more complex LTL formulas than seen during training, including those that caused timeouts in the classical solver?
- RQ4How does the choice of positional encoding affect generalization and performance on unseen formulas?
- RQ5Can the model outperform or complement classical solvers in practical verification workloads?
Key findings
- The model achieves 96.5% semantic accuracy on formulas of size 35 during training, indicating strong learning of LTL semantics.
- On a test set of formulas that timed out for the classical solver, the model correctly generated traces 83% of the time, demonstrating practical utility.
- Even when deviating from the solver’s specific solution, the model’s outputs were correct 96.5% of the time, showing robust semantic generalization.
- The model generalizes to formulas of size 50, achieving 86.1% semantic accuracy despite being trained only on size-35 formulas.
- Tree positional encoding significantly improves generalization, increasing syntactic accuracy from 29.0% to 35.8% on larger formulas.
- The model generalizes to CNF formulas, achieving 65.1% semantic accuracy on a 250-variable CNF benchmark, showing transferability beyond LTL.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.