Query Languages for Machine-Learning Models
Martin Grohe
TL;DR
The paper investigates two logics for weighted finite structures, FO(SUM) and IFP(SUM), as query languages for neural networks viewed as weighted graphs. FO(SUM) augments first-order logic with a summation operator and conditional, enabling definitions such as edge counts, triangles, and depth-bounded neural evaluation terms, with data complexity in uniform TC^0. To handle unbounded-depth networks, the paper introduces IFP(SUM) with an inflationary fixed-point operator, and its restricted fragment sIFP(SUM), establishing polynomial-time data complexity while revealing inherent limitations in expressiveness for certain model-agnostic queries. A key result is that FO(SUM) can simulate FO({\mathcal{R}}_{lin},f) on bounded-depth FNNs, while capturing broader polynomial-time model-agnostic queries remains challenging; the work also develops a normal-form theory via reduced FNNs and cylindrical cell decomposition concepts. Overall, the framework clarifies what is expressible and efficiently computable when querying ML models with logical languages, guiding future directions in descriptive complexity, explainability, and verification for neural networks.
Abstract
In this paper, I discuss two logics for weighted finite structures: first-order logic with summation (FO(SUM)) and its recursive extension IFP(SUM). These logics originate from foundational work by Grädel, Gurevich, and Meer in the 1990s. In recent joint work with Standke, Steegmans, and Van den Bussche, we have investigated these logics as query languages for machine learning models, specifically neural networks, which are naturally represented as weighted graphs. I present illustrative examples of queries to neural networks that can be expressed in these logics and discuss fundamental results on their expressiveness and computational complexity.
