Manuscript Offprint
arXiv:2610.13756ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
NKECHI J. AKINWALE, University of Cincinnati, USA
SEOKKI LEE, University of Cincinnati, USA
Expressing ML algorithms as recursive aggregate SQL queries over distributed systems enables large-scale declarative data analytics, yet no existing system supports scalable provenance capture, necessary for ML explainability. We present ProvQML, a provenance-aware recursive aggregate SQL engine that efficiently captures fine-grained provenance while evaluating ML algorithms as recursive aggregate queries. We capture two types of provenance: (i) local provenance that records the contribution of each training instance to gradient computation at a specific model state, and (ii) global provenance that encodes the sequence of model parameter updates across the iterations. Extensive experiments on widely used ML datasets demonstrate that our approach efficiently captures both provenance for various ML models over widely used ML datasets.
CCS Concepts: • Information systems → Relational database query languages.
Additional Key Words and Phrases: Provenance, Declarative Machine Learning, Aggregate in Recursion
ACM Reference Format:
Nkechi J. Akinwale and Seokki Lee. 2026. ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]. Proc. ACM Manag. Data 1, 1 (October 2026), 29 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn
1 Introduction
Expressing ML algorithms as recursive aggregate SQL queries over distributed systems such as Apache Spark has gained traction [40, 48]. For iterative ML tasks, aggregation within recursion is essential for fixpoint convergence [50]. There is also an increasing need for ML explainability [24, 30, 43]. In the context of ML as a declarative query, explainability of ML aligns with the database community's long-standing work on explaining query results [4, 6, 7, 9, 25, 27, 32]. These studies rely on provenance, the record of how a query result is derived from input tuples, which is a well-studied method for such explanations. For ML queries, [3, 45] envision that provenance can trace how training instances drive model parameter updates, supporting model validation and debugging. It also enables the possibility of computing feature importance [24, 30], which quantifies each feature's statistical contribution to the trained model. Despite this, no existing system supports scalable provenance capture for recursive aggregate SQL that is needed for ML explainability.
EXAMPLE 1 (MOTIVATING EXAMPLE). Figure 1 shows a sample of the ACS Income dataset, which records demographic and employment attributes, including class of work (CWork) and occupation category (OCat) along with a binary income label (Y = 1 if annual income exceeds 50,000, 0 otherwise), https://fairlearn.org/main/user_guide/datasets/acs_income
Authors' Contact Information: Nkechi J. Akinwale, University of Cincinnati, USA, akwarinj@mail.uc.edu; Seokki Lee, University of Cincinnati, USA, lee5sk@ucmail.uc.edu.
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.
© 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ACM 2836-6573/2026/10-ART
https://doi.org/10.1145/nnnnnnn.nnnnnnn
Nkechi J. Akinwale and Seokki Lee
Input training data
| I | C | V | Y |
|---|---|---|---|
| 1 | Age | 46 | 1 |
| 1 | CWork | 1 | 1 |
| 1 | OCat | 1760 | 1 |
| 1 | Education | 24 | 1 |
| 1 | Sex | 1 | 1 |
| 1 | Race | 1 | 1 |
| 2 | Age | 45 | 0 |
| 2 | CWork | 6 | 0 |
Optimized weights
| C | P | J |
|---|---|---|
| Age | 15.4500 | 100 |
| CWork | -0.4633 | 100 |
| OCat | -24.1800 | 100 |
| Education | 11.5067 | 100 |
| Sex | 0.4367 | 100 |
| Race | -0.4067 | 100 |
Fig. 1. ACSIncome data [11] (verticalized and pre-processed), and trained model parameters (results) over 100 iterations ().

Fig. 2. Overview of ProvQML query evaluation for the running example
which is reinterpreted as a loan approval outcome. The input data is stored in a verticalized format where each feature and its value of an instance appear as a tuple. We will revisit the verticalization in Section 2. Tom, an analyst at a bank, uses logistic regression model to determine the loan approval outcomes, and the optimized model's weights are shown in the figure. His manager raises a concern that loan approvals from the first half the year disproportionately favor a particular racial group. The model weights alone are insufficient to diagnose the cause, e.g., Race has one of the lowest weights, so Tom needs to trace which training instances drove the weight updates at each iteration.
In this paper, we present ProvQML, a provenance-aware recursive aggregate SQL engine built on top of Apache Spark that instruments input queries expressing ML algorithms, e.g., [48], to efficiently capture fine-grained provenance while evaluating a broad range of such algorithms. Unlike [48], which requires mutual and non-linear recursion with multiple aggregates, ProvQML
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
3
uses standard linear recursion with window functions, requiring no new recursion constructs, that can be evaluated in standard (distributed) database systems with a minimal extension. The correctness of ProvQML's query rewriting and optimization relies on two properties established by prior work [17, 48, 50]. The Pre-Mappability (PreM) property [17, 50] gives conditions under which extrema aggregates (min, max) can be pushed into recursion while producing the same result as the equivalent aggregate-stratified program. For non-extrema aggregates (sum, avg), the Pre-Countable Cardinality (PCC) property [48] guarantees correctness when the delta relation's cardinality is constant across iterations and pre-computable which is a condition ML workloads such as batch gradient descent satisfy naturally. Figure 2 gives an overview of ProvQML's query evaluation pipeline.
Provenance capture via query rewriting. The top of Figure 2 shows ProvQML instruments the input ML query expressing Tom's logistic regression model in SQL (Example 1) into a rewritten query computing the optimized model's weights and their provenance. We will explain the details of and in Section 2 and Section 4, respectively. The formulation of ML queries based on prior work [48] involves mutual and non-linear recursion (highlighted on ), which makes direct provenance instrumentation prohibitively expensive. It increases the number of recursions as provenance capture for aggregate query requires to join with its input relations. The ProvQML's instrumentation consists of two phases: (i) detecting mutually recursive and non-linearly recursive relations on , then (ii) collapsing them into a single linear recursive relation whose recursive case expresses intermediate computations as a sequential chain of provenance subqueries using window functions. PreM ensures that aggregates in the rewritten recursive case can be pushed into the recursion without altering the fixpoint, and PCC ensures converges to the same result as . The rewritten query captures two types of provenance, as shown in the bottom half of Figure 2. Local provenance records each training instance's contribution to gradient computation at a specific model state by capturing the per-instance prediction , the per-instance gradient contribution , and the aggregated gradient Grad. For example, for the first customer Age = 46 annotated with , ProvQML computes provenance for the per-instance prediction using the model parameter from the previous iteration. At , refers to the initialized model parameter 0.01, which gives . It further computes the corresponding per-instance gradient contribution , which contributes to the aggregated gradient value of . Thus, at , the updated model parameter for Age becomes -0.4717. Global provenance preserves the sequence of model parameter updates across the fixpoint iterations by accumulating at each iteration as a set of in RDDs. The captured provenance enables Tom to reconstruct the full optimization trajectory and trace which training instances drove the weight of, e.g., Age = 15.4500, after 100 iterations.
Optimization for Provenance Capture. Capturing local and global provenance introduces two challenges, both of which are reflected in the optimized query plan shown in Figure 2. First, the window functions required for update of model's parameters involve sorting and shuffling across worker nodes at every iteration. ProvQML addresses this by broadcasting the small delta model relation to all workers, eliminating the join shuffle entirely, and by partitioning the input training data by instance identifier I once upfront. Since the prediction window function partitions on I, this upfront partitioning eliminates its reshuffle; only a single shuffle per iteration remains for the gradient window function, which partitions on C. Second, accumulating global provenance over k iterations incurs memory growth. ProvQML joins only with at each iteration based on the observation that tuples from earlier iterations yield no valid join results due to mismatched iteration keys. Furthermore, it evicts per-iteration RDDs once the accumulated
Nkechi J. Akinwale and Seokki Lee
global provenance subsumes the provenance from the previous iterations, keeping the memory usage bounded at per iteration.
Usability of Provenance. Provenance-aware recursive training pipelines provide a principled mechanism for exposing the dependency structure of iterative optimization. By materializing intermediate values such as per-instance predictions ( ) and per-tuple gradient contributions ( ) at each iteration j, the system makes explicit the lineage linking individual training instances to parameter updates. Instead of observing only the final weight vector, analysts like Tom, can reconstruct how specific instances contribute to the aggregated gradient and how these contributions propagate across recursive state transitions. This fine-grained provenance enables systematic identification of influential records and feature-level sensitivity as indicated in [3, 45] without re-executing the recursive query entirely (retraining the model). In regulated settings, the resulting provenance can constitute a formally defined mapping from input training instances to final model parameters, supporting auditability of the training process.
Beyond interpretability, embedding provenance within the recursive relation enables computational reuse and adaptive optimization. By persisting iteration indices , gradient aggregates, and their contributing instances, the system supports warm-start execution, allowing training to resume from a previously materialized iteration state without recomputing earlier steps. Furthermore, the availability of cross-iteration lineage enables convergence diagnostics based on the evolution of gradient magnitudes and directions. Such diagnostics can guide dynamic adjustment of hyperparameters (e.g., learning rate or sampling ratio) within the same declarative framework. By integrating provenance into the recursive query dataflow, the system reduces reliance on external monitoring while enabling selective retraining and incremental refinement grounded in explicit dependency analysis.
Contributions. We make the following contributions:
-
We introduce the ProvQML query language, which extends recursive aggregate SQL with support for subqueries and window functions within the recursive case, enabling provenance capture for a broad range of ML algorithms (Section 4).
-
We devise query rewriting techniques that capture local and global provenance during query evaluation (model training), with correctness guaranteed by PreM and PCC (Section 5).
-
We develop ProvQML, a recursive aggregate SQL engine on top of Apache Spark that executes the rewritten queries with optimizations that reduce shuffle overhead and bound memory growth during provenance capture (Section 6).
-
We evaluate ProvQML using 5 ML algorithms and 4 real-world datasets, demonstrating efficient provenance capture (Section 7).
The rest of the paper is organized as follows: Section 2 covers basics of recursive aggregate queries including PreM and PCC properties. Section 3 formalizes the problem, and Section 4 introduces ProvQML query language. Section 5 explains provenance computation and Section 6 discusses optimizations. We present experiments in Section 7, related work in Section 8, and conclusion in Section 9.
2.1 Expressing ML Algorithm as Queries
We revisit the formal semantics [48] that establish how ML models can be expressed declaratively as recursive aggregate queries over data represented in verticalized format. As data volume and feature dimensionality continue to grow, training datasets have become large, high-dimensional, and increasingly sparse. Verticalized data formats provide an efficient way to store such data, e.g., the popular LIBSVM benchmark [8]. To the best of our knowledge, verticalization is the standard
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
5
encoding adopted by prior work on declarative ML expressed as recursive queries [48], and it is the encoding that makes the ML query expressible as a single, dimension-independent recursive aggregate query. Formally, each training instance is transformed into tuples of the form , where denotes the feature dimensions and is the corresponding feature value. Features with value 0 are omitted. We use Trainv( ) to represent a verticalized training data where is the identifier of a training instance , denotes a feature of , is the value of for , and denotes the label (target) for in .
The recursive aggregate queries introduced by [48] over Trainv exhibit two types of recursion. Mutual recursion occurs when two or more recursive relations depend on each other, forming a cyclic dependency among relations. Non-linear recursion occurs when a single recursive step contains multiple recursive relations. Both mutual and non-linear recursion introduce additional processing overhead compared to linear recursion, which contains exactly one recursive relation, due to their more complex evaluation paths. [48] investigated mitigation of the computational overhead of these complex recursions. Table 1 shows various ML algorithms that differ in prediction, loss, and gradient functions. Note that the general ML query structure remains the same.
EXAMPLE 2 (EXAMPLE ML QUERY). Figure 3 shows an example SQL query that expresses batch gradient descent (BGD) for logistic regression (LR), equivalent to the Datalog version in [48]. The query defines three mutually recursive relations: Model (lines 1–6), Gradient (lines 7–10), and Predict (lines 11–14). The recursive relation Model(C, P, J) consists of three columns. J is the iteration counter, C denotes a feature dimension, and P is the model weight for each feature C. The base case (line 2) initializes the model parameters by selecting distinct features C from the verticalized training relation Trainv with an initial weight of 0.01 and iteration counter 0. The recursive case (lines 4–13) updates the model weight as m.P - lr * g.G / n, where lr is the learning rate and n is the number of training instances, by joining Model with Gradient on feature dimension C and iteration J. Predict (lines 11–14) joins Model with Trainv on C and computes the per-instance predicted value YP as sum of 1/(1+exp(-(m.P * t.V))) for each training instance I. Gradient (lines 7–10) joins Predict with Trainv on instance identifier I and computes the aggregated gradient G as sum of (p.YP - t.Y) * t.V for each feature C. The three relations are evaluated mutually recursively until convergence or J reaches the maximum iteration, and the final trained model's parameters are returned by the outer SELECT (line 15).
1 WITH RECURSIVE Model(C, P, J) AS 2 (SELECT DISTINCT C, 0.01, 0 FROM Trainv) 3 UNION 4 ((SELECT m.C, m.P - lr * g.G / n, m.J+1 5 FROM Model AS m JOIN Gradient AS g 6 WHERE m.C = g.C and m.J = g.J), 7 RECURSIVE Gradient(J, C, sum() AS G) AS 8 (SELECT p.J, t.C, (p.YP - t.Y) * t.V 9 FROM Trainv AS t JOIN Predict AS p 10 WHERE p.I = t.I), 11 RECURSIVE Predict (J, I, sum() AS YP) AS 12 (SELECT m.J, t.I, 1/(1+exp(-(m.P * t.V))) 13 FROM Trainv AS t JOIN Model AS m 14 WHERE t.C = m.C)) 15 SELECT * FROM Model
Fig. 3. An example query encoding BGD for LR
Nkechi J. Akinwale and Seokki Lee
Table 1. Query Configuration for Used ML Algorithms
| Query ML Algorithm | Predict function Loss function | Gradient | Regularizer | ||
|---|---|---|---|---|---|
| Linear regression | N/A | ||||
| Lasso regression | |||||
| Ridge regression | |||||
| Logistic regression | N/A | ||||
| SVM | |||||
*Note: YP is the predicted output from the model, P is the weight and V is the feature value. Y is the true label. is a hyperparameter that controls the regularizer weight.
2.2 PreM and PCC Properties
PreM. The Pre-Mappability (PreM) property [17, 50] provides formal conditions under which extrema aggregates, i.e., min and max, can be pushed into recursion while preserving the semantics of the equivalent aggregate-stratified program. Formally, given a relational algebra expression where is the vector of relations, and a constraint , is PreM to if
When the PreM property holds, the semi-naive fixpoint computation of the unstratified program produces the same results as the equivalent aggregate-stratified program, providing both a formal declarative semantics and a more efficient evaluation by eliminating the need to defer the aggregate to a post-recursion stratum. However, PreM applies only to extrema aggregates and is insufficient for aggregates such as sum, count, and avg.
PCC. To address the limitation of PreM for non-extrema aggregates, the Pre-Countable Cardinality (PCC) property [48] provides formal semantics for the use of sum, count, and avg in recursion. The PCC property holds when the cardinality of the delta relation at each iteration of the semi-naive fixpoint computation is nonzero, remains constant across all iterations, and can be pre-computed before the fixpoint computation begins. Under this condition, non-monotonic aggregates such as sum can be computed using only monotonic constructs, since the incremental computation of continuous count and sum is monotonic. Consequently, a recursive program satisfying PCC is equivalent to an aggregate-stratified program where the cardinality is pre-computed at a lower stratum, providing its formal declarative semantics. This condition is naturally satisfied by ML workloads such as gradient descent, where the number of training instances processed per iteration is fixed and known ahead of time.
2.3 Distributed Semi-Naive Evaluation
Distributed semi-naive evaluation (DSN) executes recursive queries using the semi-naive strategy in a distributed environment, with data partitioned across workers and intermediate results redistributed via shuffle operations [48]. Semi-naive evaluation relies on delta-based execution: at iteration j, only newly derived tuples are used to compute results for iteration , and the evaluation continues until a fixpoint is reached. This significantly reduces the size of intermediate results. Algorithm 1 describes the DSN evaluation procedure. It defines two auxiliary functions specifying the Map (lines 3–5) and Reduce (lines 6–10) stages. In the Map stage, the join between the base relation and the delta relation on the specified partition key is performed locally on each mapper, generating intermediate results allocated to reducers (lines 4–5). The function denotes any additional selection or projection operations required by the recursive program. In the
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
7
Algorithm 1 Distributed Semi-Naive Evaluation
1: Input: Base relation B, Partition key K 2: Output R: Recursive relation, : Recursive relation (Delta) 3: MapStage ( , B) 4: for each partition pair of ( , B) do 5: emit 6: ReduceStage ( , R) 7: for each partition pair of ( , R) do 8: 9: 10: emit D 11: Results of base case, 12: repeat 13: 14: mapOutput MapStage( , B) 15: ShuffleExchange(mapOutput, key = K) 16: ReduceStage( , R) 17: until 18: return R
Reduce stage, each reducer computes the new tuples for the current iteration as the set difference (line 8), updates the recursive relation for the next iteration via union (line 9), and emits (line 10). The main fixpoint loop begins at line 11, where is initialized to the results of the base case and is set to . At each iteration (line 13), the Map stage produces intermediate results (line 14), which are redistributed across reducers via a shuffle exchange on key (line 15). The Reduce stage then computes the new delta (line 16). The loop terminates when no new tuples are derived, i.e., (line 17), at which point the fully computed recursive relation is returned (line 18). ProvQML leverages DSN for its query evaluation.
2.4 Gradient Descent (GD) in ML
Training a model requires finding parameters that minimize the prediction error over the training dataset. Let denote a training dataset with tuples, where each tuple consists of a d-dimensional feature vector , and a corresponding target value . For classification tasks, the target variable (e.g., queries where in Table 1); for regression tasks, (e.g., queries where ). The process of training a model can be formalized as follows. Given a function that makes predictions, the goal is to find a set of parameters (i.e., model weights ) that minimizes the prediction error, as measured by a loss function : . is typically evaluated using gradient descent (GD), a first-order, gradient-based optimizer widely adopted in ML. Gradient represents the rate of change of the loss function with respect to the model parameters , while descent imply moving in the direction that reduces toward its minimum at each iteration . In this paper, we use batch gradient descent (BGD), a variant of GD widely used in relational engines. BGD computes precise gradients over the entire training dataset, updating at each iteration. As shown in Equation (1), BDG starts from an initial model parameter , with each update step controlled by the learning rate . The iterative
Nkechi J. Akinwale and Seokki Lee
process continues until a convergence or a termination condition j is met.
where is the gradient of the loss function and denotes the regularization. Table 1 captures the GD algorithms executed in the experiments section of this paper.
3 Problem Definition
We consider an ML query that encodes an ML algorithm over a verticalized training data T. A recursive relation M (such as Model in Figure 3) maintains the parameters with one tuple per feature dimension. The goal is to capture provenance that traces how training instances influence model parameter updates through per-instance predictions and gradient computations.
3.1 ML Query
An ML query is a recursive aggregate query characterized by two distinct types of recursions that interact through aggregations (see Section 2.1). operates on input training data T and the initial model parameters in M defined using T, e.g., base case in Figure 3. denotes the model state at iteration j.
DEFINITION 1 (ML QUERY). An ML query over an input data T is formally expressed as:
where is the parameter update operator, represents aggregations within the inner recursive queries, lfp is the least fixed point function.
The outer recursion computes the fixpoint of model weights, ensuring that each parameter update is derived strictly from the model parameters p of the previous state to produce the updated p for the current state . Within each outer iteration, the query invokes inner recursive relations, Predict and Gradient. Predict computes per-instance predictions by aggregating p for each instance, while Gradient evaluates error signals by aggregating residuals for each feature.
3.2 Provenance for ML
In the context of ML, provenance is not merely source tuples but a functional trace of how training data and model states interact through aggregations, enabling explainability and debugging for iterative learning. We use P to denote provenance and distinguish two types of provenance.
Local Provenance. Local provenance captures the dependency between a training instance and its contribution to gradient computation at a specific model state .
DEFINITION 2 (LOCAL PROVENANCE). For each training instance with feature value , we define as a tuple where
-
represents the per-instance prediction where is the model's prediction function, is the whole set of features, and is the model's parameter from the previous iteration (e.g., ) in Figure 3)
-
represents the per-instance gradient contribution where is the model's gradient function (e.g., )
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
9
- Grad = is the aggregated gradient over all instances sharing the same feature category c.
Formally, is defined as follows:
where A is the augmentation function that computes , , and Grad.
This provenance explains how each tuple in influenced the gradient at a given iteration and enables contribution analysis by quantifying how specific subsets of data adjust the model's weight. Global Provenance. Global provenance preserves the evolution of the model parameters across the sequence of fixpoint iterations. In the context of a fixpoint iteration , where is the recursive relation (e.g., Model), maintains the versioning of indexed by the iteration counter J.
DEFINITION 3 (GLOBAL PROVENANCE). The global provenance is the union of historical states of such that
where k is the convergence threshold or maximum iteration.
ensures that for any model parameter p at iteration j, there exists a total mapping back to the specific instance-level gradient from the previous iteration , which allows for the reconstruction of the optimization path.
We now formally define the problem addressed in this paper:
• Input: An ML query and input data T
• Output: Optimized model weights p while maintaining local and global provenance and , respectively
Our approach instruments into , which computes the optimized model parameters p over T and M while capturing both types of provenance on-the-fly. Although this instrumentation reduces query complexity by eliminating mutual and non-linear recursions, capturing remains computationally expensive because maintaining throughout the entire iteration can significantly increase intermediate result size. We explain how our proposed framework ProvQML generates the instrumented query in Section 5 and describe how it mitigates the computational overhead in Section 6.
3.3 Computational Challenges
In evaluating , each iteration computes a new model state by aggregating contributions from all training instances. A parameter update at iteration depends on all training instances in that iteration and the model state from iteration , which recursively depends on all prior iterations. Thus, the provenance of any final model parameter implicitly includes a transitive closure over all training instances across all iterations. Aggregates like sum collapse values across tuples into a scalar, obscuring individual instance contributions, while recursive computation discards intermediate parameter states unless explicitly materialized. Thus, computing fine-grained provenance incurs substantial overhead, with space complexity where is the iteration depth, bounded by the product of input data size and iteration count.
A naive instrumentation of would require an additional join for each recursive relation. Consider the query in Figure 3. After Predict computes the per-instance predicted value YP via sum(), a provenance relation PredProv must join Predict back with T and M on instance identifier
Nkechi J. Akinwale and Seokki Lee
WITH RECURSIVE VIEW1 (C, ColPredi, ColGradi, ColGrad, Aggp(), AggJ()) AS (SQL-expression-base) UNION (SELECT C, ColPredi, ColGradi, ColGrad, m(P,lr,Grad,n), J + 1 FROM (WITH VIEW2 AS (SQL-expression-recProv), (SQL-expression-predProv) (SQL-expression-gradProv))) SELECT * FROM VIEW1
Fig. 4. ProvQML query syntax
I and feature dimension C to compute the , collapsed by the aggregate. Similarly, after Gradient computes the aggregated gradient G for each feature C, a provenance relation GradProv must join back with PredProv on (C, J) to capture the per-instance gradient contributions and the aggregated Grad per feature. These additional joins must be evaluated within the mutually recursive structure of , which already requires multiple shuffle operations per iteration. Introducing PredProv and GradProv as further recursive relations compounds this overhead: each of the k iterations incurs additional shuffle operations for both relations, and the full recursive relations — not just their deltas — must be retained in memory to support the non-linear recursion, making the computational cost unmanageable. The complete naive instrumentation of is shown in ?? which captures an example rewritten query that can be generated by naively instrumenting from Figure 3.
4 The ProvQML Language
ProvQML query language extends RaSQL [17], a recursive aggregate query engine that runs on Apache Spark, which itself extends standard SQL, especially Common Table Expressions (CTEs) to support the use of basic aggregates (i.e., min, max, sum, count) in recursion. The RaSQL system addresses the limitation of Spark SQL's compiler, i.e., its lack of native support for aggregates in recursive queries, through a two-step compilation process: first recognizing recursive table references in the query to construct a recursive plan, then executing the plan iteratively via a fixpoint operator until convergence or the maximum iteration is reached [17]. RaSQL focuses solely on recursive aggregate queries for graph problems such as reachability and shortest paths, supporting neither ML tasks nor provenance computation. ProvQML further extends in three key ways that are necessary to efficiently capture provenance for ML queries: support (i) window functions to capture provenance during recursive query evaluation, (ii) subqueries within the recursive query, and (iii) for user-defined functions (UDFs), such as last(), for the recursive query.
While a previous work [48] addresses the ML limitation by demonstrating how ML workloads can be expressed as recursive aggregate queries in Datalog, but it does not support provenance computation. Furthermore, the query construct described therein (e.g., its SQL version in Figure 3) involves complex mutual and non-linear recursions with joins over multiple recursive relations, which would incur prohibitively high computational costs for provenance capture. ProvQML addresses these limitations through the aforementioned extensions.
Syntax. Figure 4 shows the ProvQML query syntax which begins with the WITH RECURSIVE construct, followed by the recursive view VIEW1 and its schema definition. The schema of VIEW1 consists of three groups of columns. First, C identifies the feature dimension. Second, , , and carry the per-instance provenance — the predicted value , the per-instance gradient contribution , and the aggregated gradient Grad (Definition 2) — computed from the subqueries within the recursive case and propagated through VIEW1 at each iteration j.
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
11
1 WITH RECURSIVE ModelProv(C, YP, GI, Grad, last() as P, max() as J) AS 2 (SELECT DISTINCT C, 0, 0, 0, 0.01, 0 FROM Trainv) 3 UNION 4 (SELECT C, YP, GI, Grad, P - lr * Grad / n, J + 1 5 FROM 6 (WITH recProv AS 7 (SELECT m.C, m.YP, m.GI, m.Grad, m.P, m.J, t.I, t.V, t.Y 8 FROM Trainv t JOIN ModelProv m USING (C)), 9 predProv AS 10 (SELECT , 11 1/(1+exp(-(sum(VP)) OVER (PARTITION BY J,I))) AS YP 12 FROM recProv) 13 SELECT *, (YP-Y)*V AS GI, 14 sum((YP-Y)*V) OVER (PARTITION BY J,C) AS Grad 15 FROM predProv)) 16 SELECT * FROM ModelProv
Fig. 5. Example ProvQML Query capturing provenance for Batch Gradient Descent (BGD) for Logistic Regression (LR)
Third, the aggregate functions and maintain the latest model weight P and track the current iteration counter J, respectively. ProvQML allows the use of a UDF to retain the most recent model weight at each iteration, eliminating the need for joins over multiple recursive relations to capture provenance. While the model's weights are typically expected to decrease as optimization progresses, their numeric values are not guaranteed to be monotonic, so supporting a UDF is necessary. The content of VIEW1 is defined by a union of two sub-queries: a base case (SQL-expression-base), whose FROM clause does not refer to any recursive relation and initializes the model, and a recursive case, whose FROM clause refers to a recursive relation. The recursive case computes the updated model weight through the model update function , where P is the current weight, 1r is the learning rate, Grad is the computed gradient, and n is the number of training instances, and increments the iteration counter , with the recursion terminating when J is reached. The recursive case is expressed as a sub-query containing a sequence of view definitions via a nested WITH clause. SQL-expression-recProv joins VIEW1 with the input training relation to pair each training tuple with its corresponding model weight for the current iteration, capturing the provenance of the model weights with respect to the training data. SQL-expression-predProv refers to SQL-expression-recProv and uses a window function to compute the predicted values along with their provenance. Similarly, SQL-expression-gradProv refers to SQL-expression-predProv and uses a window function to compute the gradients along with their provenance. This sequential view structure is a design choice in ProvQML, which avoids the complex mutual and non-linear recursions with multiple joins over recursive relations. This design significantly reduces the computational cost of provenance capture during recursive query evaluation. Furthermore, ProvQML adopts an implicit group-by rule for the outer recursive relation VIEW1 i.e., no explicit GROUP BY clause is required, as all non-aggregate columns are automatically treated as grouping columns.
Example ProvQML Query. Consider the example query shown in Figure 5, which captures provenance for Batch Gradient Descent (BGD) for Logistic Regression (LR). The query begins by defining the recursive view ModelProv whose schema includes the UDF last() to retain the most recent model weight at each iteration, and the monotonic aggregate function max() to track the current iteration counter. Three additional columns YP, GI, and Grad are introduced to carry the
Nkechi J. Akinwale and Seokki Lee
provenance computed through the recursive case: YP stores the per-instance predicted value , GI stores the per-instance gradient contribution , and Grad stores the aggregated gradient Grad per feature, as defined in Definition 2. The base case (line 2) initializes the model parameters by selecting distinct dimensions C from the verticalized training relation Trainv (see Section 2.1), with an initial weight of 0.01, iteration counter 0, and initialized values of 0 for YP, GI and Grad. The recursive case (lines 4–16) computes the updated model weight as , increments the iteration counter , and involves a sequence of sub-queries. recProv (lines 6–8) joins ModelProv with Trainv on column C, forming the provenance of the model weights with respect to the training data. predProv (lines 9–12) computes (Definition 2) using a window function partitioned by J and I, to evaluate the logistic regression prediction function and captures the relationship between each training instance and its corresponding prediction, maintaining the result in YP. The final SELECT in the recursive case (lines 13–15) computes as stored in GI (Definition 2) and Grad using a window function partitioned by J and C, capturing the provenance of how contributes to Grad, preserving in Grad.
Challenges of the Extension. These extensions are non-trivial within RaSQL's fixpoint framework. Window functions in the recursive case require the query compiler to correctly scope them to the intra-step relation recProv rather than the accumulated recursive relation, re-executing the window evaluation fresh at each fixpoint step. Their semantic correctness within recursion also requires explicit justification via the PCC property (Section 2.2), since standard SQL semantics for window functions do not account for fixpoint convergence. The nested subqueries require RaSQL's plan recognition pass must correctly classify each table reference in the recursive case as either an inter-step recursive dependency (e.g., ModelProv) or an intra-step non-recursive view (e.g., recProv, predProv, gradProv) resolved fresh at each iteration. Without this distinction, the compiler could incorrectly flag inner view references as recursive or fail to resolve them entirely, neither of which RaSQL's original pass handles. Finally, the UDF last() is necessary because model weights are non-monotonic and no standard aggregate captures the most recently computed value. Its correctness relies on the iteration counter J acting as a total order over fixpoint steps, ensuring the fixpoint operator selects the highest J tuple per feature dimension at convergence.
5 Query Rewriting Semantics
We first explain how ProvQML instruments an input ML query into a provenance capture query that computes local provenance and global provenance . In short, the instrumentation proceeds in two phases.
• Detection (Section 5.1): Given , ProvQML identifies the mutually recursive relations and non-linearly recursive relations in the query that must be instrumented.
• Rewriting (Section 5.2): Based on and the detection result, ProvQML rewrites each identified recursive relation into a semantically equivalent form using subqueries and window functions, and combines the rewritten relations into that captures and during recursive evaluation.
The semantic correctness of with respect to is proved in Section 5.3.
5.1 Detecting Recursive Relations
Given an ML query with recursive relations , where the primary recursive relation is defined by a base case and a recursive case , and each auxiliary recursive relation ( ) is defined solely by a recursive case (i.e., the child of the UNION operator that references ), mutual recursion and non-linear recursion can be identified by each : (i) is mutually recursive if references any other ( ), and (ii) non-linearly recursive if
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
13
Algorithm 2 DETECTRECURSIVERELATIONS
Input: ML query
Output: Mutual recursion , non-linear recursion
1: , , refs
2: , Extract recursive relations
3: for each do
4: Extract recursive case of
5: refs Scan for cross-references
6: if refs then
7: Record mutually recursive relations
8: if then
9: More than one recursive relations
10: return
contains more than one recursive relations such as in addition to . While a dependency graph over combined with strongly connected component detection [2, 44] would support a more general detection procedure applicable to arbitrary recursive queries [1, 46], the fixed syntactic structure of (Definition 1) makes such generality unnecessary as a single-pass scan over each suffices. Detecting both types of recursions is necessary because they determine how provenance is propagated in the subsequent rewriting step (Section 5.2). Note that the detection algorithm can be extended to support more complex ML algorithms, such as neural networks, by generalizing the inspection to account for additional base cases per recursive relation in and deeper recursive dependencies which we leave as future work.
Algorithm 2 shows the detection procedure. Given as input, it first extracts the set of recursive relations from the RECURSIVE blocks (line 2). It then iterates over each (line 3), extracting its recursive case (line 4) and scanning for cross-references to other relations in (line 5), i.e., any with . If at least one such cross-reference is found (refs ), all involved relations are recorded as mutually recursive (lines 6–7). If also appears in its own recursive case (line 8), it is additionally recorded as non-linearly recursive (line 9), since then contains more than one recursive relation. The procedure returns the pair upon completing the scan (line 10).
EXAMPLE 3. For the example query encoding BGD for LR in Figure 3, the procedure yields a single mutually recursive group and identifies as a non-linear recursive relation, since its recursive case includes Model, joining with Gradient.
The procedure requires a single pass over each recursive case , giving an overall complexity of where is the number of recursive relations in , and is the number of a recursive case in . In practice, both are small for ML queries, so the procedure adds negligible overhead.
5.2 Rewriting for Provenance Capture
Given and the detection result produced by Algorithm 2, the rewriting instruments into a provenance capture query . The key idea is to consolidate the mutually recursive relations in into a single linear recursive relation and to make the intermediate computations of explicit as subqueries with window functions within the recursive case. Thus, per-instance predictions and gradient contributions along with their provenance are materialized at each iteration . Rather than evaluating intermediate results (i.e., , , and Grad in Definition 2) across multiple mutually recursive relations, they are computed as a sequential
Nkechi J. Akinwale and Seokki Lee
Algorithm 3 REWRITEFORPROVENANCE
Input: , mutual recursion , non-linear recursion
Output:
1:
2: if then Step 1: Relation consolidation
3:
4: AUGMENTSchema( ) Add feature column C, provenance columns (e.g., , , ), and aggregates and to
5: for each do
6: CONVERTToSUBQUERY( , , ) Move into the recursive case of in
7: if then
8: Step 2: Identify Predict
9: recProv BUILDRECPROV( ) Rewrite Predict as recProv
10: predictProv BUILDPREDPROV(recProv) Evolve recProv into predictProv computing
11: Step 3: Identify Gradient
12: Grad BUILDGRAD( , predictProv) Build gradient subquery over predictProv computing and Grad
13: REPLACEJOINCLAUSE( , , ) Replace join clause of with the subquery chain
14: return
chain of subqueries within the recursive case of the single consolidated relation. For example, as shown in Figure 5 (lines 6–8), recProv joins T with the current model state , providing the instance-level lineage required for , while predictProv and the gradient computation apply window functions over recProv to compute , , and Grad without any further joins. This ensures that provenance is captured through a single join per iteration, avoiding the additional join overhead that would arise from instrumenting the original mutually recursive structure in . Since all ML algorithms considered in this paper (Table 1) share the same recursive structure of (Definition 1), with a recursive relation for prediction and another recursive relation for gradient computation, Algorithm 3 is sufficient to instrument all of them uniformly.
Recall that the semantic justification for this transformation relies on the PreM and PCC properties (Section 2.2). PreM ensures that the aggregates in the window functions in the rewritten recursive case can be pushed into the recursion while preserving the semantics of the equivalent aggregate-stratified program. PCC ensures that converges to the same fixpoint as , since the cardinality of the delta relation at each iteration remains constant and can be pre-computed, guaranteeing that the provenance subqueries do not alter the computed model parameters. Thus, PreM and PCC guarantee that the transformation is semantics-preserving with respect to both the output relation and .
Algorithm 3 formalizes the rewriting in three steps.
• Step 1: Relation consolidation (lines 2–6). When , the mutually recursive relations are collapsed into a single recursive relation. The head relation is designated as the primary recursive relation in , and it is defined with a feature column C, columns for maintaining provenance (e.g., , , and ), in addition to and which carry converged values across fixpoint iterations. For example, in Figure 5, YP, GI, and Grad maintains provenance computed through the recursive case, and last() retains the most recently computed model weight at each iteration j, while tracks the current iteration counter, reflecting ProvQML's vertical aggregate semantics in which aggregate functions are applied column-wise
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
15
Step 1 Output
1 WITH RECURSIVE ModelProv (C, YP, GI, Grad, last() as P, max() as J) AS 2 (SELECT DISTINCT C, 0, 0, 0, 0.01, 0 FROM Trainv) 3 UNION 4 (SELECT m.C, m.YP, m.GI, m.Grad, m.P - lr * g.G / n, m.J+1 5 FROM ModelProv AS m JOIN Rewritten in Step 3 6 (WITH Predict AS 7 (SELECT m.J, t.I, 1/(1+exp(-(sum(m.P * t.V)))) 8 AS YP 9 FROM Trainv AS t JOIN ModelProv AS m 10 WHERE t.C = m.C) Rewritten in Step 2 11 SELECT p.J, t.C, sum((p.YP - t.Y) * t.V) AS G 12 FROM Trainv AS t JOIN Predict AS p 13 WHERE p.I = t.I) AS g 14 WHERE m.C = g.C and m.J = g.J) Rewritten in Step 3 15 SELECT * FROM ModelProv
(WITH recProv AS (SELECT m.C, m.YP, m.GI, m.Grad, m.P, m.J, t.I, t.V, t.Y FROM Trainv t JOIN Model m USING (C)), predProv AS (SELECT , 1/(1+exp(-(sum(VP)) OVER (PARTITION BY J,I))) AS YP FROM recProv)
SELECT *, (YP-Y)*V AS GI, sum((YP-Y)*V) OVER(PARTITION BY J,C) AS Grad FROM predProv))
Fig. 6. Example of intermediate rewritten query for each step of Algorithm 3, transforming into
over the verticalized relation T to derive a single converged value per feature at each iteration. The remaining relations in MT are converted to non-recursive subqueries within the recursive case of via CONVERTToSUBQUERY.
• Step 2: Provenance subquery injection (lines 7–10). When , the Predict relation is retrieved from and processed in two stages. First, BUILDRECPROV rewrites it as a subquery recProv, preserving all tuple-level attributes required for . Second, BUILDPREDPROV evolves recProv into a second subquery predictProv by applying partitioned window functions to compute the per-instance prediction , replacing the original inline aggregate.
• Step 3: Gradient reconstruction (lines 11–13). The Gradient relation is retrieved from MT and rewritten as a subquery Grad via BUILDGRAD, defined over predictProv and computing and the aggregated Grad using partitioned window functions. This eliminates the recursive dependency on Gradient and completes the capture of within a single recursive case. Finally, REPLACEJOINCLAUSE substitutes the subquery chain into the join clause of , replacing the original mutually recursive join structure.
EXAMPLE 4. Applying Algorithm 3 to in Figure 3 produces the rewritten query in Figure 5, through three steps. The step-wise intermediate rewritten query is shown in Figure 6. In Step 1, ModelProv becomes the head relation (line 1 of Step 1 output), containing with last() as P, max() as J, and provenance columns YP, GI and Grad. The remaining mutually recursive relations Predict and Gradient in MT are converted to non-recursive relations and nested as a subquery within the recursive case of ModelProv. Step 2 rewrites Predict (lines 6–10 of the Step 1 output) into
Nkechi J. Akinwale and Seokki Lee
recProv and predProv, creating a single linear join and materializing the per-instance prediction . Step 3 reconstructs Gradient (lines 11–13). The join clause (lines 5 and 14) is removed from the recursive case of ModelProv and folded into the subquery, yielding (Figure 5), which captures at each iteration j. Since is materialized at every iteration j through the sequential subquery structure of , is accumulated as the union of these per-iteration snapshots across all fixpoint iterations, indexed by the iteration counter J.
5.3 Semantic Correctness
We now state the correctness of the rewritten ML query for computing optimized model weights while maintaining provenance.
THEOREM 1. (Correctness.) The rewritten , instrumented for input ML query , returns the optimized model weights defined by and the and .
PROOF. We proceed by induction on the iteration index , proving simultaneously (i) that the state computed by at step , restricted to the feature, weight, and iteration columns shared with 's schema, equals as computed by , and (ii) that the provenance materialized by at step – carried in the additional columns YP, GI, and Grad introduced by Algorithm 3 – equals at per Definition 2.
Base case (j = 0). Both (e.g., Figure 3, line 2) and (Figure 5, line 2) initialize the feature column, weight, and iteration counter identically, assigning C, 0.01, and 0, respectively. By Step 1 of Algorithm 3 (AUGMENTSchema), the base case of additionally initializes the provenance columns YP, GI, and Grad to 0, reflecting that no prediction or gradient computation has yet occurred at j = 0. Thus, although 's base relation carries a strictly larger schema than 's, is syntactically and semantically identical in both queries when restricted to the shared columns (C, P, J). AUGMENTSchema extends the base case with trivially initialized provenance columns but does not alter the values or semantics of the original feature, weight, and iteration columns. No provenance is claimed at j = 0 since no gradient step has yet been taken, so (ii) holds. Having established this schema correspondence, for the remainder of the proof we write for 's state at step j to mean its projection onto (C, P, J), suppressing the additional provenance columns except where part (ii) is directly concerned.
Inductive hypothesis. Assume that at step , computed by equals computed by , and that at step (if ) was correctly captured by .
Inductive step . We show the recursive case of (e.g., Figure 3, lines 4–16) computes the same as the recursive case of (e.g., Figure 3, lines 4–14), and captures at correctly.
(1) Join equivalence. recProv (Figure 3, lines 6–8) computes exactly , the join consumed by Predict in (Definition 1). By Step 1 of Algorithm 3, ModelProv is declared with YP, GI, Grad, AggP() = last(), AggJ() = max() (Figure 3, line 1); under ProvQML's aggregate-in-recursion semantics (Section 2.1), any reference to ModelProv— including within its own recursive case — is exposed as a single collapsed tuple per feature C, obtained by applying these aggregates over all tuples derived for C so far (a logical-view guarantee independent of physical retention; see Section 6.2). Since J is a total order over fixpoint steps and each C is updated once per iteration (Section 4), max() and last() jointly identify the unique tuple from iteration j - 1, which by the inductive hypothesis is . The join with Trainv thus computes , matching in Definition 1.
(2) Prediction equivalence. predProv computes YP (e.g., Figure 3, lines 10–12). A window aggregate partitions its input into equivalence classes under k and computes over each class independently, differing from the corresponding GROUP BY k aggregate only in that
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
17
the result is broadcast back to every row of the class rather than collapsed to one row per class; since the same multiset of values within each class is aggregated either way, the two produce identical scalars. Applying this to the windowed sum over recProv shows it returns, for each tuple, the identical scalar that the sum()-annotated Predict relation of would compute when grouped by over the same join input. Thus, the per-instance prediction (Definition 2) computed by equals the one implicitly computed inside 's Predict relation.
(3) Gradient equivalence. The final SELECT of the recursive case (e.g., Figure 3, lines 10–12). A window aggregate computes GI per tuple and Grad By step 2, YP here equals 's prediction, so GI equals of Definition 2 exactly as Gradient's inner select expression, e.g., in mlquery (Figure 3, line 8). By the same window/group-by equivalence used in step 2, the windowed sum over equals the sum()-annotated aggregate of Gradient in grouped by . Thus, Grad computed by equals computed by Gradient (Predict ) in mlquery.
(4) Weight update equivalence. Both queries update the weight via the identical arithmetic expression P - lr * Grad / n (resp. m.P - lr * g.G / n) and increment J+1; since the Grad/G operands were shown equal in step 3, and since recProv already carries forward the correct m.P (step 1), the updated weight computed by equals as computed by 's outer recursive ModelProv relation ( in Definition 1).
(5) Fixpoint-level validity of the transformation. Steps 1–4 above show per-step value equivalence; it remains to argue this equivalence is preserved under recursion, i.e., that iterating the rewritten recursive case yields the same least fixed point as iterating the original mutually recursive one. This is exactly what PreM and PCC guarantee (Section 2.2): PreM ensures the extrema aggregates , used to consolidate Model, Predict, Gradient into a single relation can be pushed inside the recursion without altering the fixpoint relative to the equivalent aggregate-stratified program; PCC ensures the non-extrema sum aggregates used in predProv/Grad are similarly safe to push inside the recursion because the cardinality of the delta relation (one tuple per feature C) is constant across iterations and pre-computable ahead of the fixpoint computation – a condition satisfied by construction for the batch-gradient ML workloads of Table 1, where the instance count n and feature count are fixed. Together, PreM and PCC guarantee that the sequence of states produced by 's single linear recursion coincides, at every j, with the sequence produced by 's mutual/non-linear recursion, and that both reach the same fixpoint (or terminate at the same maximum iteration k).
By steps 1–5 above and the inductive hypothesis, the model weights in computed by equals the model weights in computed by , establishing (i) for all .
(ii) Provenance soundness and completeness at step . We now show the tuple materialized by for each matches Definition 2 exactly, with no omission or duplication.
- Soundness (no spurious tuples). recProv, predProv, and the final gradient subquery are all non-recursive subqueries defined purely in terms of ModelProv (already shown correct by (i)) and Trainv; they introduce no new base tuples and no join beyond (step 1 above). itself does not expose or materialize this dependency. Provenance capture is precisely the capability adds. What step 1 and the argument above establish is only that the values materializes as provenance ( , , ) are exactly the intermediate values 's Predict and Gradient relations already compute internally en route to the final weights.
Nkechi J. Akinwale and Seokki Lee

Fig. 7. Optimized query plan for , illustrating broadcast of , upfront partitioning of T by l, and the single Shuffle on C per iteration.
-
Completeness (no missing tuples) Since ModelProv carries exactly one live tuple per feature C at each j and the join with Trainv is on C, every with a matching feature C contributes exactly one row to recProv; since every training instance has a feature value for every relevant C by construction of the verticalized encoding (Section 2.1), at each j, so every is represented matching Definition 2's requirement that be defined for every .
-
Value correctness By steps 2–3 above, the materialized , , and Grad columns are exactly the values , , and required by Definition 2's augmentation function .
Thus, at step , as materialized by , equals of Definition 2 exactly.
Global provenance. By Definition 3, . Since (ii) shows materializes correctly and completely at every (via the sequential subquery chain re-executed fresh at each fixpoint step, as required by the “Challenges of the Extension” discussion in Section 4), and Section 6.2 establishes that the external accumulation of these per-iteration snapshots into RDDs is lossless (each snapshot is retained, indexed by , until subsumed by the accumulated union – eviction occurs only after subsumption), the accumulated result equals exactly, matching Definition 3.
Conclusion. By induction, (i) holds for all , so returns the same optimized model weights as ; by (ii) and the global provenance argument, additionally computes at every iteration and over all iterations exactly as defined. Thus is both semantics-preserving and provenance-complete with respect to and .
6 Optimization
Although the ProvQML’s instrumentation algorithm (Section 5) eliminates mutual and non-linear recursions, capturing and during recursive evaluation introduces two distinct computational challenges. First, computing at each iteration j requires evaluating window functions over the relation recProv, which requires sorting and shuffling data that can dominate execution time.
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
19
Second, maintaining across all iterations requires persisting at every , which causes intermediate result sizes to grow as where is the maximum number of iterations.
6.1 Optimizing Local Provenance Capture
Evaluating to capture relies on window functions over the relation recProv to compute and Grad (e.g., Figure 5). In a distributed setting, window functions require data to be partitioned by a specific key before aggregation, which triggers a shuffle operation to redistribute tuples across worker nodes. Specifically, computing requires partitioning by (J, I) and computing Grad requires partitioning by (J, C). If these shuffles are performed naively at every iteration j, the overhead accumulates linearly with the number of iterations, significantly degrading the performance.
We address this with two complementary techniques. First, since is much smaller than (it contains one tuple per feature dimension, while contains one tuple per feature per training instance), we broadcast to all worker nodes at each iteration. This allows recProv to be formed via a local join on each partition of without any shuffle of the training data. Second, we partition by the instance identifier I once at the beginning of query evaluation and reuse this partition throughout training. Since recProv inherits the defined partition, it is already co-partitioned with the prediction window function (e.g., OVER (PARTITION BY J, I) in Figure 5), eliminating its reshuffle. Note that since J is uniform within each recursive step, the effective partitioning key is driven by I, making the upfront partition on by I sufficient. The gradient window function (e.g., OVER (PARTITION BY J, C) in the figure) requires a single reshuffle of recProv from I to C at each iteration j, which is unavoidable. Partitioning by C instead would introduce two reshuffles per iteration, one for predictProv from C to I, and another back to C for the gradient computation. Thus, partitioning by I minimizes total shuffle overhead to exactly one reshuffle per iteration. Figure 7 shows the resulting optimized query plan. (Trainv partitioned by I) and (ModelProv broadcasted) form recProv via a local join with no shuffle. The single Shuffle [C] between predictProv and Grad (e.g., lines 14–17 in Figure 5) is the only inter-node in the plan redistributing data required per iteration. Furthermore, since the size and structure of recProv for evaluation at each iteration remain fixed at tuples across all iterations (Section 6.2), the sorted order within each partition produced by the gradient reshuffle can be cached and reused at every subsequent j, reducing the sort cost within a partition.
This optimization is valid for the ML algorithms in Table 1 because the join key between T and is the feature dimension C, and the aggregation keys for and Grad are I and C, regardless of the specific predict function f or gradient function g. Furthermore, since T is read-only throughout training, its partitions remain valid across all iterations, making upfront partitioning a sound and stable optimization. This mirrors the replica mechanism of [48], which similarly avoids repeated shuffles of the base relation by co-partitioning it with the recursive relation on the required join keys. Note that this optimization extends to any ML algorithm whose training loop joins a fixed base relation with a small delta model relation on a stable key and computes per-instance and per-feature aggregations on fixed partition keys. Algorithms with additional aggregation levels or multiple join keys would require a corresponding extension of the partitioning strategy.
6.2 Optimizing Global Provenance Capture
is defined as the union of across all fixpoint iterations (Definition 3). Since at each iteration has size , maintaining naively requires space. For large training datasets and number of iterations, the intermediate result can far exceed the size of the final model output, placing significant memory and I/O overhead. A further overhead arises from the join in recProv. Without careful management, the join between and at each iteration could
Nkechi J. Akinwale and Seokki Lee
include model states from prior iterations that are still resident in memory, producing stale or redundant provenance that inflates unnecessarily.
To address this issue, we adopt a strategy analogous to the delta-based optimization of [48] through DSN (Section 2.3). At each iteration , only the delta relation , i.e., the model parameters updated in the most recent fixpoint step, is used as the input to the join in recProv. Consequently, recProv at each joins exclusively with , producing exactly tuples with no contribution from the previous model states. This is correct because the join key between and includes the iteration counter , so tuples from earlier iterations carry mismatched values and would produce no valid join results, analogous to the observation in [48]. To maintain , the captured at each iteration is accumulated as a chain of RDDs, preserving the full optimization trajectory across all fixpoint iterations. To bound memory usage, the RDD from iteration is unpersisted at the end of each fixpoint step once its content is subsumed by the accumulated , while remaining accessible via Spark's DAG lineage on demand. At any point during the recursion evaluation, only the cached and the snapshot from the latest iteration are physically resident in memory which keeps the memory usage bounded at per iteration. Including older model states would produce no additional tuples, while retaining them in memory would incur unnecessary overhead. The incremental accumulation of as a union of per-iteration snapshots is similarly justified. Since can be queried post-hoc for explanation or debugging rather than consumed during training, evicting RDDs after each fixpoint step introduces no correctness concern, as the accumulated already subsumes all prior snapshots by Definition 3.
7 Experiments
We start by describing our experimental setup in Section 7.1 followed by an end-to-end performance evaluation in Section 7.2. We then investigate the impact of several performance factors in Section 7.3, and measure provenance capture overhead by comparing with Radlog [48] that evaluates the ML query in Section 7.4. Finally, in Section 7.5, we provide a cost estimation for computing explanations like feature importance.
7.1 Experimental Setup
Environment. All queries were executed on a cluster with 7 worker nodes. Each node has 2 x 3.3Ghz Intel Xeon Gold 6234 CPUs (16 cores) and 192 GB memory. The cluster hosts 35 executors of 32GB main memory and 4 CPU cores each.
Datasets. We conduct experiments on four real-world datasets: Income [11], BikeSharing [12], SpamBase [19] and WebSpam [47]. Income is a widely used benchmark dataset with binary labels. BikeSharing records the number of bikes rented over a given time period based on weather and seasonal information, SpamBase labels emails as spam or non-spam, while WebSpam, a LIBSVM [8] dataset, distinguishes between legitimate web pages and spam. The datasets used in this experiment are summarized in Table 2 where #Tuple means the number of training instances, while #Feature means the number of dimensions in the dataset. Each data is verticalized in the form of explained in Section 2.1.
Queries. The ML query sets include linear, lasso, ridge, and logistic regression models plus SVM denoted as queries through in Table 1. The table provides an overview of the query configurations used for our experiments. Across all five queries, the ML query structure differs in the predict and gradient functions. For experiments with the BikeSharing dataset we use queries , , and that express regression tasks and for Income, SpamBase and WebSpam, we use and that encode classification tasks.
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
21
Table 2. Experiment Dataset Statistics
| A. Verticalized Dataset | B. Original Dataset | |||
|---|---|---|---|---|
| Dataset | #Tuple | #Feature | #Tuple | #Feature |
| Income | 17M | 10 | 1.7M | 10 |
| BikeSharing | 226K | 13 | 17K | 13 |
| SpamBase | 262K | 57 | 4.6K | 57 |
| WebSpam | 29M | 138 | 350K | 138 |

Varying features
Query: Q4
Varying features
Varying features
Fig. 8. Runtime for varying number of features

Query: Q4
Query: Q5
Data Size
Query: Q4
Query: Q5
Data Size
Fig. 9. Runtime for varying input data sizes, to

Fig. 10. End-to-end execution time for ProvQML queries with regression workload on BikeSharing and classification workload on SpamBase
Parameters and Metrics. In this experiment, we focus on the query execution time as the correctness of the optimized weights was validated by comparing them with standard implementations in scikit-learn. Preprocessing time for data verticalization is excluded. Learning rate, lr, is set to 0.01, j is set to 100 maximally, and n depends on the number of tuples in each dataset (Table 2).
7.2 End-to-End Performance
We evaluate the performance of the queries over dataset sizes ranging from to tuples. Figure 10 shows end-to-end execution time across all queries. Notably, runtime increases consistently sublinearly with dataset size. Regression queries show closely similar performance, which indicates that regularization has minimal impact. A similar pattern holds for classification
Nkechi J. Akinwale and Seokki Lee
Table 3. Feature-Subset Data Statistics
| BikeSharing | SpamBase | Income | |||
|---|---|---|---|---|---|
| #Feature | #Tuple | #Feature | #Tuple | #Feature | #Tuple |
| 3 | ~52K | 12 | ~55K | 3 | ~5M |
| 6 | ~104K | 21 | ~97K | 6 | ~10M |
| 9 | ~156K | 33 | ~152K | 9 | ~15M |
| 12 | ~209K | 45 | ~207K | 10 | ~17M |
| 13 | ~226K | 51 | ~235K | - | - |
| - | - | 57 | ~262K | - | - |
queries . Overall, the results show that ProvQML's provenance capture queries for various ML models do not introduce disproportionate overhead as data scales.
7.3 Performance Impacting Factors
To better understand the behavior observed in Section 7.2, we investigate the runtime of each ProvQML query w.r.t. feature dimensionality, dataset size, the number of iterations j, the number of worker nodes, and the impact of shuffle optimization. Note that while provenance capture over smaller datasets such as BikeSharing and SpamBase fit within a single machine's capacity, the single-machine experiments on Income (17M tuples) and WebSpam (29M tuples) did not complete due to out-of-memory, confirming that distributed execution is necessary at this scale. The following experiments are therefore conducted in the distributed environment described in Section 7.1.
Varying Number of Features. We evaluate the impact of varying number of features on ProvQML query runtime. The number of features is varied for the BikeSharing dataset , SpamBase , and Income , while . The corresponding dataset for each is created by selecting the corresponding subset of the verticalized training data. Table 3 summarizes the data size for each feature subset across the datasets. Figure 8 shows the result. The runtime increases as the number of features increases, and this holds across all queries. This is because higher dimensionality increases the size of the verticalized data, and thus, the size of provenance. Consequently, the cost of computing per-instance predictions and gradients grows. For smaller feature sets, runtime remains relatively stable within each dataset, as lower dimensionality reduces shuffle and node communication overhead. In general, the runtime over Income data is higher than the one over BikeSharing. For Income, runtime at , is nearly twice that at , whereas for BikeSharing, the increase from to is only a few seconds. This difference reflects the varying data scale per feature, as Income at has 5M tuples and has 15M tuples, compared to 52K and 156K tuples for BikeSharing.
Varying Dataset Size. Next, we vary input data size from 25% (0.25) to 100% (1.0) of the complete dataset, proportionally sampling training instances across all features to preserve the feature distribution at each scale. The number of iterations is fixed at 100. Figure 9 shows the results. Runtime increases with data size across all queries and datasets since larger inputs increase both the shuffle volume during recursive evaluation and the amount of provenance tracked per iteration. For the smaller datasets such as BikeSharing and SpamBase, runtime grows sub-linearly while, for the larger dataset like Income, runtime scales roughly linearly. This behavior reflects the increased cost of scanning larger relations and aggregating more tuples per iteration. Overall, the results demonstrate that ProvQML efficiently leverages data partitioning and parallelism to keep provenance capture tractable at scale.
Varying Number of Iterations. We vary the number of iterations j from 5 to 100 and measure runtime for the queries , , and . Figure 11 shows the results. Runtime increases with j across all queries and datasets since each iteration adds an additional cost of recursive computation and
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
23
Query: Q1
Query: Q3

Number of Iterations
Query: Q4
Query: Q4
Number of Iterations
Number of Iterations
Fig. 11. Runtime varying the number of iterations
provenance tracking. The runtime is sub-linear, which reflects the fixed cost per-iteration of joining T with and the amortized effect of upfront partitioning.
Impact of Large Number of Features. We conducted a stress test for ProvQML using and WebSpam dataset which has the largest number of features. The runtime measured by varying the number of iterations and dataset size is shown in Figure 12. ProvQML successfully executes the query with j = 100 over 7M, but the maximum number of iterations that can be completed decreases as dataset size grows, reflecting the increased memory pressure at larger scales. This is also visible in the result of varying data size. Only runtime over 25% data reaches j = 100, while larger dataset sizes do not complete the full 100 iterations.
Impact of Number of Workers. This experiment evaluates the impact of varying the number of worker nodes from 2 to 7 using on the Income dataset. Figure 13 reports the measured runtimes for varying numbers of features (left) and varying data sizes (right). The result on the left confirms that fewer worker nodes (e.g., 2~3) can process smaller workloads (~6 features), but fail to complete larger workloads (~10 features) due to insufficient memory capacity. A similar trend is observed in the result on the right. Smaller data sizes (~8M tuples equivalent to 50% of the dataset) are successfully processed with fewer nodes, while larger data sizes (over 75% of the dataset) require more worker nodes to complete successfully.
Impact of Shuffle Optimization. This experiment evaluates the impact of reduced shuffle optimization of ProvQML using and on the BikeSharing and SpamBase datasets respectively. Figure 14 shows the measured runtime with and without the shuffle optimization, for varying numbers of features (left) and data sizes (right). Overall, the result shows that execution without the shuffle optimization incurs higher runtime, with an overhead of up to compared to the optimized execution.
7.4 Evaluating Provenance Overhead
We measure the provenance computation overhead by comparing the runtime of ProvQML with the runtime of Radlog [48]. Radlog is a recursive aggregate Datalog query engine for ML algorithms built on top of Apache Spark and computes the optimized model's parameters (executing the Datalog query equivalent to the SQL in Figure 3). As demonstrated in [48], the system achieves the best end-to-end execution time for the ML models in Table 1 compared to MLlib [33] and
Nkechi J. Akinwale and Seokki Lee

Fig. 12. Runtime for large number of features

Fig. 13. Runtime for varying number of worker nodes

With Shuffle Without Shuffle
Query: Q4
Query: Q4

Fig. 14. Runtime for impact of shuffle optimization
SystemML [13]. Thus, we only compare with it. As Radlog does not capture provenance for , we take Radlog as a baseline to measure the overhead of capturing provenance. Due to issues in configuring Radlog in our cluster (Section 7.1) (lack of resources to resolve them), where all other experiments were conducted, this evaluation was instead performed on a machine with 2.9 GHz quad-core Intel CPU and 16 GB memory. Figure 15 shows the runtime of (linear regression) on
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
25
Query: Q1

Varying Features
Query: Q1

Data Size
| f= | 3 | 6 | 9 | 12 | 13 |
|---|---|---|---|---|---|
| ProvQML | 52K | 104K | 156K | 209K | 226K |
| ProvQML | 5.2M | 10.4M | 15.6M | 20.9M | 22.6M |
| Radlog | 3 | 6 | 9 | 12 | 13 |
| 0.25 | 0.50 | 0.75 | 1.0 | |
|---|---|---|---|---|
| ProvQML | 56K | 113K | 169K | 226K |
| ProvQML | 5.6M | 11.3M | 16.9M | 22.6M |
| Radlog | 13 | 13 | 13 | 13 |
Query: Q4

Varying Features
Query: Q4

Data Size
| f= | 3 | 12 | 21 | 33 | 45 | 51 | 57 |
|---|---|---|---|---|---|---|---|
| ProvQML | 14K | 55K | 97K | 152K | 207K | 235K | 262K |
| ProvQML | 1.4M | 5.5M | 9.7M | 15.2M | 20.7M | 23.5M | 26.2M |
| Radlog | 3 | 12 | 21 | 33 | 45 | 51 | 57 |
| 0.25 | 0.50 | 0.75 | 1.0 | |
|---|---|---|---|---|
| ProvQML | 66K | 131K | 197K | 262K |
| ProvQML | 6.6M | 13.1M | 19.7M | 26.2M |
| Radlog | 57 | 57 | 57 | 57 |
Fig. 15. Overhead of provenance for and across varying number of features and dataset sizes
the BikeSharing dataset and (logistic regression) on the SpamBase dataset for both varying the number of features, for and for , and dataset sizes (25% - 100%). Provenance introduces a consistent considerable overhead. For varying , the provenance capture overhead is at most slower than evaluating the model weights alone, occurring at the full dataset with where ProvQML took 272.80 seconds compared to 54 seconds for Radlog. A similar trend is observed when varying the dataset size, where the provenance overhead reaches . The same trend holds for . The provenance capture overhead observed aligns with overheads reported in the data provenance literature for comparably expressive query classes [10, 34]. The tables shown in Figure 15 present the result size of Radlog and the size of provenance captured by ProvQML. The size of local provenance is bounded by , because each output tuple in (the model parameter per feature dimension at th iteration) is mapped to each tuple in (a tuple per feature per training instance). Thus, the size of global provenance across iterations. In contrast, the output size of is , containing the optimized model parameters. For ProvQML the reported size corresponds to for a single iteration, while the overall provenance size as the evaluation is conducted with 100 iterations. For example, the provenance size for on the BikeSharing dataset for is tuples.
Nkechi J. Akinwale and Seokki Lee

Fig. 16. Runtime for evaluating all possible models
7.5 Discussion
One of the widely used methods for computing model explanation is marginal feature contribution, formalized by Shapley value (SV) [41]. SV attributes the contribution of each feature to a model output as the weighted average of its marginal contributions across all possible feature coalitions. The computation introduces substantial overhead as SV requires an exhaustive evaluation of all possible feature coalitions, where each coalition is a model. Despite this expensive cost, we observe the feasibility of computing such explanations by extending ProvQML based on the prior work [3, 45]. To test, we encoded all possible coalitions of features as data, which we refer to as explanation data. For that, we augmented the input dataset with an additional attribute which encodes feature coalitions. This schema design provides two benefits: (i) it provides support for evaluations over all feature coalitions without requiring changes to the ML query and (ii) it shifts complexity that would otherwise arise at the query level to the data level. We implemented this extension in ProvQML by augmenting the recursive relation schema with an additional coalition identifier column, e.g., extending the Model relation in Figure 5 to Model(C, CF, YP, GI, Grad, last() AS P, max() AS J), where C and CF partition the training data by feature coalition and allow the existing query structure to evaluate all coalitions in a single recursive execution.
Interestingly, our investigation extracted that the computational overhead may not be completely unmanageable. We run our experiments on the BikeSharing and SpamBase datasets using queries and , varying the number of features. Note that, with the naive extension, the evaluation could be conducted for the small number of features. The result is shown in Figure 16. The feature size and the corresponding data size are shown on the x-axis. The experimental results highlight several observations. First, runtime scales roughly linearly with the number of feature coalitions. Secondly, the per-iteration cost increases more drastically as the intermediate result size is larger than the one for a single model. Note that the runtime of this evaluation includes provenance capture time for every feature coalition. A promising solution is relying on sampling that generates a representative subset of explanation data to compute explanations similar to the existing approximation-based methods in ML explanations [36]. Without approximation, we envision that the computational overhead may be further reduced by leveraging the captured provenance across coalitions to avoid redundant recomputation, and by pruning coalitions that are unlikely to contribute significantly based on properties of the model or gradient structure. This broadly captured information will enable new types of explanations, e.g., quantifying the influence of a group of training instances and a subset of features on the model's parameters. Further investigation of such explanations is an interesting avenue for future work.
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
27
8 Related Work
Recursive Query Processing. Processing recursive queries in SQL [31, 39] and Datalog [29, 42, 48] has been extensively explored. Support for aggregates within recursive queries was initially formalized in [23]. Subsequent work showed that aggregates in recursion [31, 37, 42, 48] increase the expressive power of recursive queries and provide formal declarative semantics for correctness, enabling ML workloads to be expressed in familiar declarative languages. However, none of these systems support provenance, which provides the information needed to explain ML model behavior. Database Provenance. Provenance for database queries has received significant research attention over the past decade [7, 14, 16, 20–22, 26, 27], including provenance for aggregate queries [4, 5]. Provenance for recursive queries is understudied [10]. Outside the database context, [35] proposes a JSON-based library to capture provenance in ML systems, [37] tracks provenance for training runs and predictions, and [38] captures provenance for ML tasks integrated with Git. However, these systems operate outside the database setting and require additional tools. In contrast, ProvQML is a SQL-based system that leverages query rewriting to capture fine-grained provenance for ML workloads expressed as recursive aggregate SQL queries, without requiring additional integration. In-Database Machine Learning. In-database machine learning integrates ML pipelines directly within database systems enabling tasks such as data preprocessing, model training, and validation. Systems such as MADlib [18], BigQuery ML [15], and Umbra [39] support in-database ML via SQL interfaces, but implement ML algorithms as user-defined functions or system-internal extensions rather than as recursive aggregate SQL queries. As a result, they neither expose the recursive structure of the ML computation nor support provenance capture during training.
Distributed Machine Learning Systems. Apache Spark [49] has gained significant attention as a general platform for large-scale analytics and machine learning. SystemML [13] supports ML workloads on Spark using R or Python, while BigDatalog [42] and Radlog [48] support declarative large-scale iterative computations on Spark using Datalog.
9 Conclusions
In this paper, we presented ProvQML, a provenance-aware recursive aggregate SQL engine built on Apache Spark that efficiently captures fine-grained provenance while evaluating ML algorithms as recursive aggregate queries. Our approach instruments complex ML queries into queries with standard linear recursion, using window functions and a chain of provenance subqueries. We experimentally demonstrate that ProvQML efficiently captures provenance for a range of ML models across widely used benchmark datasets. Interesting directions for future work include extending ProvQML to (i) identify the influence of groups of instances, e.g., subpopulations sharing a feature value or label, by applying provenance summarization techniques [4, 27, 28] over ; (ii) support deeper recursive dependencies in more complex ML algorithms such as neural networks, and (iii) compute new types of explanations using captured provenance and explanation data to quantify marginal feature contributions.
References
[1] Serge Abiteboul, Richard Hull, and Victor Vianu. 1995. Foundations of Databases. Addison-Wesley.
[2] Alfred V. Aho, John E. Hopcroft, and Jeffrey D. Ullman. 1983. Data Structures and Algorithms. Addison-Wesley.
[3] Nkechi J Akinwale and Seokki Lee. 2025. Efficient Computation of ML Explanations using Provenance. In Proceedings of the ProvenanceWeek 2025. 81–82.
[4] Omar AlOmeir, Eugenie Y Lai, Mostafa Milani, and Rachel Pottinger. 2023. Summarizing provenance of aggregate query results in relational databases. IEEE Transactions on Knowledge and Data Engineering 35, 10 (2023), 10695–10709.
[5] Y. Amsterdamer, D. Deutch, and V. Tannen. 2011. Provenance for aggregate queries. In PODS. ACM, 153–164.
[6] Bahareh Sadat Arab, Su Feng, Boris Glavic, Seokki Lee, Xing Niu, and Qitian Zeng. 2018. GProM-a swiss army knife for your provenance needs. IEEE Data Eng. (2018).
Nkechi J. Akinwale and Seokki Lee
[7] Peter Buneman, Sanjeev Khanna, and Wang-Chiew Tan. 2001. Why and Where: A Characterization of Data Provenance. In ICDT. Springer, 316–330.
[8] Chih-Chung Chang and Chih-Jen Lin. 2011. LIBSVM: A library for support vector machines. ACM transactions on intelligent systems and technology (TIST) 2, 3 (2011), 1–27.
[9] Ralf Diestelkämper, Seokki Lee, Melanie Herschel, and Boris Glavic. 2021. To Not Miss the Forest for the Trees - A Holistic Approach for Explaining Missing Answers over Nested Data. In SIGMOD.
[10] Benjamin Dietrich, Tobias Müller, and Torsten Grust. 2022. Data provenance for recursive SQL queries. In Proceedings of the 14th International Workshop on the Theory and Practice of Provenance. 1–8.
[11] Frances Ding, Moritz Hardt, John Miller, and Ludwig Schmidt. 2021. Retiring adult: New datasets for fair machine learning. Advances in neural information processing systems 34 (2021), 6478–6490.
[12] Hadi Fanaee-T. 2013. Bike Sharing. UCI Machine Learning Repository. DOI: https://doi.org/10.24432/C5W894.
[13] Amol Ghoting, Rajasekar Krishnamurthy, Edwin Pednault, Berthold Reinwald, Vikas Sindhwani, Shirish Tatikonda, Yuanyuan Tian, and Shivakumar Vaithyanathan. 2011. SystemML: Declarative machine learning on MapReduce. In 2011 IEEE 27th International conference on data engineering. IEEE, 231–242.
[14] Boris Glavic and Gustavo Alonso. 2009. The perm provenance management system in action. In Proceedings of the 2009 ACM SIGMOD International Conference on Management of data. 1055–1058.
[15] Google Cloud. 2024. BigQuery ML: Machine Learning in BigQuery using SQL. https://cloud.google.com/bigquery/docs/bqml-introduction.
[16] T.J. Green, G. Karvounarakis, and V. Tannen. 2007. Provenance semirings. In PODS. 31–40.
[17] Jiaqi Gu, Yugo H Watanabe, William A Mazza, Alexander Shkapsky, Mohan Yang, Ling Ding, and Carlo Zaniolo. 2019. Rasql: Greater power and performance for big data analytics with recursive-aggregate-sql on spark. In SIGMOD. 467–484.
[18] Joe Hellerstein, Christopher Ré, Florian Schoppmann, Daisy Zhe Wang, Eugene Fratkin, Aleksander Gorajek, Kee Siong Ng, Caleb Welton, Xixuan Feng, Kun Li, et al. 2012. The MADlib analytics library or MAD skills, the SQL. arXiv preprint arXiv:1208.4165 (2012).
[19] Mark Hopkins, Erik Reeber, George Forman, and Jaap Suermondt. 1999. Spambase. UCI Machine Learning Repository. DOI: https://doi.org/10.24432/C53G6X.
[20] Jiansheng Huang, Ting Chen, AnHai Doan, and Jeffrey F. Naughton. 2008. On the provenance of non-answers to queries over extracted data. PVLDB 1, 1 (2008), 736–747.
[21] Matteo Interlandi, Kshitij Shah, Sai Deep Tetali, Muhammad Ali Gulzar, Seunghyun Yoo, Miryung Kim, Todd Millstein, and Tyson Condie. 2015. Titian: Data provenance support in spark. In Proceedings of the VLDB Endowment International Conference on Very Large Data Bases, Vol. 9. 216.
[22] G. Karvounarakis, Z.G. Ives, and V. Tannen. 2010. Querying data provenance. In SIGMOD. 951–962.
[23] David B Kemp and Peter J Stuckey. 1991. Semantics of logic programs with aggregates. In International Logic Programming Symposium 1991.
[24] I Elizabeth Kumar, Suresh Venkatasubramanian, Carlos Scheidegger, and Sorelle Friedler. 2020. Problems with Shapley-value-based explanations as feature importance measures. In International Conference on Machine Learning.
[25] Seokki Lee, Bertram Ludäscher, and Boris Glavic. 2018. Provenance Summaries for Answers and Non-Answers. PVLDB 11, 12 (2018), 1954–1957.
[26] Seokki Lee, Bertram Ludäscher, and Boris Glavic. 2018. PUG: a framework and practical implementation for why and why-not provenance. VLDB J. (2018).
[27] Seokki Lee, Bertram Ludäscher, and Boris Glavic. 2020. Approximate Summaries for Why and Why-not Provenance. Proc. VLDB Endow. 13, 6 (2020).
[28] Seokki Lee, Bertram Ludäscher, and Boris Glavic. 2020. Approximate Summaries for Why and Why-not Provenance (Extended Version). Technical Report. https://arxiv.org/abs/2002.00084. https://arxiv.org/abs/2002.00084
[29] Xupeng Li, Bin Cui, Yiru Chen, Wentao Wu, and Ce Zhang. 2017. Mlog: Towards declarative in-database machine learning. Proceedings of the VLDB Endowment 10, 12 (2017), 1933–1936.
[30] Scott M Lundberg and Su-In Lee. 2017. A unified approach to interpreting model predictions. Advances in neural information processing systems (2017).
[31] Nantia Makrynioti, Ruy Ley-Wild, and Vasilis Vassalos. 2019. sql4ml A declarative end-to-end workflow for machine learning. arXiv preprint arXiv:1907.12415 (2019).
[32] A. Meliou, W. Gatterbauer, K.F. Moore, and D. Suciu. 2010. The Complexity of Causality and Responsibility for Query Answers and non-Answers. PVLDB 4, 1 (2010), 34–45.
[33] Xiangrui Meng, Joseph Bradley, Burak Yavuz, Evan Sparks, Shivaram Venkataraman, Davies Liu, Jeremy Freeman, DB Tsai, Manish Amde, Sean Owen, et al. 2016. Mlib: Machine learning in apache spark. Journal of Machine Learning Research 17, 34 (2016), 1–7.
ProvQML: Efficient Provenance Capture for Machine Learning as Recursive Aggregate SQL [Extended Version]
29
[34] Tobias Müller, Benjamin Dietrich, and Torsten Grust. 2018. You Say'What', I Hear'Where'and'Why':(Mis-) Interpreting SQL to Derive Fine-Grained Provenance. arXiv preprint arXiv:1805.11517 (2018).
[35] Gabriele Padovani, Valentine Anantharaj, and Sandro Fiore. 2025. Provenance tracking in large-scale machine learning systems. In Workshop Proceedings of the 54th International Conference on Parallel Processing. 167–174.
[36] Ahmed M Salih, Zahra Raisi-Estabragh, Ilaria Boscolo Galazzo, Petia Radeva, Steffen E Petersen, Karim Lekadir, and Gloria Menegaz. 2025. A perspective on explainable artificial intelligence methods: SHAP and LIME. Advanced Intelligent Systems 7, 1 (2025), 2400304.
[37] Sebastian Schelter, Joos-Hendrik Boese, Johannes Kirschnick, Thoralf Klein, and Stephan Seufert. 2017. Automatically tracking metadata and provenance of machine learning experiments. (2017).
[38] Marius Schlegel and Kai-Uwe Sattler. 2023. MLflow2PROV: extracting provenance from machine learning experiments. In Proceedings of the seventh workshop on data management for end-to-end machine learning. 1–4.
[39] Maximilian Schule, Harald Lang, Maximilian Springer, Alfons Kemper, Thomas Neumann, and Stephan Gunnemann. 2021. In-database machine learning with SQL on GPUs. In Proceedings of the 33rd International Conference on Scientific and Statistical Database Management. 25–36.
[40] Amir Shaikhha, Youning Xia, Meisam Tarabkhah, Jazal Saleem, and Anna Herlihy. 2025. Raqlet: Cross-Paradigm Compilation for Recursive Queries. arXiv preprint arXiv:2508.03978 (2025).
[41] Lloyd S Shapley et al. 1953. A value for n-person games. (1953).
[42] Alexander Shkapsky, Mohan Yang, Matteo Interlandi, Hsuan Chiu, Tyson Condie, and Carlo Zaniolo. 2016. Big data analytics with datalog queries on spark. In SIGMOD. 1135–1149.
[43] Govindaiah Simuni. 2024. Explainable AI in ml: the path to transparency and accountability. Int. J. Recent Adv 11 (2024), 10531–10536.
[44] Robert Tarjan. 1972. Depth-First Search and Linear Graph Algorithms. SIAM J. Comput. 1, 2 (1972), 146–160.
[45] Justin Turnau, Nkechi Akwari, Seokki Lee, and Dwarkesh Rajput. 2023. Provenance-based Explanations for Machine Learning (ML) Models. In ICDEW. IEEE, 40–43.
[46] Jeffrey D. Ullman. 1988. Principles of Database and Knowledge-Base Systems, Volume I: Classical Database Systems. Computer Science Press.
[47] De Wang, Danesh Irani, and Calton Pu. 2012. Evolutionary study of web spam: Webb spam corpus 2011 versus web spam corpus 2006. IEEE, 40–49.
[48] Jin Wang, Jiacheng Wu, Mingda Li, Jiaqi Gu, Ariyam Das, and Carlo Zaniolo. 2021. Formal semantics and high performance in declarative machine learning using Datalog. The VLDB Journal (2021).
[49] Matei Zaharia, Mosharaf Chowdhury, Tathagata Das, Ankur Dave, Justin Ma, Murphy McCauly, Michael J Franklin, Scott Shenker, and Ion Stoica. 2012. Resilient distributed datasets: A {Fault-Tolerant} abstraction for {In-Memory} cluster computing. In 9th USENIX symposium on networked systems design and implementation (NSDI 12). 15–28.
[50] Carlo Zaniolo, Mohan Yang, Ariyam Das, Alexander Shkapsky, Tyson Condie, and Matteo Interlandi. 2017. Fixpoint semantics and optimization of recursive datalog programs with aggregates. Theory and Practice of Logic Programming 17, 5-6 (2017), 1048–1065.