Inappropriate neural network input detection and processing

By detecting the difference between the neural network output and the reference output, identifying and processing inappropriate input data, the problem of being unable to detect inappropriate input in the existing technology is solved, and the practicality and user experience of the neural network are improved.

CN113196303BActive Publication Date: 2024-09-10AMAZON TECH INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201980081995.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2018-12-11
Filing Date
2019-12-06
Publication Date
2024-09-10
Estimated Expiration
2039-12-06

AI Technical Summary

Technical Problem

Existing neural network processors are unable to detect and process inappropriate input data, resulting in uncertainty in the validity of inference results, thereby reducing the practicality and user experience of neural networks.

Method used

A method and system are designed to generate intermediate outputs of neural network layers by receiving input data, applying activation function processing to generate outputs, calculating the mean and standard deviation of the outputs from a reference output, and determining the difference between the outputs and the mean, It also identifies outliers through predetermined threshold comparisons and counts the number of outliers. If the threshold is exceeded, the input data is judged to be inappropriate and a notification is executed or the calculation is suspended.

Benefits of technology

Effectively detecting and processing inappropriate input data improves the reliability of the neural network's inference operations, avoids invalid inference operations, saves neural network processing resources, and improves practicality and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113196303B_ABST
    Figure CN113196303B_ABST
Patent Text Reader

Abstract

Systems and methods for performing inappropriate input data detection are described. In one example, a system includes: a hardware circuit configured to receive input data and perform computations of a neural network based on the input data to generate a computation output; and an inappropriate input detection module configured to: determine a relationship between the computation output and a reference output of the hardware circuit; determine that the input data is inappropriate based on the relationship; and perform an action based on determining that the input data is inappropriate.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0001] An artificial neural network is a computing system with an architecture based on biological neural networks. An artificial neural network can be trained using training data to learn how to perform a certain computing task for an application. The trained artificial neural network can then perform computing tasks to, for example, generate inferences from the input data. The inference results can be utilized / interpreted based on the application. The usefulness of the inference results may depend on the degree of mismatch between the input data and the training data. BRIEF DESCRIPTION OF THE DRAWINGS

[0002] Various embodiments will be described according to the present disclosure with reference to the accompanying drawings, in which:

[0003] Figure 1 An example of a classifier apparatus for processing data using the techniques disclosed herein is shown;

[0004] Figure 2A and 2B is a simplified block diagram illustrating predictive models and calculations using the techniques disclosed herein, according to certain aspects of the present disclosure;

[0005] Figure 3A and 3B According to certain aspects of the present disclosure, Figure 2A and 2B An instance of the distribution of outputs generated by the predictive model;

[0006] Figures 4A-4D An example neural network processor and operations for inappropriate input detection supported by a neural network processor according to certain aspects of the present disclosure are presented;

[0007] Figures 5A-5C Another example neural network processor and operations for inappropriate input detection supported by a neural network processor according to certain aspects of the present disclosure are presented;

[0008] Figure 6 Example methods of detecting and processing inappropriate input data for a neural network according to certain aspects of the present disclosure are presented; and

[0009] Figure 7 An example of a computing device in accordance with certain aspects of the present disclosure is presented. DETAILED DESCRIPTION

[0010] Examples of the present disclosure relate to neural network processing, and more particularly to systems that can detect and process inappropriate input data for a hardware-implemented neural network. As used herein, "inappropriate input data" can refer to input data that deviates from training data used to train a neural network for an inference goal, wherein the deviation is so great that inference operations of the neural network based on the input data do not achieve the inference goal.

[0011] An example of the present disclosure includes a method. The method includes: performing calculations based on input data received from an application to generate intermediate outputs of a neural network layer; generating outputs of the neural network layer based on applying an activation function to the intermediate outputs; and receiving an average and a standard deviation of reference outputs of the neural network layer. The method further includes, for each of the outputs of the neural network layer: determining the difference between each output and the average; comparing the difference with one or more thresholds determined based on a predetermined multiplier of the standard deviation; and determining whether each output is an outlier output based on a result of the comparison. The method further includes: determining a total count of the outlier outputs; determining that the input data is inappropriate based on a comparison between the total count and a second threshold; and performing at least one of the following based on determining that the input data is inappropriate: transmitting a notification to the application, or suspending calculations of subsequent neural network layers.

[0012] In one aspect, the method further comprises receiving, from the application, configuration data indicative of the predetermined multiplier.

[0013] In one aspect, the reference output of the neural network layer is obtained by processing a training data set set by a neural network comprising the neural network layer.

[0014] In one aspect, the method further includes determining that the input data is inappropriate based on a total number of the outlier outputs of a plurality of neural network layers.

[0015] Examples of the present disclosure include a system. The system includes: a hardware circuit configured to receive input data and perform a calculation of a neural network based on the input data to generate a calculation output; and an inappropriate input detection module configured to: determine a relationship between the calculation output and a reference output of the hardware circuit; determine that the input data is inappropriate based on the relationship; and perform an action based on determining that the input data is inappropriate.

[0016] In some aspects, the input data deviates from a training data set used to train the neural network by at least a predetermined margin.

[0017] In some aspects, the reference output is generated by the neural network based on processing the training data set.

[0018] In some aspects, the hardware circuit includes: an arithmetic circuit configured to perform an arithmetic operation to generate an intermediate output; and an activation function circuit configured to apply an activation function process to the intermediate output to generate the calculation output.

[0019] In some aspects, the inappropriate input detection module is configured to determine the relationship between the calculated output and the reference output based on comparing the calculated output to one or more thresholds regarding a mean and a standard deviation of the reference output.

[0020] In some aspects, the inappropriate input detection module is configured to, for each of the calculated outputs: determine a difference between the each of the calculated outputs and the mean, and determine whether the each of the calculated outputs is an outlier output based on comparing the difference to a first threshold value based on a predetermined multiple of the standard deviation. The inappropriate input detection module is further configured to determine a count of the outlier outputs, and determine that the input data is inappropriate based on comparing the count to a second threshold value.

[0021] In some aspects, the inappropriate input detection circuit is configured to receive detection configuration information from an application providing the input data; and wherein the detection configuration information includes definitions of the first threshold and the second threshold.

[0022] In some aspects, the neural network includes a plurality of neural network layers. The inappropriate input detection circuit is configured to determine, based on the detection configuration information, that the input data is inappropriate based on the count of the outlier outputs in the computation output of one of the plurality of neural network layers.

[0023] In some aspects, based on the detection configuration information, the inappropriate input detection module is configured to determine that the input data is inappropriate based on a position of the one neural network layer within the neural network.

[0024] In some aspects, the inappropriate input detection module is configured to: determine a first statistical parameter of the calculated output; receive a second statistical parameter of the reference output; and determine the relationship between the calculated output and the reference output based on comparing the first statistical parameter to the second statistical parameter.

[0025] In some aspects, the neural network includes a plurality of neural network layers. The inappropriate input detection module is configured to: determine a mean and a standard deviation of the computed outputs of each of the plurality of neural network layers; and generate a record of the mean and the standard deviation of the computed outputs of each of the neural network layers.

[0026] In some aspects, the inappropriate input detection module is configured to perform the actions, which include at least one of: transmitting an error notification to an application using the computational output of the hardware circuit, or pausing computation of the neural network layer at the hardware circuit.

[0027] In some aspects, the hardware circuit is part of a neural network processor.The inappropriate input detection module implements an application interfaced with the neural network processor.

[0028] An example of the present disclosure includes a method. The method includes: receiving a computational output of a neural network based on input data provided by an application from a hardware circuit; determining a relationship between the computational output of the hardware circuit and a reference output of the neural network, the reference output being generated by processing a training data set by the neural network; determining that the input data is inappropriate based on the relationship; and performing an action based on determining that the input data is inappropriate.

[0029] In some aspects, the method further includes receiving a mean and a standard deviation of a distribution of the reference outputs. Determining the relationship between the computed outputs of the hardware circuit and the reference outputs includes: determining a difference between each of the computed outputs and the mean; and determining that the input data is inappropriate based on comparing the difference to a threshold value derived from the standard deviation.

[0030] In some aspects, the action includes at least one of transmitting an error notification to the application, or suspending computation of the neural network at the hardware circuit.

[0031] An artificial neural network (hereinafter "neural network") may include multiple processing nodes. The processing nodes may be divided into layers including, for example, an input layer, multiple intermediate layers (also referred to as hidden layers), and an output layer. Each processing node of the input layer receives an element of an input set and scales the element with a weight to indicate the degree of influence of the element on the output. Each processing node in the intermediate layer may generate a sum of scaled elements as an intermediate output, and then generate an output (of the intermediate layer) by applying an activation function to the intermediate output. The output of the intermediate layer may represent a lower-level decision (e.g., whether a feature is found) that may contribute to the final output of the neural network, which may be processed by a subsequent intermediate layer or a subsequent output layer to generate the final output / decision of the artificial neural network.

[0032] An artificial neural network can be trained to generate decisions using a training data set, wherein the training data is configured based on an inference goal for making decisions. As an example, an artificial neural network can be trained for an inference goal of identifying a specific cat from an image of a cat, and the training data can include a set of images of the cat and other cats. As another example, an artificial neural network can be trained for an inference goal of identifying a person's voice from an audio signal of the person's voice, and the training data can include a sample of the person's voice and samples of the voices of other people. In both examples, through training, the weights in the neural network can be updated with the goal of maximizing the likelihood that the trained neural network will generate a correct inference from the input data.

[0033] However, the likelihood that a neural network will generate a correct inference may depend on the neural network receiving appropriate input data. If inappropriate input data is provided to the neural network, the neural network may still generate an inference result, but the inference operation based on the inappropriate input data does not meet the inference goal. Referring to the example described above, a neural network may be trained using a set of images of cats to identify a specific cat from images of cats, but then images of dogs are input to the trained neural network to generate an inference result. In addition, a neural network may be trained using a set of human voice samples to identify human voices from audio signals of human voices, but then non-human voice signals are input to the trained neural network to generate an inference result. In both cases, the input data is not the type of data that the neural network is trained to process, and the inference operation of the neural network does not achieve the inference goal.

[0034] Currently, neural network processors do not have the ability to detect inappropriate input data or signal that an inference operation is based on inappropriate data. Therefore, applications using inference results do not have information to determine the validity of the inference results and may perform operations based on invalid inference results. For example, an application may automatically feed an image of a dog from a video feed to a neural model trained to recognize a cat from an image of a cat, receive an inference result that the image of the dog contains a cat, and indicate to the user of the application that a cat has been detected. Therefore, without realizing that the inference result is based on inappropriate input data, the user may use or otherwise rely on the inference result. This may not only reduce the practicality of the neural network inference operation but also reduce the user experience.

[0035] Examples of the present disclosure relate to neural network processing, and more specifically to systems that can detect and process inappropriate input data for a hardware-implemented neural network. In some examples, the system includes a hardware circuit configured to receive input data from an application and perform calculations of a neural network based on the input data to generate a neural network output. The system further includes an inappropriate input detection circuit configured to determine a relationship between the neural network output of the hardware circuit and a reference neural network output. The reference neural network output may represent the output of a neural network with training data as input. The system may detect that the input data is inappropriate based on a comparison result and based on a configurable detection criterion, and perform one or more actions based on the detection. The action may include, for example, transmitting a notification of inappropriate input data to an application, suspending calculations of the neural network at the hardware circuit, and the like.

[0036] Compared to existing neural network processors that do not have the ability to detect or signal inappropriate input data, examples of the present disclosure enable detection of inappropriate input data. In some instances, the application (and / or the user operating the application) to which the inappropriate input data is notified enables the user to be aware of potential limitations in the inference operation and make judgments about the reliability of the inference output. In addition, in some instances, the system can also pause the neural network calculation when inappropriate input data is detected. Such an arrangement can reduce the possibility of wasting valuable neural network processing resources on invalid inference operations, which can improve the management and utilization of neural network processing resources. Further, the detection of inappropriate input data can be based on configurable detection criteria, and the detection criteria can be independently configured for different applications, use cases and / or different users. This allows the detection of inappropriate input data to become more flexible and adaptable, thereby improving the practicality of neural network processing and user experience.

[0037] In the description herein, various embodiments are described. For the purpose of explanation, specific configurations and details are set forth in order to provide a thorough understanding of the embodiments. However, it will also be apparent to those skilled in the art that the embodiments may be practiced without the specific details. In addition, well-known features may be omitted or simplified in order to avoid obscuring the embodiments being described.

[0038] Figure 1 An example classifier device 100 for processing data using the techniques disclosed herein is shown. The classifier device 100 can be, for example, a computing device that operates a software application 102 and a prediction model 103 to predict information contained in a data sequence and performs a predetermined function based on the prediction. For example, the classifier device 100 can be part of an image recognition service that is provided for identifying certain objects (e.g., text, people, etc.) from an image. It should be understood that the image recognition service is provided only as an illustrative example, and the techniques disclosed herein can be used for other data processing applications, including, for example, text-based data processing (e.g., processing of search queries), audio data processing, etc. In addition, the classifier device 100 can operate many different prediction models to process different input data in parallel or at different times.

[0039] In some instances, image recognition services can be provided in a multi-tenant computing service system. A multi-tenant computing service system can typically include multiple servers that can host data and be used by multiple clients or organizations to run instances, such as virtual machine instances or bare metal instances (e.g., an operating system running directly on server hardware). In most instances, such as in bare metal or virtual machine instances, the multi-tenant computing service system can be allocated to a client when the client needs it and stopped when the client no longer needs it, so that resources can be reallocated to other clients. In this disclosure, the terms "tenant," "client," and "customer" can be used interchangeably, but such terms do not necessarily imply the existence of any particular business arrangement. The term "instance" can refer to, for example, an instance that executes directly on server hardware or as a virtual machine. Different types of instances typically correspond to different hardware capabilities and / or hardware arrangements (e.g., different amounts of available memory and / or processing hardware). In Figure 1 In the example of , the multi-tenant computing service system can provide image recognition services when the client needs them, and stop using them when the client no longer needs them, so that the resources supporting the image recognition services (e.g., access to the software application 102 and the underlying hardware resources for processing the software application 102) can be reallocated to other clients. Different clients (or one client) may require the application 102 to perform processing on different input data using the same or different prediction models including the prediction model 103.

[0040] exist Figure 1 In an example of, software application 102 may receive pixel data of image 104 from a user. Image 104 may include an array of pixels. Software application 102 may perform analysis on the pixel data and predict one or more objects 106 depicted in image 104. Analysis may include, for example, comparing the pixel data with a predetermined feature data set. The predetermined feature data may include data associated with a set of predetermined visual image features (e.g., a nose object, a mouth object, etc.). The predetermined feature data may also include data associated with non-visual image features or a combination of visual image features and non-visual image features. As will be discussed in more detail below, software application 102 may employ prediction model 103 to calculate a set of scores based on pixel data of image 104. The set of scores may indicate, for example, the likelihood that image 104 contains image features represented by feature data. Software application 102 may then determine other information about the content of image 104 based on the scores. For example, based on the scores, software application 102 may determine that image 104 is, for example, an image of a panda, a cat, or other object. This disclosure provides examples of techniques that allow for a trade-off between speed and accuracy of operating the prediction model 103 .

[0041] The prediction model 103 may be in the form of an artificial neural network. The artificial neural network may include a plurality of processing nodes, wherein each processing node is configured to process a portion of the input pixel data, or is configured to further process intermediate outputs from other processing nodes. Figure 1 An example of a predictive model 103 using the techniques disclosed herein is shown. Figure 1 In the example, the prediction model 103 may be a multi-layer neural network such as a deep neural network (DNN), a convolutional neural network (CNN), etc. The prediction model 103 may include an input layer 207, a set of intermediate layers including intermediate layers 209 and 211, and an output layer ( Figure 2A It should be understood that the prediction model 103 may also include other different types of neural networks, including, for example, long short-term memory (LSTM), multi-layer perceptron (MTP), multi-scale dense network (MSDNET), etc.

[0042] Layer 207 may process pixel data representing different portions of image 104. For example, Figure 2A In the example of , layer 207 can process pixel data of image 204. Each processing node of layer 207 is assigned to receive a pixel value (e.g., x0, x1, x2, . . . , x n), and transmit one or more weights with the received pixel values ​​to layer 209. In the case where the prediction model 203 is a DNN, a weight set defined based on the matrix W1 may be assigned to each processing node of layer 207. Each processing node of layer 207 may send the received pixel values ​​and the assigned weights to each processing node of layer 209. In the case where the prediction model 103 is a CNN, the groups of processing nodes of layer 207 may share a weight set, and each group may send a weight set and the pixel values ​​received by the group of processing nodes to a single processing node of layer 209. Different neural network models may contain different topologies (e.g., containing different numbers of layers, different connections between layers, etc.) and / or contain different weight sets per layer.

[0043] Layer 209 may process the scaled outputs from layer 207 to generate a set of intermediate outputs. For example, assuming that processing node 210a of layer 209 is connected to n processing nodes in layer 207, processing node 210a may generate the sum of the scaled outputs received from layer 207 based on the following equation:

[0044]

[0045] Here, sum 210a W1 represents the intermediate output generated by processing node 210a. i × i represents the scaling of a particular pixel value (e.g., x0) by a processing node of layer 207 with an associated weight (e.g., W10). In the case where prediction model 103 is a DNN, each processing node of layer 209 may generate a sum based on the scaling of the pixel values ​​from each processing node of layer 207, and then generate a sum (e.g., Sum ) by summing the scaled pixel values. 210a ). The sum can also represent the dot product between an input vector including many elements (eg, pixel values) and a weight vector (eg, W1).

[0046] In the case where the prediction model 103 is a CNN, each processing node of the layer 209 may generate an intermediate output based on scaling pixel values ​​from a group of processing nodes of the layer 207. The intermediate output may represent a convolution result between a group of pixel values ​​and a filter including weight values. Figure 2B An example of a convolution operation that layer 209 may perform is shown. Figure 2B, filter 230 may include a two-dimensional array of weights. The weights in filter 230 may represent the spatial distribution of pixels of certain features to be detected from the image. The height of the two-dimensional array may be R rows and the width may be S columns, and is typically smaller than the input image having a height of H pixels and a width of W pixels. Each weight may be mapped to a pixel in a rectangular block of pixel values ​​having the same R rows and S columns. A processing node of layer 209 (e.g., processing node 210a) may receive a group 240 of pixel values ​​corresponding to a first rectangular block of pixels from the input image from a group of processing nodes of input layer 207, and generate a convolution output 242 based on the sum of the multiplication results between each weight of filter 230 and each corresponding pixel in group 240 according to equation 1, thereby generating a dot product between the matrix represented by filter 230 and the matrix represented by group 240. Another processing node of layer 209 may also receive group 244 of pixel values ​​corresponding to a second rectangular block of pixels from the input image from another group of processing nodes of input layer 207, and generate convolution output 246 based on summing the multiplication results between each weight of filter 230 and each corresponding pixel in group 244 according to Equation 1, thereby generating a dot product between the matrix of filter 230 and the matrix represented by group 240. In some examples, Figure 2B Each convolution output (e.g., convolution output 242, convolution output 346, etc.) in may correspond to an output of a processing node of layer 209. In some instances, pixel data in an input image may be referred to as an input feature map indicating that the pixel is processed by the same filter (or the same filter bank) corresponding to a certain feature or features. A convolution output may be referred to as an output feature map indicating that the output is the result of processing the input feature map with a filter.

[0047] like Figure 2B As shown in , the convolution operation can be arranged in a sliding window so that the second rectangular block overlaps or is otherwise adjacent to the first rectangular block in the input image. Figure 2B In the example of , D can be the stride distance (in pixels) of the sliding window of each convolution operation, so that the pixel block corresponding to group 244 can be located at a distance D (in pixels) from the pixel block corresponding to group 240, and the next pixel block can also be located at the same distance D from group 244. Other processing nodes of layer 209 can also receive pixel groups corresponding to other rectangular blocks and generate other intermediate outputs. The convolution output can be part of the convolution output array. The convolution output array can have a smaller height and a smaller width than the input image. The rectangular blocks of convolution output can be further grouped, and a convolution operation can be performed at layer 211 between the convolution output group and another set of filter weights to generate another set of convolution outputs.

[0048] Return to reference Figure 2A , a processing node of layer 209 can be configured to generate a convolution output element of a convolution output array, and the group M of processing nodes of layer 209 can correspond to the group M of the convolution output array. The processing node of layer 209 can also process each convolution output with an activation function to generate an activation output. The activation function can convert the convolution output into a decision of whether to forward the convolution output to the intermediate layer 211 to affect the classifier decision (similar to triggering a biological neuron). An example of an activation function can be a rectified linear unit (ReLU) defined according to the following equation:

[0049]

[0050] In addition to ReLU, other forms of activation functions can also be used, including, for example, the softplus function (which can be a smooth approximation of the ReLU function), the hyperbolic tangent function (tanh), the inverse tangent function (arctan), the sigmoid function, the Gaussian function, etc.

[0051] A processing node of layer 209 (eg, processing node 210a) may process the sum with a ReLU function to generate a first output of layer 209 based on the following equation:

[0052] first_output 210a =ReLU(Sum 210a ) (Equation 3)

[0053] Layer 211 may further process the scaled intermediate output from layer 209 by, for example, performing additional convolution operations based on different sets of filters. The output from each processing node of layer 211 may be forwarded to other higher intermediate layers, or to the output layer ( Figure 2A The output layer may form an output vector representing, for example, the probability that certain features are included in image 104 and / or the probability that image 204 includes an image of a panda. For example, the output vector may be compared with a reference vector associated with a panda's nose object or a reference vector associated with a panda. A decision as to whether image 104 is an image of a panda may be determined based on the comparison result.

[0054] As described above, the neural network calculation may include multiplication and summation calculations to calculate a set of weighted sums (e.g., Equation 1), and then the set of weighted sums are subjected to activation function processing (Equations 2 and 3), thereby generating a set of activation function outputs for the set of weighted sums. Each of the activation function outputs may represent the vote or influence (in terms of both degree and direction) of the weighted sum on the decision. For example, where the input is pixel data of an image, and the weights represent features to be identified from the image, each activation function output may represent the influence of the pixel on the decision of whether the feature is included in the image.

[0055] Some activation functions can generate a distribution of outputs from a set of weighted sums. Figure 3A shows an example of the distribution of outputs from activation function processing. Figure 3A As shown, the tanh function F(x) can output a range of values ​​for an input range between -2 and +2. In addition, if the input value is greater than zero, the ReLU function G(x) can also output the input value. Activation functions (such as tanh functions and ReLU functions) can map the group weighted sum to a group of outputs, and the group outputs can be modeled by distribution function 300. Distribution function 300 can be specific to the input data set and can vary between different input data sets. For example, Figure 3A As shown, the distribution of the activation function output of the input values ​​x0, x1, ..., xn can follow a Gaussian distribution function with a mean of xm and a standard deviation of σ, but it should be understood that other different input data sets can generate activation function outputs that follow other distribution functions.

[0056] In some examples, the input values ​​x0, x1, ..., xn may be part of a training data set used to train a neural network (e.g., by modifying weights) to perform a specific inference operation. The activation function output distribution from the training data set may provide a reference distribution that may serve as a baseline for inference decisions. As an example, Figure 3B As shown, input pixels that generate activation function outputs within one sigma of the mean value xm can be considered to contain the target panda 302, while input pixels that generate activation function outputs between one standard deviation and three standard deviations from the mean value xm can be considered to contain different pandas 304. Based on the relationship between the activation function output of the input pixel and the activation function output distribution of the training data, a decision to infer the target can be made by the neural network (e.g., determining whether the image contains the panda 302 or other pandas).

[0057] However, if the neural network is provided with a set of inappropriate input data that the neural network is not trained to process, the effectiveness or reliability of the decision may be reduced, such that the inference operation performed based on the input data does not achieve the inference goal. For example, if the neural network is not trained to process elephant images, then image data containing elephant 306 (which may generate an activation function output that is outside the range of three standard deviations) may be inappropriate input data for the neural network. In such cases, the inference operation based on the image data of elephant 306 does not achieve the target inference goal (determining whether the image contains panda 302 or other pandas in this example), and any inference decision based on the image data of elephant 306 should be interpreted with the knowledge that the decision is based on input data that the neural network is not trained to process.

[0058] Figure 4A Device 400 according to some embodiments of the present disclosure is shown. Device 400 may be part of a computer system, such as a host server. Device 400 may be part of a multi-tenant computing service system and may communicate with a host device (not shown in FIG. 4 ) to provide computing resources and memory resources for computing services. For example, return to reference Figure 1 , the device 400 can provide computing resources and memory resources for calculations using the prediction model 103. The host device can operate the software application 102 and communicate with the device 400 to perform one or more image recognition tasks based on calculations using the prediction model 103. The host device can transmit multiple image data sets associated with multiple contexts and provide the multiple image data sets to the device 400, which can generate multiple outputs to predict, for example, whether each of the multiple image data sets contains a predetermined object.

[0059] exist Figure 4A In an example of , the device 400 may include a neural network processor 402 coupled to a memory 412, a direct memory access (DMA) controller 416, and a host interface 414 via an interconnect 418. As will be discussed in more detail, the neural network processor 402 may provide computing resources to support computations using the prediction model 103. The neural network processor 402 may include an integrated circuit, such as a system on a chip (SoC). The memory 412 may be configured to store instructions, input data (e.g., Figure 2B 249 and 244) and weights (e.g., filter 230). Memory 412 may also be configured to store outputs of neural network processor 402 (e.g., Figure 2BThe convolution outputs 242 and 246 of FIG. 4 are shown in FIG. 4 . The memory 412 may include any suitable memory, such as a dynamic random access memory (DRAM), a synchronous DRAM (SDRAM), a double data rate DRAM (DDR DRAM), a storage class memory (SCM), a flash memory device, etc.

[0060] The DMA controller 416 can be configured to perform DMA operations to transfer data between the neural network processor 402 and the host device. For example, as discussed above, the host device can store instructions, input data, and weights at the memory 412. The host device can provide the neural network processor 402 with the memory address of the stored instructions, data, and weights (e.g., in the form of a memory descriptor). The neural network processor 402 can then obtain the stored instructions, data, and weights based on the memory address provided by the host device. The neural network processor 402 can also store the calculation results (e.g., one or more image recognition decisions) at the memory 412 and provide the memory address of the stored results to the host device.

[0061] The host interface 414 may be configured to enable communication between the host device and the neural network processor 402. For example, the host interface 414 may be configured to transfer memory descriptors including memory addresses of stored data (e.g., input data, weights, calculation results, etc.) between the host device and the neural network processor 402. The host interface 414 may include, for example, a peripheral component interconnect express (PCIe) interface or any suitable interface for communicating with a host device.

[0062] The neural network processor 402 may provide computing resources to support computations performed using one or more instances of the prediction model 103. Figure 3A As shown, the neural network processor 402 may include a state buffer 422 , a computation engine 424 , an output buffer 428 , an activation function engine 430 , an inappropriate input detection module 432 , and a computation controller 434 .

[0063] The state buffer 422 may provide a cache of data used for computation at the compute engine 424. The data cached at the state buffer 422 may include, for example, input data, weights and biases retrieved from the memory 412, and intermediate outputs of computations at the compute engine 424. The cache may reduce the impact of memory access bottlenecks (e.g., caused by latency at the memory 412, DMA controller 416, interconnect 418, etc.) on the performance of the compute engine 424. The state buffer 422 may be an on-chip memory device and may include, for example, static random access memory (SRAM).

[0064] The state buffer 422 can be controlled by the computation controller 434 to fetch the weights, biases, and input data to the neural network layer to the computation engine 424. The computation engine 424 can perform the neural network computation of the neural network layer based on the weights, biases, and input data to generate a weighted sum. The computation engine 424 can include a set of circuit systems configured to perform one or more arithmetic operations involving neural network computations. For example, the computation engine 424 can include a set of multipliers for performing scaling of the input data using associated weights and a set of adders for generating a sum of multiplication results representing dot products and convolution results as discussed above. The weighted sums can be collected and accumulated at the output buffer 428 to generate intermediate output data. The output buffer 428 can provide the intermediate output data to the activation function engine 430 to perform activation function processing, thereby generating the output of the neural network layer. The output can be stored in the state buffer 422, which can fetch the output and a new set of weights and biases to the computation engine 424 to perform neural network computations for the next neural network layer.

[0065] In addition, the inappropriate input detection module 432 can detect inappropriate input data stored in the state buffer 422 and supplied to the computation engine 424 to perform neural network computations. The inappropriate input data can include input data for a specific neural network layer, an entire neural network, etc. As will be described below, the inappropriate input detection module 432 can perform detection based on output data generated by the activation function engine 430 and based on detection configuration data 450 from the computation controller 434. In some examples, the detection configuration data 450 can include, for example, threshold information for determining whether an output data element (of the output data) from the activation function engine 430 is an outlier, which can indicate that the input data element corresponding to the output data element is inappropriate. The detection configuration data 450 can also include threshold information, which (for one neural network layer, multiple neural network layers, etc.) sets a number of outlier data elements to be detected for the inappropriate input detection module 432 to determine the entire input data set supplied to the computation engine 424.

[0066] although Figure 4A The inappropriate input detection module 432 is shown as being part of the neural network processor 402, but it should be understood that the inappropriate input detection module 432 may also be part of a software application or firmware that interfaces with the neural network processor 402. Figure 4AThe inappropriate input detection module 432 is shown to perform detection on inappropriate input data based on the output of the activation function engine 430, but it should be understood that the techniques disclosed below can also be used to detect inappropriate input data at other stages of neural network processing, such as in other post-processing stages (e.g., pooling), based on certain intermediate output data from the arithmetic circuits within the computation engine 424.

[0067] In some examples, the inappropriate input detection module 432 may also obtain reference output statistical parameters 452 (eg, from the memory 412 or from the state buffer 422) for use in the distribution model of the reference output, such as Figure 3A-3B As described above, the reference output may include outputs generated by a trained neural network model with respect to the training data set used to train the neural network, and may be associated with the set of weights provided to the computation engine 424. As will be described below, the inappropriate input detection module 432 may combine the reference output statistical parameters 452 with the detection configuration data 450 to determine thresholds and / or other information for detecting inappropriate input data.

[0068] Figure 4B An example of an outlier detection scheme 460 that can be used by the inappropriate input detection module 432 to determine whether an output data element is an outlier based on a distribution of reference outputs (e.g., distribution 300) is shown. Figure 4B As shown, the mean of distribution 300 is xm and the standard deviation is σ. For a specific inference operation, a pair of thresholds may be set based on the multiple of the standard deviation from the mean xm, and the thresholds may be set to a certain range, beyond which the output data element may be determined to be an outlier, which may mean that the input data element corresponding to the output data element is inappropriate. For example, Figure 4B As shown, threshold 462 can be set by subtracting three standard deviations (xm-3σ) from the mean value xm, while threshold 464 can be set by adding three standard deviations (xm+3σ) to the mean value xm. Output data elements centered around mean value xm within range 466 between thresholds 462 and 464 can be determined as non-outliers, whereas output data elements outside the range (e.g., less than threshold 462 or greater than threshold 464) can be determined as outliers. In some instances, range 466 can be shifted by xm to become centered around zero, and thresholds 462 and 464 can be multiples of standard deviations added or subtracted from zero. Output data elements can also be shifted by xm (e.g., by subtracting xm from the output data element), and the shifted output data elements can be compared with

[0069] The detection configuration data 450 and the reference output statistical parameters 452 can provide information to the improper input detection module 432 to implement the detection scheme 460. For example, the reference output statistical parameters 452 can include statistical parameters of the distribution 300, such as the mean xm and the standard deviation σ. In addition, the detection configuration data 450 can define a standard deviation multiplier (e.g., Figure 4B ), and the multiplier is specific to the inference target, application, user, etc.

[0070] Figure 4C An example of the internal components of the inappropriate input detection module 432 is shown. Figure 4C As shown, the inappropriate input detection module 432 can include a group of subtractors 470 (e.g., subtractors 470a, 470b, ..., 470N, etc.), a group of comparators 472 (e.g., comparators 472a, 472b, ..., 472N, etc.), a threshold generator 476, and an outlier count processing logic 478. The subtractors 470, the comparators 472, and the threshold generator 476 can be controlled to perform the outlier detection scheme 460 based on the detection configuration data 450 and the reference output statistical parameters 452. In one example, each of the comparators 472 can receive an output data element (e.g., one of out0, out1, ..., outN, etc.) from the activation function engine 430 and subtract a mean value xm (supplied from the reference output statistical parameters 452) from the output data to generate a shifted output data element, which can be compared with the output data element. Figure 4B The range 466 is compared with the range 466, which is also shifted to be centered on zero.

[0071] In addition, the threshold generator 476 can also receive the standard deviation σ from the reference output statistical parameter 452 and the standard deviation multiplier 480 to generate Figure 4B Thresholds 462 and 464 are provided by threshold generator 476. In the case where range 466 is centered at zero, threshold generator 476 can generate thresholds 462 and 464 by multiplying the standard deviation σ with a multiplier value (e.g., three) set by standard deviation multiplier 480 to generate a multiple. Thresholds 462 and 464 can be negative and positive versions of the multiple, respectively. Each comparator in comparator 472 can compare the shifted output data element with thresholds 462 and 464 provided by threshold generator 476 to determine whether the shifted output data element is an outlier.

[0072] The outlier decision from each of the comparators 472 may be provided to an outlier count processing logic 478, which may process the outlier decision based on a count threshold 482 included in the detection configuration data 450 to determine, for example, whether an input data set corresponding to output data elements out0, out1, ..., outN is invalid input data. As an example, if the count threshold 482 defines a threshold of 10k, and output data elements greater than 10k are determined to be outliers, the outlier count processing logic 478 may determine that the input data set corresponding to the output data elements out0, out1, ..., outN is invalid input data.

[0073] In some instances, the inappropriate input detection module 432 can determine that an input data set is inappropriate based on outlier counts for multiple neural network layers, giving priority to specific neural network layers. Priorities can be specific to specific inference goals, applications, etc. As an example, for some applications, the neural networks of the lower level layers can be trained to recognize a wide range of basic features, and the outlier counts for the lower level layers may be large even for appropriate input data. In contrast, the high level layers can be trained to merge the features recognized by the lower level layers into a smaller feature set, and decision influences are generated based on the smaller feature set. The outlier counts from the high level layers can be much smaller. In such instances, the inappropriate input detection module 432 determines whether the input data is inappropriate based solely on the outlier counts of the high level layers, or assigns a larger weight to the outlier counts of the high level layers.

[0074] Figure 4D An example scheme is shown in which the inappropriate input detection module 432 performs inappropriate input detection based on outlier counts of multiple neural network layers. Figure 4D As shown, the inappropriate input detection module 432 can maintain a record 486 of the outlier counts for each neural network layer based on the outlier counts output by the outlier count processing logic 478. The inappropriate input detection module 432 can also receive a set of weights 484 for the outlier counts for each neural network layer from the detection configuration data 450, where higher weights are assigned to neural network layers that are predetermined to have a small number of outlier outputs. Different weights can be configured for different inference targets, applications, users, etc. The outlier count processing logic 478 can determine a total outlier value 490 based on a weighted sum of the outlier counts in the record 486, where each outlier count of the neural network layer is weighted according to the weight 484. The weighted sum can be compared to the count threshold 482 by a comparator 492 to generate an inappropriate input data decision.

[0075] Inappropriate input detection module 432 can perform one or more actions based on the detection of inappropriate input data. In one example, inappropriate input detection module 432 can provide input data to an application (e.g., Figure 1 The notification may be transmitted during the neural network computation process and / or with the inference result to provide an indication that the input data is inappropriate and / or the inference result is generated based on an inappropriate input data set. In another example, the inappropriate input detection module 432 may also transmit a notification to the computation controller 434 or other software / hardware component that manages the operation of the neural network processor 402, thereby suspending the neural network computation based on the inappropriate input data set. Such an arrangement may minimize the possibility of wasting neural network processing resources when processing inappropriate input data, which may improve the utilization of neural network processing resources.

[0076] In some instances, the inappropriate input detection module 432 can perform inappropriate input detection based on other techniques (such as based on a distribution model that determines the output of the activation function engine 430). The distribution model can then be compared with a reference output distribution (e.g., distribution 300) to determine whether the output of the activation function engine 430 is generated by an inappropriate input. In some cases, by considering the output data as a whole, rather than determining separate outlier output data elements, such detection schemes can provide more accurate detection. For example, a neural network can be trained with a training data set having a wide and relatively uniform distribution. It may be difficult to select a threshold for outlier data identification and counting to reflect the wide and (relatively) uniform distribution of the training data set. In such instances, it may be advantageous to compare the distribution model of the output with the reference output distribution. The comparison can be based on, for example, statistical parameters that compare the distribution of the output and the reference output.

[0077] Figure 5A An example of the internal components of the inappropriate input detection module 432 for identifying inappropriate input based on distribution model comparison is shown. Figure 5A As shown, the inappropriate input detection module 432 may include a statistical parameter determination module 502 and a distribution model comparison module 504. The statistical parameter determination module 502 may determine a set of statistical parameters 506, such as a mean and a standard deviation to represent the distribution model (e.g., out0, out1, ..., outN) of the output of the activation function engine 430. In some instances, the statistical parameter determination module 502 may include an arithmetic circuit (e.g., an adder, a multiplier, a divider, etc.) to calculate the mean of the output of the activation function engine 430 (e.g., by calculating the mean) and calculate the standard deviation (e.g., by calculating the average of the squared differences between each output and the mean). Figure 5AIn an example, the statistical parameter determination module 502 can determine that the mean of the output of the activation function engine 430 is equal to m1, and the standard deviation of the output is equal to s1. In some examples, the statistical parameter determination module 502 can calculate the statistical parameters 506 of each neural network layer.

[0078] The distribution model calculation module 504 can compare the statistical parameters 506 of the output of the activation function engine 430 with the reference output statistical parameters 452 to determine whether the input data is inappropriate. The comparison can be based on a set of rules and thresholds defined in the detection configuration data 450 ( Figure 4D ). For example, the distribution model comparison module 504 can apply a two-step comparison scheme. As a first step, the distribution model comparison module 504 can determine the difference between the average value m1 of the output of the activation function engine 430 and the average value xm of the reference output statistical parameter 452. If the difference exceeds a first threshold, the distribution model comparison module 504 can determine that the input data is inappropriate. If the difference between the average values ​​is within the first threshold, the distribution model comparison module 504 can determine the difference between the standard deviation s1 of the output of the activation function engine 430 and the standard deviation σ of the reference output statistical parameter 452. If the difference exceeds a second threshold, the distribution model comparison module 504 can determine that the input data is inappropriate. But if the difference is still within the second threshold, the distribution model comparison module 504 can determine that the input data is appropriate.

[0079] In some examples, the distribution model comparison module 504 can also compare the distribution model of the output of the activation function engine 430 with the distribution model of the reference output using other techniques (such as Kullback-Leibler divergence analysis). To support the Kullback-Leibler divergence analysis, the statistical parameter determination module 502 can perform a binning operation on the output of the activation function engine 430 and the reference output. Figure 5B shows an example of the result of the binning operation. Figure 5BAs shown, the statistical parameter determination module 502 can maintain a set of boxes representing the range of values ​​of the output of the activation function, including boxes for each of x0, x1, x2, x3 and x4. For example, box x0 represents a range centered on x0, box x1 represents a range centered on x1, etc. The output activation function engine 430 and the reference output can be mapped to each box. The count distribution of each box can be obtained to represent the distribution model of the output of the activation function engine 430 and the distribution model of the reference output. For example, the distribution model of the output of the activation function engine 430 can include counts Q0, Q1, Q2, Q3 and Q4 for boxes x0, x1, x2, x3 and x4, respectively. In addition, the distribution model of the reference output can include counts P0, P1, P2, P3 and P4 for boxes x0, x1, x2, x3 and x4, respectively. The statistical parameter determination module 502 can also calculate the probability of each box based on the corresponding counts and total counts of the distribution. For example, the probability that the output of the activation function engine 430 falls into bin x0 can be determined based on the following equation:

[0080]

[0081] In Equation 4, P(0) represents the probability that the output of the activation function engine 430 falls into bin x0, P0 is the count of the output of the activation function engine 430 that falls into bin x0, and P0 is the sum of the counts of the output of the activation function engine 430 across all bins including P0, P1, P2, ..., Pn. The probabilities P(1), P(2), ..., P(n) of other bins can be calculated using Equation 4 to represent the distribution model of the output of the activation function engine 430.

[0082] Furthermore, the probability of the reference output falling into bin x0 can be determined based on the following equation:

[0083]

[0084] In Equation 5, Q(0) represents the probability that the reference output falls into bin x0, Q0 is the count of the outputs that the reference output falls into bin x0, and Q(1) is the sum of the counts of the reference output across all bins including Q0, Q1, Q2, ..., Qn. The probabilities of other bins Q(1), Q(2), ..., Q(n) can be calculated using Equation 5 to represent the distribution model of the reference output.

[0085] The Kulbeck-Leibler (KL) divergence between the distribution model of the output of the activation function engine 430 and the distribution model of the reference output may be calculated based on the following equation:

[0086]

[0087] In Equation 6, represents the KL divergence, which can be obtained by multiplying the probability of the bin of the reference output (Q(i) from Equation 5) and the natural logarithm of the ratio of Q(i) to the probability of the bin of the output of the activation function engine 430 (P(i) from Equation 4). Larger values ​​can indicate larger differences between the distribution models, while smaller values ​​can indicate small differences between the distribution models. The KL divergence value can be compared to a threshold to determine whether the input data is appropriate.

[0088] In some examples, the statistical parameters 506 calculated by the statistical parameter determination module 502 can be used to support other operations, such as debugging operations. Figure 5C As shown, the statistical parameter determination module 502 can generate a record 510 that lists the mean and standard deviation of the activation function output of each neural network layer. The record 510 can be used as a debugging tool to determine, for example, the hardware resources required to support the calculation of each neural network layer. For example, when processing a training data set, the record 510 can be compared with a set of reference mean values ​​and standard deviations of the outputs of the trained neural network. Based on the comparison, it can be determined which layer begins to show a large deviation from the reference mean value and standard deviation. The hardware resources provided for the calculation of the neural network layer can then be adjusted (e.g., by having the computing engine 424 represent more processing nodes, increasing the precision of the arithmetic circuits in the computing engine 424, etc.) to minimize the deviation.

[0089] Figure 6 600 for detecting and handling inappropriate inputs to a neural network. Figure 4A-Figure 5B The various internal components of the neural network processor 402 described in (including, for example, the inappropriate input detection module 432) are executed and may include the techniques described above.

[0090] At operation 602, the inappropriate input detection module 432 receives the computation output of the neural network based on the input data provided by the application from the hardware circuit. The hardware circuit may include an activation function engine 430, and the computation output may include the output of the activation function engine 430 for the computation of the neural network layer.

[0091] At operation 604, the inappropriate input detection module 432 determines a relationship between a computational output of the neural network layer and a reference output generated by processing a training data set set by the neural network. The relationship can be determined based on Figure 4BThe techniques described herein. For example, a pair of thresholds defining a range (e.g., range 466) can be determined based on a standard deviation of a distribution of reference outputs, and each computed output can be compared to the thresholds to determine whether the computed output is within the range. If the computed output is within the range, then the computed output can be determined to be not an outlier, whereas if the computed output is outside the range, then the computed output can be determined to be an outlier. The number of outlier computed outputs can also be counted. As another example, statistical parameters of a distribution model of the computed outputs (e.g., a mean and a standard deviation) can also be determined, and the statistical parameters of the computed outputs and the reference outputs can also be compared based on the distribution model of the computed outputs and the reference outputs. Figure 5A The described techniques are compared.

[0092] At operation 606, the inappropriate input detection module 432 determines that the input data is inappropriate based on the relationship. The determination can be based on, for example, counting the number of outliers that exceed a threshold, such as Figure 4C and Figure 4D The determination may also be based on a comparison of the distribution of the calculated output and the reference output. For example, the mean and standard deviation of the calculated output distribution may be compared to the mean and standard deviation of the reference output distribution that exceeds another threshold, such as with respect to Figure 5A It is also possible to determine the Kullback-Leibler (KL) divergence between the distributions, as described for Figure 5B described.

[0093] At operation 608, the inappropriate input detection module 432 can perform one or more actions based on determining that the input data is inappropriate. In one example, the inappropriate input detection module 432 can provide an application (e.g., Figure 1 The notification may be transmitted during the neural network computation process and / or with the inference result to provide an indication that the input data is inappropriate and / or the inference result is generated based on an inappropriate input data set. In another example, the inappropriate input detection module 432 may also transmit a notification to the computation controller 434 or other software / hardware component that manages the operation of the neural network processor 402, thereby suspending the neural network computation based on the inappropriate input data set.

[0094] Embodiments of the present disclosure may also be described according to the following clauses:

[0095] 1. A method comprising:

[0096] performing computations based on input data received from the application to generate intermediate outputs of the neural network layer;

[0097] generating an output of the neural network layer based on applying an activation function to the intermediate output;

[0098] receiving a mean and a standard deviation of reference outputs of the neural network layer;

[0099] For each of the outputs of the neural network layer:

[0100] determining a difference between each of the outputs and the average;

[0101] comparing the difference to one or more thresholds, the one or more thresholds being determined based on predetermined multipliers of the standard deviation; and

[0102] determining whether each of the outputs is an outlier output based on a result of the comparing;

[0103] determining a total count of said outlier outputs;

[0104] determining that the input data is inappropriate based on a comparison between the total count and a second threshold; and

[0105] Based on determining that the input data is inappropriate, at least one of: transmitting a notification to the application, or pausing computation of a subsequent neural network layer.

[0106] 2. The method of clause 1, further comprising: receiving configuration data indicative of the predetermined multiplier from the application.

[0107] 3. A method according to any of the preceding clauses, wherein the reference output of the neural network layer is obtained by processing a training data set set by a neural network comprising the neural network layer.

[0108] 4. A method according to any of the preceding clauses, further comprising: determining that the input data is inappropriate based on the total number of the outlier outputs of multiple neural network layers.

[0109] 5. A system comprising:

[0110] a hardware circuit configured to receive input data and perform computations of a neural network based on the input data to generate computation outputs; and

[0111] An inappropriate input detection module, wherein the inappropriate input detection module is configured to:

[0112] determining a relationship between the calculated output and a reference output of the hardware circuit;

[0113] determining that the input data is inappropriate based on the relationship; and

[0114] An action is performed based on determining that the input data is inappropriate.

[0115] 6. A system according to clause 5, wherein the input data deviates from a training data set used to train the neural network by at least a predetermined margin.

[0116] 7. A system according to clause 5 or 6, wherein the reference output is generated by the neural network based on processing the training data set.

[0117] 8. A system according to any one of clauses 5 to 7, wherein the hardware circuit comprises:

[0118] an arithmetic circuit configured to perform an arithmetic operation to generate an intermediate output; and

[0119] An activation function circuit is configured to apply an activation function process to the intermediate output to generate the calculation output.

[0120] 9. A system according to any one of clauses 5 to 8, wherein the inappropriate input detection module is configured to determine the relationship between the calculated output and the reference output based on comparing the calculated output with one or more thresholds regarding a mean and a standard deviation of the reference output.

[0121] 10. The system of clause 9, wherein the inappropriate input detection module is configured to:

[0122] For each of the computed outputs:

[0123] determining a difference between said each of said calculated outputs and said average; and

[0124] determining whether each of the calculated outputs is an outlier output based on comparing the difference to a first threshold value based on a predetermined multiple of the standard deviation;

[0125] determining a count of said outlier outputs; and

[0126] The input data is determined to be inappropriate based on comparing the count to a second threshold.

[0127] 11. The system of clause 10, wherein the inappropriate input detection module is configured to receive detection configuration information from an application providing the input data; and

[0128] The detection configuration information includes definitions of the first threshold and the second threshold.

[0129] 12. The system of clause 11, wherein the neural network comprises a plurality of neural network layers; and

[0130] Wherein the inappropriate input detection module is configured to determine, based on the detection configuration information, that the input data is inappropriate based on the count of the outlier outputs in the computational outputs of one of the plurality of neural network layers.

[0131] 13. A system according to clause 12, wherein the inappropriate input detection module is configured to determine that the input data is inappropriate based on the position of the one neural network layer within the neural network based on the detection configuration information.

[0132] 14. A system according to any one of clauses 5 to 12, wherein the inappropriate input detection module is configured to:

[0133] determining a first statistical parameter of the calculated output;

[0134] receiving a second statistical parameter of the reference output; and

[0135] The relationship between the calculated output and the reference output is determined based on comparing the first statistical parameter to the second statistical parameter.

[0136] 15. The system of clause 14, wherein the neural network comprises a plurality of neural network layers; and

[0137] The inappropriate input detection module is configured to:

[0138] determining a mean and a standard deviation of the computed outputs of each of the plurality of neural network layers; and

[0139] Generating a record of the mean and the standard deviation of the computed outputs of each neural network layer.

[0140] 16. A system according to any one of clauses 5 to 15, wherein the inappropriate input detection module is configured to perform the action, which includes at least one of: transmitting an error notification to an application using the computational output of the hardware circuit, or suspending computation of the neural network layer at the hardware circuit.

[0141] 17. A system according to any one of clauses 5 to 16, wherein the hardware circuit is part of a neural network processor; and

[0142] Wherein the inappropriate input detection module is part of an application interfaced with the neural network processor.

[0143] 18. A method comprising:

[0144] receiving, from the hardware circuit, a computational output of the neural network based on input data provided by the application;

[0145] determining a relationship between the computational output of the hardware circuit and a reference output of the neural network, the reference output being generated by processing a training data set by the neural network;

[0146] determining that the input data is inappropriate based on the relationship; and

[0147] An action is performed based on determining that the input data is inappropriate.

[0148] 19. The method according to clause 18, further comprising:

[0149] receiving a mean and a standard deviation of a distribution of the reference outputs;

[0150] Wherein determining the relationship between the calculated output of the hardware circuit and the reference output comprises:

[0151] determining a difference between each of the calculated outputs and the average; and

[0152] The input data is determined to be inappropriate based on comparing the difference to a threshold value derived from the standard deviation.

[0153] 20. The method of clause 18 or 19, wherein the action comprises at least one of: transmitting an error notification to the application, or suspending computation of the neural network at the hardware circuit.

[0154] Figure 7 An example of a computing device 700 is shown. The functions and / or several components of the computing device 700 can be used with other embodiments disclosed elsewhere in the present disclosure without limitation. The computing device 800 can perform calculations to facilitate the processing of tasks. As an illustrative example, the computing device 800 can be part of a server in a multi-tenant computing service system. Various hardware and software resources of the computing device 700 (e.g., hardware and software resources associated with providing image recognition services) can be allocated to clients upon request.

[0155] In one example, computing device 700 may include processing logic 702, bus interface module 708, memory 710, and network interface module 712. These modules may be hardware modules, software modules, or a combination of hardware and software. In some cases, without departing from the scope of the present disclosure, modules may be used interchangeably with components or engines. Computing device 700 may include other modules not shown here. In some embodiments, computing device 700 may include fewer modules. In some embodiments, one or more modules in a module may be combined into one module. One or more modules in a module may communicate with each other via communication channel 714. Communication channel 714 may include one or more buses, grids, matrices, fabrics, a combination of these communication channels or some other suitable communication channels.

[0156] Processing logic 702 may include one or more integrated circuits, which may include an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a system on a chip (SoC), a network processing unit (NPU), a processor configured to execute instructions, or any other circuit system configured to perform logical arithmetic operations and floating point operations. Examples of processors that may be included in processing logic 702 may include a processor that is composed of Processors developed by etc. In some embodiments, the processor may include multiple processing cores, wherein each processing core may be configured to execute instructions independently of other processing cores. In addition, in some embodiments, each processor or processing core may implement multiple processing threads that execute instructions on the same processor or processing core, while maintaining the logical separation between the multiple processing threads. Such processing threads executed on a processor or processing core may be exposed to software as a separate logical processor or processing core. In some embodiments, multiple processors, processing cores, or processing threads executed on the same core may share certain resources, such as a bus, a level 1 (L1) cache, and / or a level 2 (L2) cache. The instructions executed by the processing logic 702 may be stored on a computer-readable storage medium, for example, in the form of a computer program. The computer-readable storage medium may be non-temporary. In some cases, the computer-readable medium may be a part of the memory 710. The processing logic 702 may also include a hardware circuit system for performing artificial neural network calculations (including, for example, one or more neural network processors 402, etc.).

[0157] Access to processing logic 702 may be granted to a client to provide the personal assistant service requested by the client. For example, computing device 700 may host a virtual machine on which an image recognition software application may be executed. The image recognition software application, when executed, may access processing logic 702 to predict, for example, objects contained in an image. As another example, access to processing logic 702 may also be granted as part of a bare metal instance, where an image recognition software application executing on a client device (e.g., a remote computer, a smart phone, etc.) may directly access processing logic 702 to perform recognition of an image.

[0158] The memory 710 may include both volatile or nonvolatile or volatile and nonvolatile types of memory. The memory 710 may include, for example, random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, and / or some other suitable storage medium. In some cases, part or all of the memory 710 may be inside the computing device 700, while in other cases, part or all of the memory may be outside the computing device 700. The memory 710 may store an operating system, which includes executable instructions for providing an execution environment for executing instructions that provide networking functions for the computing device 700 when executed by the processing logic 702. The memory 710 may also store, for example, software applications for performing artificial neural network calculations. For example, the memory 710 may store software routines related to the calculation of the above equation. In the case where the processing logic 702 is in the form of an FPGA, the memory 710 may store netlist data representing various logic circuit components of the processing logic 702. In some instances, the memory 710 may include the memory 412.

[0159] The bus interface module 708 can realize communication with external entities such as other components in the host device and / or computing system through an external communication medium. The bus interface module 708 may include a physical interface for connecting to a cable, a socket, a port or other connection to an external communication medium. The bus interface module 708 may further include hardware and / or software for managing incoming and outgoing transactions. The bus interface module 708 may implement a local bus protocol, such as a protocol based on a peripheral component interconnect (PCI), a non-volatile memory express (NVMe), an advanced host controller interface (AHCI), a small computer system interface (SCSI), a serial attached SCSI (SAS), a serial AT attachment (SATA), a parallel ATA (PATA), other standard bus protocols or proprietary bus protocols. The bus interface module 808 may include a physical layer for any one of these bus protocols, including connectors, power management and error handling, etc. In some embodiments, the computing device 700 may include multiple bus interface modules for communicating with multiple external entities. These multiple bus interface modules may implement the same local bus protocol, different local bus protocols or a combination of the same bus protocol and different bus protocols.

[0160] The network interface module 712 may include hardware and / or software for communicating with a network. This network interface module 712 may include, for example, a physical connector or physical port for being wired to a network, and / or an antenna for wirelessly communicating to a network. The network interface module 712 may further include hardware and / or software configured to implement a network protocol stack. The network interface module 712 may use a network protocol to communicate with a network, such as TCP / IP, Infiniband, RoCE, Institute of Electrical and Electronics Engineers (IEEE) 802.11 wireless protocol, user datagram protocol (UDP), asynchronous transfer mode (ATM), token ring, frame relay, high-level data link control (HDLC), fiber distributed data interface (FDDI) and / or point-to-point protocol (PPP), etc. In some embodiments, the computing device 700 may include multiple network interface modules, each of which is configured to communicate with different networks. For example, in these embodiments, the computing device 700 may include a network interface module for communicating with a wired Ethernet network, a wireless 802.11 network, a cellular network, an Infiniband network, etc. In some embodiments, the computing device 700 may receive a set of parameters for generating a forget gate factor, an input factor, an output factor, etc., such as the weight vector described above, from a server through the network interface module 712 .

[0161] The various components and modules of the computing device 700 described above may be implemented as discrete components, system on chip (SoC), ASIC, NPU, FPGA, or any combination thereof. In some embodiments, the SoC or other components may be communicatively coupled to another computing system to provide various services, such as traffic monitoring, traffic shaping, computation, etc. In some embodiments of the described technology, the SoC or other components may include multiple subsystems as disclosed herein.

[0162] The modules described herein may be software modules, hardware modules, or a suitable combination thereof. If the modules are software modules, the modules may be embodied on a non-transitory computer-readable medium and processed by a processor of any of the computer systems described herein. It should be noted that the described processes and architectures may be executed in real time or in an asynchronous mode prior to any user interaction. The modules may be configured in the manner suggested in the figure, and / or the functions described herein may be provided by one or more modules that exist as separate modules, and / or the module functions described herein may be distributed over multiple modules.

[0163] Accordingly, the specification and drawings are to be regarded in an illustrative rather than a restrictive sense. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the present disclosure as set forth in the claims.

[0164] Other variations are within the spirit of the present disclosure. Thus, while the disclosed technology is susceptible to various modifications and alternative constructions, certain illustrated embodiments thereof are shown in the drawings and have been described in detail above. However, it should be understood that it is not intended to limit the present disclosure to the specific form or forms disclosed, but on the contrary, it is intended to cover all modifications, alternative constructions, and equivalents that fall within the spirit and scope of the present disclosure as defined by the appended claims.

[0165] Unless otherwise indicated herein or clearly contradicted by context, the terms "a / an" and "the" and similar referents used in the context of describing the disclosed embodiments (particularly in the context of the following claims) should be interpreted as covering both the singular and the plural. Unless otherwise indicated herein or clearly contradicted by context, the terms "comprising", "having", "including" and "containing" should be interpreted as open-ended terms (i.e., meaning "including but not limited to") unless otherwise indicated. The term "connected" should be interpreted as partially or completely contained within, attached to, or joined together, even in the presence of intermediates. Unless otherwise indicated herein, the recitation of ranges of values ​​herein is intended merely to serve as a shorthand method of referring individually to each individual value falling within the range, and each individual value is incorporated into the specification as if the individual value were recited individually herein. Unless otherwise indicated herein or clearly contradicted by context, all methods described herein can be performed in any suitable order. Unless otherwise stated, the use of any and all examples or exemplary language (e.g., "such as") provided herein is intended only to better illustrate the embodiments of the present disclosure and is not intended to limit the scope of the present disclosure. No language in this specification should be construed as indicating any unclaimed element as being essential to the practice of the present disclosure.

[0166] Unless expressly stated otherwise, disjunctive language such as the phrase "at least one of X, Y, or Z" is intended to be understood in the context of being generally used to express that an item, term, etc. can be X, Y, or Z, or any combination thereof (e.g., X, Y, and / or Z). Thus, such disjunctive language is generally not intended to, and should not, imply that certain embodiments require that at least one of X, at least one of Y, or at least one of Z each be present.

[0167] Various embodiments of the present disclosure are described herein, including the best modes known to the inventors for implementing the present disclosure. After reading the above description, it may become apparent to those of ordinary skill in the art that the variations of those embodiments may become apparent. The inventors anticipate that the technician may adopt such variations when appropriate, and the inventors intend to practice the present disclosure in other ways different from the ways specifically described herein. Therefore, where permitted by applicable law, the present disclosure includes all modifications and equivalents of the subject matter recited in the appended claims. In addition, unless otherwise indicated herein or clearly contradictory to the context, the present disclosure encompasses any combination of the above elements in all possible variations thereof.

Claims

1. A system comprising: a hardware circuit configured to receive input data and perform computations of a neural network based on the input data to generate computation outputs; as well as An inappropriate input detection module, wherein the inappropriate input detection module is configured to: determining a relationship between the computed output of the hardware circuit and a reference output based on comparing the computed output to one or more thresholds about a mean and a standard deviation of a reference output, wherein the reference output is generated by the neural network based on processing a training data set used to train the neural network; determining that the input data is inappropriate based on the relationship; as well as An action is performed based on determining that the input data is inappropriate. 2 . The system of claim 1 , wherein the input data deviates from the training data set by at least a predetermined margin.

3. The system according to claim 1 or 2, wherein the hardware circuit comprises: an arithmetic circuit configured to perform an arithmetic operation to generate an intermediate output; as well as An activation function circuit is configured to apply an activation function process to the intermediate output to generate the calculation output.

4. The system of claim 1, wherein the inappropriate input detection module is configured to: For each of the computed outputs: determining a difference between said each of said calculated outputs and said average; and determining whether each of the calculated outputs is an outlier output based on comparing the difference to a first threshold value based on a predetermined multiple of the standard deviation; determining a count of said outlier outputs; as well as The input data is determined to be inappropriate based on comparing the count to a second threshold.

5. The system of claim 4, wherein the inappropriate input detection module is configured to receive detection configuration information from an application providing the input data; and The detection configuration information includes definitions of the first threshold and the second threshold.

6. The system of claim 5, wherein the neural network comprises a plurality of neural network layers; and Wherein the inappropriate input detection module is configured to determine, based on the detection configuration information, that the input data is inappropriate based on the count of the outlier outputs in the computational outputs of one of the plurality of neural network layers.

7. The system of claim 6, wherein the inappropriate input detection module is configured to determine that the input data is inappropriate based on a position of the one neural network layer within the neural network based on the detection configuration information.

8. The system according to claim 1 or 2, wherein the inappropriate input detection module is configured to: determining a first statistical parameter of the calculated output; receiving a second statistical parameter of the reference output; and The relationship between the calculated output and the reference output is determined based on comparing the first statistical parameter to the second statistical parameter.

9. The system of claim 1 or 2, wherein the neural network comprises a plurality of neural network layers; and The inappropriate input detection module is configured to: determining a mean and a standard deviation of the computed outputs of each of the plurality of neural network layers; and Generating a record of the mean and the standard deviation of the computed outputs of each neural network layer.

10. The system of claim 1 or 2, wherein the inappropriate input detection module is configured to perform the action, the action comprising at least one of: transmitting an error notification to an application using the computational output of the hardware circuit, or suspending computation of the neural network layer at the hardware circuit.

11. A method comprising: receiving, from the hardware circuit, a computational output of the neural network based on input data provided by the application; determining a relationship between the computed output of the hardware circuit and a reference output of the neural network based on comparing the computed output to one or more thresholds about a mean and a standard deviation of a reference output, the reference output being generated by processing a training data set by the neural network, wherein the reference output is generated by the neural network based on processing a training data set used to train the neural network; determining that the input data is inappropriate based on the relationship; as well as An action is performed based on determining that the input data is inappropriate.

12. The method of claim 11, wherein the action comprises at least one of: transmitting an error notification to the application, or suspending computation of the neural network at the hardware circuit.