<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>XAI.it</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Understanding Deep RL agent decisions: a novel interpretable approach with trainable prototypes</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Caterina Borzillo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alessio Ragno</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Roberto Capobianco</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sony AI</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer, Control and Management Engineering, Sapienza University of Rome</institution>
          ,
          <addr-line>Rome RM 00185</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>4</volume>
      <abstract>
        <p>Deep reinforcement learning (DRL) models have shown great promise in various applications, but their practical adoption in critical domains is limited due to their opaque decision-making processes. To address this challenge, explainable AI (XAI) techniques aim to enhance transparency and interpretability of black-box models. However, most current interpretable systems focus on supervised learning problems, leaving reinforcement learning relatively unexplored. This paper extends the work of PW-Net, an interpretable wrapper model for DRL agents inspired by image classification methodologies. We introduce Shared-PW-Net, an interpretable deep learning model that features a fully trainable prototype layer. Unlike PW-Net, Shared-PW-Net does not rely on pre-existing prototypes. Instead, it leverages the concept of ProtoPool to automatically learn general prototypes assigned to actions during training. Additionally, we propose a novel prototype initialization method that significantly improves the model's performance. Through extensive experimentation, we demonstrate that our Shared-PW-Net achieves the same reward performance as existing methods without requiring human intervention. Our model's fully trainable prototype layer, coupled with the innovative prototype initialization approach, contributes to a clearer and more interpretable decision-making process. The code for this work is publicly available for further exploration and applications.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;interpretable deep learning</kwd>
        <kwd>reinforcement learning</kwd>
        <kwd>explainable artificial intelligence</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Despite the successful and promising results of deep reinforcement learning (DRL) models over
the last few decades, their practical use in critical domains remains constrained due to their
unclear and enigmatic decision-making processes. To address this problem, explainable AI
(XAI) techniques aim to enhance the transparency and understandability of black-box models
[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Nevertheless, most of these recent interpretable systems address conventional supervised
learning problems, such as image classification [
        <xref ref-type="bibr" rid="ref2 ref3 ref4 ref5 ref6 ref7 ref8">2, 3, 4, 5, 6, 7, 8</xref>
        ], with a limited emphasis on
the reinforcement learning domain.
      </p>
      <p>
        Kenny et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] address the problem of building self-interpretable DRL agents by drawing
inspiration and insights from existing methodologies for image classification tasks. Indeed, they
develop an interpretable wrapper model for DRL agents, PW-Net. PW-Net aims to wrap and
encapsulate itself around any pre-trained RL agents, creating a comprehensive prototype-based
framework that sheds light on its decision-making process, making it transparent and clear.
      </p>
      <p>
        In this paper, we expand the work of Kenny et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] by introducing an interpretable deep
learning model called Shared-PW-Net. In particular, diferently from PW-Net, we develop a
fully trainable prototype layer, removing the dependence on pre-existing prototypes. To build
such architecture, we take inspiration from the work of Rymarczyk et al. [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], with ProtoPool,
giving the model the possibility of learning several general prototypes that are automatically
assigned to the actions during the training phase. Alongside this, we propose a novel method
for initializing the prototypes, which allows us to boost the model’s performance.
      </p>
      <p>Overall, the contributions of this work are the following1:
• we propose a fully trainable prototype layer that automatically learns prototypes without
human supervision, achieving PW-Net reward results;
• we apply the diferentiable prototype assignment mechanism to each class, previously
introduced in ProtoPool, in order to enhance prototype sharing and network eficiency;
• we propose a new prototype initialization based on the relevance of certain actions to
certain states.</p>
      <p>The remainder of this work is organized as follows: Section 2 presents the most related
literature to our work; in Section 3 we provide a general background about reinforcement
learning and prototype-based models’ architectures; Section 4 introduces our proposed approach
in detail; in Section 5 we carry out the experimental setup and the analysis of the obtained
results; Section 6 wraps up the results of this paper by analyzing its limitations and setting the
base for future work.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <p>
        XAI is a rapidly evolving field that aims to develop artificial intelligence systems that can provide
human-understandable explanations for their decisions and actions. One approach within XAI
is the development of self-interpretable models [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. These models are designed to inherently
possess transparency and interpretability, allowing humans to comprehend and validate their
decision-making processes. One popular self-interpretable architecture is the Prototypical-Part
Network (ProtoPNet) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]: a deep neural network that aims to solve the image classification
task in an interpretable way. The key aspect of ProtoPNet is that during training it learns a
set of prototypes for each label which are updated iteratively as the network learns to capture
the distinctive features characterizing each class. At the inference step, it utilizes the learned
prototypes to make predictions on new, unseen data: this is achieved by comparing the patches
inside the input images with the prototypes, allowing the model to determine which class each
patch belongs to.
      </p>
      <p>
        Inspired by ProtoPNet, Rymarczyk et al. [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] propose ProtoPool, an interpretable
prototypebased model for fine-grained image classification. Unlike other recent prototype-based
approaches, ProtoPool presents two main novelties: first, it implements a fully diferentiable
assignment of prototypes to classes that simplifies the training process and reduces the number
1The code of this work is fully available at the following link: https://github.com/KRLGroup/shared_pw_net
of prototypes used for classifying images; consequently, the prototypes can be shared among
classes, supporting the idea that many common visual features can occur in diferent classes.
As second novelty, ProtoPool introduces a new focal similarity function that allows to better
focus on salient visual features of an image, in contrast to other similarity metrics that focus on
wider image areas making the interpretation harder to comprehend.
      </p>
      <p>
        In the field of XRL, some works propose post-hoc methods involving attention weights
[
        <xref ref-type="bibr" rid="ref11 ref12">11, 12</xref>
        ] or trees [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], however, these approaches lack transparency in revealing the agent’s
actions. Another compelling method involves distilling recurrent neural network (RNN) policies
into finite-state machines [
        <xref ref-type="bibr" rid="ref14 ref15">14, 15</xref>
        ]. Nevertheless, this approach may not consistently yield easily
analyzable outcomes and it is limited to RNNs.
      </p>
      <p>
        In the context of this study, which combines RL and self-interpretable XAI models, highly
significant work in the field of RL is the research conducted by Kenny et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], which closely
aligns with the objectives of our study. The paper, published early in 2023, introduces the
Prototype-Wrapper Network (PW-Net) that, in contrast to the other studies, aims to build an
“interpretable-by-design” DRL agent. The architecture benefits from human supervision since
authors manually define both the prototypes (for network interpretability) and the last layer
weights (to regulate the relationship between the prototypes and the corresponding actions). In
PW-Net, in fact, the only trainable component is a set of projection networks, separately defined
for each action-specific prototype. Kenny et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] train PW-Net by means of distillation of a
black-box agent and show that it does not lose any performance relative to the black-box agent.
      </p>
      <p>
        Incorporating the concepts and methodologies proposed in the aforementioned works [
        <xref ref-type="bibr" rid="ref2 ref3 ref9">9, 3, 2</xref>
        ],
the primary objective of Shared-PW-Net is to address the main task pursued by PW-Net, which
takes advantage of the prototype mechanism to make an RL agent interpretable. At the same
time, the proposed model integrates significant ideas from ProtoPool and ProtoPNet, such as
the learning of the prototypes at training time and the concept of diferentiable assignment of
prototypes to classes with multiple slots per class. In addition to this, we introduce a novel
prototype initialization.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Background</title>
      <sec id="sec-3-1">
        <title>3.1. Reinforcement Learning</title>
        <p>Reinforcement Learning (RL) is a prominent subfield of machine learning that focuses on
teaching autonomous agents how to perceive and interpret their environment in order to
take actions. Unlike supervised learning, in fact, where labeled examples are provided, or
unsupervised learning, which seeks patterns in unlabeled data, RL focuses on the concept of
an agent which interacts with an environment, receives feedback in the form of rewards or
penalties, and learns to behave trying to maximize cumulative rewards.</p>
        <p>
          RL relies on the concept of Markov Decision Process (MDP), a stochastic decision-making
process that uses a mathematical framework to model the decision-making of a dynamic
system. In an MDP, defined by the (, ,  , ,  ) tuple [
          <xref ref-type="bibr" rid="ref16">16</xref>
          ], an agent takes actions  based
on its observations of the current state  . Once the agent selects an action, it interacts with
the environment by receiving rewards as feedback and by transitioning to a new state based
on the probabilistic transition  ∶  ×  →  . The agent’s objective is to learn an optimal
policy  ∶  ∈  →
        </p>
        <p>that maximizes the expected discounted reward and serves as a strategic
mapping from states to actions. By continuously exploring and exploiting the environment,
the agent aims to refine its understanding of the state-action relationships, seeking the most
advantageous course of action at any given state.</p>
        <p>In this study, we deal with the so-called “black-box policies”, pre-trained neural networks’
models that operate without providing clear and transparent explanations for their
decisionmaking process.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Prototype-based models</title>
        <sec id="sec-3-2-1">
          <title>3.2.1. ProtoPool</title>
          <p>
            equal to 1.
a specific patch of the image:
considering the distribution   :
ProtoPool [
            <xref ref-type="bibr" rid="ref3">3</xref>
            ] is an extension of ProtoPNet where the prototypes are assigned through a
differentiable mechanism and shared among classes. The ProtoPool architecture consists of a
convolutional network  , a prototype pool layer  , and a fully connected layer  . In  , Rymarczyk
et al. [
            <xref ref-type="bibr" rid="ref3">3</xref>
            ] introduce a pool of  trainable prototypes  = {  ∈   }=1 and  slots per class. Each
slot is represented by a distribution   ∈
          </p>
          <p>where the values in   indicate the probabilities of
assigning successive prototypes to the  -th slot, with the sum of these probabilities ‖  ‖ that is
Given an input image  ,  () is a set of  ×</p>
          <p>vectors of dimension  , each corresponding to
  = {  ∈  () ∶   ∈ ℝ  = 1, … ,  ⋅  }.</p>
          <p>Then, for each slot,  calculates the aggregated similarity   between   and all prototypes
where    is a novel focal similarity function:

=1
  = ∑</p>
          <p>⋅    ,
  () = log(1 +</p>
          <p>1
‖ − ‖ 2 ),
∈ 
  = max   () − mean∈    ().</p>
          <p>Finally, in ℎ the  similarity scores per class are multiplied by the weight matrix  ℎ to obtain
the output logits that then undergo a softmax transformation to produce the prediction:
 =̂ softmax ( ℎ ⋅   ).</p>
          <p>
            The soft prototypes’ assignment has two main constraints: first, they assign one prototype
per slot, and second, they assign successive slots of a class to diferent prototypes. The first
constraint is satisfied by the use of the diferentiable Gumbel-Softmax estimator [
            <xref ref-type="bibr" rid="ref17">17</xref>
            ] such that
for each slot  given   = ( 1, … ,   )and  ∈ (0, ∞):
          </p>
          <p>Gumbel-softmax (,  ) = ( 1, … ,   ) ∈   ,
(1)
(2)
(3)
(4)
(5)
(6)
where   =
distribution.
function  orth:
3.2.2. PW-Net
exp(   +  )</p>
          <p>∑=1 exp( 

 +  )</p>
          <p>representation  , :
 , and the prototype  , :
.</p>
          <p>Regarding the second constraint, the slots’ orthogonality is enforced by the orthogonal loss
 orth = ∑</p>
          <p>⟨  ,   ⟩
&lt; ‖  ‖2 ⋅ ‖  ‖2
.</p>
          <p>
            PW-Net [
            <xref ref-type="bibr" rid="ref9">9</xref>
            ] is an interpretable neural network that serves as a “wrapper” around any
pretrained RL agent. In particular, PW-Net uses a supervised approach for distilling an RL agent to
make it interpretable: a pre-trained RL agent with black-box policy  bb represents the desired
behavior that the prototype-based network aims to reproduce. From  bb() =   enc() +  , the
encoder  enc is taken and placed within the PW-Net architecture. In light of this, the network is
composed of the encoder  enc, a set of projection networks ℎ, (one for each action  ∈ [1,  ]
and
prototype  ∈ [1,  ]
          </p>
          <p>) and two human-defined layers, the prototype layer and the weight matrix
 ′. Initially, a state  is mapped to a latent representation  through the encoder network:
 =  enc().</p>
          <p>
            Then, for each action  and prototype  a separate linear layer ℎ, transforms z to a specific
and   for  ∈ 1, … , 
are samples drawn from the Gumbel
(7)
(8)
(9)
(10)
(11)
Successively, the similarity function from Chen et al. [
            <xref ref-type="bibr" rid="ref2">2</xref>
            ] is used to score the distance between
 , = ℎ, ()
          </p>
          <p>In the end, output actions are generated by combining the similarity scores with  ′:
 
=1
 ′ = ∑  ,′ sim( , ,  , ).</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Proposed Approach</title>
      <p>
        Inspired by the work of Kenny et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], we present Shared-PW-Net. This neural network can
transform pre-trained neural network-based algorithms for RL agents, which we refer to as
“black-box models”, into self-interpretable prototype-based ones. The main idea behind our
approach is to wrap the RL agent with a prototypical layer trained through the distillation of
the original one. In the following sections, we present the overall architecture of
Shared-PWNet, some detailed information about the novel prototype initialization, and the diferentiable
assignment of prototypes to actions.
      </p>
      <sec id="sec-4-1">
        <title>4.1.1. Architecture</title>
        <p>
          In Figure 1, we report a scheme of Shared-PW-Net in the Car Racing environment. The network
consists of a  enc stage, a projection network  , a prototype layer  , and a fully connected layer
 . As in Kenny et al. [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ],  enc represents the encoded pre-trained RL agent that our interpretable
network uses as desired behavior.  contains a pool of  trainable prototypes  = {  ∈   }=1
and  ∈ [1.. ] slots for each action  ∈ [1.. ] . The prototypes are initialized through our novel
initialization technique and are assigned to each action by employing the Rymarczyk et al. [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]
soft assignment technique. According to this strategy, only one prototype is assigned to each
slot and, within one action, successive slots are assigned to diferent prototypes.
        </p>
        <p>The network takes the RL agent’s current state  , already fed in  enc, and passes it through to
 , which projects it in the latent space:
(12)
(13)
(14)
 =  enc(),
 ′ = ()
sim( ′,  , ) = log (
( ′ −  , )2 + 1
( ′ −  , )2 + 
) .</p>
        <p>
          Successively, the network performs the similarity function from Chen et al. [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] between the
state  ′ and the prototype    associated with that slot  which belongs to a certain action  :
        </p>
        <p>After this, the similarity score is fed into  and then to the output activation function
corresponding to that particular action  in order to obtain the predicted action  ′.
 =  ⋅</p>
        <p>sim( ′,  , ),
 ′ =  (),
(15)
(16)
(17)
where  is the general activation function. In the specific case of the Car Racing domain (see
Section 5.1.1), for the steering action we use the Tanh activation function because we suppose
that the network, through the fully connected layer, learns that the value +1 is associated to
”Turn right” action and the value -1 is associated to ”Turn left” action. For braking and accelerate
actions, instead, we employ the ReLU activation function because we want a unique value for
expressing the intensity of the actions.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.1.2. Novel prototype initialization</title>
        <p>Apart from attempting the conventional initialization of prototypes with random numbers
drawn from a standard distribution, we also investigate a novel prototype initialization technique.
This novel approach involves a clustering operation on all states from which the pre-trained RL
agent executes a specific action. In detail, given the list of states  and actions  of the dataset  ,
for each action, we perform a clustering on the states where the black-box model performs that
action. In particular, we use the number of slots  as the number of clusters in order to have at
least  prototypes for each action. This procedure allows us to extract  ⋅  centroids of the
clusters. We select the first  centroids, and we use them as prototypes.</p>
        <p>In the specific case of the continuous action space for the Car Racing environment, at each step
 the agent performs the action   ∈  3 where each of the three components is the continuous
action:
⎨
⎩braking
⎧steering ∈ [−1, +1]
accelerate ∈ [0, maxAcc)</p>
        <p>∈ [0, maxBrake)</p>
        <p>This indicates that the agent, for example, can steer to the right and brake simultaneously.
For this reason, for the prototype initialization, we simply find the mean value  of each action
performed by the RL agent in  . Then, for each action, we collect the set of states where that
action is executed with an absolute value that is greater than  . In the end, we use the K-means
clustering to identify the centroids and we use them as prototypes.</p>
      </sec>
      <sec id="sec-4-3">
        <title>4.1.3. Assignment of prototypes to actions</title>
        <p>
          As already proposed and studied by Rymarczyk et al. [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ], we adopt a soft assignment method
for prototypes based on prototype distributions to enhance the interpretability of the model and
to utilize the prototypes from the pool eficiently. Unlike traditional hard assignments, this soft
assignment uses a diferentiable argmax function, specifically the Gumbel-Softmax estimator
[
          <xref ref-type="bibr" rid="ref17">17</xref>
          ], to assign exactly one prototype per slot for each action.
        </p>
        <p>Equation 6 shows the computations performed to ensure diferentiability for each slot. At
training time, we initialize the Gumbel-Softmax distribution with  = 1 and gradually reduce it
to 0.001 over 30 epochs. Moreover, we extend the loss function to enforce orthogonality between
prototypes assigned to the same action. This orthogonality constraint (previously shown in
Equation 7) prevents multiple slots from being assigned to the same prototype, maximizing the
potential of the prototype pool layer.</p>
      </sec>
      <sec id="sec-4-4">
        <title>4.1.4. Prototype projection</title>
        <p>Prototype projection is an essential stage in the training process, as it aids in visualizing the
learned prototypes and helps in better understanding the features they represent. In this
step, abstract prototypes, which the model learns during training, are replaced with the actual
representations of the nearest training data. By using the representations of actual training
data, the model’s prototypes become more interpretable, allowing one to gain insights into the
learned features and their relevance to the task. We perform prototype projection every two
epochs, only after the first 10 epochs.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Experiments</title>
      <p>In this study, we investigate how Shared-PW-Net performs compared to its counterpart, PW-Net,
and the black-box agents in diferent DRL settings. We conduct tests in two diferent types of
environments: first, we assess Shared-PW-Net performance in a DRL domain with multiple
continuous output actions, and then, we conduct tests in a diferent domain with discrete
output actions. These two experiments use a state space solely represented by raw pixel data;
however, PW-Net could also be applied to other state-action representations, such as tabular
environments. Finally, we study the influence of the proposed initialization procedure and the
role of the number of prototypes and slots of the model.</p>
      <sec id="sec-5-1">
        <title>5.1. Experimental Setup</title>
        <p>
          In this section we present the setup we use to carry out the experiments. In particular, we
evaluate each model on 30 episodes for 15 seeds. We compare our proposed method with
PW-Net [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] and the black-box we use for the distillation procedure. As PW-Net, diferently from
Shared-PW-Net, uses fixed prototypes, for a fair comparison, we also compare the following two
variations of PW-Net: PW-Net* employs a single projection network for state projection instead
of  projection networks, it includes both prototypes and the final weight matrix trainable
(hence, not human-defined) and it performs the prototype projection only at the end of the
training phase; PW-Net**, on the other hand, shares the same structural characteristics of
PW-Net*, except that it undergoes the same prototype projection scheme of Shared-PW-Net.
        </p>
        <sec id="sec-5-1-1">
          <title>5.1.1. Continuous action space</title>
          <p>
            We test our model in Car Racing continuous action domain from OpenAI’s gym environment
[
            <xref ref-type="bibr" rid="ref18">18</xref>
            ]. For a fair comparison, we use the same environment settings from Kenny et al. [
            <xref ref-type="bibr" rid="ref9">9</xref>
            ]. In the
Car Racing environment, the agent is rewarded for driving around the path as fast as possible
while avoiding any deviations from the road and having as possible actions the following three
continuous output actions: steering, accelerate, and braking. The pre-trained model used as
black-box in this domain is the one by Jain [
            <xref ref-type="bibr" rid="ref19">19</xref>
            ], which is trained with the Proximal Policy
Optimization (PPO) algorithm. In the first place, to determine the best hyperparameters for our
network that produce the most desirable results, we perform a grid search over the number of
prototypes P or the number of slots S.
          </p>
        </sec>
        <sec id="sec-5-1-2">
          <title>5.1.2. Discrete action space</title>
          <p>
            For the discrete action domain, we use Atari Pong (from OpenAI’s gym environment). In this
environment, the agent has to control a paddle and try to hit a ball back and forth, with the
goal of preventing the ball from going past its paddle. The agent is rewarded for successfully
scoring against the opponent, while it incurs penalties for being scored against. The agent’s
discrete actions are 6, each allowing the agent to move up or down. We use the pre-trained
model from Şentürk [
            <xref ref-type="bibr" rid="ref20">20</xref>
            ], trained with the DQN algorithm. As Şentürk [
            <xref ref-type="bibr" rid="ref20">20</xref>
            ] employ a technique
called “frame stacking” that involves taking multiple consecutive frames from the game as input
to the neural network, we use four state representations for describing each prototype.
          </p>
        </sec>
      </sec>
      <sec id="sec-5-2">
        <title>5.2. Agents performances</title>
        <p>Table 1 illustrates the results achieved for the Car Racing and Atari Pong environments. We
report the mean and standard deviation values over the diferent seeds for statistical significance.
In the following paragraphs, we comment on the results obtained on the two environments.</p>
        <sec id="sec-5-2-1">
          <title>5.2.1. Car Racing</title>
          <p>Concerning the Car Racing environment, we evaluate the performance of each model using the
average reward of the RL agent and the mean squared error (MSE) between the interpretable
model’s actions and the black-box’ ones. In Table 1 we observe that Shared-PW-Net succeeds in
reaching the same reward levels of PW-Net (and the black-box agent) even if it is less accurate.
In light of this, Shared-PW-Net represents a valid alternative and a workable solution for setting
up a self-interpretable model that does not rely on human intervention. The two straightforward
modifications of PW-Net with trainable prototypes, PW-Net* and PW-Net**, on the other hand,
do not achieve remarkable results. This leads to demonstrating that the application of soft
assignment of prototypes to classes and the utilization of the new prototype initialization
(adopted in Shared-PW-Net) are fundamental for achieving significant results.</p>
        </sec>
        <sec id="sec-5-2-2">
          <title>5.2.2. Atari Pong</title>
          <p>In this domain, we use the reward of the RL agent and the accuracy of the model with respect to
the black-box to evaluate the agent’s performance in the environment. Also in the Atari Pong
environment, the Shared-PW-Net outperforms PW-Net* and PW-Net** and successfully attains
the same rewards values of PW-Net and the black-box model (Table 1).</p>
        </sec>
      </sec>
      <sec id="sec-5-3">
        <title>5.3. Prototypes influence</title>
        <p>To study the efect of the prototype number and initialization, we test various hyperparameter
combinations and report the result in reward and distillation performances (Table 2).</p>
        <sec id="sec-5-3-1">
          <title>5.3.1. Car Racing</title>
          <p>For Car Racing, we test the following combinations: (i) 4 prototypes and two slots; (ii) 6
prototypes and two slots; (iii) 6 prototypes and three slots; (iv) 8 prototypes and three slots. We
ifnd the model (ii) to be the best performing. The choice in the number of prototypes and slots
is guided by the number of classes (actions) within the Car Racing environment. Moreover, for
each model, we test both the random initialization and the one proposed in Section 4.1.2. We
see that all the models trained with the novel prototype initialization perform better than the
randomly initialized ones. Moreover, while we find consistent diferences in performances for
the randomly initialized models, all the models using the novel initialization reach comparable
performances.</p>
        </sec>
        <sec id="sec-5-3-2">
          <title>5.3.2. Atari Pong</title>
          <p>The model exhibits consistently high performance in Atari Pong across diferent hyperparameter
variations, notably concerning the number of prototypes and slots. While the novel initialization
technique shows success in some instances, it is the Shared-PW-Net configuration, featuring
eight prototypes and two slots per action, that attains the highest reward value. In this particular
setup, the novel initialization proves to be the key factor in achieving the best model performance.</p>
        </sec>
      </sec>
      <sec id="sec-5-4">
        <title>5.4. Model Interpretability</title>
        <p>In this section, we show how to obtain insights on the reasoning process of
Shared-PWNet. In particular, in Figure 2, we report an illustration of the prototype assignment matrix
learned by the model with 6 prototypes and 3 slots per action. We see that for the Steering
action, the Shared-PW-Net successfully learns to diferentiate between right ( 4 , 5 ) and left
(6 ) directions. Moreover, the model associates prototypes 3 , 1 , 6 to the Accelerate action,
identifying with a straightforward road (or a road without pronounced curves) those situations
in which acceleration is possible. The same logical reasoning can be observed for the third
class, the Braking action, to which the model associates prototypes 4 , 2 , 5 , revealing that
the time to decelerate is when the car is approaching a curve. Such observations contribute to a
more comprehensive understanding of the model’s decision-making process. Examining the
prototypes and their assignment gives us valuable insights into how the model perceives diferent
actions and scenarios within the car racing environment. This analysis of the Shared-PW-Net’s
interpretability sheds light on its strengths and limitations, providing crucial information to
enhance the model’s performance and adaptability in varying real-world scenarios.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusions</title>
      <p>This paper introduces a novel prototype-based neural network that builds upon the
foundational work of PW-Net. Our proposed model is an interpretable wrapper for any pre-trained
reinforcement learning agent, enabling a deeper understanding of its decision-making
process. By leveraging prototypes assigned to actions, our network achieves comparable reward
performances with respect to the state-of-the-art in two environments, without the need for
human intervention. Indeed, the use of trainable prototypes eliminates the need for
humandefined prototypes, enhancing the model’s autonomy and adaptability. Although this study
demonstrates the eficacy of behavior cloning on a pre-trained RL agent, showcasing promising
results in various scenarios, it is essential to acknowledge the inherent limitation of relying
on a pre-existing agent for this approach. While leveraging a pre-trained agent ofers certain
advantages, such as reduced training time and access to valuable learned knowledge, it can also
introduce constraints that limit the full exploration of the model’s capabilities. With respect to
the introduction of the novel prototype initialization method, it has shown its efectiveness as
the results indicate an improvement in the reward values when it is utilized, compared to the
cases where a simple random prototypes initialization is employed.</p>
      <p>As a natural progression of this research, a future direction could be to avoid using
behavior cloning or distillation as the training method for our prototype-based neural network in
order to allow the model to learn from data directly, potentially reducing the introduction of
biased behaviors and increasingly improving performance from an interpretable perspective.
Furthermore, the exploration of additional environments (which is ongoing) could provide an
additional validation to this work.</p>
      <p>Overall, our contribution expands the frontiers of interpretable reinforcement learning by
presenting a powerful and versatile framework that enhances the interpretability of pre-trained
RL agents. By empowering researchers and practitioners to gain deeper insights into agent
behavior, our prototype-based neural network opens new avenues for improving the transparency
and trustworthiness of RL applications. Furthermore, this framework could hold significant
promise in real-world applications such as autonomous driving because it could help passengers
trust the vehicle’s decision-making processes by providing clear explanations for the car’s
driving choices and by enhancing safety and accountability in autonomous driving systems. We
believe our work provides a strong foundation for interpretable DRL in real-world applications,
where ethics, as seen in contexts like autonomous driving, plays a crucial role in responsible
decision-making and trustworthiness.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>W.</given-names>
            <surname>Saeed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Omlin</surname>
          </string-name>
          ,
          <article-title>Explainable ai (xai): A systematic meta-survey of current challenges and future opportunities</article-title>
          ,
          <source>Knowledge-Based Systems</source>
          <volume>263</volume>
          (
          <year>2023</year>
          )
          <article-title>110273</article-title>
          . URL: https:// www.sciencedirect.com/science/article/pii/S0950705123000230. doi:https://doi.org/10. 1016/j.knosys.
          <year>2023</year>
          .
          <volume>110273</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>C.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Tao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. J.</given-names>
            <surname>Barnett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Su</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Rudin</surname>
          </string-name>
          , This Looks like That:
          <article-title>Deep Learning for Interpretable Image Recognition, Curran Associates Inc</article-title>
          .,
          <string-name>
            <surname>Red</surname>
            <given-names>Hook</given-names>
          </string-name>
          ,
          <string-name>
            <surname>NY</surname>
          </string-name>
          , USA,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Rymarczyk</surname>
          </string-name>
          , Ł. Struski,
          <string-name>
            <given-names>M.</given-names>
            <surname>Górszczak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Lewandowska</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Tabor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Zieliński</surname>
          </string-name>
          ,
          <article-title>Interpretable image classification with diferentiable prototypes assignment</article-title>
          , in: S. Avidan, G. Brostow,
          <string-name>
            <given-names>M.</given-names>
            <surname>Cissé</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. M.</given-names>
            <surname>Farinella</surname>
          </string-name>
          , T. Hassner (Eds.),
          <source>Computer Vision - ECCV 2022</source>
          , Springer Nature Switzerland, Cham,
          <year>2022</year>
          , pp.
          <fpage>351</fpage>
          -
          <lpage>368</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Tucker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. A.</given-names>
            <surname>Shah</surname>
          </string-name>
          ,
          <article-title>Prototype based classification from hierarchy to fairness</article-title>
          , in: K. Chaudhuri,
          <string-name>
            <given-names>S.</given-names>
            <surname>Jegelka</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Song</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Szepesvari</surname>
          </string-name>
          , G. Niu, S. Sabato (Eds.),
          <source>Proceedings of the 39th International Conference on Machine Learning</source>
          , volume
          <volume>162</volume>
          <source>of Proceedings of Machine Learning Research, PMLR</source>
          ,
          <year>2022</year>
          , pp.
          <fpage>21884</fpage>
          -
          <lpage>21900</lpage>
          . URL: https://proceedings.mlr.press/v162/ tucker22a.html.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S. O.</given-names>
            <surname>Davoudi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Komeili</surname>
          </string-name>
          ,
          <article-title>Toward faithful case-based reasoning through learning prototypes in a nearest neighbor-friendly space</article-title>
          .,
          <source>in: International Conference on Learning Representations</source>
          ,
          <year>2022</year>
          . URL: https://openreview.net/forum?id=
          <fpage>R79ZGjHhv6p</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>J.</given-names>
            <surname>Donnelly</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. J.</given-names>
            <surname>Barnett</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <article-title>Deformable protopnet: An interpretable image classifier using deformable prototypes</article-title>
          ,
          <source>in: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)</source>
          ,
          <year>2022</year>
          , pp.
          <fpage>10265</fpage>
          -
          <lpage>10275</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>B.</given-names>
            <surname>La Rosa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Capobianco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Nardi</surname>
          </string-name>
          ,
          <article-title>A self-interpretable module for deep image classification on small data</article-title>
          ,
          <source>Applied Intelligence</source>
          (
          <year>2022</year>
          ).
          <source>doi:10.1007/s10489- 022- 03886- 6.</source>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>O.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Rudin</surname>
          </string-name>
          ,
          <article-title>Deep learning for case-based reasoning through prototypes: A neural network that explains its predictions</article-title>
          ,
          <source>in: Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence and Thirtieth Innovative Applications of Artificial Intelligence Conference and Eighth AAAI Symposium on Educational Advances in Artificial Intelligence</source>
          , AAAI'18/IAAI'18/EAAI'18, AAAI Press,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>E. M.</given-names>
            <surname>Kenny</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Tucker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Shah</surname>
          </string-name>
          ,
          <article-title>Towards interpretable deep reinforcement learning with human-friendly prototypes</article-title>
          ,
          <source>in: The Eleventh International Conference on Learning Representations</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>G.</given-names>
            <surname>Schwalbe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Finzel</surname>
          </string-name>
          ,
          <article-title>A comprehensive taxonomy for explainable artificial intelligence: a systematic survey of surveys on methods and concepts</article-title>
          ,
          <source>Data Mining and Knowledge Discovery</source>
          (
          <year>2023</year>
          ). URL: https://doi.org/10.1007/s10618-022-00867-8. doi:
          <volume>10</volume>
          .1007/ s10618- 022- 00867- 8.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>V. F.</given-names>
            <surname>Zambaldi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Raposo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Santoro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Bapst</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            <surname>Babuschkin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Tuyls</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. P.</given-names>
            <surname>Reichert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T. P.</given-names>
            <surname>Lillicrap</surname>
          </string-name>
          , E. Lockhart,
          <string-name>
            <given-names>M.</given-names>
            <surname>Shanahan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Langston</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Pascanu</surname>
          </string-name>
          ,
          <string-name>
            <surname>M. M. Botvinick</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          <string-name>
            <surname>Vinyals</surname>
            ,
            <given-names>P. W.</given-names>
          </string-name>
          <string-name>
            <surname>Battaglia</surname>
          </string-name>
          ,
          <article-title>Deep reinforcement learning with relational inductive biases</article-title>
          ,
          <source>in: 7th International Conference on Learning Representations, ICLR</source>
          <year>2019</year>
          ,
          <article-title>New Orleans</article-title>
          , LA, USA, May 6-
          <issue>9</issue>
          ,
          <year>2019</year>
          , OpenReview.net,
          <year>2019</year>
          . URL: https://openreview.net/forum?id=
          <fpage>HkxaFoC9KQ</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>A.</given-names>
            <surname>Mott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Zoran</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Chrzanowski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Wierstra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. J.</given-names>
            <surname>Rezende</surname>
          </string-name>
          ,
          <article-title>Towards Interpretable Reinforcement Learning Using Attention Augmented Agents</article-title>
          , Curran Associates Inc.,
          <string-name>
            <surname>Red</surname>
            <given-names>Hook</given-names>
          </string-name>
          ,
          <string-name>
            <surname>NY</surname>
          </string-name>
          , USA,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>G.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Schulte</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Zhu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Q.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Toward Interpretable Deep Reinforcement Learning with Linear Model U-Trees: European Conference</article-title>
          ,
          <source>ECML PKDD</source>
          <year>2018</year>
          , Dublin, Ireland,
          <source>September 10-14</source>
          ,
          <year>2018</year>
          , Proceedings,
          <string-name>
            <surname>Part</surname>
            <given-names>II</given-names>
          </string-name>
          ,
          <year>2019</year>
          , pp.
          <fpage>414</fpage>
          -
          <lpage>429</lpage>
          . doi:
          <volume>10</volume>
          .1007/ 978- 3-
          <fpage>030</fpage>
          - 10928- 8_
          <fpage>25</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>M. H.</given-names>
            <surname>Danesh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Koul</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Fern</surname>
          </string-name>
          , S. Khorram,
          <article-title>Re-understanding finite-state representations of recurrent policy networks</article-title>
          , in: M.
          <string-name>
            <surname>Meila</surname>
          </string-name>
          , T. Zhang (Eds.),
          <source>Proceedings of the 38th International Conference on Machine Learning</source>
          , volume
          <volume>139</volume>
          <source>of Proceedings of Machine Learning Research, PMLR</source>
          ,
          <year>2021</year>
          , pp.
          <fpage>2388</fpage>
          -
          <lpage>2397</lpage>
          . URL: https://proceedings.mlr.press/v139/ danesh21a.html.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>A.</given-names>
            <surname>Koul</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Greydanus</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Fern</surname>
          </string-name>
          ,
          <article-title>Learning finite state representations of recurrent policy networks</article-title>
          ,
          <year>2018</year>
          . arXiv:
          <year>1811</year>
          .12530.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>R. S.</given-names>
            <surname>Sutton</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. G.</given-names>
            <surname>Barto</surname>
          </string-name>
          , Reinforcement Learning: An Introduction, second ed., The MIT Press,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>E.</given-names>
            <surname>Jang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Poole</surname>
          </string-name>
          ,
          <article-title>Categorical reparameterization with gumbel-softmax</article-title>
          ,
          <source>in: International Conference on Learning Representations</source>
          ,
          <year>2017</year>
          . URL: https://openreview.net/forum? id=rkE3y85ee.
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>G.</given-names>
            <surname>Brockman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Cheung</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Pettersson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Schneider</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Schulman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Tang</surname>
          </string-name>
          , W. Zaremba, Openai gym,
          <source>arXiv preprint arXiv:1606.01540</source>
          (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>J.</given-names>
            <surname>Jain</surname>
          </string-name>
          , Jinayjain/deep-racing:
          <article-title>Self-driving racecar using reinforcement learning (proximal policy optimization) in pytorch</article-title>
          , https://github.com/JinayJain/deep-racing,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>B.</given-names>
            <surname>Şentürk</surname>
          </string-name>
          , https://github.com/bhctsntrk/openaipong-dqn, https://github.com/bhctsntrk/ OpenAIPong-DQN,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>