[Paper Review] Transformers Generalize to the Semantics of Logics
This paper demonstrates that Transformers can learn the semantic meaning of propositional and linear-time temporal logic (LTL) from imperfect training data, generalizing to unseen formulas and even solving LTL formulas that the training generator failed to process. Despite deviating from the generator's specific outputs, the model produces correct solutions by learning underlying logic semantics rather than training data artifacts.
We show that neural networks can learn the semantics of propositional and linear-time temporal logic (LTL) from imperfect training data. Instead of only predicting the truth value of a formula, we use a Transformer architecture to predict the solution for a given formula, e.g., a variable assignment for a formula in propositional logic. Most formulas have many solutions and the training data thus depends on the particularities of the generator. We make the surprising observation that while the Transformer does not perfectly predict the generator's output, it still produces correct solutions to almost all formulas, even when its prediction deviates from the generator. It appears that it is easier to learn the semantics of the logics than the particularities of the generator. We observe that the Transformer preserves this semantic generalization even when challenged with formulas of a size it has never encountered before. Surprisingly, the Transformer solves almost all LTL formulas in our test set including those for which our generator timed out.
Motivation & Objective
- To investigate whether neural networks can learn the semantic meaning of propositional and linear-time temporal logic (LTL) from imperfect training data.
- To determine if Transformers can generalize to formulas larger than seen during training.
- To evaluate whether models trained on generator-specific outputs can still produce correct solutions by learning underlying logic semantics.
- To assess the robustness of semantic generalization in neural models when faced with out-of-distribution formulas.
Proposed method
- Training a Transformer to predict solutions (e.g., variable assignments) for logical formulas instead of just truth values.
- Using a dataset of formulas and their solutions generated by a possibly imperfect or non-deterministic generator.
- Evaluating the model on formulas not seen during training, including those larger than any in the training set.
- Testing generalization on LTL formulas where the generator timed out, assessing if the model still finds valid solutions.
- Measuring correctness of predictions not by exact match to generator output, but by semantic validity of the solution.
- Analyzing the model's ability to preserve solution correctness despite deviations from generator-specific outputs.
Experimental results
Research questions
- RQ1Can Transformers learn the semantic meaning of propositional and LTL formulas from imperfect training data?
- RQ2Does the model generalize to formulas of unseen sizes, even when the generator fails to produce solutions?
- RQ3Can the model produce correct solutions even when its output differs from the generator’s specific output?
- RQ4To what extent does semantic generalization outperform memorization of generator-specific patterns?
Key findings
- The Transformer produces correct solutions for almost all formulas, even when its output differs from the generator’s output.
- The model generalizes to formulas larger than any seen during training, demonstrating robust out-of-distribution generalization.
- The model successfully solves LTL formulas for which the generator timed out, indicating superior reasoning capability.
- The model learns the underlying semantics of logic rather than memorizing generator-specific solution patterns.
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.