# Uncertainty-Aware Explanations Through Probabilistic Self-Explainable Neural
Networks

Jon Vadillo Department of Computer Science and Artificial Intelligence,
University of the Basque Country UPV/EHU  Roberto Santana Department of
Computer Science and Artificial Intelligence,
University of the Basque Country UPV/EHU  Jose A. Lozano Department of
Computer Science and Artificial Intelligence,
University of the Basque Country UPV/EHU  Basque Center for Applied
Mathematics (BCAM)  Marta Kwiatkowska Department of Computer Science,
University of Oxford

###### Abstract

The lack of transparency of Deep Neural Networks continues to be a limitation
that severely undermines their reliability and usage in high-stakes
applications. Promising approaches to overcome such limitations are Prototype-
Based Self-Explainable Neural Networks (PSENNs), whose predictions rely on the
similarity between the input at hand and a set of prototypical representations
of the output classes, offering therefore a deep, yet transparent-by-design,
architecture. So far, such models have been designed by considering pointwise
estimates for the prototypes, which remain fixed after the learning phase of
the model. In this paper, we introduce a probabilistic reformulation of
PSENNs, called Prob-PSENN, which replaces point estimates for the prototypes
with probability distributions over their values. This provides not only a
more flexible framework for an end-to-end learning of prototypes, but can also
capture the explanatory uncertainty of the model, which is a missing feature
in previous approaches. In addition, since the prototypes determine both the
explanation and the prediction, Prob-PSENNs allow us to detect when the model
is making uninformed or uncertain predictions, and to obtain valid
explanations for them. Our experiments demonstrate that Prob-PSENNs provide
more meaningful and robust explanations than their non-probabilistic
counterparts, thus enhancing the explainability and reliability of the models.

##  1 Introduction

The complexity in the architectures of state-of-the-art Deep Neural Networks
(DNNs) largely accounts for their “black box” nature [34], which is in
conflict with one of the basic requirements for trustworthiness [5]: to be
able to explain and understand the decisions of the model. Although several
strategies have been proposed in order to explain black box models [47], they
often provide only partial information about their inner workings, such as
which parts of the input at hand most condition the output [39, 35, 41, 6, 37,
40]. However, these approaches do not provide information about how the model
processes that information or why they imply the output [34, 18, 2, 29]. In
order to achieve a more transparent classification process, recent works
advocate the use of Prototype-Based Self-Explainable Neural Networks (PSENNs,
for simplicity) [4, 8, 18, 28, 14], which are trained to jointly maximize
their prediction performance and their explainability. These approaches rely
primarily on prototype-based models, in which the prototypes are learned
during the training phase, aiming to capture discriminative and also
semantically-meaningful features. In this way, the output classification is
based on the similarity between the input and the learned prototypes,
providing an intuitive and human-understandable classification process.

On the other hand, current DNNs models, including the PSENNs discussed above,
are optimized with the aim of finding the point estimate values of the
parameters that minimize a given loss term, leading to models with a
deterministic inference process. An important drawback of these approaches is
that, generally, it is not possible to measure to what extent the model is
confident in its own prediction, known in the literature as the epistemic
uncertainty of the model [20, 25, 13]. Indeed, it has been shown that DNNs
tend to be overconfident in their predictions [17], classifying inputs with
high probability even when random or out-of-distribution inputs are provided.
Being unable to detect when the model is making such unreliable or uninformed
decisions dramatically reduces the trustworthiness and reliability of the
model, and is, therefore, of great concern in high-stakes applications. To
address this issue, recent works proposed replacing point estimates for the
parameters of the model with a probability distribution over their values
[16]. This leads to a stochastic model, for which it is possible to measure
the aforementioned types of uncertainty, and, thus, identify when the model is
making uncertain predictions that should not be trusted.

In this paper, we aim to address the aforementioned drawbacks and challenges
by leveraging recent tools from uncertainty estimation in DNNs, and combining
them with PSENN architectures in order to develop Probabilistic Self-
Explainable Neural Networks (Prob-PSENNs). The key feature of this model is
that the prototypes are defined as random variables, for which suitable
probability distributions over their values are learned during the training
phase of the model – jointly with the rest of the parameters of the network.
This probabilistic paradigm allows us not only to improve the explainability
of the classification process, but also to capture different sources of
uncertainty regarding the explanation. Furthermore, since the output of the
PSENNs directly depends on the explanatory component [28], we can establish
connections between their corresponding uncertainties, enabling a more
thorough analysis of the prediction process, and allowing the models to self-
explain their own uncertainties.

The main contributions of this work are summarized below:

  1. 1.

First, we introduce Prob-PSENN, a paradigm shift for PSENNs, which relies on
probabilistic modeling of the explanatory component, thus replacing point
estimates for the prototypes with probability distributions over their values.

  2. 2.

We demonstrate how the probabilistic reinterpretation of the prototypes
substantially enhances the explanatory capabilities of the model, enabling
more diverse, meaningful and robust explanations than those achievable with
the non-probabilistic counterparts.

  3. 3.

Furthermore, Prob-PSENNs allow us, for the first time, to model the
uncertainty in the explanations and in the predictions, which is a missing
feature in conventional PSENNs. More specifically, we formalize different
explanatory uncertainty notions, and show how Prob-PSENNs enable not only the
quantification of those uncertainties, but also their explanations, thus
increasing reliability and trustworthiness.

  4. 4.

The effectiveness of Prob-PSENN is evaluated in several classification tasks,
demonstrating that it can effectively learn highly diverse and prototypical
representations of the output classes, capture the model uncertainties and
maintain competitive predictive performance.

##  2 Preliminaries: Prototype-Based Self-Explainable Neural Networks (PSENNs)

Let us consider a classification problem in which the goal is to classify
$d$-dimensional inputs $x\in\mathbb{R}^{d}$ into one of the $c$ possible
classes in $Y=\\{y_{1},y_{2},\dots,y_{c}\\}$. Using as baseline the
architecture introduced in [28], illustrated in Figure 1, the main components
of the PSENNs are described as follows. We refer the reader to Appendix A for
a justification for the choice of this baseline, as well as for a discussion
on related works.

Figure 1: Architecture of the Prototype-Based Self-Explainable Neural Network
[28] described in Section 2, illustrated for a handwritten digit
classification task [27].

The first component of this architecture is an encoder module
$e:\mathbb{R}^{d}\rightarrow\mathbb{R}^{l}$, where $l$ denotes the
dimensionality of the latent space to which the input is encoded. The latent
representation computed by the encoder $e(\cdot)$ for the input $x$ will be
denoted as $e_{x}=e(x)$. Oppositely, let
$g:\mathbb{R}^{l}\rightarrow\mathbb{R}^{d}$ denote a decoding module, capable
of reconstructing the original input $x$ from the corresponding encoded
representation $e_{x}$. The key component of this architecture involves the
generation of $m$ prototypes in the latent space:
$R=(r_{1},r_{2},\dots,r_{m})$, with $r_{i}\in\mathbb{R}^{l}$, $1\leq i\leq m$.
The aim of generating these prototypes is to capture diverse, discriminative
and semantically meaningful features capable of representing the classes of
the problem. In this way, the similarity between an encoded input $e_{x}$ and
each of the $m$ prototypes can be employed to determine the output class for
$x$ in an easily interpretable manner, based on the assumption that an input
$x$ belonging to the class $y_{i}$ will be closer to those prototypes
representing the class $y_{i}$ than to the prototypes corresponding to the
remaining classes. To formalize the aforementioned similarities, let the
column-vector
$\delta_{x}=(\delta_{x,1},\delta_{x,2},\dots,\delta_{x,m})^{\intercal}$
represent the distance between an encoded input $e_{x}$ and the $m$ prototypes
in $R$. More detailedly, the distance between $e_{x}$ and the $i$-th prototype
$r_{i}$ will be computed as $\delta_{x,i}=\phi(e_{x},r_{i}),\ 1\leq i\leq m,$
based on a distance metric
$\phi:\mathbb{R}^{l}\times\mathbb{R}^{l}\rightarrow\mathbb{R}$. The distance
vector $\delta_{x}$ will condition both the output classification and the
corresponding explanation, as it is detailed below.

#### Classification

Taking $\delta_{x}$ as the input, the output provided by the model will be
determined by a prototype classifier $h:\mathbb{R}^{m}\rightarrow[0,1]^{c}$.
As in [28], a classification network $h(\delta_{x})=s(W\delta_{x})$ will be
assumed, being $W$ a $c\times m$ weight matrix and $s(\cdot)$ the softmax
function. For simplicity, the end-to-end classification process will be
denoted as $f(x)=h(\delta_{x})$. Notice that $f(x)$ outputs a vector
representing the probability with which the input belongs to each of the
possible classes of the problem, according to the model. The probability
assigned to each class $y_{i}$ will be denoted as $f_{i}(x)$, $1\leq i\leq c$,
and thus we can define the output as:
$f(x)=\bigl{(}f_{1}(x),f_{2}(x),\dots,f_{c}(x)\bigr{)}$. Generally, the class
with the highest probability is considered the output class of the prediction,
what will be denoted as $f_{*}(x)=\operatorname*{arg\,max}_{y_{i}\in
Y}f_{i}(x)$.

#### Explanation

Since the output class is based on the distance-vector $\delta_{x}$, the
explanation $\xi_{x}$ for the prediction $f(x)$ can be determined also by the
similarity between the prototypes and the input at hand:
$\xi_{x}=\bigl{\\{}\\{g(r_{1}),\delta_{x,1}\\},\\{g(r_{2}),\delta_{x,2}\\},\dots,\\{g(r_{m}),\delta_{x,m}\\}\bigr{\\}},$
being $g(\cdot)$ the decoder defined above. Notice that the interpretability
of the model relies, therefore, on to what extent the decoded prototypes are
capable of capturing relevant and semantically-meaningful features
representing each class of the problem, which is enforced during the training
phase by means of including interpretability regularizers in the loss function
[28].

##  3 Probabilistic Self-Explainable Neural Networks (Prob-PSENNs)

As mentioned before, PSENNs treat the prototypes as network parameters, for
which point estimate values are computed and hence are fixed once the training
is completed. Furthermore, the number of prototypes $m$ needs to be finite and
defined beforehand, even if, in practice, it might result cumbersome or
infeasible to determine how many prototypes will be required to capture
sufficiently diverse characterizations of the classes.

To address these issues, we introduce Prob-PSENNs, generalizing the prototypes
by means of defining a probability distribution over their values. The main
motivation for this choice is twofold. On the one hand, for each class of the
problem, there might exist several sets of prototypes $R$ capable of
representing the data with a comparable effectiveness. For illustration, let
us consider a handwritten digit classification scenario, and the fact that
there are several ways of representing each digit. This implies that there are
several representative prototypes for each class. Consequently, instead of
relying on a single set of prototypes, it might be more reasonable to consider
all those possible variations in order to classify an input. This
probabilistic reformulation also enables a flexible way to decide the variety
of the prototypes required to represent the classes, which will be determined,
assuming one prototype per class, by the variance of the distribution over the
prototypes. On the other hand, the choice of the prototypes in $R$ conditions
not only the output but also the explanation. Therefore, placing a probability
distribution over the prototypes allows us to enable a probabilistic framework
for the generation of the explanation as well, which can be employed to
capture the uncertainty in the explanations of the model, and, thereby,
produce more informative and useful explanations.

###  3.1 Predictive distribution

Instead of considering a point estimate for $R$, we will consider it a random
variable, for which we will use the notation $\bm{R}$. Furthermore, we will
assume $m=c$ prototypes, such that $\bm{r}_{i}$ represents the class $y_{i}$,
$1\leq i\leq c$. Due to the randomness in the network’s prototypes, the
inference of the model will be stochastic, and will be denoted as
$f^{\bm{R}}(x)$. In this way, a predictive distribution for the output can be
defined:

$p(\bm{y}|x)=\mathbb{E}_{p(\bm{R})}[p(\bm{y}|x,R)]=\int
p(\bm{y}|x,\bm{R})\cdot p(\bm{R})\ d\bm{R}=\int f^{\bm{R}}(x)\cdot p(\bm{R})\
d\bm{R}.$ (1)

In practice, $p(\bm{y}|x)$ can be approximated by considering a finite number
of $N$ samples from $p(\bm{R})$:

$\tilde{p}(\bm{y}|x)=\bar{f}(x)=\frac{1}{N}\sum_{n=1}^{N}f^{R_{n}}(x),\ \
\text{with}\ \ R_{n}\sim p(\bm{R}),\ 1\leq n\leq N.$ (2)

###  3.2 Capturing the predictive uncertainty

The predictive distribution defined in Equation (1) allows us to better model
the predictive uncertainty in comparison to its deterministic counterpart.
First, the total predictive uncertainty can be measured by means of the
entropy [36] of the prediction:
${H[p(y|x)]=-\sum_{i=1}^{c}p(y=y_{i}|x)\cdot\log p(y=y_{i}|x)}$· However, for
a model with fixed (pointwise) values for the parameters, the source of this
uncertainty will be only aleatoric uncertainty, which refers to the possibly
unavoidable noise, randomness or ambiguity inherent in the data. Considering a
probability distribution for the parameter values instead of point estimates
allows us to capture also the epistemic uncertainty [20, 22, 25], which
accounts for the model uncertainty about the true parameters modeling the data
(e.g., as a consequence of insufficient training data). This enables a safer
use of the model in critical tasks, since it allows us to identify when the
model is making unreliable predictions. An illustrative comparison between
aleatoric and epistemic uncertainty is provided in Figure 2 (left).

Figure 2:  Comparison between the predictive and explanatory uncertainty,
illustrated for a binary classification problem with a two-dimensional input
space.

Thus, for the predictive distribution defined in Equation (1), $H[p(y|x)]$
encapsulates both aleatoric and epistemic uncertainty. To measure epistemic
uncertainty only, the mutual information between the output $\bm{y}$ and the
parameters $\bm{R}$ can be employed [19, 13, 20, 11], which, in our case, can
be formalized as:
$I(\bm{y},\bm{R}|x)=H(\bm{y}|x)-\mathbb{E}_{p(\bm{R})}[H(\bm{y}|x,\bm{R})],$
while $\mathbb{E}_{p(\bm{R})}[H(\bm{y}|x,\bm{R})]$ represents a measure of
aleatoric uncertainty. Notice that the values of all these metrics can be
normalized to the range $[0,1]$, where $1$ would represents the maximum
uncertainty, by dividing the resulting value by the entropy of the uniform
categorical distribution of $c$ categories. In practice, $H[p(y|x)]$ can be
approximated by $H[\tilde{p}(y|x)]$ (see Equation 2).

###  3.3 Capturing the explanation uncertainty

With a PSENN with fixed prototypes, only a point estimate $\delta_{x}$ can be
provided for the input at hand, that is, a point estimate on how close the
input is to the particular prototypes selected to represent each class, as
illustrated in Figure 3-(a). In contrast, the probability distribution over
the prototypes considered in Prob-PSENNs induces a probability distribution
over each value of $\delta_{x}$,
$\,p(\bm{\delta}_{x,i})\\!=\\!p\bigl{(}\phi(e_{x},\bm{r}_{i})\bigr{)}$, as
exemplified in Figure 3-(b) and Figure 3-(c). This allows us to compute not
only more robust and representative information for each value of
$\delta_{x}$, but also to compute the uncertainty in the explanation.
Furthermore, this enables a direct and explicit connection between the
explanation uncertainty and the output uncertainty, being therefore a key
advantage of Prob-PSENNs.

#### Types of explanation uncertainty

Similarly to the predictive uncertainty, different types of uncertainty can be
attributed to the explanations of Prob-PSENNs. In the context of explanations,
we will denominate aleatoric uncertainty to the uncertainty in determining
which class-prototypes best represent the input at hand, that is, in
determining which prototypes are closest to the encoded input, possibly due to
ambiguity in the representation of the input. Therefore, high aleatoric
uncertainty will imply highly overlapped distance-distributions
$p(\bm{\delta}_{x,i})$. In contrast, epistemic explanatory uncertainty will be
high for those inputs that lie far from the training distribution, and,
consequently, also far from the distribution over the prototypes, resulting in
uninformative and non-representative explanations for that input. Therefore,
high epistemic uncertainty will imply large distances with respect to all the
prototypes. An illustrative representation of these types of explanatory
uncertainty is provided in Figure 2 (right).

Figure 3:  Illustrative comparison between a conventional PSENN (left column)
and the proposed Probabilistic-PSENN (middle and right columns) regarding the
computation of the distance-vector $\delta_{x}$. Whereas a fixed set of
prototypes $R$ is used in (a), leading to a point estimate $\delta_{x}$,
placing a probability distribution over $\bm{R}$, as in (b) and (c), induces a
probability distribution over the distance $\delta_{x,i}$ between the encoded
input and the random prototypes $\bm{r}_{i}$ representing the class $y_{i}$,
$1\leq i\leq c$.

#### Quantifying explanation uncertainty

Given that, in the general case, computing $p(\bm{\delta}_{x,i})$ will be
intractable both analytically and numerically, we will rely on sample-based
estimators in order to compute meaningful information about those
distributions. To begin with, being $\delta_{x}^{(1)},\dots,\delta_{x}^{(N)}$
the distance-vectors obtained for $N$ inferences of the model (i.e., for $N$
random sets of prototypes), the sample mean
${\bar{\delta}_{x,i}=\frac{1}{N}\sum_{n=1}^{N}\delta_{x,i}^{(n)}}$ can inform
us about the average similarity between the input and the prototypes of the
class $y_{i}$, while the sample variance Var
${\bigl{(}p(\bm{\delta}_{x,i})\bigr{)}\approx\frac{1}{N-1}\sum_{n=1}^{N}\bigl{(}\delta_{x,i}^{(n)}-\bar{\delta}_{x,i}\bigr{)}^{2}}$
can be considered a measure of uncertainty about those similarities.

While the aforementioned two metrics describe only each distribution
$p(\bm{\delta}_{x,i})$ separately, considering all these distributions jointly
allows us to estimate aleatoric and epistemic uncertainty in the explanations.
As mentioned before, aleatoric uncertainty can be determined based on the
overlap between the probability density functions describing
$p(\bm{\delta}_{x,i})$, which will be denoted as
$f_{\bm{\delta}_{x,i}}(\cdot)$. For a binary case, the overlap can be measured
by means of (normalized) overlapping indices [32]:
$\int_{\mathbb{R}}\min[f_{\bm{\delta}_{x,1}}\\!(z),\,f_{\bm{\delta}_{x,2}}(z)]\,dz.\
$ In order to address multi-class problems, we will generalize the metric as
the maximum overlap between the density function
$f_{\bm{\delta}_{x,i^{*}}}(\cdot)$ corresponding to the most-likely class
$y_{i^{*}}$ and the functions corresponding to the remaining classes:

$\hskip 28.45274pt\mathscr{U}_{A}(x)=\max_{\begin{subarray}{c}j=1,\dots,c\\\
j\neq
i^{*}\end{subarray}}\left[\int_{\mathbb{R}}\min[f_{\bm{\delta}_{x,i^{*}}}\\!(z),\,f_{\bm{\delta}_{x,j}}(z)]\,dz\right].$
(3)

In practice, the density functions can be estimated by means of kernel-density
estimation methods, based on the distances obtained for a finite number of
inferences $N$.

Regarding epistemic explanatory uncertainty, as explained above, a high
uncertainty will be achieved for those inputs for which the distances to all
the prototypes are large. On that account, the minimum sample mean:
$\bar{\delta}_{x,i*}=\min_{1\leq j\leq c}\bar{\delta}_{x,j}$ represents a
suitable base metric for evaluating this uncertainty. Furthermore, in order to
determine the severity of the uncertainty in a normalized and scale-
independent manner, a quantile-based metric will be defined, close to the
approach proposed in [33]. This metric will be based on comparing the value at
hand with the values obtained for the data distribution $\mathscr{D}$, which
can be estimated, in practice, using a training set $D$:

$\mathscr{U}_{E}(x)=P_{\\!\begin{subarray}{c}(x^{\prime}\\!,y)\sim\mathscr{D}\\\
\\!y=y_{i*}\end{subarray}}\big{(}\bar{\delta}_{x^{\prime},i*}\leq\bar{\delta}_{x,i*}\big{)}.$
(4)

###  3.4 Creating more meaningful explanations

In practice, we expect to sample $N$ different explanations, and, thereby, $N$
different yet representative prototypes for each class $y_{i}\in Y$ (assuming
$m=c$). Although presenting all these prototypes as part of the explanation
might be impractical, different strategies can be considered to summarize or
distill the results, for the sake of more meaningful and useful explanations.
First, among the prototypes corresponding to the most likely class, the ones
closest to the input at hand can be considered the best candidates to justify
the prediction of the model. Furthermore, the closest prototypes corresponding
to the remaining classes can be taken as counterarguments against the most
likely class, which can be used, for instance, to identify and explain why an
input can be considered ambiguous or challenging to classify. On the other
hand, the farther prototypes corresponding to the most likely class can be
used to exemplify alternative yet still valid representations for that class,
which can provide useful complementary information, thus being valuable for
knowledge-acquisition purposes.

##  4 Training procedure

Let $p_{\lambda}(\bm{R})$ represent a parametric probability distribution over
the prototypes. The goal of the training procedure will be to optimize the
parameters $\lambda$, jointly with the rest of parameters of the model, in
order to maximize both the predictive performance and interpretability of the
model. For simplicity, the prototypes $\bm{r}_{1}\dots,\bm{r}_{c}$ will be
assumed to be independent random variables, with each $\bm{r}_{i}$ distributed
according to a distribution $p_{\lambda_{i}}(\bm{r}_{i})$, $1\leq i\leq c$,
and, hence,
$p_{\lambda}(\bm{R})=p_{\lambda}(\bm{r}_{1},\dots,\bm{r}_{c})=\prod_{i=1}^{c}p_{\lambda_{i}}(\bm{r}_{i})$.
The following generalized loss function will be employed to train the entire
architecture:

$\mathscr{L}=\tau_{1}\cdot\mathscr{L}_{NLL}+\tau_{2}\cdot\mathscr{L}_{REC}+\tau_{3}\cdot\mathscr{L}_{INT}$

where,

$\mathscr{L}_{\text{NLL}}\\!=\\!-\frac{1}{N}\sum_{n=1}^{N}\sum_{(x,y)\in
D}\sum_{i=1}^{c}\mathds{1}(y\\!=\\!y_{i})\cdot\log\bigl{(}f_{i}^{R_{n}}(x)\bigr{)},\
\ \,R_{n}\\!=\\![r_{i}]_{i=1}^{c}\text{ s.t.
}r_{i}\\!\sim\\!p_{\lambda_{i}}(\bm{r}_{i}),\ \,1\\!\leq\\!n\\!\leq\\!N,$
$\mathscr{L}_{\text{REC}}=\sum_{(x,\cdot)\in
D}\\!\\!||x-g\bigl{(}e(x)\bigr{)}||_{2}^{2},\quad\quad\quad\quad\quad\quad\mathscr{L}_{\text{INT}}=-\\!\sum_{(x,y)\in
D}\,\sum_{i=1}^{c}\mathds{1}(y=y_{i})\cdot\log
p_{\lambda_{i}}\bigl{(}e(x)\bigr{)},$

and $\tau_{1},\tau_{2},\tau_{3}\in\mathbb{R}^{+}$ weight the contribution of
each term. Notice that $\mathscr{L}_{\text{NLL}}$ represents the
classification (cross-entropy) loss, averaged for $N$ samples of prototypes,
and $\mathscr{L}_{\text{REC}}$ the reconstruction loss. Finally,
$\mathscr{L}_{\text{INT}}$ can be seen as an interpretability loss, as it will
encourage the distribution over the prototypes to be similar to the
distribution of the encoded data, which is a crucial requirement for
interpretability [28]. Based on this methodology, the entire architecture can
be jointly optimized by means of conventional gradient descent approaches.

##  5 Experiments

For illustration purposes, the effectiveness and capabilities of the proposed
model will be assessed on the MNIST dataset [27], while additional experiments
on the Fashion-MNIST [45] and K-MNIST [9] datasets are reported in Appendix D
and Appendix E, respectively. In all the experiments, the Euclidean distance
will be used as the distance metric $\phi$, and a Gaussian distribution will
be assumed for each $p_{\lambda_{i}}(\bm{r}_{i})$, $1\leq i\leq c$. The full
implementation details are reported in Appendix B.

#### Learned latent spaces and distributions over the prototypes

For illustration, the results obtained for the case in which $l=2$ (i.e., a
two-dimensional latent space is considered), are shown in Figure 4. The left
figure shows the learned latent space, visualizing the latent representations
assigned to a random set of test data (dots), as well as the learned
distribution over the prototypes $p_{\lambda_{i}}(\bm{r}_{i})$, $1\leq i\leq
c$ (contour lines). The right figure represents 15 random sets of prototypes
$R$ sampled from the learned distributions, and decoded by the decoder $g$. As
can be seen, even for a very constrained (low-dimensional) latent space, the
model is capable of capturing and decoding prototypical and varied
representations for each class. The model achieves a top-1 accuracy of $0.98$
and $0.96$ in the train and test set, respectively, computed for $N=30$
inferences. Further results for $l=5$ and $l=10$ are shown in Appendix C,
where it can be observed that the increase in the dimensionality of the latent
space makes it possible to capture prototype distributions with a higher
degree of complexity in their structure, as well as to obtain more detailed
decodings. Further results for the Fashion-MNIST and K-MNIST datasets are
provided in Appendix D and Appendix E, respectively. In addition, to show that
our approach can scale to a larger number of classes, Appendix F includes
results on the E-MNIST dataset [10], an extension of MNIST which contains
handwritten representations of numbers and letters and is composed of 47
classes.

(a) Latent space.

(b) Randomly sampled sets of prototypes.

Figure 4:  Results obtained with a Prob-PSENN with $l=2$ for the MNIST
dataset. (a) Learned latent space, where the contours represent the prototype
distributions $p_{\lambda_{i}}(\bm{r}_{i})$ and the dots represent encoded
input samples. (b) 15 random sets of prototypes
$R_{n}=(r_{1},\dots,r_{c})\text{ s.t. }r_{i}\sim
p_{\lambda_{j}}(\bm{r}_{j}),1\\!\leq\\!i\\!\leq\\!c$,
$1\\!\leq\\!n\\!\leq\\!15$.

#### Comparison between conventional PSENN and Prob-PSENN

First, to thoroughly compare the predictive performance of both approaches,
the accuracies obtained for the three datasets considered are compared in
Table 1. For the sake of completeness, the performance of PSENNs is computed
for different number of prototypes, while preserving its original
architecture, consisting of a Convolutional Autoencoder, a latent space of
$l=40$ dimensions, and using elastic deformation as data augmentation. The
performance of Prob-PSENNs has been evaluated for the following
configurations, fully described in Appendix B: using a Multi-Layer Perceptron
Autoencoder (MLP), a Convolutional Autoencoder (CNN), and including elastic
deformation [38] as data augmentation (AUG). As can be seen, Prob-PSENNs
achieve a very competitive performance in all the datasets, with an accuracy
gain of $2\%$ on the K-MNIST dataset and a loss of less than $1\%$ on MNIST
and F-MNIST, while having as benefits a greater robustness, trustworthiness
and enhanced explanatory capabilities, as we showcase in Figure 5. In
particular, this figure compares, for the MNIST task, the explanation computed
by a conventional PSENN ($m=15$) with the one computed by Prob-PSENN ($l=5$,
MLP). More comparisons will be provided in the supplementary material. As can
be seen, the prototypes sampled by Prob-PSENN exhibit considerably more
diversity than the fixed prototypes learned by a conventional PSENN, which
enables to find more tailored prototypes for the input at hand, as well as to
provide alternative forms that the class might take. In addition, while PSENNs
only return point distances to the prototypes, Prob-PSENNs provide a
distribution over those distances, enabling to assess the uncertainty of the
prediction, and, hence, representing a more robust and trustworthy approach.

Figure 5: Comparison between the explanation provided by a PSENN with fixed
prototypes (left) and a Prob-PSENN (right). For simplicity, the four most
likely classes are visualized for Prob-PSENN, considering, for each class, the
four closest prototypes and the most distant ones.  Table 1: Predictive
accuracies (mean and standard deviation for 10 runs) obtained by Prob-PSENN
and PSENN for the MNIST, Fashion-MNIST and K-MNIST datasets. The results are
shown in percentages.

Configuration | MNIST | F-MNIST | K-MNIST
---|---|---|---
PSENN ($l=40$, $m=10$) |  98.97 $\pm$ 0.16 |  90.15 $\pm$ 0.33 |  91.11 $\pm$ 0.47
PSENN ($l=40$, $m=15$) |  98.99 $\pm$ 0.11 |  90.10 $\pm$ 0.61 |  90.93 $\pm$ 0.41
PSENN ($l=40$, $m=20$) |  99.01 $\pm$ 0.12 |  90.22 $\pm$ 0.50 |  91.15 $\pm$ 0.53
PSENN ($l=40$, $m=30$) |  99.05 $\pm$ 0.15 |  89.90 $\pm$ 0.33 |  91.04 $\pm$ 0.96
PSENN ($l=40$, $m=40$) |  98.93 $\pm$ 0.17 |  90.17 $\pm$ 0.39 |  90.81 $\pm$ 0.96
PSENN ($l=40$, $m=50$) |  99.02 $\pm$ 0.11 |  89.76 $\pm$ 0.44 |  91.17 $\pm$ 0.74
Prob-PSENN ($l=5$, MLP) |  97.55 $\pm$ 0.29 |  88.83 $\pm$ 0.25 |  88.69 $\pm$ 1.23
Prob-PSENN ($l=10$, MLP) |  97.59 $\pm$ 0.48 |  88.77 $\pm$ 0.50 |  88.92 $\pm$ 1.00
Prob-PSENN ($l=10$, CNN) |  98.28 $\pm$ 0.17 |  89.47 $\pm$ 0.34 |  89.06 $\pm$ 0.34
Prob-PSENN ($l=10$, MLP + AUG) |  98.53 $\pm$ 0.08 |  87.78 $\pm$ 0.50 |  93.17 $\pm$ 0.33
Prob-PSENN ($l=10$, CNN + AUG) |  98.75 $\pm$ 0.17 |  87.98 $\pm$ 0.46 |  89.40 $\pm$ 1.14

#### Evaluating the explanatory uncertainties

Figure 6 compares, for a Prob-PSENN with $l=2$, the areas of the latent space
with high explanatory uncertainty. The aleatoric and epistemic explanatory
uncertainties (second and third columns) have been evaluated using the metrics
$\mathscr{U}_{A}(x)$ and $\mathscr{U}_{E}(x)$ defined in Equations (3) and
(4), respectively. The fourth column shows the areas with high epistemic
uncertainty exclusively (i.e., with no aleatoric uncertainty), which has been
computed as $\mathscr{U}_{E}(x)-\mathscr{U}_{A}(x)$. As can be seen from the
results, the regions with high aleatoric uncertainty are those that are at a
similar distance from the two regions that the model associates to each class.
On the other hand, the areas with high epistemic uncertainty are those far
from the regions to which the prototype distributions assign a high density,
and, therefore, the explanations are no longer representative of those
regions.

Figure 6: Evaluating the explanatory uncertainty in different regions of the
learned latent space.

#### Epistemic uncertainty

Figure 7 compares the epistemic uncertainty achieved by a Prob-PSENN, trained
for the MNIST dataset, when classifying 1000 test samples of the MNIST and
Fashion-MNIST datasets. As can be seen, when inputs from the Fashion-MNIST
dataset are presented to the model, a very high explanatory epistemic is
captured for almost all the inputs, while for the MNIST test data the
uncertainty is uniformly distributed. For reference, Figure 7 also shows, for
each dataset, the samples that achieve the lowest and highest uncertainty. As
can be seen, even for the MNIST dataset, highly unusual inputs that could be
considered out-of-distribution instances can be found, which are effectively
detected by the uncertainty estimation capabilities of Prob-PSENN.

Figure 7:  Histograms showing the explanatory epistemic uncertainty obtained
by a Prob-PSENN for 1000 test samples from MNIST (1st figure) and Fashion-
MNIST (2nd figure). Notice that the scales of the Y-axis differ in the two
plots. The following four images display those inputs that achieve, for each
dataset, the lowest and highest epistemic uncertainty.

#### Aleatoric uncertainty

Finally, the prediction and explanation for a particular input with high
aleatoric uncertainty is shown in Figure 8. The results are shown for a Prob-
PSENN with $l=5$ and $N=50$ inferences. The top row includes the density
function over the distances corresponding to the two most likely classes,
$\bm{\delta}_{x,4}$ and $\bm{\delta}_{x,9}$, estimated by Gaussian-kernel
density estimation, as well as a box plot showing the variability in the
output probabilities assigned to each class, considering all the inferences.
As it can be assessed, the distributions of both the distances and the output
probabilities are highly overlapped, evidencing a high explanatory and
predictive aleatoric uncertainty. The second row of the figure includes the
input and a subset of the sampled prototypes, sorted by distance to the input
in increasing order. As can be seen, both distributions over the prototypes
capture and sample prototypical representations that could be taken as equally
descriptive of the input at hand, thus explaining its ambiguity.

Figure 8:  Prediction and explanation results obtained for a test input with
high aleatoric uncertainty. The prototypes are sorted by distance to the
input, in increasing order.

#### Harnessing uncertainty to improve predictive accuracy and reliability

We experimentally validated that taking model uncertainty into consideration
can provide substantial improvements in accuracy. Specifically, by discarding
inputs with high explanatory epistemic uncertainty (e.g., greater than 95% or
99%), the accuracy of Prob-PSENN increases in all the datasets and
configurations, as we show in Table 2 (Appendix G). To complement these
results, Table 3 shows the percentage of inputs that are discarded in each
case. At the same time, a large number of the discarded inputs are anomalous
or challenging to classify, which would justify discarding them for the sake
of higher reliability and robustness. As evidence, we show in Table 4 that the
error rate of the deterministic baseline model is also higher in the inputs
which receive high uncertainty than in the rest. Thus, this evaluation shows
how capturing model uncertainty provides greater accuracy, robustness and
safety. We justify the choice of the mentioned uncertainty metric, based on
the fact that it is reasonable to consider a prediction unreliable if all the
prototypes have low similarity to the input, given the distance-based
classification pipeline of the model.

##  6 Conclusions

In this paper we introduced Prob-PSENN, a novel Prototype-Based Self-
Explainable Neural Network paradigm relying on a probabilistic generalization
of the prototypes, which enhances the capabilities of the model in two key
aspects. First, unlike previous approaches, our model is not restricted to a
fixed number or set of prototypes. This enables Prob-PSENN to learn much more
diverse prototypes, and to consider all of them when classifying an input,
which represents a more flexible and robust approach. Second, our
probabilistic approach equips Prob-PSENNs with tools to capture and harness
the uncertainty in both the prediction and the explanation of the network.
This novel feature makes it possible to detect when the model is providing
uncertain outcomes, substantially increasing the reliability of the model. We
experimentally demonstrate how Prob-PSENNs achieve more informative, robust
and trustworthy explanations than their non-probabilistic counterparts, while
keeping a competitive predictive accuracy.

##  7 Limitations and future work

As future work, inspired by recent advances in Bayesian Neural Networks [31,
13, 16], we plan to develop a Bayesian formulation for the distribution over
the prototypes, which might enable a more theoretically-grounded approach for
uncertainty quantification. Furthermore, we also believe that a fully-
probabilistic model (i.e., placing a probability distribution for the rest of
the network parameters as well) could enhance the quantification of the
uncertainty in Prob-PSENNs, or even induce new notions of uncertainty, such as
the encoding or class-representation uncertainty. Apart from that, while Prob-
PSENNs have demonstrated high predictive and explanatory performance, we found
it challenging to model probability distributions over the prototypes in high-
dimensional spaces, and, therefore, resort to relatively low dimensional
latent spaces in our experiments. We plan to address this limitation in the
future, in order to scale the proposed approach to higher-dimensional
datasets.

## Acknowledgements

This project has received funding from the European Research Council (ERC)
under the European Union’s Horizon 2020 research and innovation programme
(grant agreement No. 834115), the Spanish Ministry of Science, Innovation and
Universities (project PID2022-137442NB-I00, grant FPU19/03231, and BCAM Severo
Ochoa accreditation CEX2021-001142-S), and the Basque Government (projects
KK-2023/00012 and IT1504-22).

## References

  * Abadi et al. [2015] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mane, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viegas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng.  TensorFlow: Large-Scale Machine Learning on Heterogeneous Distributed Systems.  _arXiv preprint arXiv:1603.04467_ , 2015.  doi: 10.48550/arXiv.1603.04467.
  * Adebayo et al. [2018] J. Adebayo, J. Gilmer, M. Muelly, I. Goodfellow, M. Hardt, and B. Kim.  Sanity Checks for Saliency Maps.  In _Advances in Neural Information Processing Systems_ , volume 31, pages 9505–9515, 2018.
  * Aivodji et al. [2019] U. Aivodji, H. Arai, O. Fortineau, S. Gambs, S. Hara, and A. Tapp.  Fairwashing: The Risk of Rationalization.  In _Proceedings of the 36th International Conference on Machine Learning (ICML)_ , volume 97, pages 161–170, 2019.
  * Alvarez-Melis and Jaakkola [2018] D. Alvarez-Melis and T. Jaakkola.  Towards Robust Interpretability with Self-Explaining Neural Networks.  In _Advances in Neural Information Processing Systems_ , volume 31, pages 7775–7784, 2018.
  * Ashoori and Weisz [2019] M. Ashoori and J. D. Weisz.  In AI We Trust? Factors That Influence Trustworthiness of AI-infused Decision-Making Processes.  _arXiv preprint arXiv:1912.02675_ , 2019.  doi: 10.48550/arXiv.1912.02675.
  * Bach et al. [2015] S. Bach, A. Binder, G. Montavon, F. Klauschen, K.-R. Müller, and W. Samek.  On Pixel-Wise Explanations for Non-Linear Classifier Decisions by Layer-Wise Relevance Propagation.  _PLOS ONE_ , 10(7):e0130140, 2015.  ISSN 1932-6203.  doi: 10.1371/journal.pone.0130140.
  * Biggio et al. [2013] B. Biggio, I. Corona, D. Maiorca, B. Nelson, N. Šrndić, P. Laskov, G. Giacinto, and F. Roli.  Evasion Attacks against Machine Learning at Test Time.  In _Machine Learning and Knowledge Discovery in Databases_ , Lecture Notes in Computer Science, pages 387–402, 2013\.  ISBN 978-3-642-40994-3.  doi: 10.1007/978-3-642-40994-3_25.
  * Chen et al. [2019] C. Chen, O. Li, D. Tao, A. Barnett, C. Rudin, and J. K. Su.  This Looks Like That: Deep Learning for Interpretable Image Recognition.  In _Advances in Neural Information Processing Systems_ , volume 32, pages 8930–8941, 2019.
  * Clanuwat et al. [2018] T. Clanuwat, M. Bober-Irizar, A. Kitamoto, A. Lamb, K. Yamamoto, and D. Ha.  Deep Learning for Classical Japanese Literature.  In _Neural Information Processing Systems 2018 Workshop on Machine Learning for Creativity and Design_ , 2018.
  * Cohen et al. [2017] G. Cohen, S. Afshar, J. Tapson, and A. van Schaik.  EMNIST: Extending MNIST to handwritten letters.  In _Proceedings of the International Joint Conference on Neural Networks (IJCNN)_ , pages 2921–2926, 2017.  doi: 10.1109/IJCNN.2017.7966217.
  * Depeweg et al. [2018] S. Depeweg, J.-M. Hernandez-Lobato, F. Doshi-Velez, and S. Udluft.  Decomposition of Uncertainty in Bayesian Deep Learning for Efficient and Risk-sensitive Learning.  In _Proceedings of the 35th International Conference on Machine Learning (ICML)_ , volume 80, pages 1184–1193, 2018.
  * Dillon et al. [2017] J. V. Dillon, I. Langmore, D. Tran, E. Brevdo, S. Vasudevan, D. Moore, B. Patton, A. Alemi, M. Hoffman, and R. A. Saurous.  TensorFlow Distributions.  _arXiv preprint arXiv:1711.10604_ , 2017.  doi: 10.48550/arXiv.1711.10604.
  * Gal [2016] Y. Gal.  _Uncertainty in Deep Learning_.  PhD thesis, University of Cambridge, 2016.
  * Gautam et al. [2022] S. Gautam, A. Boubekki, S. Hansen, S. Salahuddin, R. Jenssen, M. Höhne, and M. Kampffmeyer.  ProtoVAE: A Trustworthy Self-Explainable Prototypical Variational Model.  In _Advances in Neural Information Processing Systems_ , volume 35, pages 17940–17952, 2022.
  * Ghorbani et al. [2019] A. Ghorbani, A. Abid, and J. Zou.  Interpretation of Neural Networks Is Fragile.  In _Proceedings of the AAAI Conference on Artificial Intelligence_ , volume 33, pages 3681–3688, 2019.  doi: 10.1609/aaai.v33i01.33013681.
  * Goan and Fookes [2020] E. Goan and C. Fookes.  Bayesian Neural Networks: An Introduction and Survey.  _Case Studies in Applied Bayesian Data Science_ , 2259:45–87, 2020.  doi: 10.1007/978-3-030-42553-1_3.
  * Guo et al. [2017] C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger.  On Calibration of Modern Neural Networks.  In _Proceedings of the 34th International Conference on Machine Learning (ICML)_ , volume 70, pages 1321–1330, 2017.
  * Hase et al. [2019] P. Hase, C. Chen, O. Li, and C. Rudin.  Interpretable Image Recognition with Hierarchical Prototypes.  In _Proceedings of the AAAI Conference on Human Computation and Crowdsourcing_ , volume 7, pages 32–40, 2019.  ISBN 978-1-57735-820-6.
  * Houlsby et al. [2011] N. Houlsby, F. Huszár, Z. Ghahramani, and M. Lengyel.  Bayesian Active Learning for Classification and Preference Learning.  _arXiv preprint arXiv:1112.5745_ , 2011.  doi: 10.48550/arXiv.1112.5745.
  * Hüllermeier and Waegeman [2021] E. Hüllermeier and W. Waegeman.  Aleatoric and Epistemic Uncertainty in Machine Learning: An Introduction to Concepts and Methods.  _Machine Learning_ , 110(3):457–506, 2021.  ISSN 1573-0565.  doi: 10.1007/s10994-021-05946-3.
  * Joo et al. [2023] H. Joo, J. Kim, H. Han, and J. Lee.  Distributional Prototypical Methods for Reliable Explanation Space Construction.  _IEEE Access_ , 11:34821–34834, 2023.  ISSN 2169-3536.  doi: 10.1109/ACCESS.2023.3264794.
  * Kendall and Gal [2017] A. Kendall and Y. Gal.  What Uncertainties Do We Need in Bayesian Deep Learning for Computer Vision?  In _Advances in Neural Information Processing Systems_ , volume 30, pages 5574–5584, 2017.
  * Kingma and Ba [2015] D. P. Kingma and J. Ba.  Adam: A Method for Stochastic Optimization.  In _International Conference on Learning Representations (ICLR)_ , 2015.  doi: 10.48550/arXiv.1412.6980.
  * Kingma and Welling [2014] D. P. Kingma and M. Welling.  Auto-Encoding Variational Bayes.  In _International Conference on Learning Representations (ICLR)_ , 2014.
  * Kwon et al. [2022] Y. Kwon, J.-H. Won, B. J. Kim, and M. C. Paik.  Uncertainty Quantification Using Bayesian Neural Networks in Classification: Application to Ischemic Stroke Lesion Segmentation.  In _Medical Imaging with Deep Learning (MIDL)_ , 2022\.
  * Lakkaraju and Bastani [2020] H. Lakkaraju and O. Bastani.  "How do I fool you?": Manipulating User Trust via Misleading Black Box Explanations.  In _Proceedings of the AAAI/ACM Conference on AI, Ethics, and Society_ , AIES ’20, pages 79–85, 2020.  ISBN 978-1-4503-7110-0.  doi: 10.1145/3375627.3375833.
  * Lecun et al. [1998] Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner.  Gradient-Based Learning Applied to Document Recognition.  _Proceedings of the IEEE_ , 86(11):2278–2324, 1998.  ISSN 1558-2256.  doi: 10.1109/5.726791.
  * Li et al. [2018] O. Li, H. Liu, C. Chen, and C. Rudin.  Deep Learning for Case-Based Reasoning Through Prototypes: A Neural Network That Explains Its Predictions.  In _Proceedings of the AAAI Conference on Artificial Intelligence_ , volume 32, pages 3530–3537, 2018.
  * Lipton [2018] Z. C. Lipton.  The Mythos of Model Interpretability: In Machine Learning, the Concept of Interpretability Is Both Important and Slippery.  _Queue_ , 16(3):31–57, 2018.  ISSN 1542-7730.  doi: 10.1145/3236386.3241340.
  * Nauta et al. [2021] M. Nauta, R. Van Bree, and C. Seifert.  Neural Prototype Trees for Interpretable Fine-grained Image Recognition.  In _Proceedings of the 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)_ , pages 14933–14943, 2021.  ISBN 978-1-66544-509-2.  doi: 10.1109/CVPR46437.2021.01469.
  * Neal [2012] R. M. Neal.  _Bayesian Learning for Neural Networks_ , volume 118.  Springer Science & Business Media, 2012.
  * Pastore and Calcagnì [2019] M. Pastore and A. Calcagnì.  Measuring Distribution Similarities Between Samples: A Distribution-Free Overlapping Index.  _Frontiers in Psychology_ , 10(1089), 2019.  ISSN 1664-1078.  doi: 10.3389/fpsyg.2019.01089.
  * Petrov and Kwiatkowska [2022] A. Petrov and M. Kwiatkowska.  Robustness of Unsupervised Representation Learning without Labels.  _arXiv preprint arXiv:2210.04076_ , 2022.  doi: 10.48550/arXiv.2210.04076.
  * Rudin [2019] C. Rudin.  Stop Explaining Black Box Machine Learning Models for High Stakes Decisions and Use Interpretable Models Instead.  _Nature Machine Intelligence_ , 1(5):206–215, 2019.  ISSN 2522-5839.  doi: 10.1038/s42256-019-0048-x.
  * Selvaraju et al. [2017] R. R. Selvaraju, M. Cogswell, A. Das, R. Vedantam, D. Parikh, and D. Batra.  Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization.  In _Proceedings of the 2017 IEEE International Conference on Computer Vision (ICCV)_ , pages 618–626, 2017.  doi: 10.1109/ICCV.2017.74.
  * Shannon [1948] C. E. Shannon.  A Mathematical Theory of Communication.  _The Bell System Technical Journal_ , 27(3):379–423, 1948.  ISSN 0005-8580.  doi: 10.1002/j.1538-7305.1948.tb01338.x.
  * Shrikumar et al. [2017] A. Shrikumar, P. Greenside, and A. Kundaje.  Learning Important Features Through Propagating Activation Differences.  In _Proceedings of the 34th International Conference on Machine Learning (ICML)_ , volume 70, pages 3145–3153, 2017.
  * Simard et al. [2003] P. Simard, D. Steinkraus, and J. Platt.  Best Practices for Convolutional Neural Networks Applied to Visual Document Analysis.  In _Proceedings of the Seventh International Conference on Document Analysis and Recognition_ , pages 958–963, 2003.  doi: 10.1109/ICDAR.2003.1227801.
  * Simonyan et al. [2014] K. Simonyan, A. Vedaldi, and A. Zisserman.  Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps.  In _Workshop of the 2014 International Conference on Learning Representations (ICLR)_ , 2014.
  * Springenberg et al. [2015] J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller.  Striving for Simplicity: The All Convolutional Net.  In _Workshop of the 2015 International Conference on Learning Representations (ICLR)_ , 2015.  doi: 10.48550/arXiv.1412.6806.
  * Sundararajan et al. [2017] M. Sundararajan, A. Taly, and Q. Yan.  Axiomatic Attribution for Deep Networks.  In _Proceedings of the 34th International Conference on Machine Learning (ICML)_ , volume 70, pages 3319–3328, 2017.
  * Szegedy et al. [2014] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus.  Intriguing properties of neural networks.  In _International Conference on Learning Representations (ICLR)_ , 2014.
  * Vadillo et al. [2021] J. Vadillo, R. Santana, and J. A. Lozano.  When and How to Fool Explainable Models (and Humans) with Adversarial Examples.  _arXiv preprint arXiv:2107.01943_ , 2021.
  * Wang et al. [2023] C. Wang, Y. Chen, F. Liu, D. J. McCarthy, H. Frazer, and G. Carneiro.  Mixture of Gaussian-distributed Prototypes with Generative Modelling for Interpretable Image Classification.  _arXiv preprint arXiv:2312.00092_ , 2023.  doi: 10.48550/arXiv.2312.00092.
  * Xiao et al. [2017] H. Xiao, K. Rasul, and R. Vollgraf.  Fashion-MNIST: A Novel Image Dataset for Benchmarking Machine Learning Algorithms.  _arXiv preprint arXiv:2107.01943_ , 2017.  doi: 10.48550/arXiv.1708.07747.
  * Yuan et al. [2019] X. Yuan, P. He, Q. Zhu, and X. Li.  Adversarial Examples: Attacks and Defenses for Deep Learning.  _IEEE Transactions on Neural Networks and Learning Systems_ , 30(9):2805–2824, 2019.  ISSN 2162-2388.  doi: 10.1109/TNNLS.2018.2886017.
  * Zhang et al. [2021] Y. Zhang, P. Tiňo, A. Leonardis, and K. Tang.  A Survey on Neural Network Interpretability.  _IEEE Transactions on Emerging Topics in Computational Intelligence_ , 5(5):726–742, 2021.  ISSN 2471-285X.  doi: 10.1109/TETCI.2021.3100641.

##  Appendix A Discussion on previous PSENN approaches

As introduced in Section 1, the development of PSENNs arises as an alternative
to black-box DNNs and posthoc explanations, with the goal of ensuring a human-
understandable decision process by construction, while keeping a competitive
predictive performance. This is achieved by integrating a transparent case-
based reasoning as the core element, so that the prediction of the model is
determined based on the similarity between the input and a set of prototypical
representations of the output classes (see Section 2 for further details).

The way in which such prototypes are defined has led to different types of
PSENNs in the literature. In the seminal work of Li et al. [28], mirrored by
recent follow-up works [14, 21], the prototypes represent complete
characterizations of each class or concept (e.g., full representations of the
digits in handwritten digit recognition). In contrast, other follow-up works
aim to capture more abstract [4] or specific features (e.g., prototypical
parts or patches) [8, 18, 30] as prototypes. However, an important drawback of
these approaches is that the prototypes are restricted to being samples or
sample parts of (encoded) training inputs [4, 8, 18, 30]. This implies a
flexibility loss regarding the end-to-end optimization of the prototypes, as
well as a transparency loss when surrogate prototypes (e.g., nearest training
images) are selected to visualize the explanations [4, 14]. For these reasons,
we followed the same spirit as in [28], and thus employed the corresponding
architecture as a baseline, in order to guarantee a fully transparent and end-
to-end trainable architecture. We also remark that, while [14, 21] also focus
on learning a fixed set of complete, unconstrained, and decodable prototypes,
the proposed architecture relies on a Variational Autoencoder [24] as the
autoencoding module. In contrast, as in [28], our approach does not require
enforcing such a regularized latent space, hence representing a more general
approach.

Closer to our approach, concurrent works [21, 44] leverage the use of
distributions over the prototypes to improve the consistency between image
similarity and latent space location [21] and to increase the representation
power of the model [44]. Contrary to our work, both approaches employ only the
means of the learned distributions as prototypes, whereas our sampling-based
inference process allows us to sample multiple sets of prototypes, avoiding
the constraint of committing to a fixed set, and harnessing all of them for
both the explanation and classification. Furthermore, the approach in [44]
follows the strategy of [4, 8, 18] and rely on surrogate prototypes, replacing
the distribution means with nearest training instances, with the corresponding
flexibility and transparency loss discussed above. Another key difference
between our approach and that in [21] is that, in their work, the similarities
between the input’s distributional embedding and the prototype distributions,
which fed the final classification layer, is measured by considering the
entire distributions, using distributional similarity metrics. However, as
stated in [21], such similarities do not form nor rely on observable
prototypes, which is contrary to the purpose of explaining and justifying the
classification. Instead, we advocate for a more transparent approach, in which
the model predictions are solely derived from the distances to the sampled
sets of prototypes, ensuring a complete and transparent justification of model
outputs.

##  Appendix B Implementation details

Our models have been implemented in Python, using TensorFlow [1] and
TensorFlow Probability [12] packages. The experiments have been conducted on a
cluster with Nvidia RTX A5000 GPUs and AMD EPYC 7252 8-Core CPUs. However, we
point out that our models are amenable to being trained on commodity hardware.
The architecture of the MLP Autoencoder module is composed of two dense layers
with $1000$ hidden units and ReLU activation, followed by a dense layer with
$l$ output neurons. A linear activation is used for the last layer of the
encoder. The architecture of the CNN Autoencoder is composed of four
convolutional layers, followed by a dense layer with $l$ output neurons and
linear activation for the last layer of the encoder, in order to control the
dimensionality of the latent space. The convolutional layers employ a $3\times
3$ kernel size, a stride value of 2, same zero padding. We use 32 channels for
the first three layers and 10 channels for the fourth layer.

The experiments have been run for $\tau_{1}=1.0,\tau_{2}=10.0,\tau_{3}=0.05$,
a batch size of 128 and 30 epochs. The Adam optimization method [23] has been
used to train the networks, using a learning rate of $0.001$. The final
classification layer $W$ was set as $W=-I$, where $I$ represents the identity
matrix of dimension $c$, thus ensuring that the association between the
prototype $\bm{r}_{i}$ and the class $y_{i}$, $1\leq i\leq c$, is explicit and
unequivocal. For all the datasets, the standard train and test splits have
been used, with sizes 60000 and 10000, respectively, and a subset of 6000
training samples has been extracted as a validation set. The results on the
baseline model [28] have been reproduced using the implementation released by
the authors.

##  Appendix C Complementary results on the MNIST dataset

In order to complement the results reported in Section 5, Figure 9 shows, for
the MNIST dataset, 15 randomly sampled sets of prototypes from a Prob-PSENN
with $l=5$ (left) and $l=10$ (right). As it can be observed, the increase in
the dimensionality of the latent space makes it possible to capture prototype
distributions with a higher degree of complexity in their structure, as well
as to obtain more detailed decodings.

Figure 9:  15 random sets of prototypes, obtained with a Prob-PSENN with $l=5$
(left) and $l=10$ (right).

##  Appendix D Results on the Fashion-MNIST dataset

This section includes complementary results on the Fashion-MNIST dataset.
First, Figure 10 shows randomly sampled prototypes for a Prob-PSENN with $l=5$
(left) and $l=10$ (right). These figures demonstrate that the probabilistic
redefinition of the prototypes introduced in Prob-PSENNs enables the model to
learn, even for relatively low-dimensional latent spaces, diverse but still
prototypical representations of each class.

Figure 10: Learned prototypes for the Fashion-MNIST dataset, with $l=5$ (left)
and $l=10$ (right).

Furthermore, a visual comparison between the explanations provided by a non-
probabilistic PSENN and a Prob-PSENN is provided in Figures 11 and 12. For the
sake of completeness, the former figure includes the explanations provided by
a PSENN with $m=15$ (left) and $m=50$ (right) prototypes. In both cases, the
original input is shown in the top-left corner, and the prototypes are colored
according to the classes returned by the model when the prototypes are
classified, in order to make it clearer which class each prototype is most
associated with. Notice that this connection is explicit and unequivocal by
construction in our Prob-PSENNs, being the class $y_{i}$ represented by the
prototype $r_{i}$, $1\leq i\leq c$, resulting in more transparent decision
processes and easier-to-interpret explanations. As can be observed in Figures
11 and 12, the prototypes learned by the PSENNs are, even for $m=50$
prototypes, considerably less meaningful and varied than the ones captured by
Prob-PSENN. Furthermore, the uncertainty metrics introduced in Section 3.3
enable us to quantify a low aleatoric and epistemic explanatory uncertainty
for this input ($0.004$ and $0.16$, respectively), which increases the
trustworthiness and reliability of the outcomes of Prob-PSENN.

Figure 11: Explanations provided by a PSENN with $m=15$ (left) and $m=50$
(right) for the Fashion-MNIST dataset. Both models classify the input (shown
in the top-left corner of each grid) as the class pullover with a probability
of $0.99$. Note that the prototypes are sorted based on their distances to the
input (displayed on top of each figure), in increasing order. Figure 12:
Explanation provided by a Prob-PSENN, for the Fashion-MNIST dataset. The top
row shows the distance distribution to the four closest classes (left), and
the variability in the output probabilities (right). The bottom part shows the
prototypes corresponding to the four closest classes, and the corresponding
distances to the input. Note that the prototypes are ordered based on their
distance, in increasing order.

##  Appendix E Results on the K-MNIST dataset

This section contains additional results on the 10-class K-MNIST dataset [9],
which includes handwritten representations of Japanese letters. Random images
from this dataset are shown in Figure 13, from which it can be noticed a high
variance in the representation of each letter. Randomly sampled prototypes
from Prob-PSENNs with $l=5$ and $l=10$ are displayed in Figure 14. As can be
assessed in the figure, despite the complexity and high variability of this
dataset, Prob-PSENNs are capable of capturing the most frequent
representations of each class, ensuring a sufficiently diverse and meaningful
characterization of the classes.

As for the previous datasets, a comparison between the explanations of PSENNs
and Prob-PSENN for the K-MNIST dataset is provided in Figures 15 and 16.
Notice how, also due to the higher variability in the representations of each
class, the prototypes learned by a PSENN with $m=15$ prototypes (Figure
15-left) are not sufficiently representative of the classes, and,
consequently, we need to resort to a large number of prototypes ($m=50$,
Figure 15-right). However, even for $m=50$, the prototypes learned by PSENN
are considerably less varied and informative than the ones sampled by Prob-
PSENN, which evidences the higher flexibility of our approach, as well as its
increased transparency and explanatory capabilities.

Figure 13: Examples of the K-MNIST dataset [9], as reported in the original
repository https://github.com/rois-codh/kmnist (CC BY-SA 4.0 license). Each
row corresponds to one class. The first column of the figure shows the modern
representation of each letter, as a reference.

Figure 14: Sampled prototypes for the K-MNIST dataset, using a Prob-PSENN with
$l=5$ (left) and $l=10$ (right).

Figure 15: Explanations provided by a PSENN with $m=15$ (left) and $m=50$
(right) for the K-MNIST dataset. Both models classify the input (shown in the
top-left corner of each grid) as the class 8 with a probability of $0.99$.
Note that the prototypes are sorted based on their distances to the input
(displayed on top of each figure), in increasing order. Figure 16: Explanation
provided by a Prob-PSENN, for the K-MNIST dataset. The top row shows the
distance distribution to the four closest classes (left), and the variability
in the output probabilities (right). The bottom part shows the prototypes
corresponding to the four closest classes, and the corresponding distances to
the input. Note that the prototypes are ordered based on their distance, in
increasing order.

##  Appendix F Results on the E-MNIST dataset

In order to analyze the scalability of ProbSENN in tasks consisting of larger
number of classes, we evaluated its performance in the E-MNIST dataset [10]
(47 classes), an extension of MNIST which includes both numeric and alphabetic
characters. As it can be seen in Figure 17, ProbSENN is still capable of
learning suitable distribution over the prototypes for the 47 classes,
yielding realistic and diverse prototypes, while achieving a test accuracy of
0.85.

Figure 17: Prototypes sampled for the E-MNIST dataset (47 classes), consisting
of handwritten representations of numbers and letters.

##  Appendix G Harnessing uncertainty to improve predictive accuracy and
reliability: Results

Table 2:  Predictive accuracy percentages (mean and standard deviation for 10
runs) obtained by Prob-PSENN for the following configurations: using the MLP-
Autoencoder, using the CNN-Autoencoder, including elastic deformation as data
augmentation (AUG), and discarding the inputs with an uncertainty rate
$\mathscr{U}_{E}(x)$ (see Equation 4 in the paper) higher than a threshold
$\alpha$ (UNC).

Configuration | MNIST | F-MNIST | K-MNIST
---|---|---|---
Prob-PSENN ($l=10$, MLP) |  97.59 $\pm$ 0.48 |  88.77 $\pm$ 0.50 |  88.92 $\pm$ 1.00
\+ UNC ($\alpha=0.99$) |  98.99 $\pm$ 0.42 |  89.16 $\pm$ 0.52 |  96.19 $\pm$ 1.42
\+ UNC ($\alpha=0.95$) |  99.68 $\pm$ 0.13 |  90.52 $\pm$ 0.67 |  98.77 $\pm$ 0.39
Prob-PSENN ($l=10$, CNN) |  98.28 $\pm$ 0.17 |  89.47 $\pm$ 0.34 |  89.06 $\pm$ 0.34
\+ UNC ($\alpha=0.99$) |  98.83 $\pm$ 0.25 |  89.52 $\pm$ 0.41 |  89.58 $\pm$ 0.50
\+ UNC ($\alpha=0.95$) |  99.68 $\pm$ 0.09 |  90.22 $\pm$ 0.59 |  94.58 $\pm$ 0.74
Prob-PSENN ($l=10$, MLP + AUG) |  98.53 $\pm$ 0.08 |  87.78 $\pm$ 0.50 |  93.17 $\pm$ 0.33
\+ UNC ($\alpha=0.99$) |  98.97 $\pm$ 0.14 |  87.81 $\pm$ 0.49 |  95.29 $\pm$ 0.65
\+ UNC ($\alpha=0.95$) |  99.67 $\pm$ 0.05 |  88.29 $\pm$ 0.57 |  98.44 $\pm$ 0.33
Prob-PSENN ($l=10$, CNN + AUG) |  98.75 $\pm$ 0.17 |  87.98 $\pm$ 0.46 |  89.40 $\pm$ 1.14
\+ UNC ($\alpha=0.99$) |  99.00 $\pm$ 0.18 |  88.00 $\pm$ 0.46 |  89.56 $\pm$ 1.09
\+ UNC ($\alpha=0.95$) |  99.74 $\pm$ 0.09 |  88.45 $\pm$ 0.52 |  93.53 $\pm$ 1.28

Table 3:  Percentage of discarded inputs when filtering by uncertainty (mean
and standard deviation for 10 runs).

Threshold | Configuration | MNIST | F-MNIST | K-MNIST
---|---|---|---|---
$\alpha=0.99$ |  Prob-PSENN ($l=10$, MLP) |  2.77 $\pm$ 0.53 |  0.79 $\pm$ 0.26 |  11.49 $\pm$ 2.31
|  Prob-PSENN ($l=10$, CNN) |  1.01 $\pm$ 0.26 |  0.13 $\pm$ 0.10 |  0.70 $\pm$ 0.40
|  Prob-PSENN ($l=10$, MLP + AUG) |  0.90 $\pm$ 0.14 |  0.05 $\pm$ 0.03 |  4.25 $\pm$ 0.97
|  Prob-PSENN ($l=10$, CNN + AUG) |  0.52 $\pm$ 0.11 |  0.04 $\pm$ 0.04 |  0.17 $\pm$ 0.11
$\alpha=0.95$ |  Prob-PSENN ($l=10$, MLP) |  7.69 $\pm$ 0.50 |  5.16 $\pm$ 0.86 |  24.89 $\pm$ 1.33
|  Prob-PSENN ($l=10$, CNN) |  5.27 $\pm$ 0.21 |  2.57 $\pm$ 0.45 |  12.38 $\pm$ 1.10
|  Prob-PSENN ($l=10$, MLP + AUG) |  5.58 $\pm$ 0.23 |  1.84 $\pm$ 0.29 |  17.02 $\pm$ 1.01
|  Prob-PSENN ($l=10$, CNN + AUG) |  4.67 $\pm$ 0.21 |  1.75 $\pm$ 0.30 |  9.59 $\pm$ 1.17

Table 4:  Error rate (%) of the deterministic baseline model on the inputs
receiving high/low uncertainty by Prob-PSENNs (with $l=10$ and an MLP-
Autoencoders).

Threshold | Configuration | MNIST | F-MNIST | K-MNIST
---|---|---|---|---
$\alpha=0.99$ |  High uncert. ($\mathscr{U}_{E}(x)>\alpha$) |  13.10 $\pm$ 1.87 |  25.56 $\pm$ 6.72 |  37.12 $\pm$ 2.69
|  Low uncert. ($\mathscr{U}_{E}(x)\leq\alpha$) |  0.73 $\pm$ 0.13 |  9.73 $\pm$ 0.32 |  5.36 $\pm$ 0.51
$\alpha=0.95$ |  High uncert. ($\mathscr{U}_{E}(x)>\alpha$) |  8.75 $\pm$ 1.24 |  25.55 $\pm$ 3.29 |  27.12 $\pm$ 1.38
|  Low uncert. ($\mathscr{U}_{E}(x)\leq\alpha$) |  0.41 $\pm$ 0.09 |  8.99 $\pm$ 0.35 |  2.92 $\pm$ 0.33

##  Appendix H Broader Impact

As specified above, the goal of Prob-PSENNs is to promote a transparent-by-
design DNN architecture while maintaining competitive predictive performance.
In addition to transparency, Prob-PSENNs provide tools to quantify the
uncertainty in the model’s predictions and explanations, which further
enhances its safety and reliability. Therefore, our work is aligned with three
important needs of deep learning models: interpretability, transparency, and
reliability. However, a current concern in deep learning models is their lack
of robustness to adversarial attacks [46, 42, 7], a vulnerability that also
threatens explanation methods and self-explainable models [43, 3, 26, 15].
Therefore, in order to ensure a safe and responsible deployment of Prob-PSENNs
in practice, it remains crucial to carefully assess the implications of
adversarial attacks, and, consequently, to evaluate the robustness of the
model against them.


# Imaging of chemical kinetics at the water–water interface in a free-flowing
liquid flat-jet

H. Christian Schewe  Fritz-Haber-Institut der Max-Planck-Gesellschaft,
Faradayweg 4-6, 14195 Berlin, Germany  Bruno Credidio  Institute for Chemical
Sciences and Engineering (ISIC), Ecole Polytechnique Fédérale de Lausanne
(EPFL), 1015 Lausanne, Switzerland  Aaron M. Ghrist  Fritz-Haber-Institut der
Max-Planck-Gesellschaft, Faradayweg 4-6, 14195 Berlin, Germany  Sebastian
Malerz  Fritz-Haber-Institut der Max-Planck-Gesellschaft, Faradayweg 4-6,
14195 Berlin, Germany  Christian Ozga  Institut für Physik und CINSaT,
Universität Kassel, Heinrich-Plett-Straße 40, 34132 Kassel, Germany  André
Knie  Institut für Physik und CINSaT, Universität Kassel, Heinrich-Plett-
Straße 40, 34132 Kassel, Germany  Henrik Haak  Fritz-Haber-Institut der Max-
Planck-Gesellschaft, Faradayweg 4-6, 14195 Berlin, Germany  Gerard Meijer
Fritz-Haber-Institut der Max-Planck-Gesellschaft, Faradayweg 4-6, 14195
Berlin, Germany  Bernd Winter  Fritz-Haber-Institut der Max-Planck-
Gesellschaft, Faradayweg 4-6, 14195 Berlin, Germany  Andreas Osterwalder
<EMAIL_ADDRESS>Institute for Chemical Sciences and Engineering
(ISIC), Ecole Polytechnique Fédérale de Lausanne (EPFL), 1015 Lausanne,
Switzerland

###### Abstract

We present chemical kinetics measurements of the luminol oxydation
chemiluminescence reaction at the interface between two aqueous solutions,
using liquid jet technology. Free-flowing iquid microjets are a relatively
recent development that has found its way into a growing number of
applications in spectroscopy and dynamics. A variant thereof, called flat-jet,
is obtained when two cylindrical jets of a liquid are crossed, leading to a
chain of planar leaf-shaped structures of the flowing liquid. We here show
that in the first leaf of this chain the fluids do not exhibit turbulent
mixing, providing a clean interface between the liquids from the impinging
jets. We also show, using the example of the luminol chemiluminescence
reaction, how this setup can be used to obtain kinetics information from
friction-less flow and by circumventing the requirement for rapid mixing but
by intentionally suppressing all turbulent mixing and instead relying on
diffusion.

Institute of Organic Chemistry and Biochemistry, Czech Academy of Sciences,
Flemingovo nám. 2, 16610 Prague 6, Czech Republic These authors contributed
equally These authors contributed equally Department of Chemistry, University
of Southern California, Los Angeles, CA 90089-0482, USA These authors
contributed equally

##  1 Introduction

Figure 1: Photograph of a water flat-jet glowing blue as a result of
chemiluminescence.

Fast-flowing liquid microjets are a powerful tool for the preparation of
volatile liquids, including water, even in high-vacuum environments.1, 2, 3,
4, 5 They recently gained much interest in particular for in-vacuum
applications where the jet travels freely for some millimeters before decaying
into droplets and freezing. One of the prime factors that make them
interesting tools is the free flow through air or vacuum which permits
unobstructed optical access to the liquid and thus enables a wide range of
spectroscopic detection that are incompatible with many solid container
materials. Recent applications include X-ray photoelectron spectroscopy,6, 7,
8, 9, 10, 11, 12, 13, 14, 1evaporation dynamics,15, 16, 17, 18, 19, 20, 21
attosecond-pulse generation,22, 23 and liquid-gas scattering.24, 24, 25 The
most common implementation is a single cylindrical jet, obtained by forcing
the liquid at a pressure of a few bars through a 10-50 $\mu$m-diameter nozzle,
which results in a laminar jet with a flow velocity of tens of m/s.

Many experiments demand a planar surface in order to avoid unwanted averaging
over effects resulting from the angle-dependent surface normal.26, 24
Different arrangements exist to produce laminar-flow planar surfaces,27, 28
among which a widely used setup is the crossing and impinging of two
cylindrical jets.29 For large enough Reynolds number this produces a chain of
few-micron thin leaf-shaped sheets, each bound by a relatively thick fluid rim
and stabilized by an interplay of surface tension and fluid inertia.
Consecutive sheet planes are perpendicular to each other. The stability and
geometry of this structure are governed by solution properties such as surface
tension and viscosity, and by controlled parameters like flow-rate and jet-
diameter.30, 29

An important question about such objects is wether the first leaf of the chain
contains a turbulent mixture of the fluids from the two jets, or if these flow
alongside each other, yet we are not aware of any experimental study
addressing this question. Indeed, the second option implies that a well-
defined liquid–liquid interface is generated which is of great interest in the
case of two different solvents, but also for identical solvents of different
composition. Previous studies have shown that in microfluidics devices it is
possible to prepare well-defined interfaces between miscible and immiscible
fluids by keeping the liquid flow laminar, and these devices have been used in
studies targeting structural and dynamical aspects of interfaces.31, 32 In
contrast to free-flowing flat jets, however, microfluidics inherently require
a container material which, on the one hand, imposes limitations on the
systems in terms of flow dynamics, since friction on the walls leads to
modified flow patterns, and on the available spectroscopic tools on the other
hand, since the container material itself absorbs electromagnetic radiation in
ranges that may be critical for the system under investigation.

We here demonstrate that impinging, but free-flowing, jets do produce a leaf
structure where the fluids flow alnogside each other in the first leaf and
thus represent a tool to gain access to the liquid-liquid interface of
miscible fluids. This finding demonstrates an important aspect of free-flowing
microjets which makes them a powerful borderless alternative to microfluidics
and opens the door towards the investigation of chemical reactions and in-
vacuum studies at liquid-liquid interfaces, with the option of using extreme
ultraviolett and X-ray radiation that are only limited by the absorption
spectrum of the solvent itself. Species in either solution diffuse across the
interface while flowing downstream, thereby creating a steady-state system
with an increasingly overlapping region where chemical reactions can take
place. Based on this we here also demonstrate a technique for chemical
kinetics studies under completely controlled conditions which explicitly
avoids the necessity for rapid mixing and benefits from the free-flowing jets
that are not perturbed by friction on container-walls.33 By combining two jets
with different reactants and applying a suitable spectroscopic detection
scheme, the flow axis of the jet represents the time axis, permitting to
directly see and image the progress of the reaction. Typical leaf surface
dimensions are 1.5 mm x 0.5 mm, and with flow velocities of a few 10 m/s this
corresponds to a flow time through the first leaf of around 50–100 $\mu$s,
thus covering a time scale for chemical kinetics that currently is difficult
to access by other methods.

The present experiment detects photons from a chemiluminescence (CL) reaction,
allowing at the same time the proof for the controlled formation of the
liquid–liquid interface, and the imaging of the chemical reaction kinetics.
Our sample reaction is the oxidation of
5-amino-2,3-dihydro-1,4-phthalazinedione, known as luminol, which is oxidized
by H2O2 in the presence of a transition metal ion.34, 35 The reaction product
is an electronically excited state of deprotonated 3-aminophthalic acid
($AP^{*}$) which relaxes to the electronic ground state by emitting a blue
photon. 36, 37, 38

Injecting the principal reactants through individual jets yields a liquid
flat-jet that luminesces exclusively where the liquids mix. Figure 1 is the
resulting photo of the glowing flat-jet, where the cylindrical jets enter from
the left and flow to the right. Such an image provides a direct visualisation
of the dynamics in the flat-jet: from the intensity distribution of the
emitted light we can immediately conclude that there is no turbulent mixing in
the flat region of the first leaf and infer information on the kinetics.
Complete mixing of the solutions leads to a uniform blue glow as it is
observed in rims and onward from the second leaf. However the first leaf
displays a gradual increase of the luminescence, indicative of diffusion
across the well-defined interface, and defined by the relative rates of
diffusion, chemical reaction kinetics, and luminescence. The luminol–H2O2
reaction has been found to take place on the sub-millisecond time scale, while
our imaging setup allows for a time resolution of around 2 $\mu$s (see SI).
This system is thus ideally suited for spatial mapping of solution mixing and
the demonstration of the feasibility of reaction kinetics measurements.

Figure 2: Experimental arrangement to generate the flat-jet. Two cylindrical
liquid microjets, operated by separate HPLC pumps, are crossed at an angle of
$\alpha$ = 48∘. One contains a luminol solution and Cu2+ ions, the second an
aqueous H2O2. (A) View at the face of the first leaf. The plane spanned by the
two cylindrical jets is vertical to the leaf plane. (B) Sketch showing the
geometry used for CL detection and a cross section of the first leaf. A CCD
camera faces the leaf surface and collects the CL.

In the present experiment, described in detail in the SI, we generate the
flat-jet by colliding two liquid jets in atmosphere, one containing an aqueous
H2O2 solution, the other containing luminol and copper ions.

A photograph of a typical flat-jet, but with no chemical reaction, used in the
present experiments is shown in Figure 2A. Rims and turn-over point to the
second leaf are clearly visible. Color structures on the leaf surface are
optical interferences resulting from the sample illumination. Figure 2B shows
a cross section of the flat-jet in the plane of the two original jets,
sketching the merged structure formed by the two flat-jets of solutions #1 and
#2, joined by the interface. Here the two cylindrical jets are represented by
the two arrows crossing at angle $\alpha$. The downstream increase of the
interfacial layer thickness, indicated as the dark blue area, results from
diffusion of species across the boundary (see the SI for calculations of the
resulting concentration distributions).

##  2 Analysis of Chemiluminescence Images

Figure 3: (A) False-color image of the measured CL intensity within the first
leaf of the flat-jet (blue is high intensity; red is zero intensity). (B) CL
signal intensity along the $y$-direction at $z$ = 0, indicated by the dashed
horizontal line in A, for luminol concentrations of 6 g/L (black line), 4 g/L
(red line), 2 g/L (blue line) and 1 g/L (green line), respectively. Thick
solid lines are numerical results. Inset: calculated results for cases with
extreme (red and green) ratios and the result found here (black) between
reaction and diffusion rates.

Figure 3A shows a false-color plot of the CL intensity in the $y-z$ plane,
from the first leaf in Figure 1, with the camera oriented along the $x$-axis
(see Figure 2B). Two 50 $\mu$m jets enter from the left, in the $x-z$ plane.
The first leaf in this arrangement has dimensions of l = 1.5 mm w = 0.3 mm,
respectively, and a flow speed of 23 m/s. They are not visible because no
luminescence is emitted from the individual reactant jets which impinge at
around $y$ =-100 $\pm$100 pixels and $z$ =0$\pm$50 pixels. Calibration of the
pixel scale and conversion to the $\mu$m scale at the top is obtained using
the known cylindrical-jet diameter in Figure 2A. The flat-jet origin is
defined as the point where a laminar flat-jet forms and CL starts to be
observable. CL intensity at negative z values and in the rims mirrors the
turbulences in those regions. In contrast, in the flat region only a slight
intensity increase, starting at zero luminescence, is observed along the flow
direction.

The specific form of this increase is defined by the overall dynamics of the
process and is used to extract information on the rates of the involved
processes. The CL intensity as a function of the downstream coordinate (along
the $y$-axis at $z$ = 0; dashed line in Figure 3A) is shown in Figure 3B.
Results are plotted for four different solutions with luminol concentrations
of 6 g/L (grey), 4 g/L (red), 2 g/L (blue) and 1 g/L (green), respectively
(all other reactants in this solution are scaled accordingly). These graphs,
along with Figures 1 and 3A, reveal the following: 1\. All leaves except the
first one exhibit uniform CL intensity of similar magnitude in the flat parts
and in the rims, indicating complete mixing of the two liquids. 2\. The CL
intensity observed at $y<$0 first decreases to zero before gradually
increasing. 3\. The CL intensity in the first leaf increases towards positive
$y$, supporting the assumption of reagent diffusion across the interface.
Point 2 is an important confirmation that the CL reaction, including the final
luminescence step, proceeds fast on the time scale in comparison with flow
speed, diffusion and reaction kinetics, and that at the origin a purely
laminar flow is established (also see SI).

The overall kinetics are assessed by theoretically reproducing the measured CL
profiles of Figure 3B, using a simple kinetics model that includes the
diffusion, the principal reaction steps (detailed in the SI), and
luminescence. The photon flux $\Phi$ from CL results from the decay of
$AP^{*}$:

$\Phi=k_{P}[AP^{*}](t),$ (1)

where $k_{P}$ is the rate coefficient for CL and $[AP^{*}](t)$ is the time-
dependent product concentration. $AP^{*}$ is formed in a series of chemical
reactions outlined in the SI.39, 40, 41, 37, 34 The rate of this process can
be written as a function of the limiting reactant concentrations

$d\left[AP^{*}\right]/dt=k_{R}\left[\ce{H2O2}\right]\left[\ce{LH-}\right],$
(2)

where $k_{R}$ is a collective rate coefficient for the chemical reaction
sequence that incorporates the various steps leading to $AP^{*}$. The required
high pH of the luminol solution indicates that it is present exclusively in
the deprotonated form LH-, conditions which have been found to be favorable
for the reaction. 42, 43

Applying the coordinate system introduced in Figures 2 and 3A, the relevant
spatial dimensions thus are both the $y$-axis (which translates into a time
axis, $t$) and the $x$-coordinate perpendicular to the leaf surface which is
the principal direction of diffusion and hence mixing of the reactants. The
concentration distribution $c(x,t)$ is derived from the initial
concentrations, $c_{0}$, using Fick’s law.44 In the model of the two-solution
flat-jet the initial concentration distributions, $c(x=0,t=0)$, are step-
functions where the concentration of either reactant is $c_{0}$ on its
original side and zero elsewhere. As time progresses, the diffusion-determined
profile for each specie $i$ is described by an error-function $\Gamma$:

$c_{i}(x,t)=\frac{c_{0,i}}{2}\left\\{1-\Gamma\left(\frac{x}{2\sqrt{D_{i}t}}\right)\right\\},$
(3)

where $D_{i}$ is the diffusion coefficient for specie $i$, and $t$ is time,
defined by the flow velocity $v$ and position along the jet propagation as
$t=y/v$.

In a second step the concentration profiles from equation 3, expressed as a
function of $y$, are convoluted with each other and fed into equation 2, thus
incorporating diffusion into the kinetic model. This yields the final profile
for $[AP^{*}]$ along the $y$ axis, and equation 1 is then used to calculate
the CL intensity:

$\frac{\Delta\left[AP^{*}\right]}{\Delta
y}=\frac{1}{v}\left[-k_{P}[AP^{*}]+k_{R}\shin(y)\right]$ (4)

Here, $\shin(y)$ is the integral along $y$ of the convoluted concentration
profiles along $x$, and it thus accounts for the widening of the interface
downstream in the jet (see SI). The terms in the brackets are the rate of
decrease of $[AP^{*}]$ due to CL, in accordance with equation 1, and of
increase due to the chemical reaction, equation 2.

The resulting expression is then numerically integrated to yield synthetic
luminescence traces along the jet axis, and rate coefficients are fitted to
reproduce the experimental results from Figure 3B, as is shown by thick solid
lines in the same graph. In the current proof-of-principle study we are not
able to extract absolute rate coefficients because some of the rates are
correlated, and because in this case a calibration of the luminescence
measurement was not attempted. Here we present a simplified analysis that
reproduces the shape of the traces that depends on the relative magnitudes of
the rates of diffusion, luminescence, and chemical kinetics. In the SI we
elaborate on a procedure that will enable a quantitative analysis for future
experiments where a calibration will be included.

From the results in Figure 3B we extract the following: The interplay and
relative magnitudes of diffusion, reaction kinetics, and fluorescence rates
determine the overall magnitude of the CL signal but in particular also the
profile of the intensity along the $y$ axis. The global shape of the curve is
an asymmetric sigmoidal evolution, and depending on the relative magnitudes of
the different rates we probe different parts of that curve, as shown in the
inset of Figure 3B. The curve starts with a positive curvature which is
emphasized in the red curve where we artificially reduced the diffusion
coefficients. It converges, showing a negative curvature, on a threshold, as
is clearly seen in the green curve where we artificially slowed down the
luminescence. The intermediate regime, shown in black, provides a near-linear
evolution as is also observed experimentally. Interestingly, the reaction rate
coefficient itself merely leads to an overall scaling of the signal but
without affecting the shape, thus underlining that for a qualitative
understanding, calibrated measurements seem unimportant: even without it, the
shape of the curve reveals principal aspects of the dominating kinetics. The
curvature also does not depend on the concentrations, and nearly identical
results to those shown in Figure 3 are obtained by linearly scaling a single
calculation with concentration.

##  3 Conclusions

A free-flowing liquid flat-jet has been produced from two different solutions
to form a controlled liquid-liquid interface with uninhibited optical access
from both sides. Using the CL reaction of luminol-oxydation by H2O2, we
created a marker for the temporal evolution of the mixing in the interfacial
layer. By measuring the CL intensity distribution from the surface of the
first leaf we demonstrate that the individual cylindrical jets merge into a
laminar regime, and mixing between the two solutions within this leaf happens
solely due to diffusion. We further show that the obtained CL image reveals
reaction kinetics on the sub-ms timescale. We observe a linear dependence of
CL on reactant concentrations, indicative of first order kinetics in the rate-
limiting substances. By modelling the experimental data theoretically, and by
including diffusion, chemical kinetics, and luminescence, we were able to
qualitatively replicate the quasi-linear increase of the CL intensities
measured experimentally, as well as to quantitatively reproduce the
concentration dependence.

This study demonstrates the potential buried in the free-flowing flat-jet
technology for the investigation of liquid-liquid interfaces and interfacial
chemical reactions for identical solvents. The flat-jet represents a steady-
state system wherein the time-axis is transformed into a spatial coordinate,
and imaging provides direct access to time-dependent phenomena. In contrast to
otherwise equivalent experiments using microfluidics, free-flowing jets are
not limited by the presence of containers. These affect the flow dynamics and
impose restrictions on the range of wave lengths applicable to spectroscopic
studies. Investigations of liquid–liquid interfaces using free-flowing fluids
on the other hand can be extended to X-ray spectroscopies on vacuum flat-jets
to access electronic structure, exploiting the unique element specificity and
sensitivity to chemical environment of these techniques, and the controlled
preparation of interfaces now offers possibilities for the study of, e.g.,
transfer processes, chemical dynamics, or catalysis.

##  4 Acknowledgments

This work is funded by the SNF (project 200021E-171721) and the DFG in the
context of a D-A-CH collaboration, and by the EPFL-MPG doctoral school. We
thank Marco Picasso and François Gallaire (both EPFL) for useful discussions.

##  5 Author contribution

H.C.S., B.W., and A.O. designed the experiments, H.C.S., B.C., A.M.G., and
C.O. performed the experiments, and H.H. designed the flat-jet. H.C.S., B.C.,
A.M.G., and A.O. analyzed the obtained data. H.C.S., B.W., A.M.G., and A.O.
wrote the paper, with comments from all authors.

## References

  * Faubel 2000 Faubel, M. _Photoionization and Photodetachment_ ; Advanced Series in Physical Chemistry; WORLD SCIENTIFIC, 2000; Vol. 10; pp 634–690
  * Faubel et al. 1997 Faubel, M.; Steiner, B.; Toennies, J. P. Photoelectron Spectroscopy of Liquid Water, Some Alcohols, and Pure Nonane in Free Micro Jets. _J. Chem. Phys._ 1997, _106_ , 9013–9031
  * Faubel et al. 2012 Faubel, M.; Siefermann, K. R.; Liu, Y.; Abel, B. Ultrafast Soft X-Ray Photoelectron Spectroscopy at Liquid Water Microjets. _Acc. Chem. Res._ 2012, _45_ , 120–130
  * Winter and Faubel 2006 Winter, B.; Faubel, M. Photoemission from Liquid Aqueous Solutions. _Chem. Rev._ 2006, _106_ , 1176–1211
  * Faubel et al. 1988 Faubel, M.; Schlemmer, S.; Toennies, J. P. A Molecular Beam Study of the Evaporation of Water from a Liquid Jet. _Z Phys D - Atoms, Molecules and Clusters_ 1988, _10_ , 269–277
  * Ali et al. 2019 Ali, H.; Seidel, R.; Bergmann, A.; Winter, B. Electronic Structure of Aqueous-Phase Anatase Titanium Dioxide Nanoparticles Probed by Liquid Jet Photoelectron Spectroscopy. _J. Mater. Chem. A_ 2019, _7_ , 6665–6675
  * Buttersack et al. 2019 Buttersack, T.; Mason, P. E.; McMullen, R. S.; Martinek, T.; Brezina, K.; Hein, D.; Ali, H.; Kolbeck, C.; Schewe, C.; Malerz, S.; Winter, B.; Seidel, R.; Marsalek, O.; Jungwirth, P.; Bradforth, S. E. Valence and Core-Level X-Ray Photoelectron Spectroscopy of a Liquid Ammonia Microjet. _J. Am. Chem. Soc._ 2019, _141_ , 1838–1841
  * Fransson et al. 2016 Fransson, T.; Harada, Y.; Kosugi, N.; Besley, N. A.; Winter, B.; Rehr, J. J.; Pettersson, L. G. M.; Nilsson, A. X-Ray and Electron Spectroscopy of Water. _Chem. Rev._ 2016, _116_ , 7551–7569
  * Jungwirth and Winter 2008 Jungwirth, P.; Winter, B. Ions at Aqueous Interfaces: From Water Surface to Hydrated Proteins. _Annu. Rev. Phys. Chem._ 2008, _59_ , 343–366
  * Lewis et al. 2011 Lewis, T.; Faubel, M.; Winter, B.; Hemminger, J. C. CO2 Capture in Amine-Based Aqueous Solution: Role of the Gas-Solution Interface. _Angew. Chem. Int. Ed._ 2011, _50_ , 10178–10181
  * Winter 2009 Winter, B. Liquid Microjet for Photoelectron Spectroscopy. _Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment_ 2009, _601_ , 139–150
  * Karashima et al. 2019 Karashima, S.; Yamamoto, Y.-i.; Suzuki, T. Ultrafast Internal Conversion and Solvation of Electrons in Water, Methanol, and Ethanol. _J. Phys. Chem. Lett._ 2019, _10_ , 4499–4504
  * Suzuki 2012 Suzuki, T. Time-Resolved Photoelectron Spectroscopy of Non-Adiabatic Electronic Dynamics in Gas and Liquid Phases. _Int. Rev. Phys. Chem._ 2012, _31_ , 265–318
  * Suzuki 2019 Suzuki, T. Ultrafast Photoelectron Spectroscopy of Aqueous Solutions. _J. Chem. Phys._ 2019, _151_ , 090901
  * Ryazanov and Nesbitt 2019 Ryazanov, M.; Nesbitt, D. J. Quantum-State-Resolved Studies of Aqueous Evaporation Dynamics: NO Ejection from a Liquid Water Microjet. _J. Chem. Phys._ 2019, _150_ , 044201
  * Faust et al. 2016 Faust, J. A.; Sobyra, T. B.; Nathanson, G. M. Gas–Microjet Reactive Scattering: Collisions of HCl and DCl with Cool Salty Water. _J. Phys. Chem. Lett._ 2016, _7_ , 730–735
  * Hahn et al. 2016 Hahn, C.; Kann, Z. R.; Faust, J. A.; Skinner, J. L.; Nathanson, G. M. Super-Maxwellian Helium Evaporation from Pure and Salty Water. _J. Chem. Phys._ 2016, _144_ , 044707
  * Lancaster et al. 2015 Lancaster, D. K.; Johnson, A. M.; Kappes, K.; Nathanson, G. M. Probing Gas–Liquid Interfacial Dynamics by Helium Evaporation from Hydrocarbon Liquids and Jet Fuels. _J. Phys. Chem. C_ 2015, _119_ , 14613–14623
  * Sobyra et al. 2017 Sobyra, T. B.; Melvin, M. P.; Nathanson, G. M. Liquid Microjet Measurements of the Entry of Organic Acids and Bases into Salty Water. _J. Phys. Chem. C_ 2017, _121_ , 20911–20924
  * Murdachaew et al. 2016 Murdachaew, G.; M. Nathanson, G.; Gerber, R. B.; Halonen, L. Deprotonation of Formic Acid in Collisions with a Liquid Water Surface Studied by Molecular Dynamics and Metadynamics Simulations. _Physical Chemistry Chemical Physics_ 2016, _18_ , 29756–29770
  * Faust and Nathanson 2016 Faust, J. A.; Nathanson, G. M. Microjets and Coated Wheels: Versatile Tools for Exploring Collisions and Reactions at Gas–Liquid Interfaces. _Chem. Soc. Rev._ 2016, _45_ , 3609–3620
  * Jordan et al. 2018 Jordan, I.; Jain, A.; Gaumnitz, T.; Ma, J.; Wörner, H. J. Photoelectron Spectrometer for Liquid and Gas-Phase Attosecond Spectroscopy with Field-Free and Magnetic Bottle Operation Modes. _Rev. Sci. Instrum._ 2018, _89_ , 053103
  * Yin et al. 2020 Yin, Z.; Luu, T. T.; Wörner, H. J. Few-Cycle High-Harmonic Generation in Liquids: In-Operando Thickness Measurement of Flat Microjets. _J. Phys. Photonics_ 2020, _2_ , 044007
  * Lancaster et al. 2013 Lancaster, D. K.; Johnson, A. M.; Burden, D. K.; Wiens, J. P.; Nathanson, G. M. Inert Gas Scattering from Liquid Hydrocarbon Microjets. _J. Phys. Chem. Lett._ 2013, _4_ , 3045–3049
  * Artiglia et al. 2017 Artiglia, L.; Edebeli, J.; Orlando, F.; Chen, S.; Lee, M.-T.; Corral Arroyo, P.; Gilgen, A.; Bartels-Rausch, T.; Kleibert, A.; Vazdar, M.; Andres Carignano, M.; Francisco, J. S.; Shepson, P. B.; Gladich, I.; Ammann, M. A Surface-Stabilized Ozonide Triggers Bromide Oxidation at the Aqueous Solution-Vapour Interface. _Nat Commun_ 2017, _8_ , 700
  * Thürmer et al. 2013 Thürmer, S.; Seidel, R.; Faubel, M.; Eberhardt, W.; Hemminger, J. C.; Bradforth, S. E.; Winter, B. Photoelectron Angular Distributions from Liquid Water: Effects of Electron Scattering. _Phys. Rev. Lett._ 2013, _111_ , 173005
  * Galinis et al. 2017 Galinis, G.; Strucka, J.; Barnard, J. C. T.; Braun, A.; Smith, R. A.; Marangos, J. P. Micrometer-Thickness Liquid Sheet Jets Flowing in Vacuum. _Rev. Sci. Instrum._ 2017, _88_ , 083117
  * Koralek et al. 2018 Koralek, J. D.; Kim, J. B.; Brůža, P.; Curry, C. B.; Chen, Z.; Bechtel, H. A.; Cordones, A. A.; Sperling, P.; Toleikis, S.; Kern, J. F.; Moeller, S. P.; Glenzer, S. H.; DePonte, D. P. Generation and Characterization of Ultrathin Free-Flowing Liquid Sheets. _Nat Commun_ 2018, _9_ , 1353
  * Ekimova et al. 2015 Ekimova, M.; Quevedo, W.; Faubel, M.; Wernet, P.; Nibbering, E. T. J. A Liquid Flatjet System for Solution Phase Soft-x-Ray Spectroscopy. _Struct. Dyn._ 2015, _2_ , 054301
  * Chen et al. 2013 Chen, X.; Ma, D.; Yang, V.; Popinet, S. High-Fidelity Simulations of Impinging Jet Atomization. _Atomiz Spr_ 2013, _23_ , 1079–1101
  * Atencia and Beebe 2005 Atencia, J.; Beebe, D. J. Controlled Microfluidic Interfaces. _Nature_ 2005, _437_ , 648–655
  * Ismagilov et al. 2000 Ismagilov, R. F.; Stroock, A. D.; Kenis, P. J. A.; Whitesides, G.; Stone, H. A. Experimental and Theoretical Scaling Laws for Transverse Diffusive Broadening in Two-Phase Laminar Flows in Microchannels. _Appl. Phys. Lett._ 2000, _76_ , 2376–2378
  * Song and Ismagilov 2003 Song, H.; Ismagilov, R. F. Millisecond Kinetics on a Microfluidic Chip Using Nanoliters of Reagents. _J. Am. Chem. Soc._ 2003, _125_ , 14613–14619
  * Rose and Waite 2001 Rose, A. L.; Waite, T. D. Chemiluminescence of Luminol in the Presence of Iron(II) and Oxygen: Oxidation Mechanism and Implications for Its Analytical Use. _Anal. Chem._ 2001, _73_ , 5909–5920
  * Matsumoto et al. 2013 Matsumoto, R.; Yoshida, K.; Matsuo, R. Diffusion in Microchannel Analyzed by Chemiluminescence. _JTST_ 2013, _8_ , 448–459
  * Merenyi et al. 1984 Merenyi, G.; Lind, J.; Eriksen, T. E. The Equilibrium Reaction of the Luminol Radical with Oxygen and the One-Electron-Reduction Potential of 5-Aminophthalazine-1,4-Dione. _J. Phys. Chem._ 1984, _88_ , 2320–2323
  * Merényi et al. 1990 Merényi, G.; Lind, J.; Eriksen, T. E. Luminol Chemiluminescence: Chemistry, Excitation, Emitter. _J. Biolumin. Chemilumin._ 1990, _5_ , 53–56
  * Merenyi et al. 1985 Merenyi, G.; Lind, J.; Eriksen, T. E. The Reactivity of Superoxide (O2-) and Its Abiulkity to Induce Chemiluminescence with Luminol. _Photochemistry and Photobiology_ 1985, _41_ , 203–208
  * Burdo and Seitz 1975 Burdo, T. G.; Seitz, W. R. Mechanism of Cobalt Catalysis of Luminol Chemiluminescence. _Anal. Chem._ 1975, _47_ , 1639–1643
  * Gaikwad et al. 1995 Gaikwad, A.; Silva, M.; Pérez-Bendito, D. Selective Stopped-Flow Determination of Manganese with Luminol in the Absence of Hydrogen Peroxide. _Analytica Chimica Acta_ 1995, _302_ , 275–282
  * Ojima 2002 Ojima, H. In _Advances in Catalytic Activation of Dioxygen by Metal Complexes_ ; Simándi, L. I., Ed.; Catalysis by Metal Complexes; Springer US, 2002
  * Menzi et al. 2020 Menzi, S.; Knopp, G.; Al Haddad, A.; Augustin, S.; Borca, C.; Gashi, D.; Huthwelker, T.; James, D.; Jin, J.; Pamfilidis, G.; Schnorr, K.; Sun, Z.; Wetter, R.; Zhang, Q.; Cirelli, C. Generation and Simple Characterization of Flat, Liquid Jets. _Rev. Sci. Instrum._ 2020, _91_ , 105109
  * O’Sullivan et al. 1995 O’Sullivan, D. W.; Hanson, A. K.; Kester, D. R. Stopped Flow Luminol Chemiluminescence Determination of Fe(II) and Reducible Iron in Seawater at Subnanomolar Levels. _Marine Chemistry_ 1995, _49_ , 65–77
  * Steinfeld et al. 1998 Steinfeld, J. I.; Francisco, J. S.; Hase, W. L. _Chemical Kinetics and Dynamics_ , 2nd ed.; Pearson: Upper Saddle River, N.J, 1998