简略阅读《Guiding Deep Learning System Testing using Surprise Adequacy》

Guiding Deep Learning System Testing using Surprise Adequacy

Abstract

深度学习(DL)系统正迅速被应用于安全和安全关键领域,迫切需要测试其正确性和鲁棒性的方法。DL系统的测试传统上依赖于手工收集和标记数据。近年来,人们提出了许多基于神经元激活值的覆盖标准。这些标准本质上是计算在DL系统执行过程中,满足某些特性(如超过预定义阈值)的激活神经元的数量。然而,现有的覆盖标准不够细粒度,无法捕获DL系统所表现出的微妙行为。此外,评估的重点是显示对抗性例子和提出的标准之间的相关性,而不是评估和指导它们在DL系统实际测试中的使用。我们提出了一种新的用于DL系统测试的测试充分性标准,称为深度学习系统的惊喜充分性(SADL),该标准基于DL系统对其训练数据的行为。我们衡量一个输入的惊喜DL系统行为的差异之间的输入和训练数据(例如,学会了在训练),随后开发这个作为一个充分性准则:一个好的测试输入应该足够但不公开的令人惊讶的训练数据相比。使用从简单图像分类器到自动驾驶汽车平台的DL系统进行的经验评价表明,通过再训练,基于输入惊喜的系统采样可以将DL系统相对于对抗性例子的分类准确率提高77.5%

Introduction

  • 最值得注意的是,旨在增加结构覆盖率[4]的传统白盒测试技术对DL系统不是很有用,因为它们的行为没有在控制流结构中明确编码。
  • 第一个假设本质上是对变质测试[11]本质的概括:如果DL系统的两个输入相对于某种人类感觉是相似的,那么输出也应该是相似的。
  • 第二个假设也是基于更传统的软件测试结果[15],即输入集越多样化,对DL系统的测试就越有效。
  • 目前提出的覆盖标准还不够细粒度,只是简单地计算激活值满足一定条件的神经元。虽然这种计数聚合确实允许测试人员量化给定输入集的测试有效性,但它传递的关于单个输入的信息很少。
  • 不是很能解释清楚为什么NC应该被认为比NC低的神经元更好以及其原因:某些输入可能会比其他输入自然激活更多高于阈值的神经元,反之亦然。
  • 同样,关于这些激活超出观察范围的程度的信息在聚合过程中会丢失,这使得很难评估每个输入的相对值。
  • 为了使测试充分性标准在实际中有用,它应该能够指导个体输入的选择,最终导致正在调查的DL系统的准确性的提高。
  • 惊喜的实际测量可以是基于系统在训练期间看到类似输入的可能性(这里是关于使用核密度估计[41]从训练过程中推断出的概率密度分布),或者表示给定输入的神经元激活轨迹和训练数据之间的向量距离(这里简单地使用欧几里得距离)。一组测试输入的惊喜充分性(SA)是由该组覆盖的单个惊喜值的范围来度量的。

SURPRISE ADEQUACY FOR DEEP LEARNING SYSTEMS

Activation Trace and Surprise Adequacy

N = { n 1 , n 2 . . . } \rm N = \{n_1,n_2...\} N={n1,n2...}: a set of neurons that constitutes a DL system D D D
X = { x 1 , x 2 . . . } X = \{x_1, x_2...\} X={x1,x2...}: a set of inputs
a n ( x ) a_n(x) an(x): activation value of a single neuron n with respect to an input x x x
N ∈ N N \in \rm N NN, a N ( x ) a_N(x) aN(x): a vector of activation values, each element corresponding to an individual neuron in N N N
a N ( x ) a_N(x) aN(x):the Activation Trace (AT) of x over neurons in N
A N ( X ) = { a N ( x ) ∣ x ∈ X } A_N(X) = \{a_N(x) \mid x \in X\} AN(X)={aN(x)xX}:a set of activation traces, observed over neurons in N, for a set of inputs X

  • 由于DL系统的行为是沿着数据流而不是控制流驱动的,我们假设所有 N N N相对于 X X X的激活轨迹, A N ( X ) A_N(X) AN(X),完全捕获使用 X X X执行时所调查的DL系统的行为
  • 给定一个训练集 T T T,我们首先利用训练数据集中的每个输入记录所有神经元的激活值,计算出 A N ( T ) A_N(T) AN(T)。随后,给定一个新的输入 x x x,我们通过将 x x x的激活轨迹与 A N ( T ) A_N(T) AN(T)进行比较,来衡量 x x x T T T相比的惊人程度。这种定量的相似性度量被称为惊喜充分性(SA)。
  • 我们引入了SA的两种变体,每种变体都有不同的方法来度量x和AN(T)之间的相似性。
  • 注意,特定类型的DL任务允许我们专注于训练集 T T T的部分,以获得更精确和有意义的SA测量。例如,假设我们正在测试一种分类器与一个新的输入 x x x( c c c类)。 In this case, the surprise of x x x is more meaningfully measured against A N ( T c ) A_N(T_c) AN(Tc), in which T c T_c Tc is the subset of T T T where members are classified as c c c. Basically, the input might be surprising as an example of class c c c even if not surprising in relation to the full set of training examples.
Likelihood-based Surprise Adequacy
  • 核密度估计(KDE)是一种估计给定随机变量的概率密度函数的方法。
  • 由此产生的密度函数允许对随机变量的特定值的相对可能性进行估计。
  • Likelihood-based SA (LSA) uses KDE 来估计 A N ( T ) A_N(T) AN(T)中每个激活值的概率密度,并得到一个新输入相对于估计密度的惊讶度。
  • To reduce dimensionality and computational cost, we only consider the neurons in a selected layer N L ⊆ N N_L ⊆ N NLN, which yields a set of activation traces, A N L ( X ) A_{N_L}(X) ANL(X).
  • To further reduce the computational cost, we filter out neurons whose activation values show variance lower than a pre-defined threshold, t t t, as these neurons will not contribute much information to KDE.
  • Given a bandwidth matrix H H H and Gaussian kernel function K K K, the activation trace of the new input x x x, and x i ∈ T x_i ∈ T xiT, KDE produces density function f ^ \hat f f^ as follows:
    f ^ = 1 A N L ( X ) ∑ x i ∈ T K H ( α N L ( x ) − K H ( α N L ( x i ) ) \hat f = \frac{1}{A_{N_L}(X)} \sum_{x_i \in T} K_H(α_{N_L}(x) - K_H(α_{N_L}(x_i)) f^=ANL(X)1xiTKH(αNL(x)KH(αNL(xi))
  • 因为我们想要测量输入x的惊讶程度,所以我们需要一个当概率密度降低时增加的指标(即,输入比训练数据很少见),反之亦然(即,输入与训练数据相似)。
  • 采用一般的方法将概率密度转换为稀有度[26],[39],我们定义LSA为密度对数的负数:
    L S A ( x ) = − l o g ( f ^ ( x ) ) LSA(x) = -log(\hat f(x)) LSA(x)=log(f^(x))
  • We can exploit this by computing LSA per class, replacing T T T with { x ∈ T ∣ D ( x ) = c } \{x ∈ T | D(x) = c\} {xTD(x)=c} for class c c c. We use per-class LSA for DL classifiers in our empirical evaluation.
Distance-based Surprise Adequacy

在这里插入图片描述

  • 这里,我们使用新输入x的AT与训练中观察到的AT之间的欧氏距离来定义基于距离的惊奇充分性(DSA)。
  • By comparing the distances a1 and a2 (i.e., distance between the AT of a new input and
    the reference point, which is the nearest AT of training data in c1) to distances b1 and b2 (i.e., distance to c2 measured from the reference point), we get a sense of how close to the class boundary the new inputs are.
  • 对于分类问题,更接近类边界的输入在测试输入多样性方面更令人惊讶和有价值。
  • 在没有类边界的情况下,新输入的AT距离另一个训练输入的AT很远,并不保证新输入是令人惊讶的,因为AT可能仍然位于AT空间的拥挤部分。因此,我们只将DSA应用于分类任务中,它比DSA更有效

D D D:a DL system
N N N:a set of neurons
C C C:a set of classes
T T T:a training dataset
A N ( T ) A_N(T) AN(T):activation traces
x x x: a new input
c x ∈ C c_x ∈ C cxC:a predicted class of the new input
x a x_a xa:we define the reference point x a x_a xa tobe the closest neighbour of x x x that shares the same class

  • The distance between x x x and x a x_a xa follows from the definition:
    在这里插入图片描述
    Subsequently, from x a x_a xa, we find the closest neighbour of x a x_a xa in a class other than c x c_x cx, x b x_b xb, and the distance d i s t b dist_b distb, as follows:
    在这里插入图片描述
  • 如果距离 d i s t a dist_a dista(x和 c x c_x cx类的样本的AT距离)和 d i s t b dist_b distb( c x c_x cx类的样本的AT距离和非 c x c_x cx类的AT距离),前者大而后者小说明 x x x would be a surprising input for class c x c_x cx to the classifying DL system D.
  • 虽然有多种方法来形式化这个问题,但我们选择了一个简单的方法,并计算DSA作为 d i s t a dist_a dista d i s t b dist_b distb之间的比率。对更复杂配方的研究留给了未来的工作。
    D S A = d i s t a d i s t b DSA = \frac{dist_a}{dist_b} DSA=distbdista
Surprise Coverage

给定一组输入,我们还可以测量该集覆盖的SA值的范围,称为意外覆盖率(SC)。由于LSA和DSA都是在连续空间中定义的,所以我们使用bucket来定义space of surprise,并定义LSC和DSC。

U U U: an upper bound
B = { b 1 , b 2 , . . . , b n } B = \{b1, b2, ..., bn\} B={b1,b2,...,bn}: buckets that divide (0, U] into n SA segments
SC for a set of inputs X X X is defined as follows:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值