# US 10,956,310 B2 · Automated test case generation for deep neural networks and other model-based artificial intelligence systems

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,956,310 B2
- Document ID: US10956310B2
- Status: Granted
- Kind: B2
- Application number: 16/117,903
- Filed: 2018-08-30
- Published: 2020-03-05
- Granted: 2021-03-23
- Earliest claimed: 2018-08-30
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Diptikalyan Saha; Aniya Aggarwal; Pranay Lohia; Kuntal Dey
- Web page: https://patentgrep.com/patent/US10956310B2

## CPC

- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06N 5/045: Explanation of inference; Explainable artificial intelligence [XAI]; Interpretable artificial intelligence
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 11/3692: {for test results analysis}
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/045: Combinations of networks
- G06N 3/0499: Feedforward networks
- G06N 3/08: Learning methods
- G06N 5/01: Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
- G06N 20/00: Machine learning
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Methods, systems and computer program products for automated test case generation are provided herein. A computer-implemented method includes selecting sample input data as a test case for a system under test, executing the test case on the system under test to obtain a result, and applying the result to a local explainer function to obtain at least a portion of a corresponding decision tree. The method further includes determining at least one path constraint from the decision tree, solving the path constraint to obtain a solution, and generating at least one other test case for the system under test based at least in part on the solution of the path constraint. The steps of the method are illustratively repeated in each of one or more additional iterations until at least one designated stopping criterion is met. The resulting test cases form a test suite for testing of a deep neural network (DNN) or other system.

## Claims

### Claim 1

A computer-implemented method for generating one or more test cases for a system under test containing a multitude of nodes, comprising:
selecting sample input data as a test case for a system under test, wherein the system under test comprises at least one deep neural network (DNN) comprising (i) an input layer, (ii) one or more hidden layers and (iii) an output layer;
executing the test case on the system under test to obtain a result;
applying the result to a local explainer function to obtain at least a portion of a corresponding decision tree, wherein the decision tree provides a semantic-level dynamic representation of a plurality of paths of the system under test;
determining at least one path constraint from the decision tree;
solving the path constraint to obtain a solution; and
generating at least one other test case for the system under test based at least in part on the solution of the path constraint;
wherein the method is carried out by at least one processing device comprising a processor coupled to a memory.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein the local explainer function is configured in accordance with a specified Local Interpretable Model-Agnostic Explanations (LIME) model.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein the steps are repeated in each of one or more additional iterations until at least one designated stopping criterion is met.

### Claim 4 (depends on 3)

The computer-implemented method of claim 3, wherein different ones of the iterations utilize respective different selected sample input data.

### Claim 5 (depends on 3)

The computer-implemented method of claim 3, wherein the designated stopping criterion comprises an iteration counter reaching a specified maximum value.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein said determining at least one path constraint from the decision tree comprises determining multiple path constraints for respective distinct subsets of branches of the decision tree.

### Claim 7 (depends on 6)

The computer-implemented method of claim 6, wherein said solving the path constraint comprises solving the multiple path constraints and generating at least one other test case comprises generating multiple test cases based at least in part on respective solutions of respective ones of the path constraints.

### Claim 8 (depends on 1)

The computer-implemented method of claim 1, wherein said determining at least one path constraint from the decision tree comprises determining the path constraint utilizing symbolic execution based at least in part on a toggle function.

### Claim 9 (depends on 1)

The computer-implemented method of claim 1, wherein said determining at least one path constraint from the decision tree comprises determining the path constraint subject to one or more user-specified constraints.

### Claim 10 (depends on 1)

The computer-implemented method of claim 1, wherein said determining at least one path constraint from the decision tree comprises:
identifying a particular path constraint from the decision tree;
determining if the particular path constraint is already covered by one or more existing test cases; and
identifying another path constraint from the decision tree, responsive to an affirmative determination that the particular path constraint is already covered by one or more existing test cases.

### Claim 11 (depends on 1)

The computer-implemented method of claim 1, wherein the decision tree is characterized by linear path constraints that are solvable by a linear constraint solver.

### Claim 12 (depends on 1)

The computer-implemented method of claim 1, wherein said selecting sample input data comprises:
obtaining input data;
clustering the input data into multiple clusters;
selecting a particular one of the clusters; and
selecting the sample input data from the selected one of the clusters.

### Claim 13 (depends on 1)

The computer-implemented method of claim 1, comprising:
configuring a test suite to include the test cases; and
performing a fairness check on the test suite.

### Claim 14

A computer program product for generating one or more test cases for a system under test containing a multitude of nodes, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by at least one computing device to cause the at least one computing device to perform steps of:
selecting sample input data as a test case for a system under test, wherein the system under test comprises at least one deep neural network (DNN) comprising (i) an input layer, (ii) one or more hidden layers and (iii) an output layer;
executing the test case on the system under test to obtain a result;
applying the result to a local explainer function to obtain at least a portion of a corresponding decision tree, wherein the decision tree provides a semantic-level dynamic representation of a plurality of paths of the system under test;
determining at least one path constraint from the decision tree;
solving the path constraint to obtain a solution; and
generating at least one other test case for the system under test based at least in part on the solution of the path constraint.

### Claim 15 (depends on 14)

The computer program product of claim 14, wherein the steps are repeated in each of one or more additional iterations until at least one designated stopping criterion is met.

### Claim 16

A system for generating one or more test cases for a system under test containing a multitude of nodes comprising:
a memory; and
at least one processor coupled to the memory and configured for:
selecting sample input data as a test case for a system under test, wherein the system under test comprises at least one deep neural network (DNN) comprising (i) an input layer, (ii) one or more hidden layers and (iii) an output layer;
executing the test case on the system under test to obtain a result;
applying the result to a local explainer function to obtain at least a portion of a corresponding decision tree, wherein the decision tree provides a semantic-level dynamic representation of a plurality of paths of the system under test;
determining at least one path constraint from the decision tree;
solving the path constraint to obtain a solution; and
generating at least one other test case for the system under test based at least in part on the solution of the path constraint.

### Claim 17 (depends on 16)

The system of claim 16, wherein said determining at least one path constraint from the decision tree comprises determining multiple path constraints for respective distinct subsets of branches of the decision tree.

### Claim 18

A computer-implemented method for generating test cases for a system under test containing a multitude of nodes, comprising steps of:
in a first iteration of a multiple-iteration process for automated generation of test cases for a system under test:
(i) generating at least a portion of a decision tree based at least in part on a result of execution of a test case on the system under test, wherein the system under test comprises at least one deep neural network (DNN) comprising (i) an input layer, (ii) one or more hidden layers and (iii) an output layer, and wherein the decision tree provides a semantic-level dynamic representation of a plurality of paths of the system under test; and
(ii) solving one or more path constraints of the decision tree to identify at least one additional test case; and
in each of one or more additional iterations of the multiple-iteration process for automated generation of test cases for a system under test, repeating the generating step (i) and the solving step (ii) utilizing a different test case than that utilized for those steps in the first iteration;
wherein the steps are carried out by at least one processing device comprising a processor coupled to a memory.
