[Paper Review] Distilling Formal Logic into Neural Spaces: A Kernel Alignment Approach for Signal Temporal Logic
The paper distills a robustness-based STL kernel into a Transformer encoder to produce efficient, invertible neural embeddings that preserve semantic similarity and enable fast reasoning and reconstruction.
We introduce a framework for learning continuous neural representations of formal specifications by distilling the geometry of their semantics into a latent space. Existing approaches rely either on symbolic kernels -- which preserve behavioural semantics but are computationally prohibitive, anchor-dependent, and non-invertible -- or on syntax-based neural embeddings that fail to capture underlying structures. Our method bridges this gap: using a teacher-student setup, we distill a symbolic robustness kernel into a Transformer encoder. Unlike standard contrastive methods, we supervise the model with a continuous, kernel-weighted geometric alignment objective that penalizes errors in proportion to their semantic discrepancies. Once trained, the encoder produces embeddings in a single forward pass, effectively mimicking the kernel's logic at a fraction of its computational cost. We apply our framework to Signal Temporal Logic (STL), demonstrating that the resulting neural representations faithfully preserve the semantic similarity of STL formulae, accurately predict robustness and constraint satisfaction, and remain intrinsically invertible. Our proposed approach enables highly efficient, scalable neuro-symbolic reasoning and formula reconstruction without repeated kernel computation at runtime.
Motivation & Objective
- Motivate learning continuous neural representations of formal STL specifications by preserving semantic geometry.
- Bridge kernel-based semantic similarity with neural encoders to enable efficient inference.
- Produce embeddings that approximate the STL kernel in a finite-dimensional space while remaining invertible.
- Demonstrate scalability and reconstruction capabilities for STL formulae across varied syntactic forms.
Proposed method
- Treat the STL kernel as a teacher to supervise a Transformer encoder via a kernel-weighted geometric alignment objective.
- Use a 12-layer Transformer encoder with an MLP projection head to map STL formulas into a fixed-dimensional unit hypersphere.
- Normalize embeddings so dot products approximate kernel similarities, effectively embedding into an RKHS proxy.
- Compute a continuous kernel similarity k(φi, φj) from robustness, using Monte Carlo sampling over trajectories and an RBF transform.
- Adopt a weighted loss L that emphasizes large semantic discrepancies, with a focal-like weighting mechanism.
- Evaluate pooling strategies ([CLS], BOS, mean) and use an end-to-end training regime with AdamW and bf16 precision.
Experimental results
Research questions
- RQ1Can a neural encoder faithfully approximate the geometry of the STL semantic kernel in a finite-dimensional embedding space?
- RQ2Do kernel-aligned neural embeddings preserve semantic similarity and quantitative STL semantics (robustness and satisfaction) effectively?
- RQ3Is the learned latent space invertible, enabling reconstruction of original STL formulas from embeddings?
- RQ4How does the proposed method compare to kernel-based and lexical baselines in terms of efficiency and scalability?
- RQ5What pooling strategy yields the fastest, most stable convergence while preserving semantic structure?
Key findings
- Kernel alignment of learned embeddings consistently exceeds 0.9 across configurations, indicating strong preservation of semantic geometry.
- Embeddings achieve uniformity scores stable around -3.0 on training/validation, indicating well-distributed representations on the hypersphere.
- Equivalent formula pairs are represented with neural similarity 0.966 vs kernel similarity 0.997; non-equivalent pairs have neural 0.182 vs kernel 0.170; lexical-similar negatives show 0.308 neural vs 0.225 kernel with MAE 0.112.
- Neural-based semantic agreement correlates highly with kernel-based semantics, with MAE 0.034 (equivalent) vs 0.072 (non-equivalent) for neural, and MAE 0.062 (lexical) for kernel.
- Lightweight probes trained on frozen embeddings predict average robustness (r ≈ 0.910) and satisfaction (r ≈ 0.947) with reasonable MAEs, indicating preserved quantitative STL semantics.
- Decoder experiments show the embedding space retains substantial semantic information, achieving median cosine similarity ~0.869 and L2-distance ~2.18 against a baseline that is less efficient.
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.