Abstract
Signal Temporal Logic (STL) provides a formal framework for specifying system requirements, but its symbolic nature poses challenges for optimization. While embedding STL into continuous vector spaces facilitates gradient-based or Bayesian optimization, the resulting vectors are often non-invertible, obscuring the learned logic. We present a Transformer-based decoder architecture designed to map semantic embeddings back to human-readable STL formulae. Our approach demonstrates high fidelity, outperforming database-retrieval baselines and exhibiting a beneficial "simplicity bias" that favors more interpretable logical expressions.
Introduction
In the field of Neuro-Symbolic (NeSy) AI, a persistent challenge is the trade-off between the interpretability of symbolic logic and the optimizability of continuous representations. Signal Temporal Logic (STL) is widely used to describe requirements for time-varying signals in cyber-physical systems. While mathematical kernels can map these rules into high-dimensional embeddings, these mappings are typically one-way. This "inversion problem" prevents researchers from interpreting the results of optimization performed in the latent space. This paper introduces a Transformer-based decoder to bridge this gap, enabling the translation of continuous semantic embeddings back into symbolic STL strings.
Methods
The proposed architecture utilizes a decoder-only Transformer, conditioned on semantic embeddings via a cross-attention mechanism.
Semantic Embedding and Decoding
STL formulae are first mapped into 512- or 1024-dimensional vectors using a pre-existing kernel-based method. These embeddings are semantically consistent, ensuring that formulae with similar behavior on data are proximal in the vector space. The Transformer decoder then auto-regressively generates the characters or tokens of the STL formula string, effectively "inverting" the embedding.
Requirement Mining
To demonstrate the practical utility of the decoder, we employ Bayesian Optimization (specifically GP-UCB) to search the continuous embedding space. The goal is to find a formula that optimally classifies trajectories (e.g., distinguishing normal from anomalous behavior). Once an optimal vector is identified, the Transformer decodes it into a human-readable rule.
Datasets and Experimental Setup
The model was trained on several synthetic datasets, each containing 78,000 examples, to evaluate the impact of formula complexity on performance.
The datasets include:
- easyskewed / hardskewed: Biased toward simpler or more complex formulae, respectively.
- balanced: Maintains an equal distribution of formula depths (2 to 7).
- random: Features a broad distribution of depths and complexities, which proved most effective for training generalization.
Evaluation was conducted on specialized sets, including worst-case scenarios for traditional lookups, out-of-distribution (OOD) formulae, and real-world examples from cyber-physical system applications.
Key Results
The Transformer-based approach demonstrated significant advantages over traditional Information Retrieval (IR) baselines, which rely on searching massive pre-computed databases.
Learning and Fidelity
The model exhibits rapid convergence, learning syntactically valid STL within a single epoch and grasping semantic meaning within ten epochs. The "random" model achieved a median cosine similarity of approximately 0.98 between the robustness vectors of the original and decoded formulae, indicating high semantic fidelity.
Requirement Mining Performance
In benchmark tasks such as Human Activity Recognition and Robot Execution Failure, the model successfully identified STL specifications with over 90% classification accuracy. Notably, the decoded rules were highly interpretable, typically consisting of three or fewer nodes.
Discussion
A significant finding is the "simplicity bias" inherent in the Transformer decoder. The model often decodes complex embeddings into simpler, semantically equivalent formulae. This behavior enhances interpretability without sacrificing accuracy. Furthermore, the results suggest that training on a diverse, "random" dataset is superior to balanced datasets, as exposure to syntactic variety helps the model better map the underlying semantic manifold.
While the model shows promise, challenges remain regarding formal guarantees and potential nonsensical outputs in unexplored regions of the embedding space. Future work will investigate encoder-decoder architectures to create "invertible-by-design" representations.
Summary updated