Manuscript Offprint
arXiv:2610.40234Unraveling the Efficacy of Neuron Coverage Criteria on Testing Large Language Models
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
XIAONING REN, University of Science and Technology of China, China
JIAYANG SONG, Macau University of Science and Technology, China
CHONGYANG LIU, University of Science and Technology of China, China
JIE LI, University of Science and Technology of China, China
LEI MA, The University of Tokyo, Japan and University of Alberta, Canada
YINXING XUE , Chinese Academy of Sciences, Institute of AI for Industries, China
In the realm of deep learning, a variety of neuron coverage criteria for Deep Neural Networks (DNNs) have been devised to effectively assess the quality of test suites and facilitate the generation of test inputs. Recently proposed coverage criteria, incorporating representation distribution and causal relationships, have infused fresh vitality into this field. However, the focus of previous works is primarily on Convolutional Neural Networks for computer vision, leading to a research gap in exploring coverage testing for language models. Concurrently, with the rise of large language models, transformer-based language models have become increasingly dominant, and numerous ones have sprouted. Therefore, the effectiveness of coverage criteria in transformer-based language tasks, especially with the introduction of novel criteria, remains an unresolved open problem. To tackle it, this study examines these concerns by evaluating a wide range of criteria, including four well-established ones and two state-of-the-art criteria, across three types of transformer-based models: encoder-only, decoder-only, and encoder-decoder models.
Building on previous research, we conduct a comprehensive evaluation across three key areas: regarding test suite properties, 1) Error-revealing capability, i.e., sensitivity to adversarial examples; 2) Diversity, i.e., distribution diversity and sample fairness (category diversity); and regarding test suite generation, 3) Input generation guidance, i.e., the ability to guide the generation of more valuable samples. The experimental results demonstrate that the impact of coverage criteria is multifaceted. For the error-revealing capability of test suites, the additional coverage for erroneous samples over noise samples is only 0.32%. In terms of distribution diversity and sample fairness, 26 and 30 cases, respectively, out of 33 configurations are effectively evaluated. Additionally, incorporating neuron-wise coverage guidance during test suite generation slightly increases the production of adversarial samples by 4.56%.
In conclusion, while current coverage criteria can act as an antidote for assessing simple diversity, they remain largely a placebo for the core task of revealing adversarial errors, particularly when relying on individual criterion. Consequently, their practical application requires carefully evaluating the trade-off between computational overhead and potential benefits given the massive scale of Transformers. However, this low cost-effectiveness ultimately highlights the urgent need to explore and develop more robust and efficient criteria designed specifically for Transformer-based models.
Additional Key Words and Phrases: Deep Neural Network, Neuron Coverage Criteria, Transformer-based Language Model
Corresponding author.
Authors' addresses: Xiaoning Ren, University of Science and Technology of China, China, hnurxn@mail.ustc.edu.cn; Jiayang Song, Macau University of Science and Technology, China, jiayang.song@ieee.org; Chongyang Liu, University of Science and Technology of China, China, lcyyy@mail.ustc.edu.cn; Jie Li, University of Science and Technology of China, China, lijie2000@mail.ustc.edu.cn; Lei Ma, The University of Tokyo, Japan and University of Alberta, Canada, ma.lei@acm.org; Yinxing Xue, Chinese Academy of Sciences, Institute of AI for Industries, China, yxxue@iai.ac.cn.
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
exhibit numerous underlying issues, such as the susceptibility to bugs, degraded performance when dealing with cases outside the training data, and vulnerabilities against adversarial attacks. Considering DNNs are widely deployed on a series of safety-critical applications (e.g., medical image analysis [13, 24, 28] and autonomous vehicle control [7, 25]), software engineering (SE) researchers and industrial practitioners are devoted to preventing such unexpected behaviors with all their might. In particular, testing and evaluating the performance of DNNs from various perspectives have become crucial topics in the SE community to safeguard the quality and further advance the deployment of DNNs in more vital domains [41].
Recent research has shown that the decision logic of DNNs is sensitive to input biases [4, 14]; namely, the comprehensiveness of the testing and evaluation of DNNs are associated with the representativeness of the test suites. Therefore, testing the DNNs with complex characteristics necessitates effective test criteria to measure the degree of representativeness of the test suites and further guide the testing processing. In this context, a series of neuron coverage criteria have been proposed by software engineering practitioners [43]. These criteria are primarily developed to evaluate the extent to which a test suite explores the behavior of a DNN by observing the outputs of neurons within the model. The more thoroughly the test suite explores the model's behavior, the higher its representativeness. For instance, neuron coverage (NC) [31] quantifies the proportion of activated neurons during testing, which considers a higher neuron coverage implies a more comprehensive exploration of the behavioural space of the DNN model as well as an extensive understanding of the corresponding decision-making capabilities. As a result, these criteria have become essential for assessing the quality of test suites and facilitating the effective testing of DNNs.
Interest in coverage testing techniques for DNNs has been steadily increasing. Since the introduction of DeepXplore by Pei et al. in 2017 [31], which pioneered the use of neuron coverage as a testing criterion, subsequent research [12, 17, 26, 27, 36, 40, 47] has expanded on this approach by developing novel criteria to improve DNN testing across various dimensions. It is worth noting that most of these criteria are designed from the perspective of structural coverage; namely, the output of the structural elements (i.e., individual neurons or neuron combinations) are utilized with specific operations to derive a statistical analysis regarding the degree of coverage of such elements. In tandem, some critical analysis [10, 16, 22, 43, 44, 46] of these criteria has emerged, highlighting limitations such as the insufficient correlation between some criteria and model quality, which pose concerns regarding the effectiveness and generalizability of these criteria. Despite these limitations, the positive impacts of coverage criteria have also been acknowledged [43]. These discussions have catalyzed the ongoing evolution of coverage testing. Recent two studies, further encouraging and promoting the development of this field, demonstrated the efficacy of their coverage criteria [17, 47], adopting representation distribution and causality, respectively. Therefore, coverage testing remains crucial for assuring the quality of neural networks.
Unlike traditional DNNs, Large Language Models (LLMs) with transformer architecture [39] as backbones are characterized by their self-attention mechanism, free-form auto-regressive generation format and generalization abilities across a diverse spectrum of tasks, which initiate a significant breakthrough in the field of Artificial Intelligence (AI). This innovation has recently gained substantial popularity due to the surge of LLM-empowered applications [3, 8, 38]. With an increasing number of applications employing transformer-based models to extend their functionalities, it becomes even more vital to safeguard the quality and reliability of such models. Nevertheless, previous work has primarily focused on fully connected networks and convolutional neural networks in the computer vision domain, with few attempts on transformer-based models. These models have a much larger number of neurons, increasing algorithmic complexity and leading to significantly higher computational costs. Therefore, one question thereupon arises that:
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
3
What and to what extent neuron coverage criteria are still effective in the context of testing transformer-based language models?
To explore this research question, in this paper, we are dedicated to investigating the effectiveness of a series of commonly studied neuron coverage criteria on different transformer-based language models. In particular, our first step involves a detailed review of existing neuron coverage criteria from two key perspectives: coverage granularity and algorithmic complexity. We categorize the neuron coverage criteria into three levels of granularity: single neuron, intra-layer neuron combinations, and inter-layer neuron combinations. Through a complexity analysis, we identify the criteria that can be applied to transformer-based language models, which have a large number of parameters while maintaining reasonable computational overhead. From this analysis, we select a representative set of criteria, which includes coverage criteria at all levels of granularity and incorporates two state-of-the-art criteria that have not been considered in earlier studies. In the second step, we conduct a comprehensive evaluation of these criteria on transformer-based language models, focusing on the following aspects: 1) Error-Revealing Capability (RQ1): whether the criterion is sensitive to corner-case samples, thereby revealing the error-revealing capability of a test suite. 2) Diversity (RQ2 and RQ3): whether the criterion correlates positively with the distribution diversity and category diversity of samples, reflecting the overall diversity of a test suite. 3) Input Generation Guidance (RQ4): whether the criterion can serve as effective guidance for selecting operators during the sample generation process, thereby aiding in the creation of valuable samples.
Extensive experiments are conducted, including seven coverage criteria and five transformer-based models on four downstream tasks. The experimental results indicate that traditional neuron coverage criteria can be helpful for testing transformer-based language models in some cases, but in others, they offer little benefit. Specifically, for the test suite properties of distribution diversity and sample fairness, 26 and 30 cases, respectively, out of 33 configurations, are satisfied, indicating that most cases meet the criteria but with some exceptions. During the test suite generation process, adding neuron-wise coverage guidance slightly increases the generation of adversarial samples by 3.35%. However, for error-revealing capability, the additional coverage for erroneous samples compared to noisy samples is only 0.32%, suggesting that the coverage information gained from erroneous samples largely comes from the fact that they are novel inputs. Notably, coverage criteria such as NLC+, which are sensitive to the input order of the test suite, can exhibit a certain degree of randomness. Overall, when properly applied, coverage criteria can serve as an antidote, but if misapplied, they risk becoming a placebo. In other words, coverage criteria should be used as complementary tools, and testing can be enhanced by combining multiple criteria for more comprehensive evaluation. Our contributions are outlined as follows:
-
To the best of our knowledge, this study is the first to explore the efficacy of traditional neuron coverage criteria on transformer-based language models. Additionally, we consider a wide range of criteria, including two state-of-the-art criteria that have not been examined in earlier studies.
-
We provide a novel analysis of most commonly applied existing neuron coverage criteria from the perspectives of coverage granularity and computational complexity, offering valuable insights for practitioners.
-
We introduce a comprehensive evaluation covering three critical aspects: the error-revealing capability and diversity of test suite properties, as well as the input generation guidance during test suite creation.
Category diversity is also referred to as sample fairness. Throughout this paper, we use these two terms interchangeably.
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue

Fig. 1. Three forms of neuron coverage: single neuron, intra-layer neuron combination, and inter-layer neuron combination. The red circles highlight unit , unit and unit , which are examples of three forms, respectively.
- We replicate multiple traditional neuron coverage criteria on transformer-based models across various language tasks, and we open-source our implementation to facilitate the broader adoption and validation of transformer-based language models.
To promote research on the safety of transformer-based language models in complex multilingual contexts, we make all source code publicly available at LLMCoverageKit. We provide the essential background and highlight the motivation in Section 2. Section 3 provides a comprehensive analysis of the target coverage. Section 4 details the workflow of our study and reports the corresponding experimental results. Finally, Section 5 covers related research work, Section 6 discusses threats to validity, and Section 8 concludes the paper.
2 BACKGROUND AND MOTIVATION
In the following section, we first provide essential information for neuron coverage criteria and transformer-based language models, then we introduce the current research gaps, summarize the open problems, and present the overall workflow of our study.
2.1 Neuron Coverage Criteria
Neuron coverage criteria are crucial techniques used in neural network testing to guide a comprehensive testing process. Following the simplest form of criterion NC by DeepXplore, several extended criteria have emerged. These criteria consider a single neuron or a set of associated neurons as an individual unit. Theoretically, neuron coverage criteria quantify the extent to which the constituent units of a neural network are explored by a test suite. While the specific definition may vary based on context and analysis goals, a general definition of neuron coverage is as follows:
Definition 2.1.1 (Neuron Coverage) Consider a neural network represented as . It is common practice to abstract the network into multiple coverage units (based on one or more neurons), often defined by specific coverage criteria. For instance, we partition the neural network into coverage units, and this set of units can be denoted as . Let be a test suite, where denotes the coverage feature value of when test suite is input into the neural network, represented as . Applying the feature values to the coverage algorithm results in , which quantifies the coverage of . This can be expressed as follows:
Intuitively, Definition 2.1.1 defines that for a given neural network f and a test suite D, each coverage criterion encompasses a unit partitioning method and a corresponding algorithm . The summation of coverage feature values across all units within the set U yields the coverage value for the test suite when applied to the neural network f. At times, it has been attempted to compute the normalized value by dividing it by the total number of units.
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
5

Fig. 2. A transformer-based language model can be constructed using an encoder, a decoder, or a combination of both, along with task-specific layers. The encoder typically employs Multi-Head Attention, while the decoder utilizes Masked Multi-Head Attention.
. As shown in Figure 1, a neural network with multiple layers can be partitioned into various granularity units based on specific coverage criteria. For example, unit represents a single neuron granularity, unit represents a combination of neurons within the same layer, and unit represents a combination of neurons across different layers. Considering a case with two specific neuron coverage criteria, where a coverage unit refers to a single neuron and if else , where is a user-defined threshold, the function value of will be 1 as long as any of the output vectors of the neuron exceed the threshold , indicating that the neuron is activated. Therefore, coverage( ) represents the total number of activated neurons. This represents the most classic form of neuron coverage [31]. Alternatively, when a unit refers to a combination of all neurons within a network layer and , where represents the covariance matrix, coverage( ) represents the L1 norm of the covariance matrices across all network layers. This is known as NLC [47], the state-of-the-art neuron coverage criteria, which adopts to represent the DNN coverage, where is the number of neurons and denotes the correlation between neuron and .
However, it is worth noting that the majority of research efforts have primarily focused on image-based tasks. Only DeepCruiser [12] and NLC have made some attempts to process text-related tasks, and these have predominantly been limited to simpler models such as RNNs and LSTMs. As a result, for transformer-based language models, which have gained popularity in recent years, the application of neuron coverage criteria remains largely unexplored.
2.2 Transformer-based Language Model
In contrast to conventional RNN and CNN architectures, the transformer architecture, known for its self-attention mechanism [39], effectively captures contextual relationships among words and tokens in text. Consequently, models designed based on this structure have achieved state-of-the-art performance in numerous language tasks and are commonly referred to as transformer-based language models. As shown in Figure 2, the self-attention mechanism is the core technology of the transformer architecture. The self-attention block computes the representation of each token by considering its relationship with all other tokens in the sequence. This is achieved using query (q), key (k), and value (v) vectors, where the attention score is calculated as:
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue

Fig. 3. Comprehensive evaluation of neuron coverage criteria on transformer-based language models across three key aspects.
with being the dimension of the key vectors. The transformer architecture includes two important modules: the encoder and the decoder, both centered around the self-attention block. The encoder, as an auto-encoding module, encodes the input into a latent representation, while the decoder, as an auto-regressive module, generates each token in the sequence one at a time, conditioning on the previously generated tokens. Practitioners can choose to use only the encoder, only the decoder, or both and add optional task-specific layers to form transformer-based language models. These choices represent three classic transformer-based model architectures.
In recent years, the transformer architecture has seen increased adoption due to its outstanding performance across various fields. Transformer-based language models are widely integrated into various software applications used in daily work and life, necessitating high safety standards and improved testing to further enhance model quality. These models have two key characteristics: large-scale model size and the self-attention mechanism, which make them more complex and harder to understand compared to traditional models. Many testing methods have been proposed for these models, but most are variants of traditional testing approaches, primarily black-box testing, and lack awareness of the internal neuron behavior within the models, i.e., they lack testing attempts guided by neuron coverage criteria.
2.3 Motivation and Our Study
Motivation. The transformer architecture has revolutionized deep learning, particularly in natural language processing, leading to widespread societal and everyday applications. Ensuring the safety and security of these models is now a critical concern, presenting urgent challenges in testing and improvement. Neuron coverage testing, primarily designed for image processing models like DNNs and CNNs, has shown its value in various applications. Therefore, it is essential to explore and comprehensively evaluate neuron coverage criteria for testing transformer-based language models. Although there have been a few empirical studies on neuron coverage criteria, these studies have primarily evaluated older models and tasks, lacking recent state-of-the-art benchmarks. Furthermore, these studies have focused on traditional networks (excluding transformer architectures) and image tasks (with minimal focus on text tasks). Neuron coverage testing for transformer-based language models remains largely unexplored. This presents a pressing research question: To what extent are neuron coverage criteria effective for transformer-based language models, and how can their effectiveness be comprehensively evaluated?
Our study. To bridge the aforementioned research gap, we conduct an empirical study to evaluate the effectiveness of coverage criteria on transformer-based language models as shown in Figure 3. Since this study requires exploring internal neuron information, the target models must be open source. As noted in Section 2.2, the core modules of transformers are the encoder and decoder. Therefore, we evaluate widely-used language models encompassing encoder-only (e.g.,
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
7

Fig. 4. An illustration depicting all neuron coverage criteria. From top to bottom, left to right, it sequentially presents the intuitive visual representation of three parts (with distinct background colors): single neuron, intra-layer neuron combination, and inter-layer neuron combination criteria.
BERT, RoBERTa, Albert), decoder-only (e.g., GPT-2, LLaMa), and encoder-decoder (e.g., T5) architectures, covering all types of transformers. Given the diverse coverage criteria available, we first perform a detailed analysis and summary of these criteria based on coverage unit granularity and algorithm complexity. Considering the large parameter sizes of transformer-based language models, only polynomial-time algorithms are feasible. As mentioned in Section 2.1, neuron coverage includes various granularities. Therefore, we evaluate the coverage criteria, including the latest state-of-the-art criteria, covering granularities such as single neuron (indicated by circles), intra-layer neuron combination (indicated by diamonds), and inter-layer neuron combination (indicated by squares). Ultimately, we conduct evaluations from three distinct aspects: Error-Revealing Capability and Diversity, which are related to test suite properties, and Input Generation Guidance, which pertains to test suite generation, unraveling the efficacy of neuron coverage criteria on transformer-based language models.
3 NEURON COVERAGE REVIEW: GRANULARITY & COMPLEXITY
Since DeepXplore [31] introduced the concept of neuron coverage in 2017, numerous neuron coverage criteria have been developed. These criteria encompass extensive structural coverage and limited non-structural coverage, with structural coverage being the predominant type. Structural coverage assesses the coverage of specific elements within a DNN during testing, primarily focusing on various forms of neuron coverage. In contrast, non-structural coverage ignores structural elements and instead evaluates the difference in DNN behaviors between a test input and the training data, termed surprise adequacy (SA). Neuron coverage and its extended versions are classified under structural coverage, which is the focus of this study. Despite numerous works introducing these criteria, a systematic summary is lacking. This chapter aims to provide a detailed analysis of various criteria, considering coverage unit granularity and algorithm complexity. Next, we will use Figure 4 as an illustrative example to conduct a detailed analysis of these two aspects. Finally, we will identify and select feasible and representative neuron coverage criteria for our evaluation.
Symbols and Notations. Given a neural network with layers , where each layer has neurons respectively, the total number of neurons is , and the total number of edges is
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
Table 1. Here are the details of each coverage criterion, including the subject models, datasets, memory complexity, and computational complexity. The "√" and "×" symbols in the last two columns indicate whether the complexity is polynomial and whether the criteria are used in this paper. The and represent the sizes of the training set and test suite, respectively. The , and represent the number of neurons, layers, and edges in the target model, respectively, and represents the number of neurons in the -th layer.
| Coverage Unit | Coverage Criteria | Model | Dataset | Memory Complexity | Computation Complexity | Polynomial | Used |
|---|---|---|---|---|---|---|---|
| Single Neuron | NC [31] /NC+ [27] | FCN CNNResNet | Image PDFAndroid | ✓ | ✓ | ||
| KMNC [27] | CNN ResNet | Image | ✓ | ✓ | |||
| NBC [27] | CNN ResNet | Image | ✓ | ✓ | |||
| SNAC [27] | CNN ResNet | Image | ✓ | ✓ | |||
| IDC [15] | CNN | Image | —— | —— | —— | ✕ | |
| Intra-layer Neuron Combination | TKNC/TKNP [27] | CNN ResNet | Image | ✓ | ✕ | ||
| NLC/NLC+ [47] | CNN MobileNetLSTM GAN | Image Text | ✓ | ✓ | |||
| CTC [26] | FCN | Image | ✕ | ✕ | |||
| Inter-layer Neuron Combination | ResNet VGGLeNet | Image | ✓ | ✓ | |||
| SS [36] | FCN | Image | ✓ | ✕ | |||
| Pcov [40] | FCN | Image | ✕ | ✕ | |||
| NPC [42] | CNN | Image | —— | —— | —— | ✕ |
. The training set is denoted as , and the test suite is denoted as , with and representing the sizes of the datasets. Given a sample, the computational cost for one inference by the neural network is denoted as . Typically, the cost of neuron coverage criterion consists of two parts: 1). Performing one inference for all samples in the test suite, with a computational cost of and a memory cost of . 2). The cost of computing the coverage criterion. For the first part, the time cost is generally acceptable and is the same for each criterion. Therefore, our focus will be on the complexity analysis of the second part.
-
NC/NC+ (Neuron Coverage): This criterion represents the proportion of activated neurons among all neurons. NC measures the proportion of neurons with activation greater than 0, while NC+ measures the proportion with activation above a certain threshold. Each neuron needs to record a boolean variable, i.e., whether it is activated, resulting in a memory complexity of . Calculating activation is a constant time operation, but this must be performed for each sample in the test suite. Consequently, the computational complexity is .
-
KMNC (K-Multisection Neuron Coverage): First, the maximum and minimum values for each neuron are initialized using the training set, introducing an additional computational complexity of and a storage complexity of . Each neuron is then divided into intervals, and the proportion of activated intervals (i.e., the presence of at least one sample with an activation value within the interval) is calculated. Since checking if a value falls within an interval is a constant time operation, the memory complexity comes from the initialization and the activation record for each interval , resulting in . The computational complexity is .
-
NBC (Neuron Boundary Coverage) / SNAC (Strong Neuron Activation Coverage): The initialization is the same as in KMNC. The conditions for the two criteria differ: NBC determines whether the activation value of a neuron is below the minimum or above the maximum, whereas SNAC only checks if it exceeds the maximum. Both operations are of constant time complexity. Therefore, the memory complexity includes the initialization
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
9
and the condition checks , resulting in a total complexity of . The computational complexity is for NBC and for SNAC.
-
TKNC (Top-k Neuron Coverage)/ TKNP (Top-k Neuron Patterns): Given the parameter k, determine whether each neuron in a layer has an activation value among the top k. This requires sorting the activation values of all neurons in a single network layer. Each neuron needs to record a boolean variable, so the memory complexity is . In addition, we also store the top-k activation patterns for each input. Each pattern includes k neurons, and aggregating across all layers leads to a storage complexity of , where is the number of neurons in the i-th layer and l is the total number of layers. Since the sorting complexity for each layer is and there are l layers, the computational complexity is .
-
NLC/NLC+ (NEURAL COVERAGE): NLC treats each neuron as a variable and computes the covariance matrix of multiple variables based on the outputs of all samples in each layer. Initially, it calculates the mean and then the covariance, with a computational complexity of . As a result, each layer must store a covariance matrix, leading to a memory complexity of . The total computational complexity is . NLC+ uses an incremental calculation method, adding samples only when the Frobenius norm of the covariance matrix increases, thus achieving a slightly lower overall complexity compared to NLC, but of the same order of magnitude.
-
CC_w (Causality-aware Coverage): Firstly, the neural network is abstracted as a causal graph where and , which can be directly derived from the DNN structure. Directed edges may exist between any two neurons in adjacent layers, leading to a memory complexity of . Then, the causal graph is extracted and recovered by the test suite. The CC metric calculates the proportion of edges recovered, i.e., . For each edge , it is determined if no subset belonging to exists such that and are independent conditioned on . If so, the edge exists. The specific procedure is as follows: assume the target edge is . Considering as the confounding neurons for this edge, the structural assignment to is given by . Then, for each neuron , compute and . This results in , and an independence test is conducted between and . The covariance matrix needs to be stored, with a memory complexity similar to NLC, . Additionally, for each edge, updating requires , where is the number of neurons in a layer, approximated by . The independence test complexity is approximately , where is a statistical parameter. Note that it is sufficient to select only a subset of network layers for analysis. Let denote the number of selected layers. The total computational complexity is roughly . Prior work has shown that selecting only three layers is sufficient for achieving effective coverage [17], and we accordingly set in this study.
-
CTC (Combinatorial Testing Coverage): Considering -way combinatorial dense coverage, each neuron has two possible states , resulting in combinations in the -th layer. For each -way neuron combination, the states are calculated, leading to computational complexity of . Considering that each neuron combination has possible states, the total number of states is . Thus, the computational complexity is . The memory complexity is .
-
SS (Sign-Sign Coverage): Using Sign-Sign Cover as the coverage method, we consider two neurons a and b in adjacent layers and . The coverage checks if a independently influences the sign change of b; i.e., there exist two samples and such that all neurons in layer except a remain unchanged, while the sign of neuron b in layer changes. The memory complexity is determined by the total number of edges e, as we need to store
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
information about whether each pair of adjacent neurons satisfies the coverage criterion. Determining coverage involves selecting two samples from the test suite, with a complexity of . Then, we check if the sign of each neuron changes , and verify if only one neuron per layer undergoes a sign change . Thus, the memory complexity is , and the total computational complexity is .
- Pcov (Path-driven Coverage): Using Full State Path Coverage as an example, a k-path is defined as a path of length k formed by neurons from k consecutive layers. There are a total of paths. For each path, each neuron can either be activated (1) or not (0), resulting in possible states for each path. Therefore, the memory complexity is . For each sample, the state of each path is calculated and activated, with a computational complexity of .
• NPC (Neuron Path Coverage) / IDC (Importance-Driven Coverage): Building on prior research, NPC / IDC necessitates a white-box approach to DNNs, specifically requiring layer-wise relevance propagation techniques. This requirement is often impractical in testing scenarios. Additionally, its core mechanism of layer-wise propagation is constrained to discriminative models. Consequently, it is not included in this analysis and comparison.
Summary. Based on the comprehensive analysis presented and as detailed in the Table 1, coverage unit granularity can be categorized into three levels: single neuron (NC/NC+, KMNC, NBC, SNAC, IDC), intra-layer neuron combination (TKNC, TKNP, NLC/NLC+, CTC), and inter-layer neuron combination (CC_w, SS, Pcov, NPC). Regarding algorithmic complexity, these methods can be distinguished between those exhibiting exponential complexity (Pcov, CTC) and those with polynomial complexity (others). Additionally, considering the requirement for gradient calculation, they can be classified as either white-box (NPC, IDC) or non-white-box (others). The analysis indicates that while TKNC, TKNP, SS, NPC, and IDC have certain limitations, TKNC, TKNP, and SS, despite not exhibiting exponential complexity, still demonstrate higher complexity compared to most other coverage criteria. Consequently, we have selected NC, KMNC, NBC, SNAC, NLC, NLC+, and CC_w. These criteria encompass all coverage unit granularities, forming a representative set that includes two state-of-the-art (SOTA) coverage criteria which have not been evaluated in other studies.
4 STUDY DESIGN AND FINDINGS
4.1 Research Questions
In response to the identified research gap, we conduct a comprehensive study to assess the effectiveness of neuron coverage criteria in testing transformer-based language models. We approach the problem from the following three perspectives: error-revealing capability (RQ1), diversity (RQ2, RQ3), and input generation guidance (RQ4). First, we investigate whether these criteria could help the model identify error samples. By introducing various types of noise to a sample, we classify the resulting samples as either adversarial, which induces classification errors, or benign, which does not affect classification. Adversarial samples significantly contribute to the coverage criteria of the test suite compared to benign samples (RQ1). Second, we examine whether these criteria could assess the diversity of the test suite, focusing on distribution diversity and sample fairness. The first aspect analyzes whether a more dispersed distribution leads to greater coverage (RQ2), while the second aspect evaluates whether more balanced categories result in higher coverage (RQ3). Finally, we explore whether these criteria could facilitate sample generation. By incorporating coverage guidance into the standard sample generation process, we aim to determine if the generated samples could uncover a higher proportion of error corner cases, such as adversarial samples (RQ4). The specific research questions are as follows:
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
11
Table 2. Summary of Transformer-Based Language Models. This table provides an overview of notable transformer-based language models, including their developers, year of release, descriptions, architectures, parameter counts, and the number of layers.
| Model | Developer | Year | Description | Architecture | Parameters | #Layers |
|---|---|---|---|---|---|---|
| BERT | 2018 | Pioneering transformer model in NLP, employing pre-training and fine-tuning. | Encoder-only | 110M | 12 | |
| ALBERT | 2019 | A lite version of BERT focusing on parameter-reduction techniques. | Encoder-only | 12M | 12 | |
| RoBERTa | Facebook AI | 2019 | An optimized method for pre-training BERT models, with improved performance. | Encoder-only | 125M | 12 |
| GPT-2 | OpenAI | 2018 | A large language model and the second in the series of GPT models. | Decoder-only | 1.5B | 48 |
| LLaMA | Meta AI | 2023 | A collection of large language models, ranging from 7B to 65B parameters. | Decoder-only | 7B | 32 |
| T5 | 2019 | Converts all NLP problems into a text-to-text format, trained using teacher forcing. | Encoder-decoder | 220M | 12 |
Table 3. Summary of Language Task Datasets. This table provides an overview of various language task datasets, detailing their training and test set sizes, maximum and average input lengths, tokenizer maximum lengths, number of classes, and the specific tasks they are used for.
| Datasets | #Train | #Test | Input_maxlen | Input_avglen | Tokenizer_maxlen | #Classes | Task |
|---|---|---|---|---|---|---|---|
| AGNews | 120,000 | 7,600 | 2470 | 233 | 256 | 4 | News Classification |
| IMDB | 25,000 | 25,000 | 203 | 39.8 | 128 | 2 | Sentiment Analysis |
| QQP | 364,000 | 40,000 | 270 | 22.2 | 128 | 2 | Question Pair |
| SNLI | 550,000 | 10,000 | 112 | 20.3 | 128 | 3 | Natural Language Inference |
| gigaword | 26,696 | 2,967 | 2,937 | 21.3 | 128 | - | Machine Translation |
| wmt14 | 4,508,785 | 3,000 | 112 | 20.3 | 128 | - | Summarization |
- RQ1 (Error-Revealing Capability): To what extent do neuron coverage criteria reveal the error-revealing capability of a test suite?
• RQ2 (Distribution Diversity): Can neuron coverage criteria evaluate the distribution diversity of a test suite?
• RQ3 (Sample Fairness): Can neuron coverage criteria assess the sample fairness within a test suite?
• RQ4 (Input Generation Assistance): Can coverage criteria guide fuzz testing to produce higher-quality test suites?
4.2 Experiment Setup
4.2.1 Target Models and Datasets. From Section 3, we understand that current research predominantly focuses on DNN and CNN models, mainly in image tasks. Hence, we will focus on transformer models for text tasks, addressing gaps in datasets and models from previous studies. Since coverage analysis requires accessible model information and manageable computational costs, our investigation targets three distinct architectures of transformer-based language models: encoder-only models (such as BERT [9], RoBERTa, and ALBERT [20]), encoder-decoder models (such as T5), and decoder-only models (like GPT-2 and LLaMA). All these models are derived from the transformer architecture (see Table 2). These models are open-source and widely used, with parameter scales ranging from small to large, covering all types of transformer models. To comprehensively assess their capabilities, we select these models as our targets and conduct experiments on six tasks in total. Among them, four are classification tasks, namely Sentiment Analysis, Semantic Matching, Natural Language Inference, and Text Classification, which correspond to the AGNews, IMDB, QQP, and SNLI datasets. In addition, we consider two generation tasks, Machine Translation and Summarization, which are evaluated on the WMT14 and Gigaword datasets, respectively (see Table 3). To ensure robustness in our findings, each configuration underwent five training iterations. For context, we present text length statistics for these datasets in Table 3. Notably, the IMDB dataset has an average text length of 233 words, significantly longer than the other datasets, where the average length is less than 40 words. Consequently, we set the maximum text lengths to 256 for IMDB and 128 for the other datasets. These settings allow the target models to achieve comparable performance and effectively assimilate information from the inputs.
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
4.2.2 Target Neuron Coverage Criteria. Considering that our analysis focuses on large-scale, transformer-based language models, we choose algorithms with polynomial time complexity to ensure computations are completed within an acceptable timeframe. To ensure representativeness, we select a set of neuron coverage criteria across three granularities: NC/NC+, KMNC, NBC, SNAC, NLC, NLC+, and CC.
4.2.3 Implementations. Our experimental framework consists of three primary implementation components: 1): Neuron Coverage Criteria: While the criteria we employ are supported by open-source code, significant modifications were necessary to standardize them within the PyTorch framework and to ensure their compatibility with transformer architectures. We meticulously summarize and refactor the existing criteria, enhancing their applicability and accuracy for our specific use case. The implementation involves two critical aspects: the definition of neurons and the calculation of coverage.
- Neuron definition in Transformers. Transformer models consist of multiple encoder or decoder blocks, each containing a multi-head attention (MHA) module and a feed-forward network (FFN). In our implementation, neurons are defined as the outputs of both the MHA and FFN modules. Specifically, for an input , the MHA produces
where denotes the concatenated head outputs, and is the output projection matrix. We treat both the concatenated head representations and their projected outputs as neuron activations. For the FFN, consisting of two fully connected layers,
we consider both the intermediate activation and the final output as neurons. In contrast, intermediate variables such as the query, key, and value are excluded, since they serve as latent factors for attention computation rather than independent activation units. This definition ensures consistency with the representational semantics of neural network layers in existing coverage criteria.
- Coverage calculation in Transformers. Transformer models process sequences of tokens in a manner analogous to the shared-kernel mechanism in CNNs: while CNNs slide convolutional kernels over spatial dimensions, transformers apply the same parameters across tokens in the sequence. Inspired by prior work on coverage testing for CNNs, where activations are commonly pooled across spatial locations within each channel, and by established testing practices in natural language processing [11, 48] that consider the entire input sequence, we adopt an averaging strategy over the token dimension and incorporate activations from all input tokens. This design not only reduces noise and enables efficient coverage computation by producing a stable sequence-level representation, but also ensures broad applicability across different Transformer architectures.
2): Transformer Model Fine-tuning: We leverage pre-trained models sourced from HuggingFace, upon which we integrate task-specific layers tailored to our experimental needs. Each model undergoes fine-tuning across four distinct tasks, meticulously calibrated to achieve comparable performance levels, thereby ensuring the reliability and validity of our results.
3): Adversarial Attacks: To evaluate the robustness of our models, we employ the TextAttack API to conduct adversarial attacks. This involves the application of three diverse and sophisticated methods, allowing us to generate a representative set of adversarial samples and further test the sensitivity of our metrics to these adversarial examples.
Implementation Environment: All experiments were conducted on a Linux server running Ubuntu 20.04.4 LTS, equipped with an Intel(R) Xeon(R) Silver 4216 CPU, 376GB of RAM, and NVIDIA RTX A6000 GPUs. The implementation
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
13
environment was built on Python v3.7.11. We implemented the neuron coverage criteria and model fine-tuning based on PyTorch v1.9.0 and the HuggingFace Transformers library v4.30.2. For the adversarial attack component, we utilized the TextAttack framework v0.3.9.
4.3 Error-Revealing Capability (RQ1)
The error-revealing capability pertains to the ability of a test suite to uncover errors in a model when erroneous samples are incorporated. This research question seeks to explore the extent to which neuron coverage criteria can reflect the error-revealing capability of a test suite. Specifically, it examines whether neuron coverage criteria can exhibit significant changes when erroneous samples are integrated into the test suite, indicating their sensitivity to newly introduced errors.
4.3.1 Experiment Design
To address RQ1, our experiment is divided into two phases: 1) Coverage Sensitivity to Error Samples: Evaluate whether the coverage criteria respond to erroneous samples. Specifically, does incorporating adversarial examples enhance coverage? 2) Factors of Coverage Increase: Identify whether the main reason for coverage increase is the addition of new samples or erroneous samples.
To disentangle these two factors, we note that adversarial (erroneous) samples can be regarded as a special case of perturbed inputs where perturbations cause misclassification. Hence, to separate the error-related effect from the perturbation itself, we introduce noise samples (perturbed but non-adversarial) alongside the original and adversarial sets. Consequently, we construct three sets as follows:
Original Samples (denoted as S):
Here, denotes the neural network, the ground-truth label, and the number of classes. Thus, is a class-balanced subset of correctly classified test samples, with in our setup.
Noise Samples (denoted as ):
Each is obtained by perturbing at either the character or word level, while ensuring the model prediction remains unchanged ( ). Hence, has the same size and label distribution as .
Error Samples (denoted as ):
Here, is generated by applying text-level adversarial attacks to , which intentionally alter the model prediction. We adopt character-level (DeepWordBug), word-level (TextFooler), and hybrid (TextBugger) attacks, consistent with the perturbation granularity used for . For generation tasks, we further employ Seq2Sick and Morpheus as adversarial attack methods.
Figure 5 provides specific examples using a sample from the QQP dataset. In this example, a square represents an original sample belonging to the "not_equivalent" class. The example distribution on the right shows that this sample falls correctly within the "not_equivalent" region. Next, Perturbation 1, as an instance of Perturb( ), is a character-level alteration changing "How" to "Htow," transforming it into a circle representing a noise sample . This
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue

Fig. 5. Distribution Examples of Different Samples. Given a standard sample (represented by squares), perturbations (noise) can be added to generate new samples. Perturbations that alter the semantic meaning of the sample are termed adversarial samples (represented by triangles), while those that do not are classified as regular noise samples (represented by circles).
minor perturbation retains the sample in the "not_equivalent" class, as shown in the right distribution example. However, Perturbation 2, as an instance of AdvAttack( ), changes "medicine" to "medicwne," resulting in a triangle representing an adversarial sample . This perturbation achieves an adversarial attack by shifting the sample close to its original position but into the "equivalent" class range, as illustrated in the right distribution example.
Having established these three test suites, we design a two-phase experiment to evaluate their fault-revealing capabilities. The first phase, coverage sensitivity, assesses the benefit of increasing coverage by involving adversarial examples, a method utilized in several studies [26, 27, 36, 40]. Following previous work, we first introduce in-distribution samples (from either the train set or the test set) to the neural network and calculate the value of the given coverage criterion C, denoted as value_S, representing the proportion of the neural network covered by the original samples. Next, we incorporate adversarial samples into the original samples and reintroduce this combined sample set to the neural network, calculating the coverage criterion C again, denoted as value_S_{adv}. We then compare value_S and value_S_{adv} to determine the difference in coverage between the original sample set and the augmented set with adversarial samples. This comparison reveals whether these slightly perturbed adversarial samples can increase coverage and expand the scope of the test suite. This step allows us to examine the impact of adversarial examples on coverage sensitivity and their potential to enhance coverage. While this step allows us to confirm the sensitivity of the coverage criterion to adversarial samples, it overlooks the impact of test suite size. As the number of samples increases with the addition of adversarial examples, it remains unclear whether the rise in coverage is due to the erroneous information in the adversarial samples or simply the inclusion of additional samples. A few studies have raised this concern [17, 43, 47] and designed experiments to address it. Inspired by previous work, we have designed an ablation experiment to address this issue, specifically exploring the main factors contributing to coverage increase. Specifically, since error samples are generated by applying slight text-level perturbations to the original samples until misclassification occurs, we aim to investigate whether the main factor of coverage increase is the addition of new samples or the addition of adversarial samples. To this end, we created a noise sample set using perturbations similar to those employed in adversarial attacks. The only difference between this noise sample set and the error samples is whether the samples are correctly classified. Thus, similar to the first phase, we introduce the combined set of noise samples and original samples into the neural network and compute the coverage value value_S_{noise}. We then compare the difference between value_S_{adv} and value_S_{noise} and calculate the percentage increase of value_S_{adv} over value_S_{noise}. To further examine whether the observed coverage increase is truly related to errors, rather than resulting from statistical bias due to minimal impact,
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
15
Table 4. The average coverage values achieved by the original samples and various error-revealing (text) test suites on transformer-based language models for classification tasks. The cells corresponding to are shaded in gray, with darker shades indicating a higher percentage increase in coverage over . Cells without shading indicate no increase.
| Coverage Criteria | Config. | LLama-2 | BERT | T5 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NC | T=0.25 | 0.966 | 0.968 | 0.967 | 0.968 | 1.000 | 1.000 | 1.000 | 1.000 | 0.991 | 0.992 | 0.992 | 0.992 |
| T=0.50 | 0.603 | 0.616 | 0.606 | 0.608 | 0.999 | 0.999 | 0.999 | 0.999 | 0.970 | 0.976 | 0.975 | 0.972 | |
| T=0.75 | 0.371 | 0.417 | 0.401 | 0.407 | 0.830 | 0.857 | 0.852 | 0.864 | 0.701 | 0.732 | 0.728 | 0.727 | |
| KMNC | K=10 | 0.989 | 0.995 | 0.993 | 0.993 | 0.996 | 0.998 | 0.998 | 0.998 | 0.987 | 0.994 | 0.993 | 0.992 |
| K=50 | 0.923 | 0.956 | 0.946 | 0.950 | 0.960 | 0.979 | 0.975 | 0.979 | 0.921 | 0.953 | 0.947 | 0.946 | |
| K=100 | 0.875 | 0.921 | 0.906 | 0.913 | 0.930 | 0.960 | 0.954 | 0.960 | 0.873 | 0.918 | 0.909 | 0.909 | |
| NBC | None | 0.450 | 0.675 | 0.616 | 0.655 | 0.496 | 0.701 | 0.657 | 0.704 | 0.497 | 0.693 | 0.663 | 0.674 |
| SNAC | None | 0.451 | 0.680 | 0.620 | 0.658 | 0.499 | 0.701 | 0.659 | 0.704 | 0.498 | 0.702 | 0.667 | 0.682 |
| NLC | None | 0.180 | 0.177 | 0.169 | 0.162 | 0.193 | 0.182 | 0.176 | 0.185 | 0.188 | 0.154 | 0.167 | 0.160 |
| NLC+ | 0.660 | 0.675 | 0.654 | 0.702 | 0.672 | 0.655 | 0.694 | 0.707 | 0.479 | 0.480 | 0.498 | 0.495 | |
| None | 0.017 | 0.023 | 0.025 | 0.024 | 0.027 | 0.038 | 0.039 | 0.035 | 0.019 | 0.024 | 0.027 | 0.026 | |
Table 5. The average coverage values achieved by the original samples and two error-revealing (text) test suites on transformer-based language models for generation tasks. The cells corresponding to are shaded in gray, with darker shades indicating a higher percentage increase in coverage over . Cells without shading indicate no increase.
| Coverage Criteria | Config. | LLama-2 | T5 | ||||
|---|---|---|---|---|---|---|---|
| NC | T=0.25 | 0.892 | 0.898 | 0.902 | 0.912 | 0.917 | 0.916 |
| T=0.50 | 0.542 | 0.546 | 0.548 | 0.878 | 0.887 | 0.884 | |
| T=0.75 | 0.310 | 0.329 | 0.333 | 0.609 | 0.622 | 0.621 | |
| KMNC | K=10 | 0.955 | 0.961 | 0.960 | 0.944 | 0.950 | 0.949 |
| K=50 | 0.846 | 0.866 | 0.869 | 0.829 | 0.849 | 0.846 | |
| K=100 | 0.792 | 0.814 | 0.820 | 0.780 | 0.802 | 0.801 | |
| NBC | None | 0.388 | 0.515 | 0.544 | 0.427 | 0.572 | 0.583 |
| SNAC | None | 0.389 | 0.517 | 0.545 | 0.428 | 0.576 | 0.588 |
| NLC | None | 0.142 | 0.133 | 0.128 | 0.146 | 0.133 | 0.127 |
| NLC+ | 0.582 | 0.573 | 0.606 | 0.412 | 0.410 | 0.415 | |
| None | 0.013 | 0.019 | 0.018 | 0.009 | 0.012 | 0.015 | |
we perform repeated subsampling for each configuration (five runs) and conduct paired t-tests. The corresponding p-values are reported to assess the statistical significance of the differences.
Our objective is to assess the general error-revealing capability of neuron coverage criteria, rather than the behavior of specific adversarial attack operators. Accordingly, we generate erroneous samples using multiple representative adversarial attack methods and report coverage results by aggregating samples across different operators. This design allows us to focus on whether coverage criteria are more sensitive to prediction-changing perturbations than to label-preserving noise, while minimizing the influence of individual attack mechanisms. Based on the two-phase experiment described above, we evaluate the sensitivity of the coverage criterion to adversarial samples by examining whether adding an adversarial sample set to the original samples increases the coverage. Additionally, by comparing the effects of adding noise samples versus adversarial samples to the original set, we aim to determine the primary factor contributing to the increase in coverage.
4.3.2 Results.
Table 4 and Table 5 report the values of neuron coverage criteria for the original samples and for the combined samples after adding adversarial examples . Table 4 corresponds to classification tasks, while Table 5 corresponds
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
to generation tasks. Here, DWB, TF, and TB denote adversarial attack methods for classification tasks, namely DeepWordBug, TextFooler, and TextBugger, respectively, while MP and SEQ represent attack methods for generation tasks, Morpheus and Seq2Sick. Each major row, spanning one or more sub-rows, represents a specific coverage criterion. For classification tasks, the three main columns correspond to three representative transformer-based language models: Llama-2, BERT, and T5; for generation tasks, the models evaluated are Llama-2 and T5. Within each main column, four sub-columns are provided: the first shows the coverage value for the original samples S, and the remaining three show the coverage values after adding adversarial samples generated by different attack methods ( , , and ). For generation tasks, the corresponding adversarial attack methods are and . For each set of adversarial samples, the percentage increase in coverage value compared to the original samples is computed. This percentage increase is indicated by the transparency level of the gray background; a gray background indicates that the value is higher than that of the original samples, with darker shades representing greater increases. For instance, in the first row, the initial coverage value, 0.966, corresponds to the NC with a threshold of 0.25 for the original sample S under the Llama-2 model. The second value, 0.968, represents the coverage value after adding adversarial samples generated by the DeepWordBug attack under the same model and criterion, showing a 0.2% increase; hence, a very light gray background is applied. Similarly, in the third row, the NC with a threshold of 0.75 yields a value of 0.371 for the original sample S, while the value for is 0.417, indicating a 12.4% increase, and thus a darker gray background is applied.
As shown in Table 4, it can be observed that the majority of the background cells are colored, indicating that for a given original sample S, the addition of adversarial samples generally leads to an increase in coverage across nearly all criteria. For the NC criterion, when the threshold is set at 0.25 or 0.50, the coverage for the original sample alone is already close to 1 in some cases. For instance, the BERT model achieves 100% and 99.9% coverage, respectively, so adding adversarial samples does not result in further improvement. However, when the threshold is set at 0.75, the coverage value increases across an entire row. The KMNC criterion behaves similarly to NC. As the threshold increases from 10 to 100, the granularity of coverage becomes finer, and the background color darkens, indicating a larger percentage increase. This occurs because finer granularity divides the coverage space into smaller intervals, making it easier to discover new coverage areas, thereby allowing more room for improvement. The criteria NBC and SNAC, which detect neurons that exceed the upper bound or fall below the lower bound, and CC, which detects deviations from normal causal logic, all play crucial roles in identifying outliers. Consequently, the addition of adversarial samples results in a significant increase in coverage for these criteria. For the NLC criterion, adding adversarial samples to the original samples does not improve coverage in the original version of NLC under any conditions. In contrast, the NLC+ version shows improvement in some cases. This discrepancy arises because the original NLC is based on overall variance; adding samples similar to existing ones in the set may reduce overall variance. Specifically, if the difference between the new sample and the original mean satisfies the following condition: , where is the original variance, n is the number of original samples, and is the distance between the new sample and the original mean. Although NLC+ attempts to address this by ignoring samples that reduce variance during incremental updates, this introduces a new issue: NLC+ becomes highly sensitive to the order of samples. Different sequences of samples can yield different results, which is why NLC+ only improves coverage in certain situations.
Table 6 presents the changes in coverage criteria after adding the noise sample set and the adversarial sample set to the original sample S across three classic transformer architectures (with each value representing an average for that architecture). Each major row, spanning two sub-rows, represents a specific transformer structure, where "DEC.", "ENC.", and "D.+E." represent the average results for the decoder, encoder, and encoder-decoder models, respectively. In
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
17
Table 6. The change in coverage value after adding the noise sample and the adversarial sample to the original sample . The cells with bolded values indicate that the coverage increase from adding is greater than that from adding . Here, DEC., ENC., and D. + E. denote decoder-only, encoder-only, and encoder-decoder models, respectively.
| Configuration | T=0.25 | NC T=0.50 | T=0.75 | K=10 | KMNC K=50 | K=100 | NBC | SNAC | NLC | NLC+ | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| DEC. | 0.002 | 0.004 | 0.019 | 0.004 | 0.026 | 0.038 | 0.216 | 0.218 | -0.019 | 0.025 | 0.001 | |
| 0.002 | 0.009 | 0.041 | 0.005 | 0.030 | 0.042 | 0.221 | 0.226 | -0.013 | 0.018 | 0.006 | ||
| ENC. | 0.000 | 0.000 | 0.024 | 0.002 | 0.018 | 0.028 | 0.193 | 0.194 | -0.007 | 0.016 | 0.007 | |
| 0.000 | 0.000 | 0.026 | 0.002 | 0.018 | 0.029 | 0.198 | 0.201 | -0.013 | 0.014 | 0.010 | ||
| D. + E. | 0.000 | 0.014 | 0.028 | 0.006 | 0.030 | 0.042 | 0.208 | 0.206 | -0.033 | 0.005 | 0.005 | |
| 0.001 | 0.014 | 0.030 | 0.007 | 0.030 | 0.044 | 0.199 | 0.209 | -0.028 | 0.012 | 0.006 | ||
Table 7. Paired t-test () p-values based on 5 subsampling runs under each configuration. Cells with are highlighted in light green, those with in light red, and cases with no change in coverage are denoted by a dash “-”.
| Configuration | NC | KMNC | NBC | SNAC | NLC | NLC+ | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| T=0.25 | T=0.50 | T=0.75 | K=10 | K=50 | K=100 | ||||||
| DEC. | - | 0.014 | 0.002 | - | 0.017 | 0.005 | 0.020 | 0.019 | 0.248 | 0.823 | 0.004 |
| ENC. | - | - | 0.006 | - | 0.187 | 0.031 | 0.007 | 0.003 | 0.315 | 0.588 | 0.008 |
| D. + E. | - | 0.500 | 0.035 | - | 0.648 | 0.016 | 0.064 | 0.021 | 0.622 | 0.622 | 0.003 |
the two sub-rows, indicates the change resulting from adding the noise sample set , while represents the change from adding the adversarial sample set . When exceeds , the corresponding value is bolded. For example, in the first column, the first two rows both show 0.002, indicating that the increase in NC with a threshold of 0.25 is 0.002 for both sample sets; thus, no bolding is applied. In contrast, in the second column, the values 0.004 and 0.009 indicate that the increase in NC with a threshold of 0.50 is greater when adding , so the latter value is bolded.
It can be observed that in most cases, the values corresponding to are bolded, indicating that the increase in coverage is greater after the addition of the adversarial sample set than after adding the noise sample set. For the NC and KMNC criteria, it is apparent that in cases where the values are not bolded, the increments are often identical, particularly when the thresholds are lower. As discussed earlier, lower thresholds result in coarser coverage, making it easier to miss finer changes, which explains why the increments in coverage from the two different sample sets are sometimes exactly the same. For NLC and NLC+, some cases are bolded while others are not. As previously mentioned, this is because the variance- and covariance-based nature of these criteria can lead to variations that decrease the values when certain samples are added. Moreover, the order in which the samples are added also plays a role, leading to different outcomes. The total increase in coverage value after adding the noise sample set is 2.757, while the total increase after adding the adversarial sample set is 2.849, representing a minimal average improvement of 0.28% per case. In addition, to further assess whether these minimal improvements are reliable, Table 7 reports the -values obtained from paired t-tests across all configurations. Improvements with are considered statistically significant. Specifically, the cells with a gray background and dashes “-” correspond to cases where the coverage value of the original samples is already saturated, resulting in zero increment. Among the remaining cases, cells highlighted in green indicate , while those in red correspond to . As shown, the NLC and NLC+ criteria consistently yield across all settings, reflecting their sensitivity to input order. Most of the other red cells are concentrated in NC and KMNC at thresholds of 0.5 and 50, respectively, where the initial coverage is already high and thus the incremental gains are
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
Sparse distribution — High diversity

Dense Distribution — Low diversity
Positive Sentiment Examples.
A The weather is great today. I feel really happy.
B The weather is great today. I feel truly happy.
C Traveling with friends was a truly unforgettable experience.
Fig. 6. An illustration of distribution diversity in sentiment classification, comparing test suites of equal size. The first sub-figure shows high diversity with a widely dispersed test suite, while the second depicts low diversity with a tightly clustered test suite.
negligible, leading to weak significance. In addition, although NBC under the Encoder–Decoder configuration is marked red, its p-value is only slightly above 0.05.
In summary, except for the NLC/NLC+ criteria, which focus on intra-layer neuron combinations, the factors contributing to coverage increase generally encapsulate the semantic errors introduced by adversarial samples. However, this additional semantic information accounts for only approximately a 0.32% improvement. Under the current computation paradigm of coverage criteria, most of the uncovered regions can already be explored through random perturbations, while only a very small fraction truly requires error-related information to be activated.
Finding 1:
Although the addition of error samples enhances the neuron coverage of a test suite (except for NLC/NLC+), the resulting coverage increment over noise samples is minimal, at just 0.32%, reflecting that the increment mainly arises from adding new samples, with little extra increase due to the error semantics of the samples.
Implication 1:
-
Usage. The coverage gains from adversarial samples over benign noise are marginal and offer limited practical value for reliable error detection in test suites.
-
Design. Future criteria should distinguish erroneous from normal samples, amplifying error-related semantics while suppressing noise-like perturbations in adversarial inputs.
4.4 Distribution Diversity (RQ2)
Distribution diversity refers to the dispersion of a test suite across the sample space. This research question aims to explore whether neuron coverage criteria can effectively evaluate the distribution diversity of a test suite. Specifically, it seeks to determine if, given test suites of equal size, coverage criteria can identify a test suite with higher dispersion.
4.4.1 Experiment Design
To address RQ2, we will design test suites with varying degrees of distribution diversity and analyze whether the coverage values generated by these test suites when passed through the model are positively correlated with their distribution diversity. Figure 6 provides an intuitive illustration of distribution diversity. Specifically, in the context of a sentiment classification task, circles and squares represent two different test suites. Each test suite contains blue, yellow, and red elements, corresponding to samples from the positive, negative, and neutral categories, respectively.
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
19

Fig. 7. Process for constructing the and test suites. A random subset of samples is first selected from the original samples, then slight perturbations are applied to expand this subset to the original sample size, yielding and .
The distribution ranges for these categories are outlined with dashed lines. In terms of overall distribution, the test suite represented by circles has samples evenly spread across the entire sample space, indicating high diversity. In contrast, the test suite represented by squares has samples that are more concentrated in specific areas of the sample space; for instance, four closely clustered samples appear in the upper-right corner of the positive region. Specific sample examples are provided on the right side of the figure: A and B are two highly similar, clustered samples that differ only by the adverbs “really” and “truly” (as underlined), while C is a completely distinct positive sample with different semantics. Following the design in [47], given the original sample set S, as shown in Figure 7 we construct a perturbed subsample set with the same size as S. This ensures equal sample quantity while reducing distributional diversity. To further amplify the diversity factor, we expand to obtain , which contains more samples than S but exhibits even lower diversity. This design highlights the sensitivity of the coverage criteria to variations in diversity. Perturbed Subsample Set (denoted as ):
This formula represents a sample set that is generated by perturbing a subset of the original sample S to match the size of the original sample. Specifically, refers to a small subset of the original sample, comprising 10% of S. The perturbation function Perturb( ) applies minor random perturbations to each sample k times, where k is chosen such that the total number of perturbed samples equals the size of the original sample: . Thus, the total size of equals that of the original sample set S.
Perturbed Extended Subsample Set (denoted as ):
This formula describes a sample set generated by perturbing a subset of the original sample S to a size that is m times the size of the original sample. The perturbation process is identical to that used for , with the only difference being that the value of k is chosen such that the size of is m times the size of the original sample: .
Having established the three test suites, the diversity of these test suites can be ranked in descending order as . This ranking is justified by the composition of the original sample set, which includes 5000 diverse text samples from real-world datasets. In contrast, is based on perturbations of only 100 text samples, leading to a concentrated distribution around these 100 samples despite matching the original sample size. Although has a distribution that is more diverse than due to its larger size, its diversity is still significantly less than that of the original sample set because it remains centred around the 100 samples, albeit with a higher quantity. Therefore,
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
Table 8. The average coverage values achieved by the sample sets , , and on transformer-based language models for classification tasks. A checkmark indicates that the relationship is satisfied. The final column shows the number of cases where this ground truth relationship holds.
| Coverage Criteria | Config. | LLama-2 | BERT | T5 | Groundtruth Satisfaction | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NC | T=0.25 | 0.966 | 0.955 | 0.949 | ✓ | 1.000 | 1.000 | 1.000 | 0.991 | 0.986 | 0.991 | 1/3 | 6/9 | ||
| T=0.50 | 0.603 | 0.588 | 0.586 | ✓ | 0.999 | 0.999 | 0.999 | 0.970 | 0.963 | 0.958 | ✓ | 2/3 | |||
| T=0.75 | 0.371 | 0.313 | 0.284 | ✓ | 0.830 | 0.746 | 0.657 | ✓ | 0.701 | 0.687 | 0.672 | ✓ | 3/3 | ||
| KMNC | K=10 | 0.989 | 0.947 | 0.922 | ✓ | 0.996 | 0.968 | 0.950 | ✓ | 0.987 | 0.924 | 0.899 | ✓ | 3/3 | 8/9 |
| K=50 | 0.923 | 0.868 | 0.879 | 0.960 | 0.918 | 0.885 | ✓ | 0.921 | 0.853 | 0.810 | ✓ | 2/3 | |||
| K=100 | 0.875 | 0.838 | 0.778 | ✓ | 0.930 | 0.900 | 0.859 | ✓ | 0.873 | 0.829 | 0.778 | ✓ | 3/3 | ||
| NBC | None | 0.450 | 0.362 | 0.263 | ✓ | 0.496 | 0.422 | 0.323 | ✓ | 0.497 | 0.341 | 0.267 | ✓ | 3/3 | 3/3 |
| SNAC | None | 0.451 | 0.364 | 0.265 | ✓ | 0.498 | 0.425 | 0.324 | ✓ | 0.498 | 0.337 | 0.264 | ✓ | 3/3 | 3/3 |
| NLC | None | 0.180 | 0.105 | 0.113 | 0.193 | 0.087 | 0.079 | ✓ | 0.188 | 0.108 | 0.122 | 1/3 | 3/6 | ||
| NLC+ | 0.660 | 0.588 | 0.547 | ✓ | 0.672 | 0.643 | 0.644 | 0.479 | 0.481 | 0.442 | ✓ | 2/3 | |||
| None | 0.017 | 0.008 | 0.007 | ✓ | 0.027 | 0.016 | 0.014 | ✓ | 0.019 | 0.011 | 0.009 | ✓ | 3/3 | 3/3 | |
Table 9. The average coverage values achieved by the sample sets , , and on transformer-based language models for generation tasks. A checkmark indicates that the relationship is satisfied for the corresponding model. The final column shows the number of cases where this ground-truth relationship holds (out of two models).
| Coverage Criteria | Config. | Llama-2 | T5 | Groundtruth Satisfaction | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| NC | T=0.25 | 0.902 | 0.890 | 0.890 | 0.935 | 0.932 | 0.927 | ✓ | 1/2 | 5/6 | |
| T=0.50 | 0.512 | 0.497 | 0.493 | ✓ | 0.851 | 0.842 | 0.835 | ✓ | 2/2 | ||
| T=0.75 | 0.281 | 0.243 | 0.226 | ✓ | 0.602 | 0.589 | 0.571 | ✓ | 2/2 | ||
| KMNC | K=10 | 0.925 | 0.884 | 0.861 | ✓ | 0.913 | 0.859 | 0.828 | ✓ | 2/2 | 6/6 |
| K=50 | 0.832 | 0.799 | 0.790 | ✓ | 0.802 | 0.742 | 0.702 | ✓ | 2/2 | ||
| K=100 | 0.755 | 0.716 | 0.662 | ✓ | 0.741 | 0.698 | 0.652 | ✓ | 2/2 | ||
| NBC | None | 0.362 | 0.285 | 0.201 | ✓ | 0.404 | 0.276 | 0.199 | ✓ | 2/2 | 2/2 |
| SNAC | None | 0.364 | 0.288 | 0.207 | ✓ | 0.406 | 0.279 | 0.202 | ✓ | 2/2 | 2/2 |
| NLC | None | 0.112 | 0.066 | 0.071 | 0.121 | 0.071 | 0.083 | 0/2 | 1/4 | ||
| NLC+ | 0.482 | 0.421 | 0.390 | ✓ | 0.352 | 0.353 | 0.320 | 1/2 | |||
| None | 0.011 | 0.005 | 0.004 | ✓ | 0.013 | 0.007 | 0.005 | ✓ | 2/2 | 2/2 | |
we construct the three aforementioned test suites and introduce them into transformer-based language models, then calculate the coverage value for each criterion. Referring to the SOTA NLC evaluation method [47] for coverage criteria, we establish the ground truth for the coverage values induced by these test suites as . Finally, we examine the extent to which the neuron coverage criterion aligns with this ground truth under various configurations.
4.4.2 Results.
Table 8 and Table 9 present the average coverage values obtained by the sample sets , , and . Specifically, Table 8 reports results for classification tasks, while Table 9 reports results for generation tasks. Each major row corresponds to a specific coverage criterion, while the main columns represent the models, further subdivided into three sub-columns indicating the respective sample sets. The table is designed to assess whether the coverage values align
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
21
Coverage Increase vs. Diversity

Fig. 8. Coverage variation under fixed-size test suites generated from randomly perturbed sub-samples of different sizes.
with the expected ground truth relationship , with a checkmark indicating when this condition is met. The final column summarizes the number of instances where this ground truth relationship holds. For example, in the first row, the coverage values 0.966, 0.955, and 0.949 correspond to Neuron Coverage (NC) with a threshold of 0.25 under the LLama-2 model. Since 0.966 > 0.955 > 0.949 satisfies the expected relationship, a checkmark is placed accordingly.
As shown in Table 8, for NC across thresholds , , and , the relationship is generally maintained, particularly at higher thresholds. All three models conform to this relationship at , with 6 out of 9 configurations meeting the expected pattern. This is partly because, at lower thresholds such as 0.25 or 0.50, the coverage for the original sample set often approaches saturation, rendering it difficult to differentiate the coverage values across the three sample sets. For the K-Multisection Neuron Coverage (KMNC) criterion, a strong alignment with the expected relationship is observed, particularly at and , where all models adhere to the relationship. However, at , the LLama-2 model deviates from this pattern, slightly reducing the overall satisfaction rate to 8 out of 9 configurations. The Neuron Boundary Coverage (NBC) and Strong Neuron Activation Coverage (SNAC) criteria consistently satisfy the expected relationship across all configurations and models. This consistency underscores the robustness of these criteria in distinguishing between different sample sets, with all configurations demonstrating the expected pattern, thereby validating their effectiveness in assessing distribution diversity. In contrast, the Neuron Linear Coverage (NLC) criterion exhibits more variability. For standard NLC, the expected relationship holds in one out of three configurations, whereas the enhanced version, NLC+, satisfies the relationship in two out of three cases, resulting in an overall mixed outcome of 3 out of 6 configurations. This variability aligns with prior analyses, indicating that the sensitivity of this metric can lead to more random results. Lastly, the Composite Coverage (CC) criterion consistently adheres to the expected relationship across all models and configurations. The uniformity across configurations suggests that CC is particularly sensitive to differences between sample sets, with even slight perturbations in noise samples rarely affecting the overall CC coverage. Table 9 shows similar findings for generation tasks, with the ground-truth relationship satisfied in all cases except for the NLC series and NC at the low threshold . Moreover, to further demonstrate the correlation between coverage and distributional diversity, Figure 8 presents one representative configuration for both classification and generation tasks. Under a fixed test suite size, diversity is gradually increased by perturbing larger sub-samples. The results indicate a generally positive correlation, as coverage consistently increases with higher diversity.
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue

Fig. 9. An illustration of sample fairness in sentiment classification. This example compares test suite of equal size. The first sub-figure demonstrates good fairness, with a balanced distribution across all categories, while the second sub-figure illustrates poor fairness, characterized by missing and imbalanced classes.
In conclusion, the table demonstrates that the relationship is largely maintained across different models and criteria. NBC, SNAC, and CC criteria show the most consistent adherence to this pattern, indicating their effectiveness in distinguishing sample sets and assessing coverage improvements. Although NC and KMNC may struggle to capture subtle variations at lower thresholds, they generally follow the expected relationship. Conversely, the variability of the NLC criterion suggests it may be less reliable under certain conditions or for specific models.
Finding 2:
Neuron coverage criteria effectively reflect the distribution diversity of a test suite in 44 out of 56 cases, though NLC shows some randomness. For threshold-based criteria, higher thresholds better capture subtle distribution variations.
Implication 2:
-
Usage. Existing criteria (except the NLC series) can be applied to evaluate the distributional diversity of test suites. However, criteria with thresholds require manual tuning, since overly small thresholds may fail to capture meaningful differences.
-
Design. Future criteria should be designed to remain robust against variations in input order while preserving their ability to differentiate distributional diversity.
4.5 Sample Fairness (RQ3)
Sample fairness refers to the balance of categories within a test suite. It represents an important dimension of test-suite diversity and complements the distribution diversity emphasized in RQ2, as the two capture representativeness from the output label space and the input space, respectively. This research question, therefore, aims to explore whether neuron coverage criteria can effectively assess the sample fairness of a test suite. Specifically, given two test suites of the same size, we seek to determine whether coverage criteria can identify the test suite with better fairness, i.e., the one with a more balanced distribution of samples across categories.
4.5.1 Experiment Design
To investigate RQ3, we design test suites with varying levels of sample fairness and analyze whether the coverage values produced by these test suites, when passed through the model, are positively correlated with their category diversity. Figure 9 provides an intuitive example of sample fairness, using a sentiment classification task as the context. In this example, circles and squares represent two different test suites, and different colors correspond to samples.
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
23

Fig. 10. Process for constructing the CSS-c-2n and CSS-dc-2n test suites: Randomly select two subsets of class and one subset of class . CSS-c-2n is formed by combining the subsets , while CSS-dc-2n combines and .
from different classes. In the first test suite, samples are drawn from three classes with nearly equal representation, indicating balanced classes. This balance reflects good fairness or high category diversity. In contrast, the second test suite contains samples from only two classes, with a majority from the red class, a minority from the blue class, and none from the yellow class. This imbalance indicates poor fairness or low category diversity.
As illustrated in Figure 10, we construct varying levels of sample fairness. We begin by defining a class-specific subset of size n for class c (denoted as CSS-c-n). From this, we can derive CSS-c-2n by either combining CSS-c-n with another subset of the same class or simply by doubling the size n. Additionally, we define CSS-dc-2n by combining CSS-c-n with a subset from a different class, where “dc” stands for different classes.
Class-Specific Subset (denoted as CSS-c-n):
This formula represents a subset of size n from the original sample S, consisting exclusively of samples with the label c. Here, represents the predicted label, and is the ground truth label of the sample, with all equal to c. The subset CSS-c-2n is created by either replacing n with 2n in CSS-c-n or by adding another CSS-c-n subset to the original, effectively doubling the sample size. In this experiment, n is set to 2500.
Two-Class Subset (denoted as CSS-dc-2n):
The CSS-dc-2n subset is constructed by combining two class-specific subsets, each of size n, from classes and . Here, represents the predicted label, and is the ground truth label, where can be either or . The total size of CSS-dc-2n is 2n, with exactly n samples from each class. As above, n is set to 2500.
After constructing the three test suites, we rank their fairness as CSS-dc-2n > CSS-c-2n > CSS-c-n. This is because CSS-c-n contains 2,500 samples from a single class, while CSS-c-2n doubles the sample size but still draws from the same class, offering only a slight diversity gain. By contrast, CSS-dc-2n introduces an equal number of samples from a different class, resulting in the highest fairness. We then apply these test suites to transformer-based language models and compute coverage values under each criterion. Using the CC method [17] as a reference, the ground-truth ranking of coverage values is established as . Finally, we evaluate how closely each neuron coverage criterion aligns with this ground truth.
4.5.2 Results
Table 10 presents the average coverage values achieved by the sample sets CSS-c-n, CSS-c-2n, and CSS-dc-2n across various transformer-based language models. The main columns represent the models, further subdivided into
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
Table 10. The average coverage values achieved by the sample sets CSS-c-n, CSS-c-2n, and CSS-dc-2n on transformer-based language models. A checkmark indicates that the relationship is satisfied. The final column shows the number of cases where this ground truth relationship holds.
| Coverage Criteria | Config. | LLama-2 | BERT | T5 | Groundtruth Satisfaction | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| c-n | c-2n | dc-2n | c-n | c-2n | dc-2n | c-n | c-2n | dc-2n | Satisfaction | ||||||
| NC | T=0.25 | 0.958 | 0.962 | 0.966 | ✓ | 0.999 | 1.000 | 1.000 | 0.973 | 0.986 | 0.991 | ✓ | 2/3 | 7/9 | |
| T=0.50 | 0.581 | 0.593 | 0.603 | ✓ | 0.997 | 0.999 | 0.999 | 0.951 | 0.955 | 0.970 | ✓ | 3/3 | |||
| T=0.75 | 0.339 | 0.347 | 0.371 | ✓ | 0.590 | 0.675 | 0.830 | ✓ | 0.671 | 0.673 | 0.701 | ✓ | 3/3 | ||
| KMNC | K=10 | 0.952 | 0.964 | 0.989 | ✓ | 0.944 | 0.961 | 0.996 | ✓ | 0.933 | 0.945 | 0.987 | ✓ | 3/3 | 9/9 |
| K=50 | 0.819 | 0.876 | 0.923 | ✓ | 0.751 | 0.887 | 0.960 | ✓ | 0.797 | 0.847 | 0.923 | ✓ | 2/3 | ||
| K=100 | 0.801 | 0.823 | 0.875 | ✓ | 0.775 | 0.840 | 0.930 | ✓ | 0.716 | 0.794 | 0.873 | ✓ | 3/3 | ||
| NBC | None | 0.313 | 0.327 | 0.450 | ✓ | 0.399 | 0.420 | 0.496 | ✓ | 0.308 | 0.350 | 0.491 | ✓ | 3/3 | 3/3 |
| SNAC | None | 0.291 | 0.327 | 0.451 | ✓ | 0.411 | 0.424 | 0.498 | ✓ | 0.329 | 0.366 | 0.498 | ✓ | 3/3 | 3/3 |
| NLC | None | 0.093 | 0.106 | 0.180 | ✓ | 0.112 | 0.118 | 0.193 | ✓ | 0.107 | 0.109 | 0.188 | ✓ | 3/3 | 5/6 |
| NLC+ | None | 0.557 | 0.551 | 0.695 | 0.531 | 0.602 | 0.668 | ✓ | 0.394 | 0.401 | 0.479 | ✓ | 2/3 | ||
| None | 0.003 | 0.004 | 0.017 | ✓ | 0.009 | 0.11 | 0.027 | ✓ | 0.012 | 0.014 | 0.019 | ✓ | 3/3 | 3/3 | |
three sub-columns indicating the respective sample sets. The table is designed to evaluate whether the coverage values adhere to the expected relationship , with a checkmark indicating when this condition is satisfied. The final column summarizes the proportion of cases where the expected relationship is met. For instance, in the first row under the NC criterion with a threshold of , the coverage values of 0.958, 0.962, and 0.966 for the LLama-2 model correspond to the sample sets CSS-c-n, CSS-c-2n, and CSS-dc-2n, respectively. Since 0.958 < 0.962 < 0.966 satisfies the expected relationship, a checkmark is placed accordingly. However, for the BERT model, the values 0.999, 1.000, and 1.000 do not satisfy the relationship since the latter two values are equal; hence, no checkmark is recorded.
When examining the NC criterion at thresholds , , and , the relationship is generally maintained, particularly at higher thresholds, with 7 out of 9 configurations conforming to the expected pattern. All three models adhere to this relationship at . Even in the two cases where the relationship is not fully satisfied, the first inequality, , is still maintained (e.g., 0.999 < 1.000 and 0.997 < 0.999). This suggests that at lower thresholds, the shift from to is consistently observed, while the more subtle shift from to is harder to discern. For the KMNC, NBC, SNAC, and CC criteria, there is a strong alignment with the expected relationship, consistently satisfying the expected pattern across all models and configurations, achieving an overall success rate of 18/18. This consistency underscores the reliability of these criteria in evaluating the fairness of the sample sets. The NLC family also achieves a high rate of adherence to the ground truth, with 5 out of 6 configurations meeting the expected relationship. Specifically, for NLC, all three configurations (3/3) are satisfied. This is likely because NLC is based on variance, which might decrease when adding certain samples that are very close in the input space, thereby lowering the NLC coverage value. However, during the fairness evaluation process, where new samples—often from different categories—are added, the close proximity effect is minimal, resulting in consistent outcomes. For NLC+, 2 out of 3 configurations meet the expected relationship. In the unsatisfied example (0.557, 0.551, 0.695), we observe that 0.557 > 0.551. As previously noted, NLC+ is sensitive to the order of sample inputs, leading to a scenario where the first sample set, due to input order, may result in a higher coverage value. However, for and , where the latter involves the addition of entirely new categories, the impact of order-induced errors becomes negligible.
In summary, the table shows that the relationship holds in 30 out of 33 cases. In the remaining three cases, a partial relation is satisfied, either or . The NBC, SNAC, KMNC, and CC criteria
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
25
show the most consistent adherence to this pattern, while NC and NLC mostly conform. In cases where NC does not satisfy the relationship, it is generally due to the low threshold, which allows to reach near-complete coverage values (close to 1). As a result, even when introduces new categories, it fails to uncover new, previously uncovered information. Overall, NC typically satisfies . For cases where NLC does not meet the expected relationship, this is attributed to the fact that datasets from the same category, even with different sample sizes, exhibit minimal semantic differences. Consequently, smaller sample sets, depending on their input order, might yield higher coverage values. Nonetheless, the NLC family generally satisfies and , as the addition of new categories effectively counterbalances potential order-induced errors.
Finding 3:
Neuron coverage criteria effectively assess the sample fairness of a test suite in 30 out of 33 cases. The remaining three instances still satisfy half of the expected relation.
Implication 3:
- Usage and Design. Experimental results indicate that existing coverage criteria already provide reasonable effectiveness in assessing the category diversity of test suites. This suggests that category diversity may be less pressing as a direction for new criterion design, though further exploration into how multiple criteria can be strategically integrated may still offer additional benefits.
4.6 Input Generation Guidance (RQ4)
Input generation refers to the process in software testing where new test inputs are generated from an initial sample set using various mutation techniques. This research question aims to explore whether guiding input generation with the goal of increasing neuron coverage criteria can produce more valuable test cases. Specifically, it examines whether incorporating coverage criteria into conventional mutation methods can lead to the generation of a higher number of fault-revealing samples.
4.6.1 Experiment Design
To address RQ4, we conduct fuzz testing on a text-based task guided by neuron coverage criteria. Coverage-guided fuzzing approaches typically use coverage as the fitness function, supplemented by seed scheduling and mutation strategies. Our objective is to determine whether coverage-guided fuzzing can generate more adversarial examples—inputs that are semantically similar to the original samples but yield different outputs. While numerous fuzz testing methods exist, most focus on image tasks. Since our work targets text datasets, we first identify common perturbation strategies for text. Simple word swaps are unsuitable for this purpose, as they can significantly alter the semantics of sentences. For example, transforming I saw a man with a telescope into I saw a telescope with a man drastically changes the meaning. Thus, word swaps are not appropriate for introducing noise into text data. Instead, we employ techniques such as synonym replacement, tense modification, and repetition as mutation operators. By applying these mutation operators, we perform random mutations on the initial dataset to generate new sample sets, establishing a baseline for sample generation without coverage guidance.
With the basic sample generation algorithm established, we develop a coverage-guided input generation algorithm to strategically select mutated samples based on coverage criteria. The detailed method is presented in Algorithm 1. In Lines
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
Algorithm 1 Coverage-Guided Input Generation
1: Input: S: Initial Seed Set, DNN: Target Neural Network, C: Coverage Criterion, N: Maximum Number of Generated Samples 2: Output: Set of adversarial examples 3: 4: 5: while do 6: 7: 8: for all do 9: 10: if then 11: break 12: else if isAdversarial( ) then 13: 14: else if isCoverageGain(cov) then 15: 16: end if 17: end for 18: end while
1-2, the algorithm begins by initializing the input parameters: the initial seed set S, the target neural network DNN, the coverage criterion C, and a custom parameter N that limits the number of generated samples. In this experiment, S refers to the original samples, where a total of 1,000 inputs are randomly selected from the test dataset to serve as fuzzing seeds, and N is set to 10,000. The output set F is initialized as empty, and the seed set S is loaded into the queue Q. In Lines 3-5, the algorithm enters a loop where it selects the next seed s from the queue Q (line 5) and applies the TextMutate function to generate a set T of mutated samples (line 6). In Line 7, the mutated samples T are evaluated against the DNN using the coverage criterion C. The Run function returns the coverage information cov, which guides the selection of further mutations. In Lines 8-16, each sample in T is processed as follows: the sample counter i is incremented (line 8) and checked against the limit N (line 9). If i exceeds N, the process stops. If a sample is adversarial (isAdversarial), it is added to the output set F (lines 10-11). If a sample increases coverage (isCoverageGain), it is added to the queue Q for further mutation (lines 12-13). In Line 17, the loop continues until the sample generation limit N is reached or no more seeds are available for mutation, at which point the algorithm terminates. This coverage-guided approach ensures that the algorithm focuses on samples that either reveal new behaviors or improve coverage, optimizing the efficiency of the fuzz testing process. Given the large size of transformer-based language models, we select neuron-level coverage criteria with the lowest computational complexity, namely NC, NBC, and SNAC, as guiding indicators. During the generation process, if any of these coverage criteria increases, the function isCoverageGain(cov) returns true. Overall, we adopt the random mutation strategy with the same operators as the baseline. In addition, we evaluate the effect of applying three coverage criteria individually, as well as their combination. We then compare the results across these four methods by measuring the proportion of adversarial samples generated from the initial sample set for classification tasks, and by analyzing the BLEU drop for generation tasks, both based on 10,000 newly generated samples.
4.6.2 Results.
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
27
Table 11. Proportion of adversarial samples on classification tasks: comparison of random mutation and its variants with different coverage-guided strategies (A, B, C), where A, B, and C correspond to NC, NBC, and SNAC, respectively. Wall-clock time is reported in seconds (s).
| Input Generation Strategy | Random Mutation | With A | With B | With C | With A+B+C |
|---|---|---|---|---|---|
| Adversarial Proportion | 1589 / 10000 | 1604 / 10000 | 1815 / 10000 | 1801 / 10000 | 2045 / 10000 |
| Wall-clock Time (s) | - | ~97.24 | ~114.71 | ~157.27 | ~265.44 |
Table 12. BLEU () on generation tasks: comparison of random mutation and its variants with different coverage-guided strategies (A, B, C), where A, B, and C correspond to NC, NBC, and SNAC, respectively. Wall-clock time is reported in seconds.
| Input Generation | Random Mutation | With A | With B | With C | With A+B+C |
|---|---|---|---|---|---|
| ΔBLEU | -7.11% | -7.56% | -7.94% | -7.61% | -10.65% |
| Wall-clock Time (s) | - | ~2145.63 | ~2990.14 | ~3841.55 | ~7701.95 |
Table 11 and Table 12 summarize the results under different mutation strategies, reporting the proportion of adversarial samples for classification tasks and the BLEU drop for generation tasks, respectively. As shown in Table 11, the baseline random mutation yields 1,589 adversarial samples out of 10,000 inputs (15.89%). Incorporating coverage criteria individually leads to modest but noticeable improvements: With A (NC) generates 1,604 samples (16.04%), With B (NBC) 1,815 samples (18.15%), and With C (SNAC) 1,801 samples (18.01%). Among the three, B and C show slightly stronger effects than A, suggesting that different criteria capture complementary aspects of neuron activations. The combined strategy With A+B+C achieves the highest proportion, producing 2,045 adversarial samples (20.45%), outperforming random mutation by 4.56 percentage points and consistently surpassing the individual criteria. A similar trend is observed in Table 12. While random mutation reduces BLEU by 7.11%, coverage-guided strategies achieve larger drops, with the combined variant (A+B+C) reaching the maximum decrease of 10.65%. The stronger BLEU degradation indicates that coverage-guided mutations introduce more semantically disruptive perturbations, thereby uncovering failure cases that random mutation is less likely to expose.
In addition to effectiveness, Tables 11 and 12 report the empirical wall-clock time of coverage-guided mutation. For classification tasks (Table 11), incorporating a single coverage criterion introduces a moderate computational overhead compared to random mutation. Specifically, NC-, NBC-, and SNAC-guided strategies require approximately 97 s, 115 s, and 157 s, respectively, while the combined strategy (A+B+C) incurs the highest cost at around 265.s. This increase is expected, as integrating more coverage criteria entails additional coverage computation and selection steps during mutation. For generation tasks (Table 12), the time cost is substantially higher, ranging from approximately 2,146 s for NC-guided mutation to about 7,702 s for the combined strategy. This roughly one-order-of-magnitude increase compared to classification tasks is mainly attributable to the substantially larger model sizes and the higher cost of computing coverage over longer output sequences in generation models. Despite this overhead, the observed wall-clock times remain practical under the experimental setting described in Section 4.2.3, where all experiments are conducted with a batch size of 32 on the same hardware configuration. It is also worth noting that these time costs are not inherent limitations of coverage-guided testing. In practice, they can be further reduced through engineering optimizations such as increasing batch size, parallelizing coverage computation, or leveraging more powerful hardware accelerators. Therefore, the reported results serve as a realistic empirical reference rather than an upper bound on the efficiency of coverage-guided fuzzing.
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
Overall, these results demonstrate that coverage guidance consistently expands the adversarial search space beyond unguided random perturbations, with stable improvements observed across both classification and generation tasks. While the improvement brought by any single coverage criterion is moderate, this is consistent with our earlier findings that coverage signals tend to be weak but directionally correct. When leveraged within an iterative fuzzing process, such signals are progressively amplified through accumulation and pruning: perturbations that fail to induce new internal behaviors are filtered out, while coverage-increasing mutations are retained and reused, effectively narrowing the search space toward error-prone regions. Moreover, combining multiple criteria yields the most robust gains, as NC, NBC, and SNAC capture complementary aspects of model behavior. Their synergy amplifies weak but consistent signals and provides stronger guidance than any individual criterion alone. As a result, coverage-guided mutation not only increases the proportion of adversarial samples in classification tasks, but also more effectively degrades generation quality, reinforcing its advantage over blind random mutation and highlighting its practical value for improving the efficiency of neural network testing.
Finding 4:
Under the guidance of neuron-level coverage criteria, the sample generation is slightly enhanced. Specifically, the improvement is as low as 0.15% for individual criterion, and only by combining three criteria does it produce 4.56% more adversarial samples compared to basic methods in a set of 10,000 samples.
Implication 4:
- Usage. In practice, combining diverse coverage criteria can, to a certain extent, more effectively constrain the search space of random mutations to guide the discovery of error-revealing inputs. However, due to cost-effectiveness concerns, practical applications must carefully weigh the computational overhead against the potential benefits.
5 RELATED WORK
5.1 Transformer-based Model
The Transformer architecture is one of the most popular neural network structures and core technology behind the widely acclaimed ChatGPT[29]. The realm of deep learning underwent a revolutionary shift with the introduction of the Transformer architecture by Vaswani et al [39]. Originally designed to address challenges in sequence transduction tasks such as machine translation, the Transformer model leverages self-attention mechanisms allowing it to weigh the significance of different parts of an input sequence relative to each other. Following this landmark work, numerous Transformer-based models have been proposed, setting new benchmarks across various tasks. BERT[9] stands out as a prominent example, introducing the concept of bidirectional training of Transformers for language understanding. BERT's pre-training on vast corpora and fine-tuning on specific task paradigms has become a de facto standard in numerous NLP tasks. Expanding upon BERT, models like RoBERTa[23] modify aspects of BERT's training regimen to achieve even better performance. GPT[32] and its subsequent versions[5, 6, 30, 33] showcase the prowess of large-scale, generative pre-trained Transformers, particularly in language generation tasks. Attention mechanisms, a key component of Transformer models, have undergone refinements. XLNet[45], for instance, integrates permutation-based training to
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
29
capture bidirectional context more effectively than traditional autoregressive models. Meanwhile, efforts like T5[34] revisit the paradigm by treating every NLP challenge as a text-to-text problem, showcasing the flexibility and robustness of Transformer models. Apart from the advances in core model architectures, there have also been significant strides in model efficiency. Efforts towards model efficiency have resulted in variants like ALBERT[20], DistilBERT[35], and TinyBERT[18], offering pruned or distilled versions of larger Transformers. These models ensure that the benefits of Transformer architectures can be leveraged even in resource-constrained environments, broadening their applicability and impact in real-world scenarios.
In summary, Transformer-based models have significantly reshaped the landscape of NLP and continue to lead the way in state-of-the-art performance across a myriad of tasks. However, due to the complexity of these models, there is still a lack of comprehensive testing methods available to evaluate them.
5.2 Neuron Coverage Testing
As deep learning models, particularly deep neural networks (DNNs), have gained widespread acceptance in diverse domains, ranging from image recognition to natural language processing, the imperative to ensure the reliability of these models has become increasingly crucial. Unlike traditional software, which has well-established testing criteria[1], the unique characteristics of DNNs necessitate the formulation of new testing standards. Neuron coverage emerges as one such criterion designed to gauge the thoroughness of DNN testing, with DeepXplore[31] pioneering as the first white-box testing framework for real-world DNN systems, introducing the concept of neuron coverage for the first time. Considering that the granularity of the neuron coverage proposed in DeepXplore is relatively coarse, DeepCover[36] and DeepGauge[27] are proposed accordingly and demonstrate better performance. Inspired by traditional combination testing methods and path-oriented testing methods, DeepCT[26] and DeepPath[40] were subsequently proposed, achieving higher coverage in terms of testing coverage standards. In order to accomplish the task of automatically identifying the confusion and deviation of DNN-based image classifiers that cannot be realized by existing DNN testing technology, the White-box testing framework DeepInspect[37] was proposed. The CNN-based test coverage criteria above do not have good portability for RNN. Therefore, the automation test framework DeepCruiser[12] which is based on the RNN test coverage criteria, is proposed and can effectively detect defects in the RNN-based system. Furthermore, to study a single input, Kim et al. propose a fine-grained testing adequacy framework SADL[19] and introduce two indicators: surprise adequacy (SA) and surprise coverage (SC), which play an important role in distinguishing adversarial samples and guiding model retraining.
However, most of the existing coverage criteria are used for DNN and image-related tasks, with a few used for NLP tasks but have only been tested on RNN. Accordingly, we apply neuron coverage testing methods to transformer-based language models to evaluate their effectiveness and the robustness of the model.
6 DISCUSSION
Implications. Our findings suggest several practical implications for the use and future design of neuron coverage criteria in Transformer-based models. First, for error detection (RQ1), the marginal coverage gains from adversarial samples over benign noise highlight the limited practical value of existing criteria; future designs should explicitly distinguish erroneous from normal samples by amplifying error-related semantics while suppressing noise-like perturbations. Second, regarding distributional diversity (RQ2), most existing criteria—except the order-sensitive NLC series—can already be applied, but those with thresholds require careful tuning; future criteria should remain robust to input order while preserving sensitivity to diversity. Third, for category diversity (RQ3), current criteria show adequate
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
performance in this dimension, implying that future design efforts might consider focusing more on other aspects while still keeping this one in view. Finally, for input generation (RQ4), combining multiple coverage criteria provides a more effective guide than individual ones, shrinking the search space of random mutations and enabling more efficient discovery of error-revealing inputs. To further illustrate the implications, we summarize two potential ways in which coverage criteria could be applied to improve the reliability of Transformer-based NLP systems: coverage-guided sample selection and coverage-guided fuzzing for input generation.
• Coverage-guided Sample Selection. Coverage information may assist in selecting representative samples under resource constraints. For example, in data annotation for classification tasks, when only a limited number of samples can be labeled, coverage could help identify subsets with more balanced category distribution (as suggested by RQ3), thereby improving the cost-effectiveness of annotation. Similarly, in fine-tuning for text generation tasks, when large training corpora cannot be fully utilized due to computational limits, coverage could guide the selection of samples with more balanced distribution (as suggested by RQ2), reducing data skewness and enhancing fine-tuning efficiency.
• Coverage-guided Fuzzing for Input Generation. Coverage may also serve as a feedback signal in fuzzing-based input generation. Rather than applying random perturbations, coverage-guided fuzzing could prioritize mutations that explore previously under-tested regions of the model(as suggested by RQ4). In text generation tasks, for instance, such perturbations may be more likely to trigger factual inconsistencies or other error-revealing behaviors, thereby producing challenging test cases. This targeted augmentation has the potential to support more effective error detection and robustness evaluation compared to unguided approaches.
Model Scale and Coverage Effectiveness. Although the complexity of most coverage criteria is polynomial, the computational cost is positively correlated with network depth and the number of neurons per layer, leading to varying degrees of growth as models expand. Therefore, analyzing the sensitivity of coverage criteria across models of varying sizes is essential. Based on our experiments covering models with vastly different parameter sizes, including the Encoder-only BERT (110M), the Encoder-Decoder T5 (220M), and the Decoder-only LLaMA (7B), we demonstrate that criterion efficacy remains consistent across model scales. Specifically, in terms of Error-Revealing Capability (RQ1), all models exhibited nearly identical trends. For Distribution Diversity (RQ2) and Sample Fairness (RQ3), the criteria effectively reflected test suite properties with comparable success rates across sizes (RQ2: 8/11, 9/11, 9/11; RQ3: 9/11, 11/11, 10/11 for BERT, T5, and LLaMA, respectively). The slightly lower success rate observed in the smallest model (BERT) is attributable to coverage saturation, where coverage approaches 100% even on low-diversity suites, rather than a lack of sensitivity. These findings confirm that, within our experimental range (110M to 7B), the validity of coverage criteria is not compromised by the exponential growth of parameters.
However, to ensure reliability, our current approach employs average pooling over all internal representations, considering the model's entire information flow. While effective, this imposes a substantial computational overhead that grows significantly with model size. Consequently, for future testing of ultra-large models, research should pivot towards identifying representative subsets within the internal representations as testing targets. This strategy aims to maintain the efficacy of coverage criteria while significantly enhancing computational efficiency.
7 THREATS TO VALIDITY
7.1 External Validity
External validity threats might arise from the scope of our experiments, which are conducted on six language models and six datasets. To mitigate this risk, we include the three most widely used transformer model architectures: encoder-only,
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
31
decoder-only, and encoder-decoder. These choices make our experiments broadly representative of transformer-based language models. Nevertheless, in future research, we will explore whether our findings hold across a wider range of model architectures, including hybrid networks that integrate transformers with convolutional networks.
7.2 Internal Validity
Internal validity threats could emerge from the randomness in model fine-tuning. To mitigate this threat, we employed five different seeds during the fine-tuning process and averaged the results to ensure that the randomness had minimal impact on our conclusions. Another potential threat arises from the data preprocessing strategy, specifically the truncation of input texts. While imposing maximum text length constraints is a standard practice to optimize model inference speed across varying language tasks, it inherently poses a risk of losing semantic information located at the end of sequences. To mitigate this risk, we struck a balance between efficiency and information integrity. As detailed in Table 3, for the majority of datasets, the maximum length was set to 128, which significantly exceeds their average lengths (ranging from 20.3 to 39.8), thereby affecting only a negligible portion of long-tail samples. For the dataset characterized by longer sequences (i.e., AGnews), we extended the limit to 256. Although this is closer to its average length of 233, preliminary experiments on the test set demonstrated that this length is sufficient for the model to capture critical semantic features. The performance discrepancy (e.g., accuracy) between inputs truncated at 256 and full-length inputs was observed to be less than 2%. Therefore, we believe our truncation strategy minimizes semantic loss while ensuring experimental feasibility.
8 CONCLUSION AND FUTURE WORK
In this study, we conducted the first systematic evaluation of neuron coverage criteria on Transformer-based language models, reviewing existing criteria in terms of granularity and algorithmic complexity. Our results show that neuron coverage can capture useful test suite properties such as error exposure, distributional diversity, and input generation guidance, but its effectiveness varies across contexts. The marginal gains from adversarial over benign perturbations indicate limited value for error detection, while most criteria, except order-sensitive variants, perform reliably for distributional and categorical diversity. Moreover, combining multiple criteria provides stronger guidance for input generation than any single one, narrowing the mutation search space and improving the discovery of error-revealing inputs.
Future Work
- Coverage Design for Transformer Architectures. Our findings suggest that future research should move beyond coverage criteria originally designed for convolutional neural networks and instead develop criteria specifically tailored to Transformer architectures. In particular, incorporating intermediate variables intrinsic to self-attention mechanisms, such as the query, key, and value representations, may help better capture error-related signals and improve the ability to distinguish erroneous perturbations from noise-like ones. In addition, designing coverage criteria that are robust to variations in input ordering remains an important challenge. Addressing these issues would further advance coverage-guided testing toward a practical and effective tool for improving the reliability of Transformer-based NLP systems.
• Efficient Evaluation Configurations. Another promising direction is to investigate alternative evaluation configurations, such as selecting specific tokens or layers, in order to better balance coverage effectiveness and computational cost. This problem naturally involves optimization over subsets of tokens or layers, where the number of possible configurations grows exponentially. Systematically studying how different token- or layer-selection strategies affect
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
coverage sensitivity, diversity characterization, and guidance quality may provide insights into more efficient coverage estimation. Such efforts could ultimately lead to more scalable and targeted coverage-guided testing frameworks for large-scale Transformer models.
• Optimization of Initialization Data and Test Suite Scale. The calculation of neuron coverage criteria necessitates a specified test suite size for evaluation and, in many cases, a baseline dataset for initializing neuron states (e.g., determining activation bounds). Currently, these configurations are largely determined empirically, such as the 1,000 and 5,000 sample sizes adopted in this study, representing a subjective trade-off between statistical stability and computational overhead. However, given the immense volume of training data and the prohibitive inference costs of modern Large Language Models (LLMs), relying on arbitrary or "the larger, the better" strategies is untenable. A critical avenue for future work is to investigate methods for identifying the most representative or "critical" subset of data for robust initialization, and to establish scientifically grounded guidelines for determining the optimal test suite size. This would ensure that coverage assessments are both statistically reliable and computationally feasible in the era of large-scale models.
• Extending Coverage-Guided Testing to Other Attack Paradigms. Beyond classical adversarial perturbations, recent attack paradigms such as prompt injection have emerged as critical security concerns for large language models. These attacks involve deliberate, semantically meaningful manipulations of input prompts and differ fundamentally from noise-like perturbations considered in this study. Exploring how coverage criteria can be adapted to characterize and detect such attacks, for example by analyzing internal state shifts induced by injected instructions, represents an important and challenging direction for future work. Addressing this problem will likely require new threat models, mutation strategies, and evaluation frameworks, enabling coverage-guided testing to extend beyond robustness testing toward broader security and safety assessments.
ACKNOWLEDGMENTS
This work was supported in part by the National Natural Science Foundation of China (Grant No. 61972373). It was also supported in part by JST CRONOS Grant (No. JPMJCS24K8), JSPS KAKENHI Grants (No. JP21H04877, No. JP23H03372, and No. JP24K02920), the Canada CIFAR AI Chairs Program, the Natural Sciences and Engineering Research Council of Canada, and the Autoware Foundation. In addition, Jiayang Song was supported by the MUST Faculty Research Grant (FRG).
Antidote or Placebo? Unraveling the Efficacy of Neuron Coverage Criteria on Testing Transformer-based Language Models
33
REFERENCES
[1] Paul Ammann and Jeff Offutt. 2016. Introduction to software testing. Cambridge University Press.
[2] Maryam Badar, Muhammad Haris, and Anam Fatima. 2020. Application of deep learning for retinal image analysis: A review. Computer Science Review 35 (2020), 100203.
[3] Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. 2015. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326 (2015).
[4] Wieland Brendel and Matthias Bethge. 2019. Approximating cnns with bag-of-local-features models works surprisingly well on imagenet. arXiv preprint arXiv:1904.00760 (2019).
[5] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. Advances in neural information processing systems 33 (2020), 1877–1901.
[6] Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. 2023. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712 (2023).
[7] Jiwoong Choi, Dayoung Chun, Hyun Kim, and Hyuk-Jae Lee. 2019. Gaussian yolov3: An accurate and fast object detector using localization uncertainty for autonomous driving. In Proceedings of the IEEE/CVF International conference on computer vision. 502–511.
[8] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. 2023. Palm: Scaling language modeling with pathways. Journal of Machine Learning Research 24, 240 (2023), 1–113.
[9] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018).
[10] Yizhen Dong, Peixin Zhang, Jingyi Wang, Shuang Liu, Jun Sun, Jianye Hao, Xinyu Wang, Li Wang, Jin Song Dong, and Dai Ting. 2019. There is limited correlation between coverage and robustness for deep neural networks. arXiv preprint arXiv:1911.05904 (2019).
[11] Xiaoning Du, Xiaofei Xie, Yi Li, Lei Ma, Yang Liu, and Jianjun Zhao. 2019. Deepstellar: Model-based quantitative analysis of stateful deep learning systems. In Proceedings of the 2019 27th ACM joint meeting on European software engineering conference and symposium on the foundations of software engineering. 477–487.
[12] Xiaoning Du, Xiaofei Xie, Yi Li, Lei Ma, Jianjun Zhao, and Yang Liu. 2018. Deepcruiser: Automated guided testing for stateful deep learning systems. arXiv preprint arXiv:1812.05339 (2018).
[13] Jan Egger, Christina Gsaxner, Antonio Pepe, Kelsey L Pomykala, Frederic Jonske, Manuel Kurz, Jianning Li, and Jens Kleesiek. 2022. Medical deep learning—A systematic meta-review. Computer methods and programs in biomedicine 221 (2022), 106874.
[14] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. 2018. ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231 (2018).
[15] Simos Gerasimou, Hasan Ferit Eniser, Alper Sen, and Alper Cakan. 2020. Importance-driven deep learning system testing. In Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering. 702–713.
[16] Fabrice Harel-Canada, Lingxiao Wang, Muhammad Ali Gulzar, Quanquan Gu, and Miryung Kim. 2020. Is neuron coverage a meaningful measure for testing deep neural networks?. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 851–862.
[17] Zhenlan Ji, Pingchuan Ma, Yuanyuan Yuan, and Shuai Wang. 2023. Cc: Causality-aware coverage criterion for deep neural networks. In 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE). IEEE, 1788–1800.
[18] Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. 2019. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351 (2019).
[19] Jinhan Kim, Robert Feldt, and Shin Yoo. 2019. Guiding deep learning system testing using surprise adequacy. In 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE). IEEE, 1039–1049.
[20] Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2019. Albert: A lite bert for self-supervised learning of language representations. arXiv preprint arXiv:1909.11942 (2019).
[21] Ivano Lauriola, Alberto Lavelli, and Fabio Aiolli. 2022. An introduction to deep learning in natural language processing: Models, techniques, and tools. Neurocomputing 470 (2022), 443–456.
[22] Zenan Li, Xiaoxing Ma, Chang Xu, and Chun Cao. 2019. Structural coverage criteria for neural networks could be misleading. In 2019 IEEE/ACM 41st International Conference on Software Engineering: New Ideas and Emerging Results (ICSE-NIER). IEEE, 89–92.
[23] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692 (2019).
[24] Tyler J Loftus, Benjamin Shickel, Matthew M Ruppert, Jeremy A Balch, Tezcan Ozrazgat-Baslanti, Patrick J Tighe, Philip A Efron, William R Hogan, Parisa Rashidi, Gilbert R Upchurch Jr, et al. 2022. Uncertainty-aware deep learning in healthcare: a scoping review. PLOS digital health 1, 8 (2022), e0000085.
[25] Antonio Loquercio, Mattia Segu, and Davide Scaramuzza. 2020. A general framework for uncertainty estimation in deep learning. IEEE Robotics and Automation Letters 5, 2 (2020), 3153–3160.
Xiaoning Ren, Jiayang Song, Chongyang Liu, Jie Li, Lei Ma, and Yinxing Xue
[26] Lei Ma, Felix Juefei-Xu, Minhui Xue, Bo Li, Li Li, Yang Liu, and Jianjun Zhao. 2019. Deepct: Tomographic combinatorial testing for deep learning systems. In 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE, 614–618.
[27] Lei Ma, Felix Juefei-Xu, Fuyuan Zhang, Jiyuan Sun, Minhui Xue, Bo Li, Chunyang Chen, Ting Su, Li Li, Yang Liu, et al. 2018. Deepgauge: Multi-granularity testing criteria for deep learning systems. In Proceedings of the 33rd ACM/IEEE international conference on automated software engineering. 120–131.
[28] Tanya Nair, Doina Precup, Douglas L Arnold, and Tal Arbel. 2020. Exploring uncertainty measures in deep networks for multiple sclerosis lesion detection and segmentation. Medical image analysis 59 (2020), 101557.
[29] OpenAI. 2023. ChatGPT. https://openai.com/chatgpt Retrieved July 26, 2023.
[30] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems 35 (2022), 27730–27744.
[31] Kexin Pei, Yinzhi Cao, Junfeng Yang, and Suman Jana. 2017. Deepexplore: Automated whitebox testing of deep learning systems. In proceedings of the 26th Symposium on Operating Systems Principles. 1–18.
[32] Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. 2018. Improving language understanding by generative pre-training. (2018).
[33] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog 1, 8 (2019), 9.
[34] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research 21, 1 (2020), 5485–5551.
[35] Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108 (2019).
[36] Youcheng Sun, Xiaowei Huang, Daniel Kroening, James Sharp, Matthew Hill, and Rob Ashmore. 2018. Testing deep neural networks. arXiv preprint arXiv:1803.04792 (2018).
[37] Yuchi Tian, Ziyuan Zhong, Vicente Ordonez, and Baishakhi Ray. 2019. Testing Deep Neural Network based Image Classifiers. arXiv preprint arXiv:1905.07831 (2019).
[38] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. 2023. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971 (2023).
[39] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. Advances in neural information processing systems 30 (2017).
[40] Dong Wang, Ziyuan Wang, Chunrong Fang, Yanshan Chen, and Zhenyu Chen. 2019. DeepPath: Path-driven testing criteria for deep neural networks. In 2019 IEEE International Conference On Artificial Intelligence Testing (AITest). IEEE, 119–120.
[41] Shengrong Wang, Dongcheng Li, Hui Li, Man Zhao, and W Eric Wong. 2024. A Survey on Test Input Selection and Prioritization for Deep Neural Networks. In 2024 10th International Symposium on System Security, Safety, and Reliability (ISSSR). IEEE, 232–243.
[42] Xiaofei Xie, Tianlin Li, Jian Wang, Lei Ma, Qing Guo, Felix Juefei-Xu, and Yang Liu. 2022. Npc: Neuron path coverage via characterizing decision logic of deep neural networks. ACM Transactions on Software Engineering and Methodology (TOSEM) 31, 3 (2022), 1–27.
[43] Ming Yan, Junjie Chen, Xuejie Cao, Zhuo Wu, Yuning Kang, and Zan Wang. 2024. Revisiting deep neural network test coverage from the test effectiveness perspective. Journal of Software: Evolution and Process 36, 4 (2024), e2561.
[44] Shenao Yan, Guanhong Tao, Xuwei Liu, Juan Zhai, Shiqing Ma, Lei Xu, and Xiangyu Zhang. 2020. Correlations between deep neural network model coverage criteria and model quality. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 775–787.
[45] Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. Advances in neural information processing systems 32 (2019).
[46] Zhou Yang, Jieke Shi, Muhammad Hilmi Asyrofi, and David Lo. 2022. Revisiting neuron coverage metrics and quality of deep neural networks. In 2022 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE, 408–419.
[47] Yuanyuan Yuan, Qi Pang, and Shuai Wang. 2023. Revisiting neuron coverage for dnn testing: A layer-wise and distribution-aware criterion. In 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE). IEEE, 1200–1212.
[48] Wujie Zheng, Wenyu Wang, Dian Liu, Changrong Zhang, Qinsong Zeng, Yuetang Deng, Wei Yang, Pinjia He, and Tao Xie. 2019. Testing untestable neural machine translation: An industrial case. In 2019 IEEE/ACM 41st International Conference on Software Engineering: Companion Proceedings (ICSE-Companion). IEEE, 314–315.