<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>EGIS: Entropy Guided Image Synthesis for Dataset-Agnostic Testing of RRAM-Based DNNs</title></titleStmt>
			<publicationStmt>
				<publisher>IEEE</publisher>
				<date>03/31/2025</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10586788</idno>
					<idno type="doi"></idno>
					
					<author>A Saha</author><author>C Amarnath</author><author>K Ma</author><author>A Chatterjee</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[While resistive random access memory (RRAM) based deep neural networks (DNN) are important for low-power inference in IoT and edge applications, they are vulnerable to the effects of manufacturing process variations that degrade their performance (classification accuracy). However, to test the same post-manufacture, the (image) dataset used to train the associated machine learning applications may not be available to the RRAM crossbar manufacturer for privacy reasons. As such, the performance of DNNs needs to be assessed with carefully crafted dataset-agnostic synthetic test images that expose anomalies in the crossbar manufacturing process to the maximum extent possible. In this work, we propose a dataset-agnostic post-manufacture testing framework for RRAM-based DNNs using Entropy Guided Image Synthesis (EGIS). We first create a synthetic image dataset such that the DNN outputs corresponding to the synthetic images minimize an entropy-based loss metric. Next, a small subset (consisting of 10-20 images) of the synthetic image dataset, called the compact image dataset, is created to expedite testing. The response of the device under test (DUT) to the compact image dataset is passed to a machine learning based outlier detector for pass/fail labeling of the DUT. It is seen that the test accuracy using such synthetic test images is very close to that of contemporary test methods.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>In recent years, resistive random access memory (RRAM) based mixed-signal DNN accelerators have emerged as a promising alternative to fully digital accelerators because of low power consumption, high density and compatibility with CMOS technology of RRAM crossbars <ref type="bibr">[1]</ref>, <ref type="bibr">[2]</ref>. The RRAM based DNN chips store DNN weights using conductances of RRAM cells within crossbars. However, the conductances of RRAM devices are vulnerable to manufacturing process variations resulting in performance loss (as measured by classification accuracy). This necessitates careful performance screening of manufactured devices before field deployment.</p><p>Functional testing of DNN accelerators has been investigated in the past <ref type="bibr">[3]</ref>- <ref type="bibr">[5]</ref>. Further, testing of process variation induced performance (classification accuracy) degradation of RRAM based DNN accelerators has been addressed in <ref type="bibr">[6]</ref>, <ref type="bibr">[7]</ref>. A major limitation of these works is that the test frameworks require access to the training/testing dataset of the DNN.</p><p>In this research, we ask a fundamental question: Is it necessary to have access to the training or testing dataset of a DNN to develop functional tests for DNN hardware? Such access becomes difficult in privacy-critical applications <ref type="bibr">[8]</ref> such as in healthcare, robotics, and defense, where patient data in healthcare for example, cannot be divulged to third parties for privacy reasons. However, model information (such as DNN weights) can be made available to the hardware manufacturer. In such scenarios, dataset-agnostic test methodologies for DNNs are necessary for pass/fail manufacturing test of DNNs without access to the DNN training/testing dataset. We show in this research, that such dataset agnostic testing methods of quality comparable to existing test techniques are indeed possible and deployable using synthetic test datasets (images).</p><p>We first create a set of purely synthetic images using entropy guided image synthesis (EGIS). Next, we derive a compact image dataset from the generated synthetic images using image set compaction. During testing, a response signature is extracted from each DNN by applying the compact image dataset and the signature is passed to a trained outlier detector for pass/fail prediction. While prior work has used generative adversarial network (GAN) to augment test patterns <ref type="bibr">[9]</ref> , training a GAN requires access to the DNN training dataset. To the best of our knowledge, this is the first work that develops test images without access to the original DNN training or testing dataset. In summary, we make the following contributions:</p><p>(1) We propose a novel dataset-agnostic image synthesis algorithm called entropy guided image synthesis (EGIS), suitable for privacy-critical applications, which generates synthetic images for RRAM-based DNN testing.</p><p>(2) An image set compaction algorithm is developed that allows DNN testing with 10-20 synthetic test images, significantly reducing test cost.</p><p>(3) Experiments show that the proposed dataset-agnostic testing framework achieves comparable test accuracy with respect to the state-of-the-art test methodologies that require access to the testing/training dataset of the DNN.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>II. OVERVIEW</head><p>In this section, we explain the dataset privacy model assumed in this work and the overall testing approach. Dataset privacy model: We assume that the end user and the DNN (RRAM crossbar) manufacturer are different entities. The end user has access to the training and testing datasets and is responsible for training the DNN. In our methodology, the end user or organization responsible for training the DNN needs to label D RRAM based manufactured DNNs as "pass" or "fail" and needs to provide the labels to the RRAM manufacturer. This could be from use of prior test algorithms <ref type="bibr">[3]</ref>. The RRAM manufacturer independently designs a compact image dataset which is applied to a manufactured device under Overall testing approach: In the presence of manufacturing process variations, the accuracy of every manufactured DUT varies from its nominal accuracy. For a fixed acceptable accuracy threshold A cutof f and a DUT with accuracy A, the test framework aims at predicting whether A &gt; A cutof f . The overall test framework, as shown in Fig. <ref type="figure">1</ref> involves three steps:</p><p>(1) A synthetic image dataset consisting of N images is generated using a generator neural network, which is trained using an entropy based loss functions to promote diversity within the synthetic image dataset.</p><p>(2) To enable post-manufacture testing using fewer images, we down-select K images from the N images above and create a compact image dataset (K &lt;&lt; N ). The image set compaction is achieved using simulated annealing (3) During testing, a signature is extracted from the DUT by applying the compact image dataset to the DUT. The signature is passed to an outlier detector which predicts whether the DUT is "pass" (A &gt; A cutof f ) or "fail" (A &#8804; A cutof f ).</p><p>Steps (1) and ( <ref type="formula">2</ref>) are executed offline before real time testing and the outlier detector used in step (3) is trained using the D labeled DUTs provided by the end user.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>III. RRAM VARIABILITY MODEL</head><p>DNNs consist of convolution, dense, maxpool and batchnormalization layers. Convolution and dense layers involve matrix vector multiplication and general matrix multiplication, which can be accelerated using RRAM crossbars. Within a crossbar, the (p, q)-th element of a weight matrix W &#8712; R P &#215;Q , w pq is mapped to the (p, q)-th RRAM cell and its conductance is programmed to g pq . We refer the reader to <ref type="bibr">[10]</ref> for details about how DNNs are accelerated using analog crossbars.</p><p>Accurate inference of RRAM based DNNs relies on the assumption that a DNN weight can be precisely mapped to the target conductance within the crossbar. However, measurements from manufactured RRAM crossbars show that programmed conductance within a crossbar deviates from its target conductance due to device-to-device and cycle-to-cycle variations <ref type="bibr">[11]</ref>. Our goal is to model the forward pass of a DNN in presence of RRAM conductance variations.</p><p>For variability modeling, we replace the ideal weight matrix of each layer of the DNN W with an equivalent non-ideal weight matrix W ni , which is calculated as: <ref type="bibr">(1)</ref> We first flatten the weight matrix W &#8712; R P &#215;Q into a flattened weight vector -&#8594; W f l &#8712; R P Q . (2) We calculate a non-ideal flattened weight vector as: shown that device-to-device variation can be inter-chip or intrachip <ref type="bibr">[12]</ref>. Inter-chip variation (also called systematic variation) affects all RRAM cells of a crossbar equally whereas intra-chip variation affects RRAM cells differently. Further, the research of <ref type="bibr">[13]</ref> has shown that RRAM cells which are physically close to each other have correlated intra-chip variation profile.</p><p>As a result intra-chip variation can be modeled as a sum of spatially correlated variation and independent random variation <ref type="bibr">[13]</ref>. Cycle-to-cycle variation can be modeled as independent random variation. Based on these observations, we model the non-ideality coefficient vector as a sum of systematic ( -&#8594; &#1013; sys ),</p><p>By definition, systematic variation affects all RRAM cells of a DNN equally <ref type="bibr">[12]</ref>. As a result, we sample &#968; &#8764; N (0, &#963; 2 sys ) and set -&#8594; &#1013; sys a = &#968; for 1 &#8804; a &#8804; P Q. Following <ref type="bibr">[14]</ref>, we sample all elements of -&#8594; &#1013; rand independently from N (0, &#963; 2 rand ). Here &#963; 2 sys (&#963; 2 rand ) refers to the variance in the elements of non-ideality coefficient vector caused by systematic (random) variation. Calculation of -&#8594; &#1013; cor involves the following steps:</p><p>(1) We compute the spatial correlation matrix &#915; &#8712; R P Q&#215;P Q , where the (a, b)-th element of &#915;, &#947; ab is the correlation between a-th and b-th element of -&#8594; W f l . Within a crossbar, if w f l a and w f l b are d ab distance apart, then we set &#947; ab = exp(-&#955;d ab ), where &#955; is a proportionality constant <ref type="bibr">[15]</ref>. <ref type="bibr">(2)</ref> The spatial covariance matrix is calculated as &#931; = &#915; &#8857; &#963; 2 cor , where &#963; 2 cor represents the variance corresponding to spatial correlation. ( <ref type="formula">3</ref>) Finally, we sample -&#8594; &#1013; cor from &#931;.</p><p>We refer the reader to <ref type="bibr">[11]</ref>- <ref type="bibr">[15]</ref> for more details about RRAM variability modeling.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IV. IMAGE SYNTHESIS</head><p>The goal of the synthetic image dataset (SID) generation is to synthesize a set of images for post-manufacture test without any access to training and testing dataset of the DNN. The key intuition is that when a DNN is used to classify the images from its testing dataset, the DNN outputs produce a constant entropy independent of the individual images. The proposed Fig. <ref type="figure">2</ref>: Generator neural network training entropy guided image synthesis (EGIS) approach trains a generator neural network (GeNN) which maps a set of input noise vectors to images such that when the synthetic images are applied to the DNN, the DNN outputs produce an entropy equal to the entropy corresponding to the original testing dataset. In Section IV-A, we first introduce definitions of class entropy and sample entropy. We show that sample entropy is approximately zero and class entropy scales logarithmically with respect to the number of classes in the testing dataset, irrespective of the pixel values of individual images. Next, in Section IV-B, we explain how the GeNN is trained to create the SID, which has similar class and sample entropies compared to the original testing dataset.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Sample and Class Entropy</head><p>Assume that an ideal DNN (used as a classifier) is trained for an image dataset T = {x n , lab n } N n=1 , with N images from total M classes. The true label of the n-th image x n is lab n . When we apply x n to the ideal DNN, the DNN's final layer neuron outputs consist of M real numbers {y n m } M m=1 . These DNN outputs undergo softmax operation to generate normalized class probabilities as {p n m } M m=1 , where p n m is the probability that the image belongs to class m. The softmax operation is defined as,</p><p>. By definition of an ideal DNN (used as a classifier):</p><p>In the rest of this subsection, we first introduce the concept of entropy in machine learning. Next, we will use Equation ( <ref type="formula">2</ref>) to derive class entropy and sample entropy. Intuitively, class entropy is a measure of the confidence with which a DNN classifies a set of images. A lower class entropy implies that the images are classified with high confidence. On the other hand, a high value of sample entropy indicates that the dataset has a diverse set of images.</p><p>In machine learning, if an image x n is applied to a DNN for classification and the normalized class probabilities (softmax outputs) are {p n m } M m=1 , then the entropy is defined as</p><p>Using this, we define class entropy H c and sample entropy H s as follows: Class Entropy: We derive class entropy as: </p><p>From Equation ( <ref type="formula">6</ref>) and ( <ref type="formula">4</ref>), we have:</p><p>If T is applied to a practical DNN (instead of ideal DNN), Equation (2) holds true approximately (instead of exact equality). As a result, Equation ( <ref type="formula">4</ref>),( <ref type="formula">6</ref>) and ( <ref type="formula">7</ref>) can be modified as:</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Generator Neural Network Training</head><p>We want to create a SID X = {x 1 , x 2 &#8226; &#8226; &#8226; , x N } such that when images from X are applied to a DNN with nominal weights (which are mapped to RRAM crossbars), it satisfies Equation ( <ref type="formula">8</ref>),( <ref type="formula">9</ref>) and <ref type="bibr">(10)</ref>. To achieve this, we use a GeNN with weights &#952;, which takes a &#8486; dimensional noise &#951; &#8712; R &#8486; as its input and maps the noise to an image g &#952; (&#951;). The weights of the GeNN (&#952;) are trained using backpropagation as shown in Fig. <ref type="figure">2</ref>.</p><p>Before training, we fix the probability density function of the noise as P(&#951;) = N (0, I). At every iteration of the optimization, B (B refers to batch size) noise vectors {&#951; b } B b=1 are sampled from P(&#951;). During forward pass (as shown by solid arrows in Fig. <ref type="figure">2</ref> In order to reduce uncertainty in classification (minimize class entropy) and promote diversity of images (maximize sample entropy), we set the loss as L = -exp(H s -H c ). The goal of GeNN training is to minimize L by updating &#952;, i.e., min &#952; L. During backward pass (as shown by dotted arrows in Fig. <ref type="figure">2</ref>), the gradient of L with respect to &#952; is calculated using chain rule of differentiation. Finally, &#952; is updated using Adam optimizer.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Synthetic Image Dataset</head><p>Once the generator neural network is trained, we perform inference using it to create a synthetic image dataset. The synthetic image dataset is created in two steps: <ref type="bibr">(1)</ref> We sample N noise vectors {&#951; 1 , &#951; 2 , &#8226; &#8226; &#8226; , &#951; N } (2) Each sampled noise vector is applied to the generator neural network. Corresponding to the input noise &#951; n , the generator creates a synthetic image x n (for 1 &#8804; n &#8804; N ).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. IMAGE SET COMPACTION</head><p>The SID is a set of N (&#8776; 10 3 ) images that can be potentially used for post manufacture test. However, for practical utility during volume production, it is important to test DUTs using as few images as possible. We develop an image set compaction algorithm to create a compact image dataset (CID) of K images (K &lt;&lt; N ), which are used for efficient post-manufacture test. While it is possible to generate only K images using the approach mentioned in Section IV and use them for testing, such an approach leads to unpredictable post-manufacture test performance because the generated images depend highly on the randomly sampled noises for image generation. On the other hand, the image set compaction algorithm uses signatures from DUTs to down-select images from the SID, leading to reliable performance during post-manufacture test.</p><p>The image set compaction algorithm requires D DUTs which are known to be either "pass" or "fail". The goal is to choose K images which, when used for predicting the D DUTs as "pass" or "fail", are most effective. In this work, we use simulated annealing to pick the compact image dataset.</p><p>Algorithm 1 outlines the overall image set compaction algorithm. As inputs, it requires the SID X , initial and final temperatures T init and T f inal , and D DUTs which are known to be "pass" or "fail". The algorithm starts with K images randomly selected from X . At every iteration of the optimization: <ref type="bibr">(1)</ref> We replace each image in the current solution with a randomly chosen image from X with probability 0. Train a binary classifier with Dtr DUTs which predicts a DUT as "pass" or "fail" from its signature Set T cur = &#961;T cur 36: end while 37: Return C best rate (line 35). At the end, when the temperature reaches below T f inal , the solution which achieves the best reward is set as the compact image dataset for post-manufacture test.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VI. OUTLIER DETECTION</head><p>In this section, we explain the training procedure of the outlier detector (shown in Fig. <ref type="figure">1</ref>), which is used to label a DUT as "pass" or "fail" from the response of the DUT to the CID. The outlier detector is implemented using a binary classifier. Each image of the CID C = {c 1 , c 2 &#8226; &#8226; &#8226; c K } is applied to the D DUTs with known "pass"/"fail" labels. When the k-th image in C, c k is applied to the d-th DUT, the DUT output is a vector of M real numbers -&#8594;</p><p>. The DUT outputs corresponding to all images in C are stacked to generate the DUT signature, i.e., Fig. 4: (a) Best reward in simulated annealing (b) Compact Image Dataset (VGG16, CIFAR-10, K = 4) Each DUT has a label lab d &#8712; {0, 1}, where 1 indicates a "pass" DUT and 0 indicates a "fail" DUT. The overall training data for the classifier is D signatures with associated labels. The goal of training is to fit a function f clf (&#8226;) : R KM &#8594; {0, 1} such that f clf (sig d ) = lab d . We use gradient boosting to fit f clf , where an ensemble of weak learners represent f clf .</p><p>We refer the reader to <ref type="bibr">[16]</ref> for further details on gradient boosting.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VII. RESULTS</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Simulation Setup and Performance Metrics</head><p>We evaluate three DNNs: (1) VGG16 <ref type="bibr">[17]</ref> trained on CIFAR-10 <ref type="bibr">[18]</ref> (nominal accuracy = 93.24%) (2) Mobilenet <ref type="bibr">[19]</ref> trained on CIFAR-10 (nominal accuracy = 91.72%) and (3) VGG16 trained on CIFAR-100 (nominal accuracy = 72.36%). For variability modeling, we define total variance &#963; 2 tot = &#963; 2 sys + &#963; 2 cor + &#963; 2 rand . Following <ref type="bibr">[12]</ref>, we fix &#963; 2 rand = 0.5 &#215; &#963; 2 tot . We define percentage of systematic (spatially correlated) variation as</p><p>) &#215;100%. We simulate for (a) typical variability: 25% (25%) systematic (spatially correlated) variation and (b) extreme systematic variability 50% (0%) systematic (spatially correlated) variation. Table <ref type="table">I</ref> outlines the layers of the GeNN. We sample each noise vector from R 100 . After layer 1-4, we use batch normalization and Relu activation. The final layer of the GeNN uses tanh activation. The generator neural network is trained for 5000 iterations using Adam optimizer <ref type="bibr">[20]</ref> with an initial learning rate of 0. We use 1000 DUTS with known labels ("pass" or "fail") to train the outlier detector. We evaluate the test framework on another 1000 DUTs. During testing, a DUT can fall in either of the four cases: (a) True positive (TP): "pass" predicted as "pass" (b) False negative (FN): "pass" predicted as "fail" (c) False positive (FP): "fail" predicted as "pass" (d) True negative</p><p>TABLE I: Architecture of generator neural network Layer Type Input Channels Output Channels Kernel Size 1 Transpose Convolution 100 256 2 2 Transpose Convolution 256 128 4 3 Transpose Convolution 128 64 4 4 Transpose Convolution 64 32 4 5 Transpose Convolution 32 32 4</p><p>(TN): "fail" predicted as "fail". We define test accuracy T A = We categorize test escapes into critical test escapes (CTE) and benign test escapes (BTE). CTE is calculated as the percentage of DUTs which are predicted as "pass" but their classification accuracy lies in the range A &lt; A cutof f -1%. BTE is calculated as the percentage of DUTs which are predicted as "pass" but their classification accuracy is in the range A cutof f -1% &#8804; A &#8804; A cutof f %. We define A p as the p-th percentile classification accuracy of the 1000 DUTs used for training the outlier detector. We evaluate our test framework for A cutof f = A 50 , A 60 and A 70 . For example, for A cutof f = A 70 , 70% DUTs with highest accuracy are referred as "pass". </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Compact Image Dataset Generation</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Evaluation of the Test Framework</head><p>Fig. <ref type="figure">5a</ref> shows the performance of the proposed test framework for typical variation (VGG16, CIFAR-10). For A cutof f = A 50 , we achieve test accuracy between 88.6-89.9% depending on the number of images K in the CID. For A cutof f = A 60 and A 70 , the test accuracy lies between 90.9-93% and 91.8-93.1% respectively. For all simulation conditions, critical test escape is less than 4.4%, yield loss is less than 4.5% and benign test escape is less than 3.5%. As shown in Fig. <ref type="figure">5b</ref> and Fig. <ref type="figure">5c</ref>, the proposed framework achieves similar test accuracy for Mobilenet trained on CIFAR-10 and VGG-16 trained on CIFAR-100. For extreme variability, (50% systematic, 0% spatially correlated and 50% random) the test framework achieves test accuracy in the range 95-98%, critical and benign test escapes less than 2% and yield loss less than 2.4% (VGG16, CIFAR-10). For Mobilenet trained on CIFAR-10 and VGG-16 trained on CIFAR-100, we observe similar trends.</p><p>The key takeaways from these experiments are: (a) Test accuracy is above 89% for all simulation conditions. (b) Depending on simulation conditions, 4-8 images are appropriate TABLE II: Comparison with dataset-aware test Test Accuracy systematic correlated A cutof f ours [6] 25% 25% A 50 89.9 87.7 A 60 92.1 93.3 A 70 91.8 93.9 50% 0% A 50 95.4 96.4 A 60 96.4 97.4 A 70 97.8 98.1</p><p>for testing. Using 16 images leads to highest test duration whereas using 2 images leads to sub-optimal test accuracy.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Runtime Analysis and Comparison with State-of-the-art</head><p>GeNN training, image set compaction and outlier detection take 94 seconds, 688 seconds and 9ms respectively using NVIDIA A100 GPU (VGG16, CIFAR-10, N = 2048 and K = 4). Since the CID is created offline and real-time testing of RRAM-based DNNs only involves outlier detection, the proposed test framework requires 9ms to test a DUT.</p><p>We compare the proposed framework with the state-of-theart dataset aware test of <ref type="bibr">[6]</ref> (VGG16, CIFAR-10, K = 4). Two major differences between the proposed framework and <ref type="bibr">[6]</ref> are: the work of <ref type="bibr">[6]</ref> assumes access to (a) all images in the original testing dataset and (b) exact classification accuracy of all 1000 DUTs used to train the outlier detector. The proposed framework only assumes access to "pass"/"fail" labels of 1000 DUTs. Table <ref type="table">II</ref> shows that despite lack of access to the original testing dataset and exact accuracies of the 1000 DUTs, for typical process variation the proposed dataset-agnostic test achieves test accuracy within 2.1% of <ref type="bibr">[6]</ref> for a wide range of accuracy cutoff. For extreme systematic variation the test accuracy of dataset-agnostic test is within 1% of <ref type="bibr">[6]</ref> VIII. CONCLUSION We propose a dataset-agnostic post-manufacture test framework for RRAM based DNNs, targeted for privacy critical applications. A novel methodology is proposed to train a generator neural network for creating a synthetic image dataset. An image set compaction algorithm is developed to create a compact image dataset, reducing the test duration during volume production. The proposed framework achieves comparable test accuracy with respect to dataset-aware test.</p></div></body>
		</text>
</TEI>
