scieee AI-readable full text Open interactive document viewer

Scanflow: A multi-graph framework for machine learning workflow management, supervision, and debugging

Bravo Rocca, Gusseppe Jesus,Liu, Peini,Guitart Fernández, Jordi,Dholakia, Ajay,Ellison, David,Falkanger, Jeffrey,Hodak, Miroslav

Abstract

Machine Learning (ML) is more than just training models, the whole workflow must be considered. Once deployed, a ML model needs to be watched and constantly supervised and debugged to guarantee its validity and robustness in unexpected situations. Debugging in ML aims to identify (and address) the model weaknesses in not trivial contexts. Several techniques have been proposed to identify different types of model weaknesses, such as bias in classification, model decay, adversarial attacks, etc., yet there is not a generic framework that allows them to work in a collaborative, modular, portable, iterative way and, more importantly, flexible enough to allow both human- and machine-driven techniques. In this paper, we propose a novel containerized directed graph framework to support and accelerate end-to-end ML workflow management, supervision, and debugging. The framework allows defining and deploying ML workflows in containers, tracking their metadata, checking their behavior in production, and improving the models by using both learned and human-provided knowledge. We demonstrate these capabilities by integrating in the framework two hybrid systems to detect data drift distribution which identify the samples that are far from the latent space of the original distribution, ask for human intervention, and whether retrain the model or wrap it with a filter to remove the noise of corrupted data at inference time. We test these systems on MNIST-C, CIFAR-10-C, and FashionMNIST-C datasets, obtaining promising accuracy results with the help of human involvement.

Full text

Scanflow: A multi-graph framework for Machine Learning workflow management, supervision, and debugging Gusseppe Bravo-Roccaa,∗,Peini Liua,Jordi Guitarta,b,Ajay Dholakiac,David Ellisonc, Jeffrey Falkangercand Miroslav Hodakc aEmerging Technologies for Artificial Intelligence, Barcelona Supercomputing Center (BSC), Barcelona, Spain bComputer Architecture Department, Universitat Politecnica de Catalunya (UPC), Barcelona, Spain cLenovo Infrastructure Solutions Group, Lenovo, Morrisville, NC, USA ARTICLE INFO Keywords: Machine Learning Symbolic Knowledge Graph Robustness Containerization Concept drift ABSTRACT Machine Learning (ML) is more than just training models, the whole workflow must be considered. Once deployed, a ML model needs to be watched and constantly supervised and debugged to guarantee its validity and robustness in unexpected situations. Debugging in ML aims to identify (and address) the model weaknesses in not trivial contexts. Several techniques have been proposed to identify different types of model weaknesses, such as bias in classification, model decay, adversarial attacks, etc., yet there is not a generic framework that allows them to work in acollaborative, modular, portable, iterative way and, more importantly, flexible enough to allow both human- and machine-driven techniques. In this paper, we propose a novel containerized directed graph framework to support and accelerate end-to-end ML workflow management, supervision, and debugging. The framework allows defining and deploying ML workflows in containers, tracking their metadata, checking their behavior in production, and improving the models by using both learned and human-provided knowledge. We demonstrate these capabilities by integrating in the framework two hybrid systems to detect data drift distribution which identify the samples that are far from the latent space of the original distribution, ask for human intervention, and whether retrain the model or wrap it with a filter to remove the noise of corrupted data at inference time. We test these systems on MNIST-C, CIFAR-10-C, and FashionMNIST-C datasets, obtaining promising accuracy results with the help of human involvement. 1. Introduction Machine Learning (ML) approaches have been successfully applied in different tasks such as machine translation, image classification, recommendation systems, and speech recognition. However, the robustness of these techniques is still under question. For example, many ML models are vulnerable to issues such as adversarial attacks (Takemura, Yanai, & Fujiwara,2020) and concept drift (Gama, Žliobaitundefined, Bifet, Pechenizkiy, & Bouchachia,2014), which jeopardize their robustness in unexpected situations. These issues may occur at both design time (training) and run-time (inference). From the previous examples, we can derive three ways in which a model can lose robustness. First, due to the data; for instance, if there is a change in the data distribution at run-time, the model drifts or behaves wrongly, which leads to accuracy degradation. Second, due to the model itself; for instance, a model with non-robust features that have highly predictive power but are brittle and incomprehensible to humans, does not generalize well in the presence of valid data perturbations and, as a result, is vulnerable to adversarial examples (Ilyas et al.,2019). Third, due to the workflow that encompasses the model; for instance, given a model that ∗Corresponding author. Phone: +34651913568; Address: C/ Jordi Girona 1-3, Campus Nord UPC, C6 building, Barcelona, Spain. [email protected] (G. Bravo-Rocca); [email protected] (P. Liu); [email protected] (J. Guitart); [email protected] (A. Dholakia); [email protected] (D. Ellison); [email protected] (J. Falkanger); [email protected] (M. Hodak) ORCID(s): consumes data from a previous preprocessing step, if this input signal is unstable (can change its behavior over time), silent updates on the signal will affect the accuracy of the model. Besides robustness issues at design and run-time, there are other convenient properties when building ML models to avoid the hidden technical debt, namely usability and scalability. Usability refers to howintuitive and efficient is to build workflows and interact with them, that is, how easy is that a human agent can be involved in the ML workflow to build, deploy, supervise, and improve models (Michael, Acklin, & Scheuerman,2020). Usability is also related to portability and modularity. Portability allows dealing successfully with different libraries, operating systems, and any environment in general, when deploying workflows and, especially, when moving them between different platforms. Modularity allows adding new execution blocks to the workflow in a simple way. On the other side, scalability (Hestness et al., 2017) refers to the ability to handle increasing amounts of data and more expensive computations in an efficient way. Scalability in machine learning is necessary when dealing with huge data sets and complex models for both training and inference (Guo et al.,2017). For instance, the ImageNet data set contains 1.2 million of images (Russakovsky et al., 2015), the real-time object detection model YOLO has 24 convolutional layers followed by 2 fully connected layers (Redmon, Divvala, Girshick, & Farhadi,2016), and the GPT-3 language model comprises 175 billion parameters (Brown et al.,2020). Hence, the management of ML workflows must be able to exploit adequately resources in large Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 1 of 23 © 2022 Elsevier. This manuscript version is made available under the CC-BY-NC-ND 4.0 license http://creativecommons.org/licenses/by-nc-nd/4.0/ clusters to handle their data and computations efficiently, as well as to allocate different types and amounts of resources to individual execution steps of the workflows according to their specific needs. Consequently, there is a need for a framework that can help data scientists to define, deploy, track, supervise, and improve workflows in a flexible, usable, portable, modular, and scalable way so that they end up with more robust models. For that purpose, the framework has to combine machine-learned knowledge (to deal, for instance, with data distribution drift and data denoising) with human-provided knowledge (to deal, for instance, with bias, exceptions, fairness, and interpretability). This paper contributes with a framework, so-called Scanflow, based on a graph structure where each node represents an executor (e.g., to handle tasks such as preprocessing, feature engineering, modeling, tuning), and each edge represents an interaction between nodes (e.g., input/output flux, constraints, addresses, and parameters in general). Each node runs its own image (which includes all the required software and dependencies) in a separate container to ease deployment, portability, reproducibility, and scalability. The graph structure supports also three types of special nodes, which aim for workflow robustness by allowing to manage combined machine-learned and human-derived knowledge. In particular, each workflow can include its own Tracker, to log any metadata (settings, metrics, statistics, scores) for future analysis; Checker/s, to supervise the workflow behavior in production, identify abnormal observations, and allow human feedback; and Improver/s, to refine the model by using feedback from the Tracker and Checker nodes. As a proof-of-concept, we have implemented a prototype of Scanflow including built-in versions of the Checker and the Improver nodes which feature a non-trivial anomaly detector and a denoising filter based on AutoEnconders that will detect and clean, respectively, out-of-distribution samples in the data and will improve a target estimator based on human intervention. Scanflow, with its flexible graph structure and special built-in nodes (Trackers, Checkers, and Improvers), allows data scientists to set up reproducible dynamic workflows, track each execution, check for abnormal behaviors and, finally, refine the models based on both machine and human feedback. The remainder of this paper is as follows. Section 2states the formal definition of Scanflow, as well as its structure and collaborative elements, such as, graph design, deployment, and special nodes. Next, in Sections 3and 4, we describe the Scanflow implementation and the results of our evaluation to demonstrate its usefulness when debugging ML models. Then, in Section 5we present a comparison of different approaches regarding ML management, supervision, and debugging. Finally, the conclusions and new ideas for future work are presented in Section 6. 2. Framework design Latest ML algorithms have been focused mostly on data, learning, and computational power. However, terms such as knowledge and reasoning have been left out. As a consequence, many current models suffer from lack of generalization for unexpected or anomalous cases, i.e., samples that maintain the same semantics of the training data but are outside the ideal distribution of that set. Recent research work on the area has proposed the annexation of prior knowledge that can help to learn how to generalize better (Bengio, 2017). This previous work states that the manipulation of symbolic knowledge, for example, declarative knowledge (facts and rules) that contains statements with very high probability (i.e., ground truth), fits very well with the concept of conscious state. This is a step for the process of reasoning, which together with learning models, manages to help considerably in model generalization. A similar process occurs in the development of a baby’s intelligence, where the mutual exclusivity of linguistic labels (symbolic system) works as a powerful tool to avoid overlapping concepts, allowing children to develop a rule-like generalization (Smith & Gasser,2005). For instance, the word "ball" can be used for many objects that belong to this shape, similarly, the term "cup". In addition, the compositionality feature of language that allows children to understand a complex sentence by its components can aid in detecting and understanding the behavior of a function given a workflow, helping in the debugging process. We concur that any artificial intelligence or machine learning application has to be inspired by both symbolic human knowledge and the power of state-of-art learning algorithms. Therefore, we propose Scanflow, a multi-graph framework that combines both machine (learning nodes) and human knowledge (symbolic nodes) to tackle the problem of model robustness. On one side, using machine learning will help to detect any abnormal behavior in a workflow with ease. On the other side, with the help of human knowledge we can tackle the bias in algorithms by supervising the type of data that is fed to the model or creating rule-based procedures to guarantee an expected behavior. Scanflow involves humans in creating models that other humans can trust. In this section, we outline the implementation of the Scanflow graph structure that allows both approaches to work side by side. Figure 1depicts this idea. 2.1. Definition Scanflow is a directed labeled multigraph represented by a 7-tuple 𝐺= (Σ𝑉,Σ𝐸, 𝑉 , 𝐸, 𝑓, 𝓁𝑉,𝓁𝐸), where Σ𝑉is the alphabet of vertex labels. 𝑉is the set of nodes or vertices. Each node is considered a task node which performs some action. Σ𝐸is the alphabet of edge labels. 𝐸is the set of ordered edges. Each edge represents a dependency between nodes, that is, which nodes should be executed before or after others. Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 2 of 23 Figure 1: An abstract overview of Scanflow. A symbolic node represents a task node that involves human rules, knowledge base, or deterministic algorithms independently of experience. Whereas, a learning node depicts a pattern recognition behavior with the aim of fitting or approximating a function, like deep learning approaches that depend on experience. The goal of wrapping a user workflow with new nodes is to increase its robustness. 𝑓∶𝐸→𝑉×𝑉= {(𝑢, 𝑣)|𝑢, 𝑣 ∈𝑉}is the function that maps each edge to a pair of vertices or nodes. 𝑓(𝑒1)= 𝑓(𝑒2)in case of multiple edges. 𝓁𝑉∶𝑉→Σ𝑉, maps a label for each node. For instance, a node can be a preprocessing node, cleaning node or modeling node belonging to a certain workflow. 𝓁𝐸∶𝐸→Σ𝐸, maps a label for each edge. For instance, an edge (e.g., gathering →preprocessing) can be labeled as belonging to the training phase or belonging to the inference process. There are three special nodes: {𝑇 , 𝐶, 𝐼} ∈ 𝑉,𝑇 𝑟𝑎𝑐𝑘𝑒𝑟 (T), 𝐶ℎ𝑒𝑐𝑘𝑒𝑟 (C), and 𝐼𝑚𝑝𝑟𝑜𝑣𝑒𝑟 (I), which are instances of symbolic and learning nodes that will interact with each other to enhance either a node or set of nodes. A 𝑇 𝑟𝑎𝑐𝑘𝑒𝑟 node is a symbolic node since it depicts a declarative knowledge (facts), for instance, logging any execution metadata. A 𝐶ℎ𝑒𝑐𝑘𝑒𝑟 node can behave both as a learning or as a symbolic node since it takes both pattern recognition and rule-based ideas. Finally, an 𝐼𝑚𝑝𝑟𝑜𝑣𝑒𝑟 node shares also both behaviors, symbolic (e.g., rules to decide when to update the model) and learning (e.g., retrain the model based on feedback from 𝑇 𝑟𝑎𝑐𝑘𝑒𝑟 and 𝐶ℎ𝑒𝑐𝑘𝑒𝑟). Finally, let be (𝐺) = ∑𝑛 𝑘=0 𝑖(𝑘) 𝐺a return function that measures all the improvements 𝑖, jobs done by the 𝐼𝑚𝑝𝑟𝑜𝑣𝑒𝑟 nodes, applied to a graph 𝐺. Then, the goal is to get a graph 𝐺∗ 𝜃(𝑤)for a given workflow 𝑤(𝑥)(graph that depends on an input 𝑥) and metric 𝜃of quality (e.g., accuracy, trust score) that maximizes , where 𝐺∗ 𝜃(𝑤) = arg max 𝜃 (𝐺𝜃(𝑤)) (1) 𝑤(𝑥) = [𝑛(0) (𝑥), 𝑛(1) (𝑥),…, 𝑛(𝑘−1) (𝑥)] = ⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ 𝑛(0) 1th task node 𝑛(1) 2th task node ⋮ 𝑛(𝑘−1) kth task node (2) We consider that a multigraph is a flexible superset of most data structures best suited for ML pipelines. For example, an automata model like a finite state machine is just one kind of directed graph, where nodes represent states and arcs are transitions going from one state to another. Similarly, a semantic model that depicts the relationships found on specific values of data is a type of graph. For instance, a semantic model would be a hierarchy in a company where a Staff member is an (→) Employee, Employees work (→) full time, full-time employment receives (→) health care benefits, which is still a kind of directed graph. As a first attempt to implement Scanflow, we propose a blueprint comprising five modules: 𝑆𝑒𝑡𝑢𝑝 and 𝐷𝑒𝑝𝑙𝑜𝑦𝑚𝑒𝑛𝑡 to define and execute a workflow, respectively, a 𝑇 𝑟𝑎𝑐𝑘𝑖𝑛𝑔 module to log or save metadata in any execution, a 𝐶ℎ𝑒𝑐𝑘𝑖𝑛𝑔 module to tag any observation, and finally, an 𝐼𝑚𝑝𝑟𝑜𝑣𝑖𝑛𝑔 module to apply all the collected feedback coming from whether 𝑇 𝑟𝑎𝑐𝑘𝑖𝑛𝑔 or 𝐶ℎ𝑒𝑐𝑘𝑖𝑛𝑔 modules to be used to enhance the target model. Figure 2depicts a running state of this template. 2.2. Modules 2.2.1. Setup This module is responsible for designing the workflow or graph in which each node will be assigned a specific task, e.g., preprocessing, cleaning, modeling, etc. Additionally, special nodes (Tracker, Checker, and Improver) can be also defined, so that, together with the existing user nodes, a more robust workflow can be obtained. Apart from the definition of the graph, it is also possible to define the order of execution of each node, that is, which nodes should be executed before or after others. In particular, Scanflow allows sequential and parallel execution of nodes. This provides a greater flexibility when working with ML workflows in the training and inference phases, since the user has total control of each node and of the information transmitted in each path (nodes in the same neighborhood). This is useful when one wants to create multiple versions (reuse) of the same node with different parameters and execute them in a parallel way. This could reduce training times, help in the modularization, or simplify the experimentation with specific cases that in a standard execution would be very expensive and cumbersome. Figure 3shows an example of this idea, where two workflows are connected to one another. The first workflow, which runs sequentially, can include a data extraction node, which precedes a cleaning node, which then precedes a feature engineering node. The second Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 3 of 23 Figure 2: Scanflow execution cycle. Figure shows the interaction between Tracker, Checker, and Improver nodes to enhance the model quality once the workflow is already established. workflow can comprise a modeling node, which executes models written in Pytorch or Tensorflow or Sklearn in a parallel way and with different arguments. Additionally, note that each workflow can have a Checker and/or a Tracker node. 2.2.2. Deployment This module is in charge of deploying each task node within a container (which has more capabilities than a simple Python virtual environment, e.g., allocating different Linux kernels, compilers, etc.), with the purpose of encapsulating it in an isolated environment including its own software dependencies, its view of the operating system, and its computational resources, which provides advantages on modularization, portability, and reproducibility. Conceptually, our design allows the containers to be implemented in any containerization technology, although our prototype is currently built on top of Docker (as described later). Once the containers are in place, they are grouped into a virtual network (e.g., with private IP addresses) to enable isolated communication between them. This can be seen in Figure 4. Additionally, this module executes the workflow in the environment where it has been deployed (in local, in a server, or in a cluster). Once the workflow is running, along with the special nodes (Tracker/s, Checker/s, Improver/s), Scanflow allows to proceed with the testing or debugging of the workflow to improve its robustness. 2.2.3. Special nodes The two previous modules were responsible for designing and deploying the workflow through a graph of containers to have a flexible structure which solves the problems of usability (simplifying deployment, portability, and reproducibility) and scalability (using containers allows to finetune the resources to work with large data and more complex models). In spite of these benefits, the real advantage for robustness lays down in the definition of the special nodes, namely the Tracker, the Checker, and the Improver, which are described below. 2.2.4. Tracking The Tracking module is in charge of saving any kind of metadata coming from the workflow (e.g., parameters, metrics, statistics, split datasets, etc.), as well as metadata coming from other special nodes, such as the Checker (e.g., anomalous points) and the Improver (e.g., new model, new score). The purpose of the Tracker is to offer this information to the other special nodes so that they can improve the final model or even the workflow as a whole. The more information obtained from the execution of the workflow, the better for the performance of the other special nodes. Figure 5shows a high-level overview of this module. Furthermore, the way of how this module works is shown in Algorithm 1, which savesmetadata to the Tracker, and Algorithm 2, which queries the Tracker for specific metadata. Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 4 of 23 Figure 3: Setup module. The blue nodes belong to the current user workflow, whereas the green ones represent the special nodes that will help to increase the quality and reliability. Besides, this figure shows one graph comprising two subgraphs, one with a sequential order (top) and one with parallel order (bottom). Algorithm 1: High-level tracking algorithm for saving metadata Input:𝑖𝑑: execution identifier, 𝑚𝑒𝑡𝑎: metadata; // Process metadata pmeta ←process_metadata(meta); // Save processed metadata to repository flag ←save_metadata(pmeta, id); return flag; Output:𝑓𝑙𝑎𝑔: success or failure; 2.2.5. Checking To obtain a robust workflow, its behavior over time must be analyzed in order to detect anomalous observations and apply corrective measures. The Checking module is in charge of identifying different types of behaviors through predefined instructions. Figure 6depicts this idea. To this end, Checker nodes can be built to implement symbolic or learning behaviors. A symbolic type node can hold rules or some knowledge in order to help the model decisions. For example, some rules can constrain the minimum and maximum temperatures a sensor can measure, so that, if the measurement exceeds 1000 Celsius degrees or drops below - 273 Celsius degrees, it is considered to be caused by a sensor malfunction. Another example of a symbolic node is human labeling, where a human agent labels observations to be used later for refining the model with an extended training set. This can contribute to a great extent to the generalization of the model. On the other hand, a learning type node is in charge of predicting anomalous behavior on some data Figure 4: Deployment module. Once the workflow is defined (in both structure and order), this module uses containers to deploy and run this graph, i.e., execute the task and special nodes. Figure 5: Tracking module. The user’s workflow (blue nodes), the Checker (green node), and the Improver (green node) send metadata to the Tracker node to be used later to refine the model. This metadata will be saved in a shared or private repository. by using patterns learnt from historical data. For example, a classification model of dogs and cats can fail if new images fed into the model, in the inference stage, deviate from the training distribution (e.g., cats with dog breeds, big cats, small dogs). A general formulation of the Checking module is shown in Algorithm 3. 2.2.6. Improving The Improving module is in charge of carrying out the corrective measures to the model (in a general way, it could improve any node of the workflow, not only the model). Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 5 of 23 Algorithm 2: High-level tracking algorithm for getting metadata Input:𝑖𝑑: execution identifier, 𝑞𝑢𝑒𝑟𝑦: request; // Get tracker address given an experiment id tracker_uri ←get_tracker_uri(id); // Get tracker node instance given a tracker address tracker ←get_tracking_uri(tracker_uri); // Gather data from tracker given a query data ←tracker.gather_log(query); return data; Output:𝑑𝑎𝑡𝑎: requested information; Figure 6: Checking module. It is in charge of analyzing some data and deciding if it behaves as expected or not. It can add a tag indicating whether the data is anomalous or not, or some continuous severity level. Algorithm 3: High-level checking algorithm Input:𝑋: metadata; feedback ←𝑁𝑜𝑛𝑒; // Prepare the raw metadata X_prep ←preprocessing(X); // Call a symbolic or learning function to check behaviour tags ←tagger(X_prep); // Save tags for later analysis feedback ←tags; return feedback; Output:𝑓𝑒𝑒𝑑𝑏𝑎𝑐𝑘: information for improvement; As shown in Figure 7, the information obtained from the Tracker and/or Checker will be used to address anomalous behaviors not seen in the training stage with the aim of optimizing some given metric, such as, accuracy, execution time, interpretability, trust, etc. To this end, the Improver node takes the feedback from the other nodes and refines the current model, obtaining a new version of it. After this step, it measures how much the improvement is with respect to the old model, and if it is higher than a given threshold, then the new model is saved for a future update triggered by a previous authorization (human intervention) or in an Figure 7: Improving module. The feedback coming from different sources is used to enhance the current model. The updated model is shown in red color. unsupervised way. Algorithm 4shows the blueprint of this module. Algorithm 4: High-level improving algorithm Input:𝑚: model; Input:𝑓𝑒𝑒𝑑𝑏𝑎𝑐𝑘: any kind of metadata; Input:𝑞: current quality metric; // Modify or create a wrapper for the current model 𝑚′←modify(𝑚, feedback); // Get score from modified model 𝑞′←evaluate(𝑚′); // If new model is better, save it, else, do nothing if 𝑞′> 𝑞 then return 𝑚′,𝑞′; end return None, None; Output:𝑚′: new model; Output:𝑞′: new quality value; 3. Implementation 3.1. Graph structure Scanflow is implemented under the principles of graph theory and containerization, which provide the needed support to enable ML model debugging. As for this first stage, Scanflow is written in Python on top of Docker (in the future, we plan to extend it to other technologies), which allow easy integration with a variety of libraries and task isolation, respectively. Additionally, Scanflow structure facilitates fast prototyping, easy deployment, portability, reproducibility, and scalability. The encapsulation of any node (e.g., preprocessing, modeling, cleaning) will create a Docker image (which includes all the required software and dependencies) at the Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 6 of 23 Figure 8: Scanflow’s structure. This is a proof-of-concept implementation using Docker, MLflow, and Python. At the top, the core structure is shown; each task node is encapsulated into a Docker image, which is then instantiated as a container. At the bottom, the interaction of user task nodes and special nodes is shown. Setup stage. This image will then be instantiated into a Docker container. The whole process is shown in Figure 8. As a result, a workflow is represented by a set of containers and running this workflow (Deployment stage) means executing each one of the containers according to the order defined in the Setup. It should be noted that the ML task encapsulated in each image can be written in any language and use any library, since its ecosystem is isolated from other nodes. Furthermore, Scanflow provides a registry of all the images for later reuse. 3.2. Graph communication The communication between nodes is a key point in the interaction within the workflow. This gives the characteristic of ’multi’ to a graph, i.e., the possibility of using one or more edges between two nodes. As shown in Figure 9, the communication between two nodes in Scanflow is done in two ways. The first one is through a Docker shared volume. Our proof-of-concept implementation sets a space in the file system to persist the data, which can be shared by any container running in the same host. This type of communication is faster for files that need to be used many times. Although not part of the current implementation, Docker supports also volume drivers that allow storing volumes on remote hosts or Cloud providers. The second communication option is through a Tracker, which receives queries and delivers the results from its database. This type of communication serves for metadata, such as logs, metrics, scores, parameters, etc., and allows communicating containers in both local and remote hosts. Figure 9: Scanflow’s communication between nodes. The first link is using a Docker shared volume and the second is using a Tracker. These nodes can be either a task node or a special node. 3.3. Special nodes The special nodes implement tracking, checking, or improving functionality. Each of them features machinelearned or human-derived knowledge to improve workflow robustness. The Tracker node, for example, is implemented using MLflow (Databricks,2020), an open source library that helps in event tracking and metadata management, but also in data acquisition with predefined methods. The Checker and Improver nodes run on-demand (or in the background), observing the data that gets into the model, detecting anomalous events, and trying to improve the model using information from those events. The implementation of the Checker and the Improver nodes depends on the specific functionality they are supporting (for instance, dealing with model bias, fairness, and interpretability). Next section describes the built-in implementation of those nodes included in Scanflow. 3.4. Built-in special nodes Scanflow comes with novel built-in Checker and Improver nodes which aim to detect data drift distribution and refine the model or the out-of-distribution data accordingly by using human feedback. This is motivated by the need of being aware of any deviation of the data that leads to a malfunction of the model. For example, if a model is asked to classify an image, but this image contains some noise, in many cases the model fails and predicts a totally wrong class, which means that the model is not robust enough to generalize to other scenarios. We explored two approaches to deal with this issue. The first one, as shown in Figure 10, comprises three components, namely a Drift Detector Checker, which analyzes the out-of-distribution observations that occur in the inference stage by calculating the distance between the new data and the original data, a Human Labeler Checker, which asks a human agent to label the further away samples that indicate non-expected behaviors, and a Model Trainer Improver, which retrains the model with the extended training data to improve a target estimator. The second approach, which Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 7 of 23 Figure 10: First ML debugging approach. Joint work between Drift Detector Checker, Human Labeler Checker, and Model Trainer Improver. Figure 11: Second ML debugging approach. Joint work between Drift Detector Checker, Human Labeler Finder, and Model Denoiser Wrapper Improver. is shown in Figure 11, aims to remove the noise from the corrupted input data. For this purpose, it first uses the same Drift Detector Checker to detect the corrupted observations, then a Human Finder Checker looks for clean observations in the training data similar to the corrupted ones, and finally, a Model Denoiser Wrapper Improver connects a denoiser to the current model in order to filter out the noisy input before predicting. The detailed implementation of these two approaches is described in the next sections. 3.4.1. Background According to Webb, Hyde, Cao, Nguyen, and Petitjean (2016), there are many types of concept drift, such as class drift, covariate drift, novel class drift, etc. For this work, we consider the covariate drift, where the features (𝑋) or covariates change over time. A more formal definition is as follows. Let be 𝑃(𝑋)the prior probability distribution over the covariates, 𝑃(𝑌)the prior probability distribution over the class labels, 𝑃(𝑌∣𝑋)the likelihood distribution over class labels given 𝑋, and 𝑃(𝑋∣𝑌)the posterior probability distribution over covariates given class labels, then a covariate drift is defined as shown in Equation 3. It means that for two times 𝑡and 𝑢, the prior probability distribution changes for each case, as long as, posterior class distribution remains the same. 𝑃𝑡(𝑋)≠𝑃𝑢(𝑋) ∧ 𝑃𝑡(𝑌∣𝑋) = 𝑃𝑢(𝑌∣𝑋)(3) Equation 3tells us that by maintaining the semantics of the classification, that is, predicting the same 𝑌, the values (𝑋) that feed into the model have changed over time, forcing the model to readjust in order to deal with this distribution variation. One way to detect this variation is through the idea of coding, that is, building an architecture capable of learning internal representations through a coding process. Rumelhart, Hinton, and Williams (1986) used a neural network in which the input and output layer have the same 𝑁dimension and the hidden layer has a log2𝑁 dimension. Their idea is to code an 𝑁bit pattern into alog2𝑁bit pattern, and then decode that representation into the output 𝑁bit pattern. Lecun (1987) and Bourlard and Kamp (1988) came up with the idea of 𝑎𝑢𝑡𝑜𝑒𝑛𝑐𝑜𝑑𝑒𝑟, an architecture made up of two components: an encoder and a decoder. The encoder is a function 𝑓, as shown in Equation 4, that allows to code the input data into a specific representation called latent space ℎ. Conversely, a decoder maps 𝑔, as shown in Equation 5, from a latent space ℎto input space, which produces a reconstruction 𝑟that mimics the input space 𝑥(Bengio, Courville, & Vincent,2013). The following equations show the backbone idea of a general autoencoder: ℎ=𝑓𝜃(𝑥)(4) 𝑟=𝑔𝜃(ℎ)(5) 𝐴𝐸(𝜃) = ∑ 𝑡 𝐿(𝑥(𝑡), 𝑔𝜃(𝑓𝜃(𝑥(𝑡)))) (6) Here 𝐴𝐸 (Equation 6) represents the loss overall function that penalizes 𝑟for being dissimilar from 𝑥. Figure 12 shows a general structure of an autoencoder. Similarly, a denoising autoencoder (DAE) (Vincent, Larochelle, Bengio, & Manzagol,2008) goes one step further. It changes the loss function adding a corrupted version (𝑥) of the input data (𝑥) obtained throughacorruption process𝐶(𝑥|𝑥).Thismodified loss function, as shown in Equation 7, forces the autoencoder to remove the noise and obtain useful latent features (not only mapping or learning the identity function). Figure 13 depicts this idea. 𝐷𝐴𝐸(𝜃) = ∑ 𝑡 𝐿(𝑥(𝑡), 𝑔𝜃(𝑓𝜃(𝑥(𝑡)))) (7) Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 8 of 23 Figure 12: Naive autoencoder Figure 13: Denoising autoencoder 3.4.2. Drift Detector Checker The Drift Detector Checker is capable of capturing deviated points using only the data considered the "normal distribution", that is, the training data. In an unsupervised manner, this detector is trained on this set to learn a function to reconstruct the new data into the original one. Using this reconstruction error, the detector is able to calculate the anomalous or critical points. As shown in Figure 14, our built-in Drift Detector Checker consists of two parts, namely a Convolutional Deep Autoencoder and a Critical Point Selector, and, as shown in Algorithm 5, its logic follows the high-level blueprint presented before for Checker nodes. Algorithm 5: Drift Detector Checker Input:𝑋_𝑡𝑟𝑎𝑖𝑛: training data, original distribution; Input:𝑋_𝑡𝑒𝑠𝑡: testing data, data that contains corruptions; feedback ←𝑁𝑜𝑛𝑒; // Learn the original distribution autoencoder ←conv_autoencoder(X_train); // Prepare the testing data, like normalization, scaling, etc. X_test_prep ←preprocessing(X_test); // Find the observations that deviate the original distribution X_critical ←crit_point_selector(autoencoder, X_train, X_test_prep); // Save the most critical observations feedback ←X_critical; return feedback; Output:𝑓𝑒𝑒𝑑𝑏𝑎𝑐𝑘: critical observations, subset of X_test; The Convolutional Deep Autoencoder, which contains 7 convolutional layers, 3 max-pooling layers, and 3 upsampling layers, calculates how far the new points are from the original distribution. This is shown in Algorithm 6. Algorithm 6: Convolutional Deep AutoEncoder Input:𝑋: training data; Input:𝑒𝑝𝑜𝑐ℎ𝑠,𝑏𝑎𝑡𝑐ℎ𝑒𝑠,𝑙𝑟: Number of epochs, number of batches, learning rate; Input:𝑊,𝑏,𝑏ℎ: Parameters (𝜽) : Weights, bias, latent bias; for epoch in 𝑒𝑝𝑜𝑐ℎ𝑠 do for batch in 𝑏𝑎𝑡𝑐ℎ𝑒𝑠 do 𝒉←relu(𝑿∗𝑊+𝒃) 𝒓←sigmoid (𝒉∗𝑊𝑇+𝒃𝒉) 𝑳(𝑥, 𝒓)← −∑𝑑 𝑖=1 [𝒙𝑖log 𝒓𝑖+(1 − 𝒙𝑖)log (1 − 𝒓𝑖)] 𝒈←gradient(𝜽) for 𝜃𝑖, 𝑔𝑖in (𝜽,𝒈)do 𝜃𝑖←𝜃𝑖−𝐼∗𝑔𝑖 end end end autoencoder ←join(h, r) return autoencoder Output:𝑎𝑢𝑡𝑜𝑒𝑛𝑐𝑜𝑑𝑒𝑟: convolutional deep autoencoder; Then, by using this result, the Auto-threshold component of the Critical Point Selector calculates two thresholds, one upper and one lower, in order to identify the points that are out of these boundaries. Given these limits, the Kernel Density Estimator component of the Critical Point Selector estimates the distribution density of these critical points from the previous step, which is then used to choose the required number of the most likely critical points. The logic of the Critical Point Selector, including the Auto-threshold and the Kernel Density Estimator, is shown in Algorithm 7. 3.4.3. Human Labeler Checker This Checker node is a type of symbolic node, that is to say, it can be anything that does not depend on the historical data: a rule, a fact, or a human intervention. In this case, it is a human that works as a participatory agent within this multinode environment. His or her job is to take the observations that are given to him or her, that is, the new critical values (X_test) and tag them. The objective is that the human agent uses the least effort possible since human time is a very scarce and expensive resource. For this purpose, this node is connected to the Drift Detector Checker to reduce the amount of observations to be tagged (only the most critical). This action improves notably the model score, as shown in the Experiments Section. The rationale behind this is that both learning algorithms and symbolic knowledge should work together to improve the model robustness. Algorithm Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 9 of 23 10 25 50 100 200 500 Number of labels 94.0 94.5 95.0 95.5 96.0 96.5 97.0 97.5 Mean accuracy Test on MNIST + MNIST-C Baseline DDC+HLC RND+HLC MDWI+HFC (a) Mean accuracy plot Baseline Naive DDC+HLC RND+HLC MDWI+HFC Approach 102550100200500 Number of labels 93.98 71.46 94.96 94.66 94.93 93.98 70.75 95.54 95.22 95.85 93.98 70.75 95.8 95.67 96.24 93.98 69.66 96.2 96.16 96.68 93.98 65.38 96.62 96.58 97.05 93.98 60.38 97.17 97.15 97.34 65 70 75 80 85 90 95 (b) Mean accuracy score table Figure 22: Evaluation on MNIST + MNIST-C datasets for each scenario. gain some insights. For instance, the model is never wrong in predicting number one by number zero and vice versa. According to this, in order to streamline the labeling effort, we might prioritize other classes more than these two. 4.3. Experiment 2: Human-in-the-loop ML model debugging on CIFAR-10 and FashionMNIST This experiment demonstrates the ability of Scanflow to support more diverse datasets and more complex modeling architectures. For that purpose, we developed models for two additional datasets. The first dataset is CIFAR-10 (and its corresponding corrupted version), which contains color images of motor vehicles and animals. Figure 24a and Figure 24b show samples of CIFAR-10 and CIFAR-10-C, respectively. The modeling architecture for this dataset was built on top of DenseNet (G. Huang, Liu, van der Maaten, & Weinberger,2018) and using transfer learning on ImageNet weights (Russakovsky et al.,2015). The second dataset is 0123456789 Predicted label 0 1 2 3 4 5 6 7 8 9 True label 2897 0 2 1 0 6 11 3 18 2 03375 8 5 0 0 4 1 12 0 6 13 2992 14 11 1 1 27 31 0 2 0 5 2954 0 19 0 23 24 3 2 3 8 2 2864 0 14 6 9 38 3 2 2 21 1 2607 10 3 21 6 17 9 0 0 13 15 2811 0 9 0 0 14 61 12 3 3 0 2920 14 57 16 0 4 15 7 7 7 13 2826 27 13 23 2 16 14 16 1 14 16 2912 Figure 23: Confusion matrix for MNIST-C. This plot shows the number of correct and incorrect predictions broken down by each class for the MDWI+HFC scenario (best scenario). FashionMNIST (and also its corresponding corrupted version), which contains grayscale images of clothing. Figure 28a and Figure 28b show samples of FashionMNIST and FashionMNIST-C, respectively. Differently from the MNIST dataset, we trained FashionMNIST dataset on a fully connected Multi Layer Perceptron (Haykin,1994). Both architectures were implemented with TensorFlow. We tested scenarios Baseline, Naive, DDC+HLC, and RND+HLC, as described in the previous experiment, and we used the same methodology to compare the results. As shown in the score tables, the Naive scenario has always considerably worse performance and for this reason it has been excluded from the plots to avoid problems with Y axis scaling. Figure 25 and Figure 29 shows the accuracy of the tested scenarios on the original CIFAR-10 and FashionMNIST datasets, respectively. All the scenarios obtain nearly the same accuracy than the baseline for this dataset (±0.6), although the accuracy of DDC+HLC and RND+HLC on CIFAR-10 degrades minimally with more labels, because retraining the model with the new labels adapts it to predict better the corrupted dataset (so the accuracy improvement in this case is higher, as shown below). Figure 26 and Figure 30 show the accuracy of the tested scenarios on the CIFAR-10-C and FashionMNIST-C corrupted datasets, respectively, and Figure 27 and Figure 31 show the average accuracy on both datasets (original+corrupted), which is pretty similar to the corrupted one. The plots show that scenarios DDC+HLC and RND+HLC clearly outperform the Baseline accuracy, that using more labels tends to improve the model accuracy, and that the model generalizes better when using DDC+HLC rather than RND+HLC, because the drift detector yields better significant points to be labeled. Additionally, Figure 32a and Figure 32b show the confusion matrices for the best scenario (i.e., DDC+HLC) in FashionMNIST-C and CIFAR-10-C, respectively. Whereas Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 16 of 23 7 0 6 9 5 1 7 0 3 CIFAR-10 (a) Original CIFAR-10 test sample. 7 0 6 9 5 1 7 0 3 CIFAR-10-C_impulse_noise_1 (b) CIFAR-10-C test sample with impulse noise corruption (severity 1). Figure 24: CIFAR-10 and CIFAR-10-C datasets. This figure shows 9 images and their respective corrupted version. the two models have an acceptable prediction accuracy on average, they still have some weakness in predicting certain classes. For example, with FashionMNIST-C, the model misclassifies more often ’shirt’ from ’t-shirt’ than ’shirt’ from ’sandal’. Similarly, with CIFAR-10-C, the model does more mistakes predicting ’horse’ from ’deer’ than predicting ’horse’ from ’automobile’. This is because these pairs of classes are perceptually more similar. This analysis should be taken into account when creating more efficient Improver/s. For instance, if the set of observations to be labeled includes only ’shirt’ and ’sandal’, then it would be better to skip that effort and wait to get observations from other classes instead. Another interesting example is when the model predicts ’bag’ or ’trouser’, as shown in Figure 32a. The model is more accurate in these classes than in others. Therefore, we can have high confidence in the model when predicting these classes (a custom Checker can give this explanation along the prediction), which is important for cases where 50 100 200 500 Number of labels 87.9 88.0 88.1 88.2 88.3 88.4 88.5 88.6 Mean accuracy Test on CIFAR-10 Baseline DDC+HLC RND+HLC (a) Mean accuracy plot Baseline Naive DDC+HLC RND+HLC Approach 50100200500 Number of labels 88.54 87.68 88.47 88.44 88.54 87.6 88.63 88.57 88.54 87.49 88.03 88.38 88.54 88.03 88.03 87.91 87.6 87.8 88.0 88.2 88.4 88.6 (b) Mean accuracy score table Figure 25: Evaluation on CIFAR-10 original dataset for each scenario. the uncertainty in predictions is critical, such as medical analysis. 5. Related work In recent years, despite the excellent results of Machine Learning (ML) approaches in different tasks such as machine translation (Bahdanau, Cho, & Bengio,2014;Luong, Pham, & Manning,2015), image classification (Krizhevsky, Sutskever, & Hinton,2017;Le, Zou, Yeung, & Ng,2011), recommendation systems (Covington, Adams, & Sargin, 2016;He et al.,2017), and speech recognition (Conneau, Baevski, Collobert, Mohamed, & Auli,2020), many concerns have arisen regarding the robustness of these techniques, such as security vulnerabilities (e.g., adversarial attacks, adversarial examples) (Biggio et al.,2013;Kurakin, Goodfellow, & Bengio,2016;Szegedy et al.,2014;Takemura et al.,2020), concept drift (e.g., class drift, covariate drift) (Gama et al.,2014), lack of explainability and interpretability (e.g., black box networks) (Alvarez-Melis & Jaakkola,2018;Goebel et al.,2018;Guidotti et al.,2018), and maintainability or hidden technical debt (e.g., boundary erosion, unstable data dependencies, hidden feedback loops) (Sculley et al.,2015). Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 17 of 23 50 100 200 500 Number of labels 73.5 74.0 74.5 75.0 75.5 76.0 76.5 77.0 77.5 Mean accuracy Test on CIFAR-10-C Baseline DDC+HLC RND+HLC (a) Mean accuracy plot Baseline Naive DDC+HLC RND+HLC Approach 50100200500 Number of labels 73.62 70.59 74.2 74.13 73.62 69.5 75.2 75.02 73.62 69.22 75.93 74.38 73.62 73.3 77.4 76.43 70 71 72 73 74 75 76 77 (b) Mean accuracy score table Figure 26: Evaluation on CIFAR-10-C dataset for each scenario. In this context, several technologies have emerged to facilitate the work with workflows in general, such as Airflow (Apache Software Foundation,2021) and Luigi (Bernhardsson & Freider,2021), as well as those applied specifically to Machine Learning, such as Kubeflow (Google,2021), MLflow, and Seldon (Housley,2021). It is evident that there is a need for tools to create simple, portable, and scalable pipelines that allow easy ML deployments for various infrastructures. For instance, Kubeflow, Airflow, MLflow, and Luigi deal with deployment, dependency resolution, and tracking and monitoring of workflows, with more or less intensity. Similarly, Seldon includes those features and also deals with explainability and outlier/drift detection (Housley,2021). However, current ML models need not only a passive behavior, that is to say, to have a good deployment, to get nice explanations, and to detect critical data instances, but also to be actively reformulated and updated in an always changing world. Perhaps, the key difference between these frameworks and Scanflow is that the latter, in addition to debugging, also performs model updating with human intervention, which of course, not only makes the model better but also the original data (by providing good labels). 50 100 200 500 Number of labels 81.2 81.4 81.6 81.8 82.0 82.2 82.4 82.6 82.8 Mean accuracy Test on CIFAR-10 + CIFAR-10-C Baseline DDC+HLC RND+HLC (a) Mean accuracy plot Baseline Naive DDC+HLC RND+HLC Approach 50100200500 Number of labels 81.08 79.14 81.34 81.28 81.08 78.55 81.91 81.79 81.08 78.35 81.98 81.38 81.08 80.66 82.72 82.17 78.5 79.0 79.5 80.0 80.5 81.0 81.5 82.0 82.5 (b) Mean accuracy score table Figure 27: Evaluation on CIFAR-10 + CIFAR-10-C datasets for each scenario. On the other hand, different methods to deal with the lack of robustness in ML have been proposed. In addition to the concept drift problem addressed in this paper (see the corresponding related work in Section 3.4.1), other problems that compromise model generalization include for instance adversarial attacks. For example, Xie, Wu, van der Maaten, Yuille, and He (2018) developed a feature denoising method to improve adversarial robustness for ImageNet (Deng et al.,2009). Similarly, Z. Huang and Zhang (2019) presented a method based on low-dimensional embedding using a pretrained model to alleviate this problem (that includes also not-learning steps). These works are related to our proposal as they also aim to improve robustness in models. However, our work does it externally without modifying the current code (e.g., without modifying the learning model). Our claim is our particular architecture to deal with robustness, that is to say, the external joint work between the Tracker, Checker, and Improver (special nodes) that can include other approaches (even better anomaly detectors) as nodes to improve models over time. Focusing on the MNIST dataset, many defensive methods have been applied recently on this regard, in particular by using the MNIST-C dataset to evaluate their performance ([dataset] Norman Mu & Gilmer, 2019). Table 1compares those previous results with the Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 18 of 23 9 2 1 1 6 1 4 6 5 FashionMNIST (a) Original FashionMNIST test sample. 9 2 1 1 6 1 4 6 5 FashionMNIST-C_impulse_noise_1 (b) FashionMNIST-C test sample with impulse noise corruption (severity 1). Figure 28: FashionMNIST and FashionMNIST-C datasets. This figure shows 9 images and their respective corrupted version. approaches proposed in this paper. Whereas it is true that some of these methods can improve our accuracy in certain types of corruption, on average our methods provide better performance and therefore they generalize better. Finally, few research works have considered hybrid systems involving symbolic knowledge that aims at increasing model generalization. An example is the Neuro-Symbolic Concept Learner (Mao, Gan, Kohli, Tenenbaum, & Wu, 2019) developed by IBM and MIT, a system that combines the reasoning power of rule-based systems and the learning flexibility of neural networks to solve visual question answering (VQA) problems, which are difficult to be solved with only a learning approach. As a result, this system gets better results with less training data and yields explainable results. This study conducted a similar idea to our work in the way of combining approaches to come up with a hybrid architecture. Nonetheless, we consider wrappers (special 50 100 200 500 Number of labels 86.9 87.0 87.1 87.2 87.3 Mean accuracy Test on FashionMNIST Baseline DDC+HLC RND+HLC (a) Mean accuracy plot Baseline Naive DDC+HLC RND+HLC Approach 50100200500 Number of labels 86.91 52.29 87.32 87.06 86.91 52.43 87.18 87.27 86.91 56.3 87.34 87.18 86.91 39.56 87.11 87.08 40 50 60 70 80 (b) Mean accuracy score table Figure 29: Evaluation on FashionMNIST original dataset for each scenario. Table 1 Mean accuracy of various models on MNIST-C Model Mean Accuracy Baseline 88.78 Conv2 (PGD) 80.06 Conv3 (PGD) 78.86 Conv3 (GAN) 81.14 Capsule 77.60 ABS 82.46 RND+HLC* 91.33 DDC+HLC* 91.97 MDWI+HFC* 92.60 * Involves human intervention. Best results are bolded nodes) which interact, externally, with the current workflow without altering, internally, its parts (nodes). Besides, Marcus (2020) presented a proposal of some steps to tackle this issue, such as creating hybrid neuro-symbolic architectures, developing cognitive models, and emerging reasoning mechanisms to operate on these models. Likewise, Chollet Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 19 of 23 50 100 200 500 Number of labels 70 71 72 73 74 Mean accuracy Test on FashionMNIST-C Baseline DDC+HLC RND+HLC (a) Mean accuracy plot Baseline Naive DDC+HLC RND+HLC Approach 50100200500 Number of labels 69.49 42.09 72.59 70.18 69.49 42.83 71.74 69.78 69.49 47.08 73.89 73.33 69.49 35.14 73.65 73.33 40 45 50 55 60 65 70 (b) Mean accuracy score table Figure 30: Evaluation on FashionMNIST-C dataset for each scenario. (2019) presented similar ideas on how to help the reasoning of tasks by means of certain strategies, on which combined with a learning method, lead to further steps towards robust artificial intelligence. 6. Conclusions and future work In this paper, we have introduced Scanflow, a multigraph containerized framework for ML workflow management, supervision, and debugging that seeks to provide initial steps towards improving the robustness of workflows in run time. For this purpose, it builds on a graph structure that offers high flexibility when operating on pipelines, as well as, on the work of special nodes that are responsible for detecting and ensuring the proper functioning of those workflows by using both learned and human-provided knowledge. We have presented novel ideas on how to perform continuous improvements on ML models over time through the joint work of Tracker, Checker, and Improver nodes to track models metadata, check their behavior in production, and 50 100 200 500 Number of labels 78.5 79.0 79.5 80.0 80.5 Mean accuracy Test on FashionMNIST + FashionMNIST-C Baseline DDC+HLC RND+HLC (a) Mean accuracy plot Baseline Naive DDC+HLC RND+HLC Approach 50100200500 Number of labels 78.19 47.19 79.96 78.62 78.19 47.63 79.46 78.53 78.19 51.69 80.62 80.26 78.19 37.35 80.38 80.2 40 45 50 55 60 65 70 75 80 (b) Mean accuracy score table Figure 31: Evaluation on FashionMNIST + FashionMNIST-C datasets for each scenario. refine them. Additionally, we have provided built-in implementations of those nodes for detecting drift distribution, for selecting the most critical observations, for removing noise from data, and for including human agents in the debugging loop. That is to say, mechanisms to deal with not only ordinary or normal data distribution (Independent and Identically Distributed) but also with atypical or more general data distribution (Out-of-Order Distributed). Scanflow allows greater flexibility in the manipulation of its structure by working with multigraphs. By defining a workflow as a multigraph, it can have loops and multiple edges between nodes, which allow, for example, a special node (e.g., the Improver) to loop over itself until a better model is obtained or to run different edges between two nodes depending on whether some condition is fulfilled or not. Moreover, thanks to graph theory, Scanflow inherits graph properties that allow, for instance, finding node neighbors, successors, and predecessors, which are really useful to find dependencies (backbone ideas on causality), and also using a rich myriad of algorithms, such as, path searching, Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 20 of 23 T-shirt Trouser Pullover Dress Coat Sandal Shirt Sneaker Bag Ankle boot Predicted label T-shirt Trouser Pullover Dress Coat Sandal Shirt Sneaker Bag Ankle boot True label 2369 11 23 171 3 1 355 4 59 4 48 2807 0 64 0 4 24 11 41 1 401 20 1643 70 142 0 533 7 183 1 626 96 20 1875 8 5 282 16 71 1 242 45 543 275 1034 0 639 12 208 2 163 2 1 4 0 2343 17 363 48 59 647 39 183 220 72 0 1706 10 121 2 173 0 0 2 0 55 5 2623 23 119 52 22 4 24 2 8 44 23 2818 3 112 5 0 20 0 45 15 324 96 2383 (a) Confusion matrix for FashionMNIST-C airplane automobile bird cat deer dog frog horse ship truck Predicted label airplane automobile bird cat deer dog frog horse ship truck True label 1624 10 55 20 97 1 28 19 136 10 23 1686 8 60 26 2 31 6 45 113 47 1 1366 92 274 27 173 8 11 1 11 3 64 1427 168 120 179 10 12 6 3 4 46 41 1817 8 57 12 11 1 3 0 45 320 146 1392 77 14 2 1 4 4 42 80 112 17 1735 2 2 2 7 0 25 70 424 51 7 1401 10 5 107 23 32 41 89 1 13 4 1672 18 63 132 3 30 33 3 14 7 82 1633 (b) Confusion matrix for CIFAR-10-C Figure 32: Confusion matrices for FashionMNIST-C and CIFAR-10. These plot show the number of correct and incorrect predictions broken down by each class for the DDC+HLC scenario (best scenario). community detection, connected components, and pagerank. On the other hand, commercial alternatives such as Airflow, Luigi, Kubeflow, and MLflow only work with directed acyclic graphs (DAG) and do not support special nodes that can provide capabilities beyond deployment, such as supervision and adaptation. For example, these could include having a human-in-the-loop approach or improving models using automatic retraining or custom-made rules as a response to anomalous behavior detection. From our experiments with MNIST, CIFAR-10, and FashionMNIST datasets, we highlight some relevant research results. First, external components to a ML workflow (such as the Tracker and Checker) that monitor its behavior, are an effective and agnostic way to add value to the model incrementally over time without interfering in its performance since they take the model as a black box and only care about what goes in and what comes out. Second, human intervention proved to improve the models considerably in all cases in a fast and transparent way, i.e., few human effort allows both to improve the accuracy of the models and to democratize their use towards the end user. Third, the generalization problem can be reduced by considering not only refinements on the model (model-centric), but also enhancing data quality (data-centric), so considering these two aspects together enables a comprehensive improvement. Whereas this paper examined a model based on convolutional networks for image classification, our framework can be also applied to other types of classification, such as text or tabular classification, and other ML techniques, such as regression. This is because the special nodes (e.g., the Checker) can be modified in its structure to accept different types of data. For example, for text classification, the convolutional layers can be replaced by recurrent layers or Long Short-term Memory (LSTM) neural networks, which work better to obtain the context of a word/sentence. As future work, we expect to work on improving the interface between symbolic and learning operations to accelerate debugging, focusing especially on the refinement of the human-computer interaction to get good heuristics and labels (domain knowledge) which can be leveraged to introduce ideas of data-centric techniques like weak supervision (Ratner, Varma, Hancock, & Ré,2019). Besides, we can exploit further the compositionality feature of the framework, that implies that a user might know any node behavior over time, and as a result, a workflow could be explained as a whole by its parts. Naturally, the workflow might be explained by measuring the effects that data causes on it, externally. On the other hand, we will continue working on the creation of built-in nodes that can be generalized to many tasks and provide a common template for the resolution of many problems. Finally, we plan to integrate Scanflow with well-known container orchestrators and exploit their resource management capabilities to optimize the management of the workflows. In fact, we have some preliminary results on multi-layer workflow management through agents on Kubernetes (Liu et al.,2021) . Declarations Funding This work was partially supported by Lenovo as part of Framework Contract Lenovo-BSC 2020, by the Spanish Government under contract PID2019-107255GB, and by the Generalitat de Catalunya under contract 2017-SGR-1414 and under grant 2020 FI-B 00257. Competing interests The authors declare that they have no competing interests. Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 21 of 23 Availability of data and material The datasets used to perform the current study are MNIST, MNIST-C, CIFAR-10, CIFAR-10-C, FashionM- NIST, and FashionMNIST-C (noise functions were applied on FashionMNIST to convert it to FashionMNIST-C because such dataset does not exist). Code availability The code for reproducing the experiments is available in three Google Colab notebooks (one for each dataset), namely, experiment 1 (MNIST)1, experiment 2 (CIFAR- 10)2and experiment 2 (FashionMNIST)3. Moreover, the Scanflow implementation is available in GitHub4. We can also find the links to the notebooks in this repository. Authors’ contributions The first draft of the manuscript was written by Gusseppe Bravo-Rocca and Jordi Guitart and all authors commented on previous versions of the manuscript. All authors read and approved the final manuscript. References Abadi, M., Agarwal, A., Barham, P., Brevdo, E., Chen, Z., Citro, C., ... Zheng, X. (2016). TensorFlow: Large-Scale Machine Learning on Heterogeneous Distributed Systems. CoRR,abs/1603.04467. Retrieved from http://arxiv.org/abs/1603.04467 Alvarez-Melis, D., & Jaakkola, T. S. (2018). Towards Robust Interpretability with Self-Explaining Neural Networks. In Proceedings of the 32nd international conference on neural information processing systems (pp. 7786–7795). Curran Associates Inc. Anaconda Inc. (2020). Anaconda individual edition (version 3) [computer software]. Retrieved from https://www.anaconda.com/products/ individual Apache Software Foundation. (2021). Airflow (version 2.2.3) [computer software]. Retrieved from https://airflow.apache.org/ Bahdanau, D., Cho, K., & Bengio, Y. (2014). Neural Machine Translation by Jointly Learning to Align and Translate. Retrieved from https:// arxiv.org/abs/1409.0473 Bengio, Y. (2017). The Consciousness Prior. Retrieved from https:// arxiv.org/abs/1709.08568 Bengio, Y., Courville, A., & Vincent, P. (2013, August). Representation learning: A review and new perspectives. IEEE Trans. Pattern Anal. Mach. Intell.,35(8), 1798–1828. doi: 10.1109/TPAMI.2013.50 Bernhardsson, E., & Freider, E. (2021). Luigi (version 3.0.3) [computer software]. Retrieved from https://github.com/spotify/luigi Biggio, B., Corona, I., Maiorca, D., Nelson, B., Šrndić, N., Laskov, P., ... Roli, F. (2013). Evasion Attacks against Machine Learning at Test Time. In Proceedings of the 2013 european conference on machine learning and knowledge discovery in databases - volume part iii (pp. 387–402). Springer-Verlag. doi: 10.1007/978-3-642-40994-3\ _25 Bourlard, H., & Kamp, Y. (1988). Auto-association by multilayer perceptrons and singular value decomposition. Biological Cybernetics, 59, 291–294. doi: 10.1007/BF00332918 Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., ... Amodei, D. (2020). Language Models are Few-Shot Learners. Retrieved from https://arxiv.org/abs/2005.14165 Chollet, F. (2019). On the Measure of Intelligence. Retrieved from https://arxiv.org/abs/1911.01547 1shorturl.at/zJR28 2shorturl.at/sBDRX 3shorturl.at/juzJ7 4https://github.com/gusseppe/scanflow Conneau, A., Baevski, A., Collobert, R., Mohamed, A., & Auli, M. (2020). Unsupervised cross-lingual representation learning for speech recognition. CoRR,abs/2006.13979. Retrieved from https://arxiv.org/abs/2006.13979 Covington, P., Adams, J., & Sargin, E. (2016). Deep Neural Networks for YouTube Recommendations. In Proceedings of the 10th ACM Conference on Recommender Systems (pp. 191–198). ACM. doi: 10.1145/2959100.2959190 Databricks. (2020). Mlflow (version 1.10) [computer software]. Retrieved from https://www.mlflow.org/ [dataset] Alex Krizhevsky. (2009). Learning Multiple Layers of Features from Tiny Images (Tech. Rep. No. TR-2009). University of Toronto. [dataset] Dan Hendrycks, & Dietterich, T. (2019). Benchmarking Neural Network Robustness to Common Corruptions and Perturbations. Retrieved from https://arxiv.org/abs/1903.12261 [dataset] Feiyang Chen, Chen, N., Mao, H., & Hu, H. (2018). Assessing four Neural Networks on Handwritten Digit Recognition Dataset (MNIST). Retrieved from https://arxiv.org/abs/1811.08278 [dataset] Han Xiao, Rasul, K., & Vollgraf, R. (2017). Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms. Retrieved from https://arxiv.org/abs/1708.07747 [dataset] Norman Mu, & Gilmer, J. (2019). MNIST-C: A Robustness Benchmark for Computer Vision. Retrieved from https://arxiv .org/abs/1906.02337 Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., & Fei-Fei, L. (2009). ImageNet: A large-scale hierarchical image database. In Proceedings of the 2009 IEEE Conference on Computer Vision and Pattern Recognition (pp. 248–255). doi: 10.1109/CVPR.2009.5206848 Frosst, N., Sabour, S., & Hinton, G. (2018). DARCCC: Detecting Adversaries by Reconstruction from Class Conditional Capsules. Retrieved from https://arxiv.org/abs/1811.06969 Gama, J. a., Žliobaitundefined, I., Bifet, A., Pechenizkiy, M., & Bouchachia, A. (2014, March). A Survey on Concept Drift Adaptation. ACM Comput. Surv.,46(4). doi: 10.1145/2523813 Goebel, R., Chander, A., Holzinger, K., Lecue, F., Akata, Z., Stumpf, S., ... Holzinger, A. (2018). Explainable AI: The New 42? In A. Holzinger, P. Kieseberg, A. M. Tjoa, & E. Weippl (Eds.), Machine learning and knowledge extraction (pp. 295–303). Springer International Publishing. Google. (2021). Kubeflow (version 1.4) [computer software]. Retrieved from https://www.kubeflow.org/ Guidotti, R., Monreale, A., Ruggieri, S., Turini, F., Giannotti, F., & Pedreschi, D. (2018, August). A Survey of Methods for Explaining Black Box Models. ACM Comput. Surv.,51(5). doi: 10.1145/ 3236009 Guo, K., Han, S., Yao, S., Wang, Y., Xie, Y., & Yang, H. (2017, March). Software-Hardware Codesign for Efficient Neural Network Acceleration. IEEE Micro,37(2), 18–25. doi: 10.1109/MM.2017.39 Haykin, S. (1994). Neural Networks: a Comprehensive Foundation. Prentice Hall PTR. He, X., Liao, L., Zhang, H., Nie, L., Hu, X., & Chua, T.-S. (2017). Neural Collaborative Filtering. In Proceedings of the 26th International Conference on World Wide Web (pp. 173–182). doi: 10.1145/ 3038912.3052569 Hestness, J., Narang, S., Ardalani, N., Diamos, G., Jun, H., Kianinejad, H., ... Zhou, Y. (2017). Deep Learning Scaling is Predictable, Empirically. Retrieved from https://arxiv.org/abs/1712.00409 Housley, A. (2021). Seldon core (version 1.12) [computer software]. Retrieved from https://www.seldon.io/ Huang, G., Liu, Z., van der Maaten, L., & Weinberger, K. Q. (2018). Densely Connected Convolutional Networks. Retrieved from https://arxiv.org/abs/1608.06993 Huang, Z., & Zhang, T. (2019). Black-Box Adversarial Attack with Transferable Model-based Embedding. Retrieved from https:// arxiv.org/abs/1911.07140 Ilyas, A., Santurkar, S., Tsipras, D., Engstrom, L., Tran, B., & Madry, A. (2019). Adversarial Examples Are Not Bugs, They Are Features. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’ Alché-Buc, Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 22 of 23 E. Fox, & R. Garnett (Eds.), Advances in neural information processing systems 32 (pp. 125–136). Curran Associates, Inc. Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2017, May). ImageNet Classification with Deep Convolutional Neural Networks. Commun. ACM,60(6), 84–90. doi: 10.1145/3065386 Kurakin, A., Goodfellow, I., & Bengio, S. (2016). Adversarial examples in the physical world. Retrieved from https://arxiv.org/abs/1607 .02533 Le, Q. V., Zou, W. Y., Yeung, S. Y., & Ng, A. Y. (2011). Learning Hierarchical Invariant Spatio-Temporal Features for Action Recognition with Independent Subspace Analysis. In Proceedings of the 2011 IEEE Conference on Computer Vision and Pattern Recognition (pp. 3361–3368). IEEE Computer Society. doi: 10.1109/CVPR.2011 .5995496 Lecun, Y. (1987). Phd thesis: Modeles connexionnistes de l’apprentissage (connectionist learning models). Universite P. et M. Curie (Paris 6). Lecun, Y., & Bengio, Y. (1995). Convolutional Networks for Images, Speech and Time Series. In The Handbook of Brain Theory and Neural Networks (pp. 255–258). The MIT Press. Liu, P., Bravo-Rocca, G., Guitart, J., Dholakia, A., Ellison, D., & Hodak, M. (2021). Scanflow: An End-to-End Agent-Based Autonomic ML Workflow Manager for Clusters. In Proceedings of the 22nd International Middleware Conference: Demos and Posters (pp. 1– 2). ACM. doi: 10.1145/3491086.3492468 Luong, T., Pham, H., & Manning, C. D. (2015, September). Effective Approaches to Attention-based Neural Machine Translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (pp. 1412–1421). Lisbon, Portugal: Association for Computational Linguistics. doi: 10.18653/v1/D15 -1166 Mao, J., Gan, C., Kohli, P., Tenenbaum, J., & Wu, J. (2019). The Neuro-Symbolic Concept Learner: Interpreting Scenes, Words, and Sentences From Natural Supervision. Retrieved from https:// arxiv.org/abs/1904.12584 Marcus, G. (2020). The Next Decade in AI: Four Steps Towards Robust Artificial Intelligence. Retrieved from https://arxiv.org/abs/2002 .06177 Merkel,D. (2014, mar). Docker:Lightweightlinux containersfor consistent development and deployment. Linux J.,2014(239), 2. Michael, C. J., Acklin, D., & Scheuerman, J. (2020). On Interactive Machine Learning and the Potential of Cognitive Feedback. Retrieved from https://arxiv.org/abs/2003.10365 Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., ... Chintala, S. (2019). PyTorch: An Imperative Style, High- Performance Deep Learning Library. In Advances in neural information processing systems 32 (pp. 8024–8035). Curran Associates, Inc. Ratner, A., Varma, P., Hancock, B., & Ré, C. (2019). Weak Supervision: A New Programming Paradigm for Machine Learning. Retrieved from http://ai.stanford.edu/blog/weak-supervision/ Redmon, J., Divvala, S., Girshick, R., & Farhadi, A. (2016). You Only Look Once: Unified, Real-Time Object Detection. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR) (pp. 779–788). doi: 10.1109/CVPR.2016.91 Rumelhart, D. E., Hinton, G. E., & Williams, R. J. (1986). Learning Internal Representations by Error Propagation. In Parallel distributed processing: Explorations in the microstructure of cognition, vol. 1: Foundations (pp. 318–362). MIT Press. Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., ... Fei-Fei, L. (2015, December). ImageNet Large Scale Visual Recognition Challenge. Int. J. Comput. Vision,115(3), 211–252. doi: 10.1007/s11263-015-0816-y Schott, L., Rauber, J., Bethge, M., & Brendel, W. (2018). Towards the first adversarially robust neural network model on MNIST. Retrieved from https://arxiv.org/abs/1805.09190 Sculley, D., Holt, G., Golovin, D., Davydov, E., Phillips, T., Ebner, D., ... Dennison, D. (2015). Hidden Technical Debt in Machine Learning Systems. In Proceedings of the 28th international conference on neural information processing systems - volume 2 (pp. 2503–2511). MIT Press. Smith, L., & Gasser, M. (2005, January). The Development of Embodied Cognition: Six Lessons from Babies. Artif. Life,11(1-2), 13–30. doi: 10.1162/1064546053278973 Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., & Fergus, R. (2014). Intriguing properties of neural networks. In Proceedings of the 2nd international conference on learning representations, ICLR’14. Takemura, T., Yanai, N., & Fujiwara, T. (2020). Model Extraction Attacks against Recurrent Neural Networks. Retrieved from https://arxiv .org/abs/2002.00123 The Debian Project. (2019). Debian (version 10.0) [computer software]. Retrieved from https://www.debian.org/ Vincent, P., Larochelle, H., Bengio, Y., & Manzagol, P.-A. (2008). Extracting and Composing Robust Features with Denoising Autoencoders. In Proceedings of the 25th international conference on machine learning (pp. 1096–1103). ACM. doi: 10.1145/1390156.1390294 Webb, G. I., Hyde, R., Cao, H., Nguyen, H. L., & Petitjean, F. (2016). Characterizing concept drift. Data Mining and Knowledge Discovery, 30, 964–994. doi: 10.1007/s10618-015-0448-4 Xie, C., Wu, Y., van der Maaten, L., Yuille, A., & He, K. (2018). Feature Denoising for Improving Adversarial Robustness. Retrieved from https://arxiv.org/abs/1812.03411 Gusseppe Bravo-Rocca et al.: Preprint submitted to Elsevier Page 23 of 23