---
title: k-Multisection Neuron Coverage (KMNC)
url: https://www.emergentmind.com/topics/k-multisection-neuron-coverage-kmnc
type: topic
---

# k-Multisection Neuron Coverage (KMNC)

k-Multisection Neuron Coverage (kMNC) is a structural testing metric designed to quantify how thoroughly a test suite exercises the internal activation space of a deep neural network (DNN). Unlike plain neuron coverage, which measures whether a neuron is ever activated, kMNC evaluates how extensively test inputs explore the range of activations for each neuron by partitioning that range into $k$ discrete sections and tracking coverage of each. This metric is applicable to the hidden layers of feed-forward DNNs and provides a more fine-grained view of test adequacy [2208.03407].

## 1. Formal Definition

Let $N$ denote the total number of neurons across all hidden layers of a DNN (excluding input and output layers by convention). For each neuron $i$, a profiling set (often the training set) is used to empirically determine the closed activation interval $[\mathrm{lb}_i, \mathrm{ub}_i]$, where
\[
\mathrm{lb}_i = \min_{x \in \mathit{Profile}} a_i(x), \quad \mathrm{ub}_i = \max_{x \in \mathit{Profile}} a_i(x).
\]
This interval is divided into $k$ equal-length sections per neuron. For $j = 1$ to $k$, the $j$th section for neuron $i$ is defined as
\[
S_{i,j} = \left[ \mathrm{lb}_i + (j-1) \tfrac{\mathrm{ub}_i-\mathrm{lb}_i}{k}, \; \mathrm{lb}_i + j \tfrac{\mathrm{ub}_i-\mathrm{lb}_i}{k} \right),
\]
with the last section typically closed on the right. For a given test input $x$, section $S_{i,j}$ is covered if $a_i(x) \in S_{i,j}$.

## 2. Computation Procedure

The computation of kMNC proceeds in the following steps:

1. **Profiling activations**: For each neuron $i$, collect $\mathrm{lb}_i$ and $\mathrm{ub}_i$ using the profiling set.
2. **Sectioning per neuron**: Compute $k$ sections ${S_{i,1}, ..., S_{i,k}}$ for each neuron.
3. **Initialization**: Set up a Boolean table $\text{Covered}[i][j] = \text{false}$ for each neuron-section pair.
4. **Test coverage evaluation**: For each test input $x$ in the test suite $\mathcal{T}$ and for each neuron $i$:
   1. Compute the activation $a_i(x)$.
   2. Compute the bin index:
      \[
      j = \left\lfloor k \times \frac{a_i(x) - \mathrm{lb}_i}{\mathrm{ub}_i - \mathrm{lb}_i} \right\rfloor
      \]
      (clamped to $[0, k-1]$).
   3. Mark $\text{Covered}[i][j+1] = \text{true}$.
5. **Aggregating coverage**: After all test inputs, count the number of $\text{true}$ entries in the $N \times k$ matrix.

## 3. Metric Formula

The overall kMNC score is computed as:
\[
\mathrm{kMNC} = \frac{1}{N \times k} \sum_{i=1}^{N} \sum_{j=1}^{k} \mathbf{1}[S_{i,j} \text{ is covered by at least one } x \in \mathcal{T}]
\]
where
\[
\mathbf{1}[\,\cdot\,] =
\begin{cases}
1 & \text{if the condition holds} \\
0 & \text{otherwise}
\end{cases}
\]
Here, $N$ is the neuron count (in hidden layers), $k$ is the number of sections per neuron, $S_{i,j}$ is the $j$-th activation interval of neuron $i$, and $\mathcal{T}$ is the test set. The metric thus represents the fraction of all neuron-section pairs that are exercised by at least one test input [2208.03407].

## 4. Illustrative Example

Consider a scenario with two neurons ($N=2$) each divided into $k=4$ sections:

- Profiling yields:  $\mathrm{lb}_1=0,\,\mathrm{ub}_1=8$; $\mathrm{lb}_2=2,\,\mathrm{ub}_2=10$.
- Each section has width $2$ for both neurons.

  | Neuron | Section 1      | Section 2    | Section 3    | Section 4   |
  |--------|----------------|--------------|--------------|-------------|
  | 1      | [0,2)          | [2,4)        | [4,6)        | [6,8]       |
  | 2      | [2,4)          | [4,6)        | [6,8)        | [8,10]      |

Suppose test suite $\{ x^a, x^b, x^c \}$ produces the following activations:
- $x^a$:  $a_1 = 1.5$ (bin 1), $a_2 = 5.0$ (bin 2)
- $x^b$:  $a_1 = 4.3$ (bin 3), $a_2 = 9.1$ (bin 4)
- $x^c$:  $a_1 = 7.7$ (bin 4), $a_2 = 3.5$ (bin 1)

Coverage summary:
- Neuron 1: bins 1, 3, 4 covered
- Neuron 2: bins 1, 2, 4 covered

Out of $2 \times 4 = 8$ bins, $3+3=6$ are covered, yielding $k\mathrm{MNC} = 6/8 = 75\%$ [2208.03407].

## 5. Advantages and Limitations

### Benefits

- More fine-grained than plain neuron coverage, enabling detection of test-set inadequacy that broad coverage metrics may miss.
- Explicitly measures the extent to which the test suite exercises the full activation range of each neuron.
- Can identify “dead” sections of activation range even when a neuron is sometimes activated.
- Straightforward to implement and scales well to large networks [2208.03407].

### Limitations

- Strong dependence on quality profiling: if $[\mathrm{lb}_i, \mathrm{ub}_i]$ is misestimated, section boundaries may become uninformative.
- Purely structural—does not account for semantic relationships or clusters in the input space.
- Sensitivity to parameter $k$: small $k$ leads to coarse, easily saturated coverage; large $k$ may result in bins that are rarely or never covered without a very large test suite.
- Does not account for interactions or dependencies between neurons; it only analyzes 1-D activation axes [2208.03407].

## 6. Parameter Selection and Practical Guidance

Practical guidance for selecting $k$ includes:
- For typical convolutional architectures, an initial $k \approx 10$ balances resolution with tractability.
- If kMNC rapidly saturates, increasing $k$ may reveal additional inadequacies in the test set.
- If coverage remains low across many tests, consider reducing $k$.
- Monitoring the slope of kMNC as new tests are added can inform about diminishing returns in test adequacy.

In operational use, kMNC is often computed alongside other neuron-level and decision-structure coverage criteria, such as top-$k$ neuron coverage, neuron boundary coverage, and MC/DC variants. Combining these criteria supports comprehensive test generation and test-suite minimization [2208.03407].

Source: https://www.emergentmind.com/topics/k-multisection-neuron-coverage-kmnc