<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" 'JATS-journalpublishing1-3-mathml3.dtd'>
<article article-type="research-article" dtd-version="1.3" xml:lang="EN" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ali="http://www.niso.org/schemas/ali/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">Front. Robot. AI</journal-id>
<journal-title-group>
<journal-title>Frontiers in Robotics and AI</journal-title>
<abbrev-journal-title abbrev-type="pubmed">Front. Robot. AI</abbrev-journal-title>
</journal-title-group>
<issn pub-type="epub">2296-9144</issn>
<publisher>
<publisher-name>Frontiers Media S.A.</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="publisher-id">1637574</article-id>
<article-id pub-id-type="doi">10.3389/frobt.2025.1637574</article-id>
<article-version article-version-type="Version of Record" vocab="NISO-RP-8-2008"/>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Original Research</subject>
</subj-group>
</article-categories>
<title-group>
<article-title>Personalized causal explanations of a robot&#x2019;s behavior</article-title>
<alt-title alt-title-type="left-running-head">Galeas et al.</alt-title>
<alt-title alt-title-type="right-running-head">
<ext-link ext-link-type="uri" xlink:href="https://doi.org/10.3389/frobt.2025.1637574">10.3389/frobt.2025.1637574</ext-link>
</alt-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<name>
<surname>Galeas</surname>
<given-names>Jos&#xe9;</given-names>
</name>
<xref ref-type="aff" rid="aff1">
<sup>1</sup>
</xref>
<uri xlink:href="https://loop.frontiersin.org/people/2921214"/>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Software" vocab-term-identifier="https://credit.niso.org/contributor-roles/software/">Software</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Investigation" vocab-term-identifier="https://credit.niso.org/contributor-roles/investigation/">Investigation</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Writing &#x2013; original draft" vocab-term-identifier="https://credit.niso.org/contributor-roles/writing-original-draft/">Writing &#x2013; original draft</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Visualization" vocab-term-identifier="https://credit.niso.org/contributor-roles/visualization/">Visualization</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Conceptualization" vocab-term-identifier="https://credit.niso.org/contributor-roles/conceptualization/">Conceptualization</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Methodology" vocab-term-identifier="https://credit.niso.org/contributor-roles/methodology/">Methodology</role>
</contrib>
<contrib contrib-type="author" corresp="yes">
<name>
<surname>Bensch</surname>
<given-names>Suna</given-names>
</name>
<xref ref-type="aff" rid="aff2">
<sup>2</sup>
</xref>
<xref ref-type="corresp" rid="c001">&#x2a;</xref>
<uri xlink:href="https://loop.frontiersin.org/people/1347286"/>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Resources" vocab-term-identifier="https://credit.niso.org/contributor-roles/resources/">Resources</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Conceptualization" vocab-term-identifier="https://credit.niso.org/contributor-roles/conceptualization/">Conceptualization</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Validation" vocab-term-identifier="https://credit.niso.org/contributor-roles/validation/">Validation</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Supervision" vocab-term-identifier="https://credit.niso.org/contributor-roles/supervision/">Supervision</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Formal analysis" vocab-term-identifier="https://credit.niso.org/contributor-roles/formal-analysis/">Formal Analysis</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Methodology" vocab-term-identifier="https://credit.niso.org/contributor-roles/methodology/">Methodology</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Writing &#x2013; review &#x26; editing" vocab-term-identifier="https://credit.niso.org/contributor-roles/Writing - review &#x26; editing/">Writing &#x2013; review and editing</role>
</contrib>
<contrib contrib-type="author">
<name>
<surname>Hellstr&#xf6;m</surname>
<given-names>Thomas</given-names>
</name>
<xref ref-type="aff" rid="aff2">
<sup>2</sup>
</xref>
<uri xlink:href="https://loop.frontiersin.org/people/1118842"/>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Formal analysis" vocab-term-identifier="https://credit.niso.org/contributor-roles/formal-analysis/">Formal Analysis</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Resources" vocab-term-identifier="https://credit.niso.org/contributor-roles/resources/">Resources</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Methodology" vocab-term-identifier="https://credit.niso.org/contributor-roles/methodology/">Methodology</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Supervision" vocab-term-identifier="https://credit.niso.org/contributor-roles/supervision/">Supervision</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Conceptualization" vocab-term-identifier="https://credit.niso.org/contributor-roles/conceptualization/">Conceptualization</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Validation" vocab-term-identifier="https://credit.niso.org/contributor-roles/validation/">Validation</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Writing &#x2013; review &#x26; editing" vocab-term-identifier="https://credit.niso.org/contributor-roles/Writing - review &#x26; editing/">Writing &#x2013; review and editing</role>
</contrib>
<contrib contrib-type="author">
<name>
<surname>Bandera</surname>
<given-names>Antonio</given-names>
</name>
<xref ref-type="aff" rid="aff1">
<sup>1</sup>
</xref>
<uri xlink:href="https://loop.frontiersin.org/people/173300"/>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Resources" vocab-term-identifier="https://credit.niso.org/contributor-roles/resources/">Resources</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Validation" vocab-term-identifier="https://credit.niso.org/contributor-roles/validation/">Validation</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Writing &#x2013; review &#x26; editing" vocab-term-identifier="https://credit.niso.org/contributor-roles/Writing - review &#x26; editing/">Writing &#x2013; review and editing</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Supervision" vocab-term-identifier="https://credit.niso.org/contributor-roles/supervision/">Supervision</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Formal analysis" vocab-term-identifier="https://credit.niso.org/contributor-roles/formal-analysis/">Formal Analysis</role>
<role vocab="credit" vocab-identifier="https://credit.niso.org/" vocab-term="Conceptualization" vocab-term-identifier="https://credit.niso.org/contributor-roles/conceptualization/">Conceptualization</role>
</contrib>
</contrib-group>
<aff id="aff1">
<label>1</label>
<institution>Department Tecnolog&#xed;a Electr&#xf3;nica, University of M&#xe1;laga</institution>, <city>M&#xe1;laga</city>, <country country="ES">Spain</country>
</aff>
<aff id="aff2">
<label>2</label>
<institution>Department Computing Science, University of Ume&#xe5;</institution>, <city>Ume&#xe5;</city>, <country country="SE">Sweden</country>
</aff>
<author-notes>
<corresp id="c001">
<label>&#x2a;</label>Correspondence: Suna Bensch, <email xlink:href="mailto:suna@cs.umu.se">suna@cs.umu.se</email>
</corresp>
</author-notes>
<pub-date publication-format="electronic" date-type="pub" iso-8601-date="2025-10-08">
<day>08</day>
<month>10</month>
<year>2025</year>
</pub-date>
<pub-date publication-format="electronic" date-type="collection">
<year>2025</year>
</pub-date>
<volume>12</volume>
<elocation-id>1637574</elocation-id>
<history>
<date date-type="received">
<day>29</day>
<month>05</month>
<year>2025</year>
</date>
<date date-type="accepted">
<day>01</day>
<month>09</month>
<year>2025</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#xa9; 2025 Galeas, Bensch, Hellstr&#xf6;m and Bandera.</copyright-statement>
<copyright-year>2025</copyright-year>
<copyright-holder>Galeas, Bensch, Hellstr&#xf6;m and Bandera</copyright-holder>
<license>
<ali:license_ref start_date="2025-10-08">https://creativecommons.org/licenses/by/4.0/</ali:license_ref>
<license-p>This is an open-access article distributed under the terms of the <ext-link ext-link-type="uri" xlink:href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution License (CC BY)</ext-link>. The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.</license-p>
</license>
</permissions>
<abstract>
<p>The deployment of robots in environments shared with humans implies that they must be able to justify or explain their behavior to nonexpert users when the user, or the situation itself, requires it. We propose a framework for robots to generate personalized explanations of their behavior by integrating cause-and-effect structures, social roles, and natural language queries. Robot events are stored as cause&#x2013;effect pairs in a causal log. Given a human natural language query, the system uses machine learning to identify the matching cause-and-effect entry in the causal log and determine the social role of the inquirer. An initial explanation is generated and is then further refined by a large language model (LLM) to produce linguistically diverse responses tailored to the social role and the query. This approach maintains causal and factual accuracy while providing language variation in the generated explanations. Qualitative and quantitative experiments show that combining the causal information with the social role and the query when generating the explanations yields the most appreciated explanations.</p>
</abstract>
<kwd-group>
<kwd>explainable robots</kwd>
<kwd>understandable robots</kwd>
<kwd>personalized explanations</kwd>
<kwd>speaker role recognition</kwd>
<kwd>human&#x2013;robot interaction</kwd>
<kwd>causal explanations</kwd>
</kwd-group>
<funding-group>
<funding-statement>The author(s) declare that financial support was received for the research and/or publication of this article. This work has been supported by grants PDC2022-133597-C4X, TED2021-131739B-C2X, and PID2022-137344OB-C3X, funded by MCIN/AEI/10.13039/501100011033 and by the European Union NextGenerationEU/PRTR (for the first two grants), and &#x201c;ERDF A way of making Europe&#x201d; (for the third grant). This research was partly funded by the Swedish Research Council Vetenskapsr&#xe5;det through grant number 2022-04674.</funding-statement>
</funding-group>
<counts>
<fig-count count="1"/>
<table-count count="17"/>
<equation-count count="1"/>
<ref-count count="29"/>
<page-count count="16"/>
</counts>
<custom-meta-group>
<custom-meta>
<meta-name>section-in-acceptance</meta-name>
<meta-value>Human-Robot Interaction</meta-value>
</custom-meta>
</custom-meta-group>
</article-meta>
</front>
<body>
<sec id="s1">
<label>1</label>
<title>Introduction</title>
<p>Making robots understandable is generally acknowledged as important for improving safety, user experience, trust, and efficiency (<xref ref-type="bibr" rid="B12">Hellstr&#xf6;m and Bensch, 2018</xref>). Understandable robots may, for example, verbally explain their actions and decisions as a response to questions asked by interacting humans. Such explainability is especially important in sensitive settings, such as eldercare or medical assistance, where lack of information or clarity could result in physical or psychological harm.</p>
<p>Explainability and causality are closely intertwined concepts (<xref ref-type="bibr" rid="B24">Setchi et al., 2020</xref>). Lewis, in his seminal work, described explaining an event as &#x201c;providing information about its causal history&#x201d; (<xref ref-type="bibr" rid="B15">Lewis, 1986</xref>). Earlier related work (<xref ref-type="bibr" rid="B16">Lindner and Olz, 2022</xref>; <xref ref-type="bibr" rid="B4">Chakraborti et al., 2017</xref>) often shares this focus on actions, effects, and their technical causes, that is, on <italic>what</italic> to explain.</p>
<p>However, an explanation solely based on cause and effect reasoning might not be sufficient if the robot interacts with humans with diverse backgrounds. For example, in an eldercare home, humans interacting with an assistive robot may be residents, medical staff, family members, or technicians. We build on several observations.</p>
<p>First, not all inquirers have the same wishes and needs for information. For example, a family member and a nurse asking &#x201c;Why did Maria choose to eat meat today?&#x201d; may want different aspects included in an explanation. The <italic>social role</italic> of the user also influences which words and expressions are appropriate to use. Second, the tone and wordings of a query may express an intentional or latent wish to have certain aspects addressed in the causal explanation. For example, a family member asking &#x201c;Why did my father Alberto have meat today?&#x201d; or &#x201c;Why did my father Alberto have meat today again?&#x201d; may reflect a wish for different aspects to be included in the explanation. To address the two observations above, we take the social role of the person asking the question and the question itself into account when generating explanations, thereby addressing the additional focus on <italic>how</italic> to explain.</p>
<p>In this paper, we present a framework for robots to generate personalized explanations for events when a human requests an explanation. Our approach maintains factual and causal correctness, which are crucial for any robotic application, while leveraging a large language model (LLM) to personalize and diversify the language of the explanations. Providing linguistic variation of the explanations is important for humans who interact with the robot on a regular basis to avoid monotony and reduced engagement.</p>
<p>More specifically, robot events (e.g., actions and tasks) are stored in a causal log where they are structured into cause and effect pairs. Given a human query <inline-formula id="inf1">
<mml:math id="m1">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, we use machine learning to extract the robot event <inline-formula id="inf2">
<mml:math id="m2">
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> for which an explanation is requested and to identify the likely social role <inline-formula id="inf3">
<mml:math id="m3">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> of the human asking. For the identified robot event, the corresponding cause and effect in the causal log are processed to provide an initial explanation. This initial explanation is then refined by an LLM (Llama) to produce linguistically varied explanations that are tailored to the social role and the actual query. The initial explanation that is based on the data from the causal log maintains factual correctness, whereas the LLM adds language variation.</p>
<p>To evaluate our approach, three quantitative and qualitative experiments were performed. Experiment I investigated the effects of including combinations of cause and effect, social role, and query when generating an explanation. Experts and 30 participants assessed the quality of the generated explanations, and a statistical analysis of the results indicates that combining cause and effect with the human&#x2019;s social role and the original query yields the most preferred explanations. The findings further show that the second most preferred option includes cause-and-effect structures and social roles (compared to cause-and-effect and query combinations). This indicates that incorporating the social role in causal explanations plays a significant role. Experiment II verifies that the social role of the enquirer is identified with high accuracy, and Experiment III shows a high semantic similarity between the system-generated explanations and human-generated explanations that served as ground truth. The paper is organized as follows. <xref ref-type="sec" rid="s2">Section 2</xref> consists of <xref ref-type="sec" rid="s2-1">Section 2.1</xref> that provides an overview of related work and <xref ref-type="sec" rid="s2-2">Section 2.2</xref> in which basic terms and concepts used in the paper are introduced. <xref ref-type="sec" rid="s3">Section 3</xref> describes the proposed methodology for the generation of explanations, followed by a description of experiments and results in <xref ref-type="sec" rid="s4">Section 4</xref>. <xref ref-type="sec" rid="s5">Section 5</xref> discusses challenges and limitations, and <xref ref-type="sec" rid="s6">Section 6</xref> finalizes the paper with conclusions and ideas for future work.</p>
</sec>
<sec id="s2">
<label>2</label>
<title>Technical background</title>
<sec id="s2-1">
<label>2.1</label>
<title>Related work</title>
<sec id="s2-1-1">
<label>2.1.1</label>
<title>What is an explanation?</title>
<p>Humans have an innate tendency to construct explanations, a process crucial for understanding and making sense of the world around us. Explanations help build the foundation for reasoning and generalization (<xref ref-type="bibr" rid="B17">Lombrozo, 2006</xref>). According to <xref ref-type="bibr" rid="B8">Federer et al. (2015)</xref> and <xref ref-type="bibr" rid="B19">Meyer and Schnell (2020)</xref>, explanations are composed of two key elements: the explanandum, the phenomenon being explained, and the explanation itself, which provides the rationale or reasoning. On a broader level, <xref ref-type="bibr" rid="B20">Norris et al. (2005)</xref> defined an explanation as an &#x201c;act intended to make something clear, understandable, or intelligible&#x201d; (p. 546). For explanations to be effective, they must be meaningful and adapted to the abilities and needs of the audience (<xref ref-type="bibr" rid="B26">Stefani and Tsaparlis, 2009</xref>). Similarly, Tania Lombrozo characterized explanations as bridging the gap that enables others to comprehend an event (<xref ref-type="bibr" rid="B17">Lombrozo, 2006</xref>). This process is inherently cognitive, involving answers to questions&#x2014;often framed as &#x201c;why&#x201d;&#x2014;that are typically constrained by context. The recipient of an explanation is usually less interested in the mere occurrence of an event and more focused on understanding why it happened in a particular instance rather than in alternative, counterfactual scenarios (<xref ref-type="bibr" rid="B18">Matarese et al., 2021</xref>).</p>
<p>The idea of crafting a universal theory of &#x201c;good explanations&#x201d; has been explored but remains unresolved due to the distinct needs of different disciplines (<xref ref-type="bibr" rid="B21">Pitt, 2009</xref>). For example, engineering often requires professionals to clearly communicate their decisions and solutions, as part of their nontechnical competencies (<xref ref-type="bibr" rid="B14">Kaplar et al., 2021</xref>). Reverse engineering, in particular, focuses on understanding &#x201c;how existing artifacts produce their overall functions in terms of underlying mechanisms&#x201d; (<xref ref-type="bibr" rid="B27">van Eck, 2015</xref>).</p>
<p>From a technological point of view, <xref ref-type="bibr" rid="B21">Pitt (2009)</xref> advocated for a theory of technological explanations to clarify the purpose and functionality of artifacts. He argued that such explanations must reference the broader system in which a tool operates, as its design, function, or structure &#x2026; &#x201c;can only be adequately explained by reference to the system&#x201d; (p. 861). Although scientific explanations aim to reveal &#x201c;why the world works the way it does&#x201d; in specific contexts (p. 862), technological explanations address practical questions such as &#x201c;How does this work?&#x201d; or &#x201c;Why does the artifact do this?&#x201d;.</p>
</sec>
<sec id="s2-1-2">
<label>2.1.2</label>
<title>Explanations in HRI</title>
<p>In human&#x2013;robot interaction (HRI), the ability to provide clear and meaningful explanations is essential for the widespread acceptance of robots in critical tasks (<xref ref-type="bibr" rid="B7">Edmonds et al., 2019</xref>). Studies, such as those by <xref ref-type="bibr" rid="B23">Sakai and Nagai (2022)</xref> and <xref ref-type="bibr" rid="B5">Chakraborti et al. (2021)</xref>, highlight that true communication between humans and robots requires more than a basic understanding of commands or questions. Robots must also be capable of recognizing and interpreting a person&#x2019;s internal state while conveying their own reasoning in ways that humans can easily grasp (<xref ref-type="bibr" rid="B28">Zakershahrak and Ghodratnama, 2020</xref>). For a robot to anticipate the needs of a person or adapt its behavior effectively, it must possess mechanisms to infer human intentions and provide clear and actionable insights into its own actions. This capability not only helps robots align with human expectations but also builds trust. Robots equipped with these abilities are referred to as explainable autonomous robots (XARs) (<xref ref-type="bibr" rid="B25">Stange et al., 2022</xref>; <xref ref-type="bibr" rid="B23">Sakai and Nagai, 2022</xref>). This concept parallels explainable artificial intelligence (XAI), but with a critical distinction. Whereas XAI aims to enhance understanding and control by offering transparent justifications for decisions often centered on data-driven processes (<xref ref-type="bibr" rid="B11">Gj&#xe6;rum et al., 2023</xref>; <xref ref-type="bibr" rid="B1">Adadi and Berrada, 2018</xref>), XARs are primarily concerned with explaining their autonomous behaviors in a shared, dynamic environment. As Sakai and Nagai emphasized, this involves a shift from data-focused explainability to goal-driven explainability, where the robot must clearly articulate the rationale behind its actions in pursuit of its objectives (<xref ref-type="bibr" rid="B23">Sakai and Nagai, 2022</xref>; <xref ref-type="bibr" rid="B28">Zakershahrak and Ghodratnama, 2020</xref>). This focus is crucial for fostering effective collaboration and trust in human&#x2013;robot partnerships. &#x201c;Understandability&#x201d; is suggested as a broader term than explainability (<xref ref-type="bibr" rid="B12">Hellstr&#xf6;m and Bensch, 2018</xref>) and covers not only a robot&#x2019;s actions but also entities such as intentions, desires, knowledge, beliefs, emotions, perceptions, capabilities, and limitations of the robot. Furthermore, understandability may be achieved not only by uttering verbal explanations but also by other modalities and even by the robot&#x2019;s actual motions and actions.</p>
</sec>
<sec id="s2-1-3">
<label>2.1.3</label>
<title>Speaker role recognition</title>
<p>Typically framed in the process of determining the speaker&#x2019;s turn in a homogeneous speech segment, speaker role recognition (SRR) seeks to determine the role of a speaker, considering that this role is characterized by the task performed by the speaker and the goals related to it (<xref ref-type="bibr" rid="B9">Flemotomos et al., 2019</xref>). Obviously, to solve the SRR problem, patterns must be identified to differentiate these roles. Different proposals have looked for these patterns at the low level, either in audio files or in rhythm and sound (e.g., the interviewer will use more interrogative words than the interviewee). Other authors agreed that language usually incorporates more information to solve this problem (<xref ref-type="bibr" rid="B9">Flemotomos et al., 2019</xref>; <xref ref-type="bibr" rid="B22">Prasad et al., 2022</xref>; <xref ref-type="bibr" rid="B29">Zuluaga-Gomez et al., 2023</xref>), so the aim is to exploit lexical variability to differentiate roles. Both sets of acoustic and lexical patterns can be used together, in approaches that combine automatic speech recognition (ASR) and SRR (<xref ref-type="bibr" rid="B3">Blatt et al., 2024</xref>). In any case, in recent years, traditional solutions have been replaced by deep learning.</p>
<p>Earlier work is built upon and advanced in this paper by integrating the enquirer and their mental state (through their social role) and the natural language query into the generation of more personalized explanations while maintaining causal correctness of the description of the robot&#x2019;s behavior. As our experiments show, this approach results in explanations that are more appreciated by the enquirer and, in turn, make the robot more understandable and valuable to the interacting human.</p>
</sec>
</sec>
<sec id="s2-2">
<label>2.2</label>
<title>Formalism and terminology</title>
<p>In this section, we introduce the terminology that will be used throughout the paper.</p>
<sec id="s2-2-1">
<label>2.2.1</label>
<title>Literals, robot event, and causal robot event</title>
<p>Starting with the basic entities the robot operates on, we define a <italic>literal</italic> as follows: <xref ref-type="statement" rid="Definition_1">Definition 1</xref> [Literal] A Literal is a placeholder for a physical or virtual entity that the robot considers in its operation. Notation: <italic>literal_name</italic> or <italic>literal_name1(literal_name2)</italic>.</p>
<p>Literals are frequently used in the program code controlling the robot and are necessary when describing the operation of the robot. Examples of literals are as follows: 1, <italic>Jose</italic>, <italic>Menu(Maria)</italic>, <italic>No_of_choices</italic>, <italic>Full</italic>, and <italic>Empty</italic>. The functional notation <italic>literal_name1(literal_name2)</italic> should be interpreted as a specification of <italic>literal_name1</italic>. For example, <italic>Menu(Maria)</italic> refers to the specific menu that is connected to <italic>Maria</italic>. Moving on to entities that the robot may be asked to explain, we consider three categories of basic robot operations:<list list-type="simple">
<list-item>
<p>
<inline-formula id="inf4">
<mml:math id="m4">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Sensing or perception (e.g., the robot detects an object, a person, or low battery level).</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf5">
<mml:math id="m5">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Cognition (e.g., the robot estimates the distance to an object or associates a value with a literal).</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf6">
<mml:math id="m6">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Acting (e.g., the robot moves to a certain location or asks a person about their food preferences).</p>
</list-item>
</list>
</p>
<p>Based on these categories, we define a <italic>robot event</italic> as follows:</p>
<p>
<statement content-type="definition" id="Definition_1">
<label>Definition 1</label>
<p>(Robot event). <italic>A robot event is a predicate (i.e., a Boolean expression that evaluates to True or False) with zero or more arguments and represents a specific robot operation. The arguments</italic> <inline-formula id="inf7">
<mml:math id="m7">
<mml:mrow>
<mml:mi>a</mml:mi>
<mml:mi>r</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>g</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> <italic>are literals. Notation: event_name(</italic>
<inline-formula id="inf8">
<mml:math id="m8">
<mml:mrow>
<mml:mi>a</mml:mi>
<mml:mi>r</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>g</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, &#x2026;, <inline-formula id="inf9">
<mml:math id="m9">
<mml:mrow>
<mml:mi>a</mml:mi>
<mml:mi>r</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>g</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>), <inline-formula id="inf10">
<mml:math id="m10">
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mo>&#x2265;</mml:mo>
<mml:mn>0</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</statement>
</p>
<p>For example, the one-argument event <italic>Start_move_to_safe_distance(Jose)</italic> represents the action where the robot moves away from the person identified as <italic>Jose</italic>, and the two-argument event <italic>Assign(No_of_choices, 3)</italic> represents the robot&#x2019;s cognitive operation of associating the value 3 with the literal <italic>No_of_choices</italic>. As an alternative notation, this event may also be denoted as <italic>No_of_choices &#x3d; 3</italic>. Similarly, the event <italic>Assign(Menu(Maria), Full)</italic> may also be denoted by <italic>Menu(Maria) &#x3d; Full</italic>.</p>
<p>To describe the reasons why events occur, we introduce the notion of a <italic>Causal robot event</italic>, defined as follows:</p>
<p>
<statement content-type="definition" id="Definition_2">
<label>Definition 2</label>
<p>(Causal robot event). <italic>A causal robot event comprises a timestamped rule:</italic>
<disp-formula id="equ1">
<mml:math id="m11">
<mml:mrow>
<mml:mi>t</mml:mi>
<mml:mfenced open="[" close="]">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:mfenced>
<mml:mo>&#x2192;</mml:mo>
<mml:mi>&#x3b2;</mml:mi>
<mml:mo>,</mml:mo>
</mml:mrow>
</mml:math>
</disp-formula>where <inline-formula id="inf11">
<mml:math id="m12">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> is the timestamp and the antecedent <inline-formula id="inf12">
<mml:math id="m13">
<mml:mrow>
<mml:mo stretchy="false">[</mml:mo>
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
<mml:mo stretchy="false">]</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> is a list of robot events that were all True at time t, which caused the consequent robot event <inline-formula id="inf13">
<mml:math id="m14">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> to happen. The antecedent is referred to as the Cause and is sometimes denoted by <inline-formula id="inf14">
<mml:math id="m15">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> as a short notation. The consequent is referred to as the Effect.</p>
</statement>
</p>
<p>Two examples of causal robot events are as follows:<list list-type="simple">
<list-item>
<p>
<inline-formula id="inf15">
<mml:math id="m16">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> <italic>Effect</italic> <inline-formula id="inf16">
<mml:math id="m17">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>: &#x201c;Use_case_menu_started (Jose)&#x201d;</p>
</list-item>
<list-item>
<p>&#x2009;&#x2009;&#x2009;&#x2009;&#x2009;<italic>Causes</italic> <inline-formula id="inf17">
<mml:math id="m18">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>3</mml:mn>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>: (&#x201c;Person_detected (Jose),&#x201d; &#x201c;Menu (Jose) &#x3d; False,&#x201d; &#x201c;Therapy_time &#x3d; False&#x201d;)</p>
</list-item>
<list-item>
<p>&#x2009;&#x2009;&#x2009;&#x2009;&#x2009;timestamp <inline-formula id="inf18">
<mml:math id="m19">
<mml:mrow>
<mml:mi>t</mml:mi>
<mml:mo>:</mml:mo>
<mml:mn>123213123</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>
</p>
</list-item>
<list-item>
<p>&#x2009;&#x2009;&#x2009;&#x2009;&#x2009;At time <inline-formula id="inf19">
<mml:math id="m20">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, all events in <italic>Cause</italic> were True, and the <italic>Effect</italic> occurred.</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf20">
<mml:math id="m21">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> <italic>Effect</italic> <inline-formula id="inf21">
<mml:math id="m22">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>: &#x201c;Person_detected (Jose)&#x201d;</p>
</list-item>
<list-item>
<p>&#x2009;&#x2009;&#x2009;&#x2009;&#x2009;<italic>Cause</italic> <inline-formula id="inf22">
<mml:math id="m23">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>: ()</p>
</list-item>
<list-item>
<p>&#x2009;&#x2009;&#x2009;&#x2009;&#x2009;timestamp <inline-formula id="inf23">
<mml:math id="m24">
<mml:mrow>
<mml:mi>t</mml:mi>
<mml:mo>:</mml:mo>
<mml:mn>123213923</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>
</p>
</list-item>
<list-item>
<p>&#x2009;&#x2009;&#x2009;&#x2009;&#x2009;The <italic>Effect</italic> occurred at time <inline-formula id="inf24">
<mml:math id="m25">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> without any specified prior conditions to hold true; that is, a person was detected independently of events internal to the robot.</p>
</list-item>
</list>
</p>
<p>It should be noted that for causal events with non-empty causes, the &#x201c;causation&#x201d; reflects how the software controlling the robot is written: certain conditions (the Cause) lead the program to follow a path where Effect is performed. The only exception is Effects related to perception, which depend on external conditions, and the Cause is, in these cases, an empty list.</p>
</sec>
<sec id="s2-2-2">
<label>2.2.2</label>
<title>Causal log and dictionary</title>
<p>The causal log is a component of a complex cognitive robot architecture CORTEX (<xref ref-type="bibr" rid="B10">Galeas et al., 2025</xref>). It is a tabular high-level episodic memory representation, and the causal log entries are automatically generated in real-time settings. In particular, the cause column is filled in with states/actions extracted from behavior trees that control the robot&#x2019;s behavior. These behavior trees are defined at design time and specify both task steps and conditions that trigger robot behavior changes. When such a change occurs, the system automatically records one row in the causal log.</p>
<p>Formally, all occurrences of causal events are recorded in the <italic>causal log</italic>, which is defined as follows:</p>
<p>
<statement content-type="definition" id="Definition_3">
<label>Definition 3</label>
<p>(Causal log). <italic>A causal log is a table with numbered rows. Three columns represent causal events: the timestamp</italic> <inline-formula id="inf25">
<mml:math id="m26">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
<italic>, the effect</italic> <inline-formula id="inf26">
<mml:math id="m27">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
<italic>, and the cause</italic> <inline-formula id="inf27">
<mml:math id="m28">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
<italic>. The additional column cause_idx contains a list (possibly empty) of links that connect each</italic> <inline-formula id="inf28">
<mml:math id="m29">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> <italic>with a prior occurrence of a causal event with the effect equal to</italic> <inline-formula id="inf29">
<mml:math id="m30">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
<italic>. More precisely, the cause_idx at row</italic> <inline-formula id="inf30">
<mml:math id="m31">
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> <italic>is a list</italic> <inline-formula id="inf31">
<mml:math id="m32">
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>r</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>r</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> <italic>of row numbers in the causal log, where each</italic> <inline-formula id="inf32">
<mml:math id="m33">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>r</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> <italic>belongs to condition</italic> <inline-formula id="inf33">
<mml:math id="m34">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> <italic>in the cause at row</italic> <inline-formula id="inf34">
<mml:math id="m35">
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>. <inline-formula id="inf35">
<mml:math id="m36">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>r</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> <italic>is set to the largest row number less than</italic> <inline-formula id="inf36">
<mml:math id="m37">
<mml:mrow>
<mml:mi>j</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
<italic>, for which the effect column equals</italic> <inline-formula id="inf37">
<mml:math id="m38">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</statement>
</p>
<p>An example of a causal log is given in <xref ref-type="table" rid="T1">Table 1</xref>.</p>
<table-wrap id="T1" position="float">
<label>TABLE 1</label>
<caption>
<p>The robot records all occurrences of causal events in the causal log, which is represented as a table.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left"/>
<th align="left">Timestamp <inline-formula id="inf38">
<mml:math id="m39">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">Effect <inline-formula id="inf39">
<mml:math id="m40">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">Cause <inline-formula id="inf40">
<mml:math id="m41">
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">cause_idx</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">1</td>
<td align="left">1727677625</td>
<td align="center">Menu (Jose) &#x3d; Empty</td>
<td align="left">( )</td>
<td align="left">&#x2026;</td>
</tr>
<tr>
<td align="left">2</td>
<td align="left">1727678125</td>
<td align="center">Use_case_wandering_started</td>
<td align="left">( )</td>
<td align="left"/>
</tr>
<tr>
<td align="left">3</td>
<td align="left">1727681232</td>
<td align="center">Menu (Alberto) &#x3d; Empty</td>
<td align="left">( )</td>
<td align="left">&#x2026;</td>
</tr>
<tr>
<td align="left">4</td>
<td align="left">1727679180</td>
<td align="center">Neuron (Alberto) &#x3d; True</td>
<td align="left">( )</td>
<td align="left"/>
</tr>
<tr>
<td align="left">5</td>
<td align="left">1727679030</td>
<td align="center">Ordered_food (Maria)</td>
<td align="left">(Use_case_menu_ended (Maria))</td>
<td align="left"/>
</tr>
<tr>
<td align="left">6</td>
<td align="left">&#x2026;</td>
<td align="center">&#x2026;</td>
<td align="left">&#x2026;</td>
<td align="left">&#x2026;</td>
</tr>
<tr>
<td align="left">7</td>
<td align="left">1727679060</td>
<td align="center">Therapy_time &#x3d; False</td>
<td align="left">( )</td>
<td align="left"/>
</tr>
<tr>
<td align="left">8</td>
<td align="left">1727679070</td>
<td align="center">Person_detected (Maria)</td>
<td align="left">( )</td>
<td align="left"/>
</tr>
<tr>
<td align="left">9</td>
<td align="left">1727679090</td>
<td align="center">Menu (Maria) &#x3d; Full</td>
<td align="left">(Ordered_food (Maria))</td>
<td align="left">(5)</td>
</tr>
<tr>
<td align="left">10</td>
<td align="left">&#x2026;</td>
<td align="center">&#x2026;</td>
<td align="left">&#x2026;</td>
<td align="left">&#x2026;</td>
</tr>
<tr>
<td align="left">11</td>
<td align="left">1727679140</td>
<td align="center">Person_detected (Jose)</td>
<td align="left">( )</td>
<td align="left"/>
</tr>
<tr>
<td align="left">12</td>
<td align="left">&#x2026;</td>
<td align="center">&#x2026;</td>
<td align="left">&#x2026;</td>
<td align="left"/>
</tr>
<tr>
<td align="left">13</td>
<td align="left">1727699200</td>
<td align="center">Use_case_menu_started (Jose)</td>
<td align="left">(Person_detected (Jose), Menu (Jose) &#x3d; Empty, Therapy_time &#x3d; False)</td>
<td align="left">(11,1,7)</td>
</tr>
<tr>
<td align="left">14</td>
<td align="left">1727679120</td>
<td align="center">Therapy_time &#x3d; True</td>
<td align="left">( )</td>
<td align="left"/>
</tr>
<tr>
<td align="left">15</td>
<td align="left">1727679140</td>
<td align="center">Person_detected (Alberto)</td>
<td align="left">( )</td>
<td align="left"/>
</tr>
<tr>
<td align="left">16</td>
<td align="left">1727679180</td>
<td align="center">&#x2026;</td>
<td align="left">&#x2026;</td>
<td align="left"/>
</tr>
<tr>
<td align="left">17</td>
<td align="left">1727699200</td>
<td align="center">Use_case_cognitive_started (Alberto)</td>
<td align="left">(Person_detected (Alberto), Neuron (Alberto) &#x3d; True, Therapy_time &#x3d; True)</td>
<td align="left">(15,4,14)</td>
</tr>
<tr>
<td align="left">18</td>
<td align="left">1727679180</td>
<td align="center">Neuron (Alberto) &#x3d; False</td>
<td align="left">(Use_case_cognitive_started (Alberto))</td>
<td align="left">(17)</td>
</tr>
<tr>
<td align="left">19</td>
<td align="left">1727699200</td>
<td align="center">Use_case_menu_started (Alberto)</td>
<td align="left">(Person_detected (Alberto), Menu (Alberto) &#x3d; Empty, Neuron (Alberto) &#x3d; False)</td>
<td align="left">(15,3,18)</td>
</tr>
</tbody>
</table>
<table-wrap-foot>
<fn>
<p>The causal log contains causal chains or causal dependencies of linked causal events.</p>
</fn>
</table-wrap-foot>
</table-wrap>
<p>The generation of explanations requires descriptions of all events that may occur in the causal log. Such descriptions are provided in a <italic>dictionary</italic>, as exemplified in <xref ref-type="table" rid="T2">Table 2</xref>. Parameterized event names <inline-formula id="inf41">
<mml:math id="m42">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> and descriptions <inline-formula id="inf42">
<mml:math id="m43">
<mml:mrow>
<mml:mi>d</mml:mi>
<mml:mi>e</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> reduce the size of the dictionary considerably. Parameters are instantiated when the dictionary is used to find initial basic descriptions for robot events in the causal log that should be explained. A <italic>dictionary</italic> is formally defined as follows:</p>
<table-wrap id="T2" position="float">
<label>TABLE 2</label>
<caption>
<p>The dictionary provides basic descriptions <inline-formula id="inf43">
<mml:math id="m44">
<mml:mrow>
<mml:mi>d</mml:mi>
<mml:mi>e</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> for events <inline-formula id="inf44">
<mml:math id="m45">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left">Parameterized event name <inline-formula id="inf45">
<mml:math id="m46">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">Parameterized event description <inline-formula id="inf46">
<mml:math id="m47">
<mml:mrow>
<mml:mi>d</mml:mi>
<mml:mi>e</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">Start_move_to_safe_distance_from (&#x26;1)</td>
<td align="left">The robot started to move to reach a safe distance from &#x26;1</td>
</tr>
<tr>
<td align="left">Person_detected (&#x26;1)</td>
<td align="left">Person &#x26;1 was detected by the robot&#x2019;s facial recognition camera</td>
</tr>
<tr>
<td align="left">Menu (&#x26;1) &#x3d; Empty</td>
<td align="left">&#x26;1 had not ordered any food today</td>
</tr>
<tr>
<td align="left">Menu (&#x26;1) &#x3d; Full</td>
<td align="left">&#x26;1 had already ordered food today</td>
</tr>
<tr>
<td align="left">Therapy_time &#x3d; True</td>
<td align="left">It was the right time for cognitive therapy</td>
</tr>
<tr>
<td align="left">Neuron (&#x26;1) &#x3d; True</td>
<td align="left">Person &#x26;1 was scheduled for the cognitive therapy today</td>
</tr>
<tr>
<td align="left">Use_case_reminder_started (&#x26;1)</td>
<td align="left">The robot reminded &#x26;1 about an activity in their agenda</td>
</tr>
<tr>
<td align="left">Use_case_cognitive_started (&#x26;1)</td>
<td align="left">When the robot recognized &#x26;1 who participates in the therapy, it offered the possibility to start an activity which is conducted using the robot&#x2019;s touch screen</td>
</tr>
</tbody>
</table>
<table-wrap-foot>
<fn>
<p>Both <inline-formula id="inf47">
<mml:math id="m48">
<mml:mrow>
<mml:mi>d</mml:mi>
<mml:mi>e</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> and <inline-formula id="inf48">
<mml:math id="m49">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> may contain variables that are instantiated when explanations are generated.</p>
</fn>
</table-wrap-foot>
</table-wrap>
<p>
<statement content-type="definition" id="Definition_4">
<label>Definition 4</label>
<p>(Dictionary). <italic>A dictionary is a table where all possible events are listed in separate rows. The table has two columns: parameterized event</italic> <inline-formula id="inf49">
<mml:math id="m50">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> <italic>and parameterized event description</italic> <inline-formula id="inf50">
<mml:math id="m51">
<mml:mrow>
<mml:mi>d</mml:mi>
<mml:mi>e</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
<italic>. Both columns may contain variables</italic> &#x26;<inline-formula id="inf51">
<mml:math id="m52">
<mml:mrow>
<mml:mi>n</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> <italic>that are substituted for actual values when explanations are generated.</italic>
</p>
</statement>
</p>
</sec>
<sec id="s2-2-3">
<label>2.2.3</label>
<title>Questions</title>
<p>A person interacting with a robot may ask the robot several types of questions. In this paper, we restrict the scope to questions about the <italic>reasons for robot events</italic> that appear in the robot&#x2019;s causal log. Hence, the robot can answer questions related to what it has perceived (sensing), &#x201c;thought about&#x201d; (cognition), and done (acting). Examples of such questions are &#x201c;Why are you asking me about physio therapy?,&#x201d; &#x201c;How come you returned to the charging station?,&#x201d; and &#x201c;Why are you moving around in the living room?&#x201d;.</p>
</sec>
<sec id="s2-2-4">
<label>2.2.4</label>
<title>Causal explanation</title>
<p>A question may be answered with a <italic>causal explanation</italic>. A <italic>causal explanation</italic> for an effect <inline-formula id="inf52">
<mml:math id="m53">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> in a causal event appearing in a causal log is a text string describing the direct and indirect causes of <inline-formula id="inf53">
<mml:math id="m54">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>. The direct causes <inline-formula id="inf54">
<mml:math id="m55">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> are given in the corresponding column in the causal log. The indirect causes of <inline-formula id="inf55">
<mml:math id="m56">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> can be found by, for each <inline-formula id="inf56">
<mml:math id="m57">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, looking up rows in the causal log where the effect column matches <inline-formula id="inf57">
<mml:math id="m58">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>. For this, the row numbers in the <italic>cause_idx</italic> column are utilized. Each cause of <inline-formula id="inf58">
<mml:math id="m59">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> is an indirect cause of <inline-formula id="inf59">
<mml:math id="m60">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>. This can, in principle, continue recursively until all causes are empty&#x2014;corresponding to events that cannot be explained by referring to other events in the causal log, but rather to external conditions (e.g., related to perception). Although an explanation may be observed as more &#x201c;accurate&#x201d; if it also refers to indirect causes, it may become overly complex and difficult to understand. The optimal trade-off between complexity and understandability depends on factors such as the purpose of the explanation, the user&#x2019;s ability to understand detailed and complex information, and the time available to communicate the explanation. In this paper, we only consider direct causes when constructing explanations. However, the methodology presented can also handle the recursive inclusion of indirect causes.</p>
</sec>
</sec>
</sec>
<sec sec-type="methods" id="s3">
<label>3</label>
<title>Methodology</title>
<sec id="s3-1">
<label>3.1</label>
<title>Methodological overview</title>
<p>
<xref ref-type="fig" rid="F1">Figure 1</xref> shows an overview of the methodology that generates a final explanation <inline-formula id="inf60">
<mml:math id="m61">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> in response to a user&#x2019;s question <inline-formula id="inf61">
<mml:math id="m62">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>. It comprises the following six steps: <list list-type="simple">
<list-item>
<p>1. Input of a natural language query <inline-formula id="inf62">
<mml:math id="m63">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> from a user.</p>
</list-item>
<list-item>
<p>2. Recognition of a robot event <inline-formula id="inf63">
<mml:math id="m64">
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> and the user&#x2019;s social role <inline-formula id="inf64">
<mml:math id="m65">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> from <inline-formula id="inf65">
<mml:math id="m66">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>. This is done using the intent recognition component in Rasa, trained using supervised learning, as described in <xref ref-type="sec" rid="s3-2">Section 3.2</xref>.</p>
</list-item>
<list-item>
<p>3. Retrieval of the effect <inline-formula id="inf66">
<mml:math id="m67">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> and the cause <inline-formula id="inf67">
<mml:math id="m68">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> from the causal log, as described in <xref ref-type="sec" rid="s3-3">Section 3.3</xref>.</p>
</list-item>
<list-item>
<p>4. Generation of initial causal explanation <inline-formula id="inf68">
<mml:math id="m69">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> based on descriptions in the dictionary for <inline-formula id="inf69">
<mml:math id="m70">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> and <inline-formula id="inf70">
<mml:math id="m71">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> (see <xref ref-type="sec" rid="s3-4">Section 3.4</xref>).</p>
</list-item>
<list-item>
<p>5. Syntactical refinement of the initial explanation <inline-formula id="inf71">
<mml:math id="m72">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, resulting in a grammatically structured explanation <inline-formula id="inf72">
<mml:math id="m73">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> (see <xref ref-type="sec" rid="s3-4">Section 3.4</xref>).</p>
</list-item>
<list-item>
<p>6. Generation of final explanation <inline-formula id="inf73">
<mml:math id="m74">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> by prompting an LLM with a combination of the three factors <inline-formula id="inf74">
<mml:math id="m75">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, <inline-formula id="inf75">
<mml:math id="m76">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and <inline-formula id="inf76">
<mml:math id="m77">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> (see <xref ref-type="sec" rid="s3-5">Section 3.5</xref>).</p>
</list-item>
</list>
</p>
<fig id="F1" position="float">
<label>FIGURE 1</label>
<caption>
<p>Methodological overview illustrating the process of generating personalized causal explanations based on user queries, social roles, and cause-and-effect structures.</p>
</caption>
<graphic xlink:href="frobt-12-1637574-g001.tif">
<alt-text content-type="machine-generated">Flowchart depicting six stages of generating a final explanation. Stage 1: Input event and social role recognition by RASA. Stage 2: Retrieves effect and cause. Stage 3: Generates initial causal explanation using a dictionary. Stage 4: Refines syntax. Stage 5: Produces final explanation with Llama. Arrows indicate process flow and interconnections between stages.</alt-text>
</graphic>
</fig>
<p>An example of the inputs and outputs in each step of the process is given in <xref ref-type="table" rid="T3">Table 3</xref>. In the last step, all the three factors <inline-formula id="inf77">
<mml:math id="m78">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, <inline-formula id="inf78">
<mml:math id="m79">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and <inline-formula id="inf79">
<mml:math id="m80">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> were used to generate the final explanation <inline-formula id="inf80">
<mml:math id="m81">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
<table-wrap id="T3" position="float">
<label>TABLE 3</label>
<caption>
<p>Examples of inputs and outputs in each step of the process illustrated in <xref ref-type="fig" rid="F1">Figure 1</xref>.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left">
<inline-formula id="inf81">
<mml:math id="m82">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">Why did my father, Alberto, have cognitive therapy today?</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">
<inline-formula id="inf82">
<mml:math id="m83">
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</td>
<td align="left">Use_case_cognitive_started (&#x26;1)</td>
</tr>
<tr>
<td align="left">
<inline-formula id="inf83">
<mml:math id="m84">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</td>
<td align="left">Family</td>
</tr>
<tr>
<td align="left">
<inline-formula id="inf84">
<mml:math id="m85">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</td>
<td align="left">Use_case_cognitive_started (Alberto)</td>
</tr>
<tr>
<td align="left">
<inline-formula id="inf85">
<mml:math id="m86">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</td>
<td align="left">Person_detected (Alberto), Neuron (Alberto) &#x3d; True, Therapy time &#x3d; True</td>
</tr>
<tr>
<td align="left">
<inline-formula id="inf86">
<mml:math id="m87">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
</td>
<td align="left">Cause: person Alberto was detected by the robot&#x2019;s facial recognition camera; person Alberto was scheduled for the cognitive therapy activity today; it was the right time for cognitive therapy. Effect: when the robot recognized Alberto who participates in the therapy, it offered the possibility to start an activity, which is conducted using the robot&#x2019;s touch screen</td>
</tr>
<tr>
<td align="left">
<inline-formula id="inf87">
<mml:math id="m88">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
</td>
<td align="left">Because Alberto was detected by the robot&#x2019;s facial recognition camera, Alberto was scheduled for the cognitive therapy activity today, and it was the right time for cognitive therapy. As a result, when the robot recognized Alberto who participates in the therapy, it offered the possibility to start an activity, which is conducted using the robot&#x2019;s touch screen</td>
</tr>
<tr>
<td align="left">
<inline-formula id="inf88">
<mml:math id="m89">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
</td>
<td align="left">I gave your father cognitive therapy because I recognized him and knew he had a scheduled session today, so I offered him the activity on my screen</td>
</tr>
</tbody>
</table>
</table-wrap>
<p>The following subsections provide detailed descriptions of the steps in the process.</p>
</sec>
<sec id="s3-2">
<label>3.2</label>
<title>Recognition of the robot event and social role</title>
<p>In this step, the user&#x2019;s natural language query <inline-formula id="inf89">
<mml:math id="m90">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> is mapped to a parameterized robot event <inline-formula id="inf90">
<mml:math id="m91">
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> and a social role <inline-formula id="inf91">
<mml:math id="m92">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> related to the user. We utilized Rasa&#x2019;s intent recognition component, which is intended to find mappings from natural language utterances to the speaker&#x2019;s intent. For example, the intents behind &#x201c;Good morning&#x201d; and &#x201c;What do you mean?&#x201d; may be &#x201c;greeting&#x201d; and &#x201c;clarification,&#x201d; respectively. This mapping is created through supervised learning by providing pairs of utterances and intents. We used the same learning functionality but provided pairs of queries <inline-formula id="inf92">
<mml:math id="m93">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> and parameterized robot events <inline-formula id="inf93">
<mml:math id="m94">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> (see Definition 2.2.2), such as the query &#x201c;Why did my father, Alberto, have cognitive therapy today?&#x201d; and the parameterized event &#x201c;Use_case_cognitive_started (&#x26;1).&#x201d; The model for robot event recognition was trained on 25 parameterized events <inline-formula id="inf94">
<mml:math id="m95">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, each associated with 20 query&#x2013;event pairs <inline-formula id="inf95">
<mml:math id="m96">
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula>, <inline-formula id="inf96">
<mml:math id="m97">
<mml:mrow>
<mml:mn>1</mml:mn>
<mml:mo>&#x2264;</mml:mo>
<mml:mi>i</mml:mi>
<mml:mo>&#x2264;</mml:mo>
<mml:mn>20</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>, resulting in a total of 500 training pairs. Half of the queries <inline-formula id="inf97">
<mml:math id="m98">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> were collected from real users (e.g., residents, family members, and technical staff) during a previous project where a robot was deployed in a retirement home in Malaga, Spain (<xref ref-type="bibr" rid="B13">Jerez et al., 2024</xref>). This ensured that the queries reflected the actual concerns and needs of the target user groups. The other half of the queries <inline-formula id="inf98">
<mml:math id="m99">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> were linguistic variations of the real users&#x2019; queries, generated using ChatGPT. Appropriate event templates from the dictionary were manually matched with each query. Examples of the robot event recognition are shown in <xref ref-type="table" rid="T4">Table 4</xref>, where system output for four use cases are shown: choosing from the menu, cognitive therapy, robot moving around in common room (i.e., wandering), and interaction with a human.</p>
<table-wrap id="T4" position="float">
<label>TABLE 4</label>
<caption>
<p>Examples of robot event recognition.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="center">Example 1. Robot event: use<inline-formula id="inf99">
<mml:math id="m100">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf100">
<mml:math id="m101">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>menu</th>
<th align="center">Example 2. Robot event: use<inline-formula id="inf101">
<mml:math id="m102">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf102">
<mml:math id="m103">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>cognitive therapy</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">
<italic>&#x201c;Why did my father Alberto choose his menu?&#x201d;</italic> Use_case_menu_started (&#x26;1), Confidence: 0.81 Use_case_menu_finished (&#x26;1), Confidence: 0.06 Menu_choices (&#x26;1), Confidence: 0.03 Person_finish_interact (&#x26;1), Confidence: 0.03 Person_interacting (&#x26;1), Confidence: 0.02 Looking_for_therapist (&#x26;1), Confidence: 0.01</td>
<td align="center">
<italic>&#x201c;Why did my father Alberto undergo cognitive therapy?&#x201d;</italic> Use_case_cognitive_started (&#x26;1), Confidence: 0.87 Use_case_cognitive_finished, Confidence: 0.03 Person_interacting (&#x26;1), Confidence: 0.02 Use_case_reminder_finished, Confidence: 0.02 Person_finish_interact (&#x26;1), Confidence: 0.01</td>
</tr>
</tbody>
</table>
<table>
<thead valign="top">
<tr>
<th align="center">Example 3. Robot event: use<inline-formula id="inf103">
<mml:math id="m104">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf104">
<mml:math id="m105">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>wandering</th>
<th align="center">Example 4. Robot event: use<inline-formula id="inf105">
<mml:math id="m106">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf106">
<mml:math id="m107">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>person interaction</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">
<italic>&#x201c;Why did you move around the living room?&#x201d;</italic> Use_case_wandering_started, Confidence: 0.87 Use_case_music_finished, Confidence: 0.08 Use_case_wandering_finished, Confidence: 0.02 Use_case_request_finished, Confidence: 0.01</td>
<td align="left">
<italic>&#x201c;Why were you interacting with Pedro?&#x201d;</italic> Person_interacting (&#x26;1), Confidence: 0.91 Person_finish_interact (&#x26;1), Confidence: 0.06 Looking_for_therapist (&#x26;1), Confidence: 0.01 Robot.activities &#x3d; &#x26;1, Confidence: 0.00</td>
</tr>
</tbody>
</table>
<table-wrap-foot>
<fn>
<p>In Example 4, the user query &#x201c;Why were you interacting with Pedro?&#x201d; is associated with the parameterized robot event &#x201c;Person_interacting (&#x26;1)&#x201d; with confidence 0.91.</p>
</fn>
</table-wrap-foot>
</table-wrap>
<p>Similarly, for social role recognition, we provided pairs of queries <inline-formula id="inf107">
<mml:math id="m108">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> and social roles <inline-formula id="inf108">
<mml:math id="m109">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> as training data. We considered the three social roles: <italic>technician</italic>, <italic>resident</italic>, and <italic>family member</italic>. The social role of a technician refers to a professional who is responsible for the maintenance of the social robot used in, for example, a retirement home. Technicians engage on a technical level with the robot, and robot explanations tailored to technicians should be focused on technology-oriented aspects. The social role of a resident refers to an independent older adult who resides in a retirement home and interacts with the robot. The interaction between a resident and social robot focuses on aspects that influence their daily lives (e.g., choosing lunch, cognitive therapy, and playing games in the common room.). Explanations for the resident should not be technical, but rather clarifying, easily understandable, accurate, and adaptive to the needs and preferences of the resident. The social role of a family member refers to visitors to the retirement home (e.g., children, grandchildren, relatives, and friends). The explanations to family members should also be clear, correct, and potentially more personal. Social roles guide how humans interact with each other and affect both what we talk about and how we talk (<xref ref-type="bibr" rid="B6">Eastman, 1985</xref>). Related to explanations, it is reasonable to assume that the social role of a person affects both the topic of a question asked and the way the question is formulated. An ideal explanation also takes the social role into account. Therefore, it would be advantageous for a robot that generates explanations to know the social role of the user. To this end, we trained a model that maps a user&#x2019;s questions to her social role. The model was trained with a total of 160 training pairs <inline-formula id="inf109">
<mml:math id="m110">
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
</mml:math>,</inline-formula> where each of the three roles <inline-formula id="inf110">
<mml:math id="m111">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> was manually associated with 40 queries <inline-formula id="inf111">
<mml:math id="m112">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
<mml:mo>,</mml:mo>
<mml:mi>i</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>. Of these queries, 20 were sourced from real users based on the previous deployment of the robot in the retirement home, whereas 20 were linguistic variations generated using ChatGPT. Examples of the social role recognition are provided in <xref ref-type="table" rid="T5">Table 5</xref>.</p>
<table-wrap id="T5" position="float">
<label>TABLE 5</label>
<caption>
<p>Examples of social role recognition.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left">Example 1. Social role: family</th>
<th align="left"/>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">
<italic>&#x201c;Why did my father Alberto choose his menu?&#x201d;</italic> family, Confidence: 0.99 resident, Confidence: 0.00 technician, Confidence: 0.0</td>
<td align="left"/>
</tr>
</tbody>
</table>
<table>
<thead valign="top">
<tr>
<th align="left">Example 2. Social role: resident</th>
<th align="left">Example 3. Social role: technician</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">
<italic>&#x201c;Why did you remind my colleague Alberto about his physiotherapy session?&#x201d;</italic> resident, Confidence: 1.00 family, Confidence: 0.00 technician, Confidence: 0.0</td>
<td align="center">
<italic>&#x201c;Why do you prioritize charging over continuing your current task?&#x201d;</italic> technician, Confidence: 1.00 resident, Confidence: 0.00 family, Confidence: 0.00</td>
</tr>
</tbody>
</table>
<table-wrap-foot>
<fn>
<p>In Example 1, the query &#x201c;Why did my father Alberto choose his menu?&#x201d; is predicted with a confidence of 0.99 to have been asked by a person with the social role family.</p>
</fn>
</table-wrap-foot>
</table-wrap>
<p>The remaining subsection provides a more detailed description of how the Rasa system was configured and used. In Rasa, natural language text is processed by a sequence of components in a so-called processing pipeline defined in a configuration file. The text is first split into tokens using the WhitespaceTokenizer, which creates one token for each sequence of characters separated by whitespace. The Featurizer component transforms these tokens into numerical representations (features). We utilized the RegexFeaturizer, which extracts features based on predefined regular expressions; the LexicalSyntacticFeaturizer, which extracts lexical-syntactic features using a sliding window approach; and the CountVectorsFeaturizer at both the word and character levels in the input query. At the word level, features were extracted using the bag-of-words approach capturing the frequency of occurrence of words. At the character level, features representing sub-word structures were extracted, making the model more robust to spelling variations or unseen words. Next, we utilized the DIETClassifier (Dual Intent and Entity Transformer), a component designed for joint intent classification and entity recognition, which is built on a transformer-based architecture. The DIETClassifier shares a transformer for both tasks, using a conditional random field (CRF) layer for entity recognition and a semantic vector space for intent classification (in our case, robot event and social role classification). The model optimizes by maximizing the similarity between the predicted intent vector and the correct label using dot-product loss. The outputs are the primary intent and the intent ranking with respective confidences scores. <xref ref-type="table" rid="T4">Table 4</xref> shows various examples of the classifier&#x2019;s output. Finally, the FallbackClassifier classifies a query with the intent &#x201c;nlu_fallback&#x201d; if the intent&#x2019;s confidence score is below a defined threshold (30% in our case). The fallback intent can also be predicted when the confidence scores of the two top ranked intents are closer than the ambiguity threshold (10% in our case).</p>
</sec>
<sec id="s3-3">
<label>3.3</label>
<title>Retrieval of the effect and the cause</title>
<p>Step 2 results in a parameterized event <inline-formula id="inf112">
<mml:math id="m113">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, such as &#x201c;Use_case_cognitive_started(&#x26;1),&#x201d; and a named entity such as &#x201c;Alberto.&#x201d; In step 3, they are compared with the events in the effect column in the causal log to find rows with a matching effect <inline-formula id="inf113">
<mml:math id="m114">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, such as &#x201c;Use_case_cognitive_started(Alberto).&#x201d; If more than one such row exists, the row most recently added to the causal log is chosen. In addition to the effect <inline-formula id="inf114">
<mml:math id="m115">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, the cause <inline-formula id="inf115">
<mml:math id="m116">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, the timestamp <inline-formula id="inf116">
<mml:math id="m117">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and the cause index <inline-formula id="inf117">
<mml:math id="m118">
<mml:mrow>
<mml:mi>c</mml:mi>
<mml:mi>a</mml:mi>
<mml:mi>u</mml:mi>
<mml:mi>s</mml:mi>
<mml:mi>e</mml:mi>
<mml:mtext>_</mml:mtext>
<mml:mi>i</mml:mi>
<mml:mi>d</mml:mi>
<mml:mi>x</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> are retrieved from the same row. Examples of effect and cause retrieval for four queries are provided in <xref ref-type="table" rid="T6">Table 6</xref>.</p>
<table-wrap id="T6" position="float">
<label>TABLE 6</label>
<caption>
<p>Examples of effect and cause retrieval for four queries.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left">Example 1. &#x201c;Why did my father Alberto choose his menu?&#x201d;</th>
<th align="left">Example 2. &#x201c;Why did my father Alberto undergo cognitive therapy?&#x201d;</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">Primary intent: Use_case_menu_started (&#x26;1), Confidence: 0.81 Primary effect: Use_case_menu_started (&#x26;1) Final effect: Use_case_menu_started (Alberto) Full row of effect: {&#x2018;timestamp&#x2019;: 1728374585; &#x2018;cause&#x2019;: Use_case_cognitive_finished &#x5e; Person_detected (Alberto) &#x5e; Person (Alberto).neuron &#x3d; false &#x5e; Person (Alberto).menu &#x3d; &#x201c;&#x201d;; &#x2018;cause_idx&#x2019;: 46,25,43,27}</td>
<td align="center">Primary intent: Use_case_cognitive_started (&#x26;1), Confidence: 0.87 Primary effect: Use_case_cognitive_started (&#x26;1) Final effect: Use_case_cognitive_started (Alberto) Full row of effect: {&#x2018;timestamp&#x2019;: 1728374558; &#x2018;cause&#x2019;: Person_detected (Alberto) &#x5e; Person (Alberto).neuron &#x3d; true &#x5e; Cognitive_time &#x3d; true; &#x2018;cause_idx&#x2019;: 25,26,3}</td>
</tr>
</tbody>
</table>
<table>
<thead valign="top">
<tr>
<th align="left">Example 3. &#x201c;Why did you move around the living room?&#x201d;</th>
<th align="left">Example 4. &#x201c;Why were you interacting with Pedro?&#x201d;</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">Primary intent: Use_case_wandering_started, Confidence: 0.87 Primary effect: Use_case_wandering_started Final effect: Use_case_wandering_started Full row of effect: {&#x2018;timestamp&#x2019;: 1728383268; &#x2018;cause&#x2019;: Use_case_music_finished; &#x2018;cause_idx&#x2019;: 127}</td>
<td align="center">Primary intent: Person_interacting (&#x26;1), Confidence: 0.91 Primary effect: Person_interacting (&#x26;1) Final effect: Person_interacting (Pedro) Full row of effect: No match found in the &#x2018;effect&#x2019; column</td>
</tr>
</tbody>
</table>
<table-wrap-foot>
<fn>
<p>The latest entry of an effect <inline-formula id="inf118">
<mml:math id="m119">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> is retrieved from the causal log, alongside with its cause <inline-formula id="inf119">
<mml:math id="m120">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, timestamp <inline-formula id="inf120">
<mml:math id="m121">
<mml:mrow>
<mml:mi>t</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and cause index.</p>
</fn>
</table-wrap-foot>
</table-wrap>
</sec>
<sec id="s3-4">
<label>3.4</label>
<title>Generation of causal explanations</title>
<p>An initial natural language description of the retrieved cause <inline-formula id="inf121">
<mml:math id="m122">
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
<mml:mo>&#x3d;</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> and effect <inline-formula id="inf122">
<mml:math id="m123">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> is first generated by utilizing the dictionary (see <xref ref-type="sec" rid="s2-2-2">Section 2.2.2</xref>). Parameter values within parentheses, such as &#x201c;Alberto,&#x201d; are first substituted with placeholders (e.g., &#x26;1). The resulting <inline-formula id="inf123">
<mml:math id="m124">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>,</mml:mo>
<mml:mo>&#x2026;</mml:mo>
<mml:mo>,</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>&#x3b1;</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>k</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> and <inline-formula id="inf124">
<mml:math id="m125">
<mml:mrow>
<mml:mi>&#x3b2;</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> are then matched with the parameterized event names <inline-formula id="inf125">
<mml:math id="m126">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> in the dictionary. The corresponding event descriptions are then concatenated, and all parameters are substituted back. Separators &#x201c;; &#x201d; are finally added to form the initial causal explanation <inline-formula id="inf126">
<mml:math id="m127">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>. Examples are shown in <xref ref-type="table" rid="T7">Table 7</xref>.</p>
<table-wrap id="T7" position="float">
<label>TABLE 7</label>
<caption>
<p>Examples of initial causal explanations <inline-formula id="inf127">
<mml:math id="m128">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> for four queries, generated by concatenating descriptions for cause and effect in the dictionary.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left">Example 1. &#x201c;Why did my father Alberto choose his menu?&#x201d;</th>
<th align="left">Example 2. &#x201c;Why did my father Alberto undergo cognitive therapy?&#x201d;</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">The robot ended the cognitive therapy as it only asks a limited number of questions to avoid exhausting the user; person Alberto was detected by the robot&#x2019;s facial recognition camera; person Alberto did not have the cognitive therapy activity scheduled for today or has just completed it; person had not ordered any food. Effect: the robot approached a recognized person Alberto and asked for his menu choices. Menu selection was made by touching the appropriate images on the robot&#x2019;s screen</td>
<td align="center">Person Alberto was detected by the robot&#x2019;s facial recognition camera; person Alberto was scheduled for the cognitive therapy activity today; it was the right time for cognitive therapy. Effect: when the robot recognized Alberto, who participates in the therapy, it offered the possibility to start an activity, which is conducted using the robot&#x2019;s touch screen</td>
</tr>
</tbody>
</table>
<table>
<thead valign="top">
<tr>
<th align="left">Example 3. &#x201c;Why did you move around the living room?&#x201d;</th>
<th align="left">Example 4. &#x201c;Why where you interacting with Pedro?&#x201d;</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">The robot finished playing music as the hour of music therapy has ended. Effect: the robot moved to random locations in a specified area looking for opportunities to perform a use case</td>
<td align="center">The robot has not seen the person</td>
</tr>
</tbody>
</table>
</table-wrap>
<p>
<inline-formula id="inf128">
<mml:math id="m129">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> is syntactically enhanced to form a grammatically cohesive sentence that is better suited for the final refinement stage handled by the LLM. We observed that the LLM consistently produced more fluent and natural explanations when the input was a single connected sentence, rather than a sequence of disjointed clauses or bullet points. The word &#x201c;because&#x201d; is inserted at the beginning of the first cause to explicitly mark causality. If there are multiple causes, they are joined using commas between clauses, with the word &#x201c;and&#x201d; before the final cause to form a coordinated list. Additionally, occurrences of the word &#x201c;Person&#x201d; are removed for better readability, resulting in the syntactically enhanced explanation <inline-formula id="inf129">
<mml:math id="m130">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>. Examples are provided in <xref ref-type="table" rid="T8">Table 8</xref>.</p>
<table-wrap id="T8" position="float">
<label>TABLE 8</label>
<caption>
<p>Examples of syntactically enhanced causal explanations <inline-formula id="inf130">
<mml:math id="m131">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> for four queries, created by adding conjunctions such as &#x201c;and&#x201d; or &#x201c;as a result&#x201d; to <inline-formula id="inf131">
<mml:math id="m132">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left">Example 1. &#x201c;Why did my father Alberto choose his menu?&#x201d;</th>
<th align="left">Example 2. &#x201c;Why did my father Alberto undergo cognitive therapy?&#x201d;</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">Because the robot ended the cognitive therapy as it only asks a limited number of questions to avoid exhausting the user, Alberto was detected by the robot&#x2019;s facial recognition camera, Alberto did not have the cognitive therapy activity scheduled for today or has just completed it, and Alberto had not ordered any food. As a result, the robot approached a recognized person, Alberto, and asked for his menu choices. Menu selection was made by touching the appropriate images on the robot&#x2019;s screen</td>
<td align="left">Because Alberto was detected by the robot&#x2019;s facial recognition camera, Alberto was scheduled for the cognitive therapy activity today and it was the right time for cognitive therapy. As a result, when the robot recognized Alberto, who participates in the therapy, it offered the possibility to start an activity, which is conducted using the robot&#x2019;s touch screen</td>
</tr>
</tbody>
</table>
<table>
<thead valign="top">
<tr>
<th align="left">Example 3. &#x201c;Why did you move around the living room?&#x201d;</th>
<th align="left">Example 4. &#x201c;Why where you interacting with Pedro?&#x201d;</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">Because the robot finished playing music as the hour of music therapy had ended. As a result, the robot moved to random locations in a specified area looking for opportunities to perform a use case</td>
<td align="left">The robot has not seen the person</td>
</tr>
</tbody>
</table>
</table-wrap>
</sec>
<sec id="s3-5">
<label>3.5</label>
<title>Generation of final explanation</title>
<p>Although the generated explanations <inline-formula id="inf132">
<mml:math id="m133">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> (see <xref ref-type="table" rid="T8">Table 8</xref>) contain necessary and correct information, they are not sufficiently well expressed to be easily understood. A final adaption is, therefore, performed by utilizing the LLM Llama<xref ref-type="fn" rid="fn1">
<sup>1</sup>
</xref>, which allows for local and not only cloud-based processing. This enables responsive real-time interaction, suitable for on-device usage in social robotics applications. The specific model used was the Meta-Llama-3.1-8B-InstructQ4_k_M.gguf, with 8 billion parameters. It is tuned for generating instructional and conversational responses, allowing it to respond accurately and naturally to user queries.</p>
<p>
<xref ref-type="sec" rid="s4">Section 4</xref> describes how different combinations of the factors <inline-formula id="inf133">
<mml:math id="m134">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, <inline-formula id="inf134">
<mml:math id="m135">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and <inline-formula id="inf135">
<mml:math id="m136">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> were evaluated for the generation of the final explanation <inline-formula id="inf136">
<mml:math id="m137">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>. For the combination with all factors, Llama was called with the following prompt: &#x201c;You are a social assistive robot. According to the role <inline-formula id="inf137">
<mml:math id="m138">
<mml:mrow>
<mml:mo stretchy="false">[</mml:mo>
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
<mml:mo stretchy="false">]</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> of the target that you are answering and the question asked <inline-formula id="inf138">
<mml:math id="m139">
<mml:mrow>
<mml:mo stretchy="false">[</mml:mo>
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
<mml:mo stretchy="false">]</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula>. Compress the answer with the meaningful information: <inline-formula id="inf139">
<mml:math id="m140">
<mml:mrow>
<mml:mo stretchy="false">[</mml:mo>
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
<mml:mo stretchy="false">]</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula>.&#x201d; For other combinations of factors, the prompt was adjusted correspondingly.</p>
</sec>
</sec>
<sec id="s4">
<label>4</label>
<title>Evaluation</title>
<p>The proposed methodology was implemented on a computer and evaluated using three experiments. Before providing detailed descriptions of these experiments, we provide a summary of the design and results of the experiments.</p>
<p>Experiment I assessed the quality of various system-generated explanations in terms of how well they are tailored to a specific social role. The system-generated explanations were assessed by experts and by 30 recruited participants filling out questionnaires. The vast majority of the participants were staff at the Electronic Technology Department at the University of Malaga, with some technical knowledge of programming and physical robotic systems. The results established that the most preferred explanations were generated by including the original query <italic>q</italic> and the social role <italic>s</italic> in the LLM prompt used to refine <inline-formula id="inf140">
<mml:math id="m141">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> to the final explanation <inline-formula id="inf141">
<mml:math id="m142">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> (step 6 in <xref ref-type="fig" rid="F1">Figure 1</xref>).</p>
<p>Experiment II investigated how well the system inferred the social role, given a natural language query. For this, all queries used in Experiment I were tested, and in addition, 30 survey participants generated queries to an imagined robot, assuming one of the social roles of family member, resident, and technician. As summarized in <xref ref-type="table" rid="T10">Table 10</xref>, the accuracy for recognition of the three social roles varied between 83% and 90%.</p>
<p>Experiment III evaluated the system-generated explanations by calculating the cosine similarity between human-generated explanations, serving as ground truth, and system-generated explanations. As reported in <xref ref-type="table" rid="T11">Table 11</xref>, the cosine similarities were maximized for system-generated explanations aimed for the same social role as the human-generated explanations. For all three roles, these similarity scores were higher than 86%. The three conducted experiments are described in detail in the following subsections.</p>
<sec id="s4-1">
<label>4.1</label>
<title>Experiment I</title>
<p>The first experiment aimed at investigating the effect of providing various types of information to the LLM for the generation of explanations. In particular, for each original query, four use cases were considered: <italic>Why did Alberto choose from the menu today?</italic>, <italic>Why did you give cognitive therapy to Alberto?</italic>, <italic>Why did you detect Jose?</italic>, and <italic>Why are you starting to move around</italic>; corresponding modified questions, tailored to one of the social roles of family member, resident, and technician, were then generated. For each such modified question, four combinations of <inline-formula id="inf142">
<mml:math id="m143">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, <inline-formula id="inf143">
<mml:math id="m144">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and <inline-formula id="inf144">
<mml:math id="m145">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> were used to formulate four LLM prompts, as described in <xref ref-type="sec" rid="s3-5">Section 3.5</xref>. The combinations, denoted <inline-formula id="inf145">
<mml:math id="m146">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:mi>C</mml:mi>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>, were defined as follows:<list list-type="simple">
<list-item>
<p>
<inline-formula id="inf146">
<mml:math id="m147">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>: <inline-formula id="inf147">
<mml:math id="m148">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf148">
<mml:math id="m149">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>: <inline-formula id="inf149">
<mml:math id="m150">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> and <inline-formula id="inf150">
<mml:math id="m151">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf151">
<mml:math id="m152">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>3</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>: <inline-formula id="inf152">
<mml:math id="m153">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> and <inline-formula id="inf153">
<mml:math id="m154">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf154">
<mml:math id="m155">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>: <inline-formula id="inf155">
<mml:math id="m156">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, <inline-formula id="inf156">
<mml:math id="m157">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and <inline-formula id="inf157">
<mml:math id="m158">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</list-item>
</list>
</p>
<p>The quality and adequacy of the output of the final explanation <inline-formula id="inf158">
<mml:math id="m159">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> for <inline-formula id="inf159">
<mml:math id="m160">
<mml:mrow>
<mml:msub>
<mml:mrow>
<mml:mi>C</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:msub>
<mml:mo>&#x2212;</mml:mo>
<mml:msub>
<mml:mrow>
<mml:mi>C</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> was then assessed by 30 test participants. In particular, they were asked to mark which one of the explanations generated through the four combinations <inline-formula id="inf160">
<mml:math id="m161">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:mi>C</mml:mi>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula> they preferred, considering semantic adequacy, linguistic efficiency, temporal contextualization, and social role. By the term contextualization, we refer to correct identification of the cause-and-effect structures, and by the term personalization, we refer to the explanations being tailored to the social role of the human and to the linguistic subtleties in the natural language query. Note that each participant assessed the suitability of the generated questions for assumed interlocutors with different social roles. The age distribution of the participants was as follows: under 30 years (6.67%), 30&#x2013;44 years (23.33%), 45&#x2013;60 years (43.33%), and over 60 years (26.67%). A total of 56.67% of the participants were male and 43.33% were female participants. Details are reported in the next section, and a tabular summary of the 48 explanations preferred by the participants is provided in <xref ref-type="sec" rid="s4-1-1">Section 4.1.1</xref>.</p>
<p>Additionally, the authors of the paper conducted an expert evaluation of the obtained final system-generated explanation regarding the identification of social roles <inline-formula id="inf161">
<mml:math id="m162">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> and events <inline-formula id="inf162">
<mml:math id="m163">
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and also the differences between the four combinations <inline-formula id="inf163">
<mml:math id="m164">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:mi>C</mml:mi>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula> of information (see details in <xref ref-type="sec" rid="s4-1-1">Section 4.1.1</xref>).</p>
<p>For all examined cases, the social role <inline-formula id="inf164">
<mml:math id="m165">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> recognized by Rasa as described in <xref ref-type="sec" rid="s3-2">Section 3.2</xref> matched the social role assumed when constructing the three modified social role questions. All events <inline-formula id="inf165">
<mml:math id="m166">
<mml:mrow>
<mml:mi>e</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> were also correctly recognized for all modified questions. As a result, the initial explanations <inline-formula id="inf166">
<mml:math id="m167">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">init</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> (and thereby <inline-formula id="inf167">
<mml:math id="m168">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>) were also the same.</p>
<p>In the following, all use case queries and all 48 assessed explanations are listed.</p>
<p>For ease of reference, each explanation is marked with a sequential number within parentheses. The percentage of test participants preferring one of the four versions <inline-formula id="inf168">
<mml:math id="m169">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:mi>C</mml:mi>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula> is added after the explanation.</p>
<p>
<statement content-type="example" id="Example_1">
<label>Example 1</label>
<p>System-generated explanations for use<inline-formula id="inf169">
<mml:math id="m170">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf170">
<mml:math id="m171">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>menu.</p>
<p>Original query: Why did Alberto choose from the menu today?</p>
<p>Recognized event <italic>e</italic>: Use_case_menu_started (Alberto).</p>
<p>
<inline-formula id="inf171">
<mml:math id="m172">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>: Because the robot ended the cognitive therapy as it only asks a limited number of questions to avoid exhausting the user, Alberto was detected by the robot&#x2019;s facial recognition camera, Alberto did not have the cognitive therapy activity scheduled for today or has just completed it, and Alberto had not ordered any food. As a result, the robot approached a recognized person Alberto and asked for his menu choices. Menu selection was made by touching appropriate images on the robot&#x2019;s screen.</p>
</statement>
</p>
<sec id="s4-1-1">
<label>4.1.1</label>
<title>Social role: family</title>
<p>Modified social role question <italic>q</italic>: Why did my father Alberto choose his menu today?</p>
<p>Generated final explanations <inline-formula id="inf172">
<mml:math id="m173">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (1) I approach Alberto because I detected him through my camera, and as he does not have a scheduled therapy session or a food order, I am here to help him choose his meal. 0%</p>
</list-item>
<list-item>
<p>C2: (2) I approached Alberto because he was recognized by my facial recognition camera, and as he did not have a scheduled cognitive therapy session today, I asked him to order his meal by selecting from the menu on my screen. 0%</p>
</list-item>
<list-item>
<p>C3: (3) Good morning, Alberto! I am here to help. I noticed you are here, so I shall ask, would you like to order some lunch today? 0%</p>
</list-item>
<list-item>
<p>C4: (4) I helped your father order the menu because I finished his therapy session and saw that he had not eaten yet, so I offered him the menu on my screen. 100%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-2">
<label>4.1.2</label>
<title>Social role: resident</title>
<p>Modified social role question <italic>q</italic>: I am Alberto, why did you ask me to select my menu?</p>
<p>Generated final explanations <inline-formula id="inf173">
<mml:math id="m174">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (5) I approach Alberto because I detected him through my camera and he was not scheduled for therapy today, and he has not ordered food, so I am offering him the menu to make a selection. 0%</p>
</list-item>
<list-item>
<p>C2: (6) I asked you to select your menu, Alberto, because I detected you with my camera and saw you were not in therapy today, and you have not ordered food yet, so I wanted to help you choose your meal. 0%</p>
</list-item>
<list-item>
<p>C3: (7) I am here to assist you, Alberto. I noticed you were here, so I shall show you the menu for today. Can you please touch the images on my screen to choose what you would like to eat? 26.67%</p>
</list-item>
<list-item>
<p>C4: (8) I asked you to select your menu because I recognized you, saw you had finished therapy, and knew you had not ordered yet, so I helped you choose your meal. 73.33%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-3">
<label>4.1.3</label>
<title>Social role: technician</title>
<p>Modified social role question <italic>q</italic>: Why did the system ask Alberto to choose from the menu today?</p>
<p>Generated final explanations <inline-formula id="inf174">
<mml:math id="m175">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (9) I approach Alberto because I detected him with my camera, and as he does not have a scheduled therapy session or a food order, I am offering him the menu to select his meal. 6.67%</p>
</list-item>
<list-item>
<p>C2: (10) I ordered the menu to Alberto because I detected him with my camera, he did not have a scheduled therapy session today and had not ordered food yet, so I approached him to offer the menu, and he can select his choices by touching the screen. 23.33%</p>
</list-item>
<list-item>
<p>C3: (11) I am approaching Alberto because I detected him with my camera and he does not have a scheduled therapy session or a food order, so I am offering him the menu to make a selection. 0%</p>
</list-item>
<list-item>
<p>C4: (12) I selected the menu for Alberto because our system detected him through facial recognition and determined he was done with therapy and had not ordered food yet, so I prompted him to choose from the menu on the screen. 70%</p>
</list-item>
</list>
</p>
<p>
<statement content-type="example" id="Example_2">
<label>Example 2</label>
<p>System-generated explanations for use<inline-formula id="inf175">
<mml:math id="m176">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf176">
<mml:math id="m177">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>cognitive therapy</p>
<p>Original query: Why did you give cognitive therapy to Alberto?</p>
<p>Recognized event <italic>e</italic>: Use_case_cognitive_started (Alberto).</p>
<p>
<inline-formula id="inf177">
<mml:math id="m178">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>: Because Alberto was detected by the robot&#x2019;s facial recognition camera, Alberto was scheduled for the cognitive therapy activity today, and it was the right time for cognitive therapy. As a result, when the robot recognized Alberto who participates in the therapy, it offered the possibility to start an activity, which is conducted using the robot&#x2019;s touch screen.</p>
</statement>
</p>
</sec>
<sec id="s4-1-4">
<label>4.1.4</label>
<title>Social role: family</title>
<p>Modified social role question <italic>q</italic>: Why did you give cognitive therapy to my father Alberto?</p>
<p>Generated final explanations <inline-formula id="inf178">
<mml:math id="m179">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (13) I am starting the cognitive therapy activity with Alberto because I detected him through my camera and it was his scheduled time today. 0%</p>
</list-item>
<list-item>
<p>C2: (14) I gave cognitive therapy to your father Alberto because I detected him through my camera and it was his scheduled therapy time today. 0%</p>
</list-item>
<list-item>
<p>C3: (15) I am here to help Alberto with his cognitive therapy session, which is scheduled for today. 16.67%</p>
</list-item>
<list-item>
<p>C4: (16) I gave your father cognitive therapy because I recognized him and knew he had a scheduled session today, so I offered him the activity on my screen. 83.33%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-5">
<label>4.1.5</label>
<title>Social role: resident</title>
<p>Modified social role question <italic>q</italic>: I am Alberto, why did you ask me to start the cognitive session?</p>
<p>Generated final explanations <inline-formula id="inf179">
<mml:math id="m180">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (17) I am recognizing Alberto through the camera, and as he is scheduled for cognitive therapy today, I am offering him the chance to start the activity on my touch screen. 3.33%</p>
</list-item>
<list-item>
<p>C2: (18) I asked you some questions, Alberto, because I detected you through my camera and it was your scheduled therapy time today. 6.67%</p>
</list-item>
<list-item>
<p>C3: (19) I am here to help you, Alberto, because it is time for your cognitive therapy session today, and I have been programmed to assist you with it. 26.67%</p>
</list-item>
<list-item>
<p>C4: (20) I asked you questions because I recognized you and knew it was time for your therapy session, so I offered you the activity on my screen. 63.33%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-6">
<label>4.1.6</label>
<title>Social role: technician</title>
<p>Modified social role question <italic>q</italic>: Why did you perform the cognitive therapy use case to Alberto?</p>
<p>Generated final explanations <inline-formula id="inf180">
<mml:math id="m181">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (21) I am starting the cognitive therapy activity with Alberto because I have recognized him through my camera and it is his scheduled time. 3.33%</p>
</list-item>
<list-item>
<p>C2: (22) I performed the cognitive therapy use case with Alberto because I detected him through my facial recognition camera, and he had a scheduled therapy session today, which is the optimal time for it. 13.33%</p>
</list-item>
<list-item>
<p>C3: (23) I am recognizing Alberto through the facial recognition camera, and as he is scheduled for cognitive therapy today, I am offering him the opportunity to start the activity on my touch screen. 26.67%</p>
</list-item>
<list-item>
<p>C4: (24) I performed the cognitive therapy use case with Alberto because our system detected him through facial recognition and confirmed he had a scheduled therapy session today, so I initiated the activity on my screen. 56.67%</p>
</list-item>
</list>
</p>
<p>
<statement content-type="example" id="Example_3">
<label>Example 3</label>
<p>System-generated explanations for use<inline-formula id="inf181">
<mml:math id="m182">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf182">
<mml:math id="m183">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>person detection</p>
<p>Original query: Why did you detect Jose?</p>
<p>Recognized event <italic>e</italic>: Person_detected (Jose).</p>
<p>
<inline-formula id="inf183">
<mml:math id="m184">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>: Because Jose was sitting or standing in front of the robot, the light level in the room was sufficient for the robot&#x2019;s camera, and Jose&#x2019;s face is stored in the robot&#x2019;s database. As a result, Jose was detected through the robot&#x2019;s facial recognition camera.</p>
</statement>
</p>
</sec>
<sec id="s4-1-7">
<label>4.1.7</label>
<title>Social role: family</title>
<p>Modified social role question <italic>q</italic>: Why did you detect my father Jose?</p>
<p>Generated final explanations <inline-formula id="inf184">
<mml:math id="m185">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (25) I detected Jose because he was in my line of sight, the room was well-lit, and his face is stored in my database, allowing my facial recognition camera to identify him. 0%</p>
</list-item>
<list-item>
<p>C2: (26) I detected your father Jose because he was in front of me, the room was well-lit, and his face was in my database, allowing my facial recognition camera to identify him. 0%</p>
</list-item>
<list-item>
<p>C3: (27) Ah, Jose is here! I have recognized him through my facial recognition system, which uses the camera to detect him when he is in front of me and the lighting is good, and as his face is stored in my database. 20%</p>
</list-item>
<list-item>
<p>C4: (28) I detected your father Jose because he was in front of me, the room had sufficient lighting, and his face is stored in my database, allowing me to recognize him through my facial recognition camera. 80%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-8">
<label>4.1.8</label>
<title>Social role: resident</title>
<p>Modified social role question <italic>q</italic>: I am Jose, why did you detect me?</p>
<p>Generated final explanations <inline-formula id="inf185">
<mml:math id="m186">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (29) I detected Jose because he was in my line of sight, the room was well-lit, and his face is stored in my database, allowing my facial recognition camera to identify him. 10%</p>
</list-item>
<list-item>
<p>C2: (30) I detected you, Jose, because you are in front of me, the room is well-lit, and your face is stored in my database, allowing my facial recognition camera to identify you. 0%</p>
</list-item>
<list-item>
<p>C3: (31) I am glad I was able to catch your attention, Jose! My system recognized you because you are right in front of me, the lighting is good, and I have your face stored in my memory. It is nice to see you! 30%</p>
</list-item>
<list-item>
<p>C4: (32) I detected you, Jose, because you were in front of me, the room had good lighting, and your face is stored in my database, which allowed me to recognize you through my facial recognition camera. 60%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-9">
<label>4.1.9</label>
<title>Social role: technician</title>
<p>Modified social role question <italic>q</italic>: Why did your recognition system detect Jose?</p>
<p>Generated final explanations <inline-formula id="inf186">
<mml:math id="m187">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (33) I detected Jose because he was in my line of sight, the room was well-lit, and his face is stored in my database, allowing my facial recognition camera to identify him. 26.67%</p>
</list-item>
<list-item>
<p>C2: (34) My recognition system detected Jose because he was in my direct view, the room had sufficient lighting, and his face is stored, allowing facial recognition to identify him. 13.33%</p>
</list-item>
<list-item>
<p>C3: (35) System check confirms that Jose&#x2019;s face was detected by the facial recognition camera due to optimal lighting conditions and his stored profile in the database, indicating a successful recognition event. 0%</p>
</list-item>
<list-item>
<p>C4: (36) Our recognition system detected Jose because he was in direct view of the camera, the room&#x2019;s lighting was adequate for the camera, and his face is stored in our database, which enabled our facial recognition camera to identify him. 60%</p>
</list-item>
</list>
</p>
<p>
<statement content-type="example" id="Example_4">
<label>Example 4</label>
<p>System-generated explanations for use<inline-formula id="inf187">
<mml:math id="m188">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>case<inline-formula id="inf188">
<mml:math id="m189">
<mml:mrow>
<mml:mtext>_</mml:mtext>
</mml:mrow>
</mml:math>
</inline-formula>wandering</p>
<p>Original query: Why are you starting to move around?</p>
<p>Recognized event <italic>e</italic>: Use_case_wandering_started.</p>
<p>
<inline-formula id="inf189">
<mml:math id="m190">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>: Because the robot finished the request, having already notified the therapist of the user&#x2019;s need. As a result, the robot moved to random locations in a specified area looking for opportunities to perform a use case.</p>
</statement>
</p>
</sec>
<sec id="s4-1-10">
<label>4.1.10</label>
<title>Social role: family</title>
<p>Modified social role question <italic>q</italic>: Why are you starting to move around my father&#x2019;s room?</p>
<p>Generated final explanations <inline-formula id="inf190">
<mml:math id="m191">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (37) Notified therapist, moving to random locations to perform use case. 10%</p>
</list-item>
<list-item>
<p>C2: (38) I am moving around your father&#x2019;s room because I have completed the task of notifying the therapist of his need, and now I am exploring the area to identify opportunities to assist him. 3.33%</p>
</list-item>
<list-item>
<p>C3: (39) I have completed the task and notified the therapist. Now, I am roaming the area, looking for opportunities to engage with the residents and perform a use case, perhaps assisting with medication reminders, providing companionship, or helping with daily tasks. 0%</p>
</list-item>
<list-item>
<p>C4: (40) I am moving around your father&#x2019;s room because I have finished assisting with his request, and now I am exploring the area to see if there are any other ways I can help him, perhaps by reminding him of his medication schedule or helping him find something he needs. 86.67%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-11">
<label>4.1.11</label>
<title>Social role: resident</title>
<p>Modified social role question <italic>q</italic>: Why are you starting to move around?</p>
<p>Generated final explanations <inline-formula id="inf191">
<mml:math id="m192">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (41) Notified therapist, moving to random locations to perform use case. 0%</p>
</list-item>
<list-item>
<p>C2: (42) I have completed the task of notifying the therapist of the user&#x2019;s need. Now, I am moving to random locations in the specified area to identify opportunities to perform a use case and assist the residents. 0%</p>
</list-item>
<list-item>
<p>C3: (43) Hello! I am glad to see you are doing well today. I have finished helping with your request, and I am now exploring the area to see if I can assist you with anything else, perhaps reminding you of your medication schedule or helping you find something in the activity room? 46.67%</p>
</list-item>
<list-item>
<p>C4: (44) I am moving around because I have completed my current task of notifying the therapist about the user&#x2019;s need, so I am now exploring the area to identify new opportunities to assist and perform various use cases. 53.33%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-12">
<label>4.1.12</label>
<title>Social role: technician</title>
<p>Modified social role question <italic>q</italic>: Why did your system decide to start moving?</p>
<p>Generated final explanations <inline-formula id="inf192">
<mml:math id="m193">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>:<list list-type="simple">
<list-item>
<p>C1: (45) Notified therapist, moving to random locations to perform use case. 16.67%</p>
</list-item>
<list-item>
<p>C2: (46) I started moving because I completed the task of notifying the therapist of the user&#x2019;s need, so I am now exploring the area to identify opportunities to assist the residents. 6.67%</p>
</list-item>
<list-item>
<p>C3: (47) System check: task completed, user&#x2019;s need notified to the therapist. Now, I am roaming the designated area, scanning for opportunities to engage in use cases, such as medication reminders, social interaction, or task assistance, to ensure optimal support for the residents. 0%</p>
</list-item>
<list-item>
<p>C4: (48) My system decided to start moving because I have completed the current task of notifying the therapist about the user&#x2019;s need, and now I am entering autonomous mode to proactively seek out new opportunities to assist and perform various use cases in the specified area. 76.67%</p>
</list-item>
</list>
</p>
</sec>
<sec id="s4-1-13">
<label>4.2.1</label>
<title>Analysis of the results from experiment I</title>
<sec id="s4-1-13-1">
<label>4.2.1.1</label>
<title>Expert evaluation</title>
<p>The effect of including varying amount of information (C1&#x2013;C4) in the generation of explanations was assessed by the authors and by survey participants. Comparing explanations based on C2 and C4 (both including the query <italic>q</italic>) with C1 and C3 (neither including the query <italic>q</italic>), it becomes clear that <italic>q</italic> contains important information that is not reflected in the event <italic>e</italic> extracted from <italic>q</italic>. This additional information allows for explanations that, for example, use the correct and specific pronouns, such as &#x201c;your menu&#x201d; (6) and &#x201c;your father&#x201d; (14, 26, and 38). Omitting this information sometimes leads to explanations with incorrect pronouns, such as &#x201c;Good morning Alberto &#x2026; &#x201d; (3) although the query states &#x201c;Why did my father Alberto &#x2026; ,&#x201d; &#x201c;I&#x2019;m recognizing Alberto &#x2026; &#x201d; (17) although the query states &#x201c;I am Alberto &#x2026; ,&#x201d; and &#x201c;Ah, Jose is here!&#x2026;&#x201d; (27) although the query states &#x201c;Why did you detect my father &#x2026; &#x201d;</p>
<p>Adding the social role <italic>s</italic> of the user (C3 and C4) clearly adapts the language of the explanations to the assumed social context. Some examples for the social roles family and resident are as follows: &#x201c;I&#x2019;m here to help &#x2026; &#x201d; (15, 19), &#x201c;I noticed you&#x2019;re here &#x2026; &#x201d; (3, 7), and &#x201c;I recognized you &#x2026; &#x201d; (20). Some examples for the social role technician are as follows: &#x201c;Our system detected him through facial recognition &#x2026; &#x201d; (24), &#x201c;&#x2026;touch screen&#x201d; (23), &#x201c;&#x2026;initiated the activity &#x2026; &#x201d; (24), and &#x201c;entering autonomous mode &#x2026; &#x201d; (48).</p>
</sec>
<sec id="s4-1-13-2">
<label>4.2.1.2</label>
<title>Participant assessment</title>
<p>Our qualitative assessment above matched the survey participants&#x2019; preferences reported in the questionnaires. The percentages reported (see <xref ref-type="table" rid="T9">Table 9</xref> for an overview) indicate that C4 (including both <italic>s</italic> and <italic>q</italic>) is preferred by a majority of the participants for all investigated cases.</p>
<table-wrap id="T9" position="float">
<label>TABLE 9</label>
<caption>
<p>Overview percentage of the preferred system-generated explanations.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="left"/>
<th align="left">C1: <inline-formula id="inf193">
<mml:math id="m194">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">C2: <inline-formula id="inf194">
<mml:math id="m195">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> &#x2b; <inline-formula id="inf195">
<mml:math id="m196">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">C3: <inline-formula id="inf196">
<mml:math id="m197">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> &#x2b; <inline-formula id="inf197">
<mml:math id="m198">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
<th align="left">C4: <inline-formula id="inf198">
<mml:math id="m199">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> &#x2b; <inline-formula id="inf199">
<mml:math id="m200">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> &#x2b; <inline-formula id="inf200">
<mml:math id="m201">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>
</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td colspan="5" align="left">Use case menu</td>
</tr>
<tr>
<td align="center">Family member</td>
<td align="center">0%</td>
<td align="center">0%</td>
<td align="center">0%</td>
<td align="center">100%</td>
</tr>
<tr>
<td align="center">Resident</td>
<td align="center">0%</td>
<td align="center">0%</td>
<td align="center">26.67%</td>
<td align="center">73.33%</td>
</tr>
<tr>
<td align="center">Technician</td>
<td align="center">6.67%</td>
<td align="center">23.33%</td>
<td align="center">0%</td>
<td align="center">70%</td>
</tr>
<tr>
<td colspan="5" align="left">Use case cognitive therapy</td>
</tr>
<tr>
<td align="center">Family member</td>
<td align="center">0%</td>
<td align="center">0%</td>
<td align="center">16.67%</td>
<td align="center">83.33%</td>
</tr>
<tr>
<td align="center">Resident</td>
<td align="center">3.33%</td>
<td align="center">6.67%</td>
<td align="center">26.67%</td>
<td align="center">63.33%</td>
</tr>
<tr>
<td align="center">Technician</td>
<td align="center">3.33%</td>
<td align="center">13.33%</td>
<td align="center">26.67%</td>
<td align="center">56.67%</td>
</tr>
<tr>
<td colspan="5" align="left">Use case person interaction</td>
</tr>
<tr>
<td align="center">Family member</td>
<td align="center">0%</td>
<td align="center">0%</td>
<td align="center">20%</td>
<td align="center">80%</td>
</tr>
<tr>
<td align="center">Resident</td>
<td align="center">10%</td>
<td align="center">0%</td>
<td align="center">30%</td>
<td align="center">60%</td>
</tr>
<tr>
<td align="center">Technician</td>
<td align="center">26.67%</td>
<td align="center">13.33%</td>
<td align="center">0%</td>
<td align="center">60%</td>
</tr>
<tr>
<td colspan="5" align="left">Use case wandering</td>
</tr>
<tr>
<td align="center">Family member</td>
<td align="center">10%</td>
<td align="center">3.33%</td>
<td align="center">0%</td>
<td align="center">86.67%</td>
</tr>
<tr>
<td align="center">Resident</td>
<td align="center">0%</td>
<td align="center">0%</td>
<td align="center">46.67%</td>
<td align="center">53.33%</td>
</tr>
<tr>
<td align="center">Technician</td>
<td align="center">16.67%</td>
<td align="center">6.67%</td>
<td align="center">0%</td>
<td align="center">76.67%</td>
</tr>
<tr>
<td align="center">Total</td>
<td align="center">6.39%</td>
<td align="center">5.56%</td>
<td align="center">16.11%</td>
<td align="center">71.94%</td>
</tr>
</tbody>
</table>
<table-wrap-foot>
<fn>
<p>
<inline-formula id="inf201">
<mml:math id="m202">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>1</mml:mn>
<mml:mo>&#x2212;</mml:mo>
<mml:mi>C</mml:mi>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula> denote different combinations of syntactically enhanced explanations <inline-formula id="inf202">
<mml:math id="m203">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">syn</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>, social roles <inline-formula id="inf203">
<mml:math id="m204">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>, and original queries <inline-formula id="inf204">
<mml:math id="m205">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> that are used to construct the prompt to the LLM for generation of the final explanation <inline-formula id="inf205">
<mml:math id="m206">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
</fn>
</table-wrap-foot>
</table-wrap>
<p>Pairwise chi-square tests were conducted to confirm that the number of votes for C4 was larger than that for each of C1, C2, and C3.</p>
<p>These tests were conducted on the data aggregated over all user cases and social roles, with the null hypotheses that the preference for C4 is the same as that for C1, C2, and C3.</p>
<p>In all cases, the null hypothesis could be rejected with p-values <inline-formula id="inf206">
<mml:math id="m207">
<mml:mrow>
<mml:mo>&#x226a;</mml:mo>
<mml:mn>0.0001</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>. Although responses were not strictly independent as each participant answered multiple questions, the very low p-values strongly suggest that C4 is the most preferred option.</p>
<p>It should be noted that this conclusion is based on the aggregated data and that the situation for individual use cases/social roles may differ. However, such an analysis would require a larger study for statistical significance.</p>
<p>Hence, we conclude that generated explanations benefit from the extra information provided by both original query <italic>q</italic> and social role <italic>s</italic>. Query <italic>q</italic> contains additional information that is not included in recognized event <italic>e</italic>, and <italic>s</italic> enables adaption of both language and content to fit the social context and the user&#x2019;s specific need for information.</p>
<p>
<inline-formula id="inf207">
<mml:math id="m208">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>3</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula> (including the social role <inline-formula id="inf208">
<mml:math id="m209">
<mml:mrow>
<mml:mi>s</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> but not the query <inline-formula id="inf209">
<mml:math id="m210">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula>) is the second most preferred option, indicating that social context plays an important role for the generation of explanations. <inline-formula id="inf210">
<mml:math id="m211">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>, that is, including only cause-and-effect information, is preferred roughly as often as <inline-formula id="inf211">
<mml:math id="m212">
<mml:mrow>
<mml:mi>C</mml:mi>
<mml:mn>2</mml:mn>
</mml:mrow>
</mml:math>
</inline-formula>, in which the query <inline-formula id="inf212">
<mml:math id="m213">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> is added.</p>
</sec>
</sec>
</sec>
<sec id="s4-2">
<label>4.2</label>
<title>Experiment II</title>
<p>The trained Rasa intent recognizer successfully inferred the social roles associated with all questions in Experiment I. To further evaluate this ability, an additional experiment was conducted with 30 participants (same as in Experiment I). The participants were asked to assume the three social roles and formulate open questions to a hypothetical robot, for example,<list list-type="simple">
<list-item>
<p>
<inline-formula id="inf213">
<mml:math id="m214">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Family: Why did not you remind my father about the physiotherapy appointment earlier?</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf214">
<mml:math id="m215">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Resident: Why did you ask John what he wants to eat before you asked me?</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf215">
<mml:math id="m216">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Technician: Why did the system decide to give the menu to Alberto?</p>
</list-item>
</list>
</p>
<p>For each of the resulting 90 questions, the role was inferred by Rasa and compared with the actual role assumed by the participant formulating the question. The overall accuracy is summarized in <xref ref-type="table" rid="T10">Table 10</xref>. For example, for 27 of the 30 questions asked by participants assuming the family role, the role was correctly inferred. Incorrect inferences were mainly related to the distinction between the resident and technician, particularly for questions of a technical informative nature asked in a colloquial tone, such as &#x201c;Why did the system decide to give the menu to Alberto?&#x201d;. Averaged over all social roles, the accuracy was <inline-formula id="inf216">
<mml:math id="m217">
<mml:mrow>
<mml:mn>84</mml:mn>
<mml:mi>%</mml:mi>
<mml:mrow>
<mml:mo stretchy="false">(</mml:mo>
<mml:mrow>
<mml:mn>76</mml:mn>
<mml:mo>/</mml:mo>
<mml:mn>90</mml:mn>
</mml:mrow>
<mml:mo stretchy="false">)</mml:mo>
</mml:mrow>
</mml:mrow>
</mml:math>
</inline-formula>.</p>
<table-wrap id="T10" position="float">
<label>TABLE 10</label>
<caption>
<p>Social role recognition performance.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th align="center">Role</th>
<th align="center">Accuracy</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="center">Family</td>
<td align="center">90.00% (27/30)</td>
</tr>
<tr>
<td align="center">Resident</td>
<td align="center">80.00% (24/30)</td>
</tr>
<tr>
<td align="center">Technician</td>
<td align="center">83.33% (25/30)</td>
</tr>
</tbody>
</table>
</table-wrap>
</sec>
<sec id="s4-3">
<label>4.3</label>
<title>Experiment III</title>
<p>To evaluate how well the system-generated explanations matched human-generated explanations for given social roles, the following experiment was conducted. For each of the questions in the use case examples 1&#x2013;4 (see <xref ref-type="sec" rid="s4-1">Section 4.1</xref>) and for each social role, a human-generated explanation was generated by one of the authors. For example, for &#x201c;Why did Alberto choose from the menu today?&#x201d; (example 1), the following explanations were generated:<list list-type="simple">
<list-item>
<p>
<inline-formula id="inf217">
<mml:math id="m218">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Family: Your father chose the menu today because he had finished therapy and did not have lunch yet.</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf218">
<mml:math id="m219">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Resident: You selected the menu because you had completed your therapy and not yet ordered it.</p>
</list-item>
<list-item>
<p>
<inline-formula id="inf219">
<mml:math id="m220">
<mml:mrow>
<mml:mo>&#x2022;</mml:mo>
</mml:mrow>
</mml:math>
</inline-formula> Technician: I selected the menu case for him because I determined he was done with therapy and had not ordered food yet.</p>
</list-item>
</list>
</p>
<p>For each question and social role, a system-generated final explanation <inline-formula id="inf220">
<mml:math id="m221">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> was also created. The cosine similarity between the embedding of the final explanation <inline-formula id="inf221">
<mml:math id="m222">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula> and the embedding of the corresponding human-generated explanation was then computed and assigned as the quality <inline-formula id="inf222">
<mml:math id="m223">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> of the final explanation <inline-formula id="inf223">
<mml:math id="m224">
<mml:mrow>
<mml:mi>e</mml:mi>
<mml:mi>x</mml:mi>
<mml:msub>
<mml:mrow>
<mml:mi>p</mml:mi>
</mml:mrow>
<mml:mrow>
<mml:mi mathvariant="italic">final</mml:mi>
</mml:mrow>
</mml:msub>
</mml:mrow>
</mml:math>
</inline-formula>. The procedure was repeated for all three social roles and the four questions in examples 1&#x2013;4. Average <inline-formula id="inf224">
<mml:math id="m225">
<mml:mrow>
<mml:mi>q</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> values are presented in <xref ref-type="table" rid="T11">Table 11</xref>. The maximum value for each row lies on the diagonal in the table, which confirms that the system adapts the explanations well to the targeted social role.</p>
<table-wrap id="T11" position="float">
<label>TABLE 11</label>
<caption>
<p>Cosine similarity between system-generated explanations and human-generated reference explanations for different targeted social roles.</p>
</caption>
<table>
<thead valign="top">
<tr>
<th rowspan="2" align="center">System-generated explanation</th>
<th colspan="3" align="center">Human-generated explanation</th>
</tr>
<tr>
<th align="center">Family, %</th>
<th align="center">Resident, %</th>
<th align="center">Technician, %</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left">Family</td>
<td align="left">90.17</td>
<td align="left">76.45</td>
<td align="left">78.88</td>
</tr>
<tr>
<td align="left">Resident</td>
<td align="left">76.10</td>
<td align="left">86.41</td>
<td align="left">79.31</td>
</tr>
<tr>
<td align="left">Technician</td>
<td align="left">77.27</td>
<td align="left">77.13</td>
<td align="left">88.71</td>
</tr>
</tbody>
</table>
</table-wrap>
</sec>
</sec>
<sec id="s5">
<label>5</label>
<title>Discussion and limitations</title>
<p>We examined how integrating social roles, user queries, and cause-and-effect structures influences the generation and perception of causal explanations. The presented framework combines manual control for factual causal correctness (via the causal log) and flexibility and variety in linguistic expression (via LLMs).</p>
<p>As mentioned in <xref ref-type="sec" rid="s2-1">Section 2.1</xref>, some related earlier studies argue for the importance of adapting to the abilities and needs of the inquirer and bridging the mental gap to enable comprehension. Our proposed methodology addresses this by incorporating the social role and the verbally expressed query that potentially encodes beliefs, desires, and other relevant parts of a mental model of the inquirer.</p>
<p>Although the proposed framework shows promise in generating personalized explanations, several challenges remain. The ethical implications extend beyond transparency, touching on issues of integrity, fairness, bias, and the risk of manipulation. Furthermore, explanations must not exploit user vulnerabilities or reinforce harmful stereotypes. In particular, in elder care settings, sensitive personal data, such as levels of cognitive or physical fitness, should be handled with utmost integrity and safety and not be verbalized by the robot when interacting with a resident. Verbally communicating sensitive personal data, in particular in common rooms with other bystanders, may make a resident in an elder care home feel embarrassed, shameful, or stereotyped (<xref ref-type="bibr" rid="B2">Bensch et al., 2023</xref>). Trust calibration also remains a central concern; explanations should align user expectations with the robot&#x2019;s actual capabilities to avoid over-reliance or distrust.</p>
<p>The proposed identification of the social role of the enquirer calls for ethical considerations related to personal integrity. Visiting family members, for example, may or may not want to be identified as such. To ensure that sensitive personal information is not shared with outsiders, electronic ID cards or badges could be a crucial complement. Another important issue that would have to be considered in a real implementation is adaptation to different languages and cultures. Social roles, linguistic expressions, and expectations connected to explanations can vary significantly between cultures and languages. For example, what is considered an appropriate or respectful tone in one culture might be perceived as overly formal or informal in another. Similarly, the interpretation of causal responsibility can differ in different contexts.</p>
<p>In the evaluation, the survey participants assessed the system-generated explanations in terms of their adequacy for an assumed social role. This should be tested and evaluated with users who actually have the social role of, for example, medical staff or family member.</p>
<p>The presented solution offers a robust starting point, combining manual control for factual causal correctness and flexibility of LLMs, but its reliance on specific pretrained models and predefined user interaction modes may limit its flexibility in unstructured environments. Additionally, the computational requirements of LLM-based explanation generation may pose challenges in resource-constrained scenarios. Addressing these limitations will require both algorithmic innovation and hardware optimization.</p>
<p>Additionally, even though the causal log entries are extracted from actual robot sensors, much manual inspection is still required, and the dictionary that describes the causal log entries in natural language has to be created manually. In this paper, we use the causal log to extract only the most recent event for which an explanation was asked; however, the tabular form and indexing allow the causal log to be used for longer causal chains.</p>
</sec>
<sec id="s6">
<label>6</label>
<title>Conclusion and future work</title>
<p>We introduced a framework and methodology that enable robots to generate personalized causal explanations of robot events. By representing robot events as cause&#x2013;effect structures in a causal log that represents the robot&#x2019;s episodic memory, causal correctness is preserved and causal data are transparent. Using machine learning, the human&#x2019;s social role is identified and is, together with the causal data and the natural language query, given to an LLM that then generates linguistically varied causal explanations. We evaluated our approach with 30 participants, who assessed explanations that combined cause&#x2013;effect reasoning, the social role, and the natural language query in different ways. The results show that <inline-formula id="inf225">
<mml:math id="m226">
<mml:mrow>
<mml:mn>72</mml:mn>
<mml:mi>%</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> of the survey participants preferred explanations that integrate all three factors. The second most preferred option was explanations based on the cause-and-effect structures and the social role (see <xref ref-type="table" rid="T9">Table 9</xref> for details).</p>
<p>Future work could investigate whether preferences depend on the social role and specific use cases.</p>
<p>Further evaluations show that the social role of the enquirer was inferred from the query with an accuracy of <inline-formula id="inf226">
<mml:math id="m227">
<mml:mrow>
<mml:mn>79</mml:mn>
<mml:mi>%</mml:mi>
</mml:mrow>
</mml:math>
</inline-formula> (see <xref ref-type="table" rid="T10">Table 10</xref>). It was also shown that system-generated explanations tailored to a specific social role have the highest semantic similarity to human-generated explanations aimed for the same social role (see <xref ref-type="table" rid="T11">Table 11</xref>). This indicates that the adaption of explanations to the social role of the enquirer works as intended.</p>
<p>Overall, the presented solution addresses a critical need for personalized and linguistically varied explanations. We believe that such functionality increases user engagement, as shown in an earlier study where users of a social assistive robot used at a retirement home in Malaga, Spain, remarked on the linguistic monotony of the robot.</p>
<p>The presented methodology has been integrated into a complex robotic cognitive architecture and implemented on a social robot (<xref ref-type="bibr" rid="B10">Galeas et al., 2025</xref>). As a planned next step, the operation will be evaluated in a retirement home with real users. This will involve adapting the software to work seamlessly with robotic hardware, including sensors, actuators, and real-time processing capabilities. Deploying the system in this dynamic environments will provide valuable insights into robustness, usability, and scalability under real-world conditions. Future work on the theoretical aspects will investigate explanations that include indirect causes. As discussed in <xref ref-type="sec" rid="s2-2-4">Section 2.2.4</xref>, the decision on which direct and indirect causes to include is a trade-off. While explanations must be accessible and intuitive, they should also accurately reflect the underlying decision-making process. Over-simplification risks reduce the fidelity of explanations, potentially leading to user misconceptions, whereas overly complex explanations may overwhelm nonexpert users. This balance becomes particularly important in safety-critical domains, such as healthcare and eldercare, where misunderstandings can have significant consequences. Striking this balance will require both algorithm development and iterative testing with diverse user groups to develop optimal explanation strategies for various application domains. Another possible extension is to investigate how markers such as intonation, facial expression, dress code, and age could be used to further improve the personalization of causal explanations.</p>
<p>Through these efforts, we aim to advance the field of explainable or understandable robots, bringing us closer to realizing the vision of socially intelligent robots that seamlessly integrate into our daily lives.</p>
</sec>
</body>
<back>
<sec sec-type="data-availability" id="s7">
<title>Data availability statement</title>
<p>The raw data supporting the conclusions of this article will be made available by the authors, without undue reservation.</p>
</sec>
<sec sec-type="ethics-statement" id="s8">
<title>Ethics statement</title>
<p>Ethical approval was not required for the studies involving humans because the study consisted of participants assessing sentences that were displayed on a screen. We requested informed consent from all participants involved in the study (users and professionals). This informed consent was approved by the Provincial Ethical Committee of the Andalusian Public Healthcare System (Comit&#xe9; de &#xc9;tica de la Investigaci&#xf3;n Provincial de M&#xe1;laga). The study did not involve processing of (sensitive) personal data or involved a physical intervention on participants. The study was not carried out using a method that was intended to affect a participant physically or mentally or involved a clear risk of harming participants. The studies were conducted in accordance with the local legislation and institutional requirements. The participants provided their written informed consent to participate in this study.</p>
</sec>
<sec sec-type="author-contributions" id="s9">
<title>Author contributions</title>
<p>JG: Software, Investigation, Writing &#x2013; original draft, Visualization, Conceptualization, Methodology. SB: Resources, Conceptualization, Validation, Supervision, Formal analysis, Methodology, Writing &#x2013; review and editing. TH: Formal analysis, Resources, Methodology, Supervision, Conceptualization, Validation, Writing &#x2013; review and editing. AB: Resources, Validation, Writing &#x2013; review and editing, Supervision, Formal analysis, Conceptualization.</p>
</sec>
<ack>
<title>Acknowledgements</title>
<p>The authors thank the two reviewers for their thorough reviewing and their accurate feedback on the paper. Some of their suggested thoughts and ideas have been incorporated into the paper.</p>
</ack>
<sec sec-type="COI-statement" id="s11">
<title>Conflict of interest</title>
<p>The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.</p>
</sec>
<sec sec-type="ai-statement" id="s12">
<title>Generative AI statement</title>
<p>The author(s) declare that no Generative AI was used in the creation of this manuscript.</p>
<p>Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.</p>
</sec>
<sec sec-type="disclaimer" id="s13">
<title>Publisher&#x2019;s note</title>
<p>All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.</p>
</sec>
<fn-group>
<fn fn-type="custom" custom-type="edited-by">
<p>
<bold>Edited by:</bold> <ext-link ext-link-type="uri" xlink:href="https://loop.frontiersin.org/people/78087/overview">Silvia Rossi</ext-link>, University of Naples Federico II, Italy</p>
</fn>
<fn fn-type="custom" custom-type="reviewed-by">
<p>
<bold>Reviewed by:</bold> <ext-link ext-link-type="uri" xlink:href="https://loop.frontiersin.org/people/2160877/overview">Karolina Eszter Kov&#xe1;cs</ext-link>, University of Debrecen, Hungary</p>
<p>
<ext-link ext-link-type="uri" xlink:href="https://loop.frontiersin.org/people/3099823/overview">Marc Roig Vilamala</ext-link>, Cardiff University, United Kingdom</p>
</fn>
</fn-group>
<fn-group>
<fn id="fn1">
<label>1</label>
<p>
<ext-link ext-link-type="uri" xlink:href="https://github.com/ggerganov/11ama.cpp">https://github.com/ggerganov/11ama.cpp</ext-link>
</p>
</fn>
</fn-group>
<ref-list>
<title>References</title>
<ref id="B1">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Adadi</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Berrada</surname>
<given-names>M.</given-names>
</name>
</person-group> (<year>2018</year>). <article-title>Peeking inside the black-box: a survey on explainable artificial intelligence (Xai)</article-title>. <source>IEEE Access</source> <volume>6</volume>, <fpage>52138</fpage>&#x2013;<lpage>52160</lpage>. <pub-id pub-id-type="doi">10.1109/ACCESS.2018.2870052</pub-id>
</mixed-citation>
</ref>
<ref id="B2">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Bensch</surname>
<given-names>S.</given-names>
</name>
<name>
<surname>Suna</surname>
<given-names>J.</given-names>
</name>
<name>
<surname>Rubio</surname>
<given-names>J.-P. B.</given-names>
</name>
<name>
<surname>Romero-Garc&#xe9;s</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Hellstr&#xf6;m</surname>
<given-names>T.</given-names>
</name>
</person-group> (<year>2023</year>). &#x201c;<article-title>Personalised multi-modal communication for HRI</article-title>,&#x201d; in <source>In <italic>presented at the WARN workshop at the 32nd IEEE International Conference on Robot and Human Interactive Communication</italic>
</source>. <publisher-loc>Busan, South Korea</publisher-loc>: <publisher-name>RO-MAN</publisher-name>.</mixed-citation>
</ref>
<ref id="B3">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Blatt</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Krishnan</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Klakow</surname>
<given-names>D.</given-names>
</name>
</person-group> (<year>2024</year>). &#x201c;<article-title>Joint vs sequential speaker-role detection and automatic speech recognition for air-traffic control</article-title>,&#x201d; in <source>Interspeech 2024</source>, <fpage>3759</fpage>&#x2013;<lpage>3763</lpage>. <pub-id pub-id-type="doi">10.21437/Interspeech.2024-1987</pub-id>
</mixed-citation>
</ref>
<ref id="B4">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Chakraborti</surname>
<given-names>T.</given-names>
</name>
<name>
<surname>Sreedharan</surname>
<given-names>S.</given-names>
</name>
<name>
<surname>Zhang</surname>
<given-names>Y.</given-names>
</name>
<name>
<surname>Kambhampati</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2017</year>). &#x201c;<article-title>Plan explanations as model reconciliation: moving beyond explanation as soliloquy</article-title>,&#x201d; in <source>Proceedings of the twenty-sixth international joint conference on artificial intelligence</source>. <publisher-loc>Melbourne, Australia</publisher-loc>: <publisher-name>IJCAI-17</publisher-name>, <fpage>156</fpage>&#x2013;<lpage>163</lpage>. <pub-id pub-id-type="doi">10.24963/ijcai.2017/23</pub-id>
</mixed-citation>
</ref>
<ref id="B5">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Chakraborti</surname>
<given-names>T.</given-names>
</name>
<name>
<surname>Sreedharan</surname>
<given-names>S.</given-names>
</name>
<name>
<surname>Kambhampati</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2021</year>). &#x201c;<article-title>The emerging landscape of explainable automated planning &#x26; decision making</article-title>,&#x201d; in <source>Proceedings of the twenty-ninth international joint conference on artificial intelligence</source>. <publisher-loc>Yokohama, Japan</publisher-loc>: <publisher-name>IJCAI&#x2019;20</publisher-name>.</mixed-citation>
</ref>
<ref id="B6">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Eastman</surname>
<given-names>C. M.</given-names>
</name>
</person-group> (<year>1985</year>). <article-title>Establishing social identity through language use</article-title>. <source>J. Lang. Soc. Psychol.</source> <volume>4</volume>, <fpage>1</fpage>&#x2013;<lpage>20</lpage>. <pub-id pub-id-type="doi">10.1177/0261927x8500400101</pub-id>
</mixed-citation>
</ref>
<ref id="B7">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Edmonds</surname>
<given-names>M.</given-names>
</name>
<name>
<surname>Gao</surname>
<given-names>F.</given-names>
</name>
<name>
<surname>Liu</surname>
<given-names>H.</given-names>
</name>
<name>
<surname>Xie</surname>
<given-names>X.</given-names>
</name>
<name>
<surname>Qi</surname>
<given-names>S.</given-names>
</name>
<name>
<surname>Rothrock</surname>
<given-names>B.</given-names>
</name>
<etal/>
</person-group> (<year>2019</year>). <article-title>A tale of two explanations: enhancing human trust by explaining robot behavior</article-title>. <source>Sci. Robotics</source> <volume>4</volume>, <fpage>eaay4663</fpage>. <pub-id pub-id-type="doi">10.1126/scirobotics.aay4663</pub-id>
<pub-id pub-id-type="pmid">33137717</pub-id>
</mixed-citation>
</ref>
<ref id="B8">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Federer</surname>
<given-names>M. R.</given-names>
</name>
<name>
<surname>Nehm</surname>
<given-names>R. H.</given-names>
</name>
<name>
<surname>Opfer</surname>
<given-names>J. E.</given-names>
</name>
<name>
<surname>Pearl</surname>
<given-names>D.</given-names>
</name>
</person-group> (<year>2015</year>). <article-title>Using a constructed-response instrument to explore the effects of item position and item features on the assessment of students&#x2019; written scientific explanations</article-title>. <source>Res. Sci. Educ.</source> <volume>45</volume>, <fpage>527</fpage>&#x2013;<lpage>553</lpage>. <pub-id pub-id-type="doi">10.1007/s11165-014-9435-9</pub-id>
</mixed-citation>
</ref>
<ref id="B9">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Flemotomos</surname>
<given-names>N.</given-names>
</name>
<name>
<surname>Georgiou</surname>
<given-names>P.</given-names>
</name>
<name>
<surname>Atkins</surname>
<given-names>D. C.</given-names>
</name>
<name>
<surname>Narayanan</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2019</year>). &#x201c;<article-title>Role specific lattice rescoring for speaker role recognition from speech recognition outputs</article-title>,&#x201d; in <source>Icassp 2019 - 2019 IEEE international conference on acoustics, speech and signal processing (ICASSP)</source>, <fpage>7330</fpage>&#x2013;<lpage>7334</lpage>. <pub-id pub-id-type="doi">10.1109/ICASSP.2019.8683900</pub-id>
</mixed-citation>
</ref>
<ref id="B10">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Galeas</surname>
<given-names>J.</given-names>
</name>
<name>
<surname>Tudela</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Pons</surname>
<given-names>O.</given-names>
</name>
<name>
<surname>Bensch</surname>
<given-names>S.</given-names>
</name>
<name>
<surname>Hellstr&#xf6;m</surname>
<given-names>T.</given-names>
</name>
<name>
<surname>Bandera</surname>
<given-names>A.</given-names>
</name>
</person-group> (<year>2025</year>). <article-title>Building a self-explanatory social robot on the basis of an explanation-oriented runtime knowledge model</article-title>. <source>Electronics</source> <volume>14</volume>, <fpage>3178</fpage>. <pub-id pub-id-type="doi">10.3390/electronics14163178</pub-id>
</mixed-citation>
</ref>
<ref id="B11">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Gj&#xe6;rum</surname>
<given-names>V. B.</given-names>
</name>
<name>
<surname>Str&#xfc;mke</surname>
<given-names>I.</given-names>
</name>
<name>
<surname>Lekkas</surname>
<given-names>A. M.</given-names>
</name>
<name>
<surname>Miller</surname>
<given-names>T.</given-names>
</name>
</person-group> (<year>2023</year>). <article-title>Real-time counterfactual explanations for robotic systems with multiple continuous outputs</article-title>. <source>IFAC-PapersOnLine</source> <volume>56</volume>, <fpage>7</fpage>&#x2013;<lpage>12</lpage>. <pub-id pub-id-type="doi">10.1016/j.ifacol.2023.10.1328</pub-id>
</mixed-citation>
</ref>
<ref id="B12">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Hellstr&#xf6;m</surname>
<given-names>T.</given-names>
</name>
<name>
<surname>Bensch</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2018</year>). <article-title>Understandable robots - what, why, and how</article-title>. <source>Paladyn, J. Behav. Robotics</source> <volume>9</volume>, <fpage>110</fpage>&#x2013;<lpage>123</lpage>. <pub-id pub-id-type="doi">10.1515/pjbr-2018-0009</pub-id>
</mixed-citation>
</ref>
<ref id="B13">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Jerez</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Iglesias</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Perez-Lorenzo</surname>
<given-names>J. M.</given-names>
</name>
<name>
<surname>Tudela</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Cruces</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Bandera</surname>
<given-names>J. P.</given-names>
</name>
</person-group> (<year>2024</year>). <article-title>An user-centered evaluation of two socially assistive robots integrated in a retirement home</article-title>. <source>Int. J. Soc. Robotics</source> <volume>16</volume>, <fpage>2043</fpage>&#x2013;<lpage>2063</lpage>. <pub-id pub-id-type="doi">10.1007/s12369-024-01175-5</pub-id>
</mixed-citation>
</ref>
<ref id="B14">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Kaplar</surname>
<given-names>M.</given-names>
</name>
<name>
<surname>Lu&#x17e;anin</surname>
<given-names>Z.</given-names>
</name>
<name>
<surname>Verbi&#x107;</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2021</year>). <article-title>Evidence of probability misconception in engineering students&#x2014;why even an inaccurate explanation is better than no explanation</article-title>. <source>Int. J. STEM Educ.</source> <volume>8</volume>, <fpage>18</fpage>. <pub-id pub-id-type="doi">10.1186/s40594-021-00279-y</pub-id>
</mixed-citation>
</ref>
<ref id="B15">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Lewis</surname>
<given-names>D.</given-names>
</name>
</person-group> (<year>1986</year>). &#x201c;<article-title>Causal explanation</article-title>,&#x201d;. <source>Philosophical papers</source>. Editor <person-group person-group-type="editor">
<name>
<surname>Lewis</surname>
<given-names>D.</given-names>
</name>
</person-group> (<publisher-name>Oxford University Press</publisher-name>), <volume>Vol. Ii</volume>, <fpage>214</fpage>&#x2013;<lpage>240</lpage>. <pub-id pub-id-type="doi">10.1093/0195036468.003.0007</pub-id>
</mixed-citation>
</ref>
<ref id="B16">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Lindner</surname>
<given-names>F.</given-names>
</name>
<name>
<surname>Olz</surname>
<given-names>C.</given-names>
</name>
</person-group> (<year>2022</year>). &#x201c;<article-title>Step-by-step task plan explanations beyond causal links</article-title>,&#x201d; in <source>2022 31st IEEE international conference on robot and human interactive communication (RO-MAN)</source>, <fpage>45</fpage>&#x2013;<lpage>51</lpage>. <pub-id pub-id-type="doi">10.1109/RO-MAN53752.2022.9900590</pub-id>
</mixed-citation>
</ref>
<ref id="B17">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Lombrozo</surname>
<given-names>T.</given-names>
</name>
</person-group> (<year>2006</year>). <article-title>The structure and function of explanations</article-title>. <source>Trends Cognitive Sci.</source> <volume>10</volume>, <fpage>464</fpage>&#x2013;<lpage>470</lpage>. <pub-id pub-id-type="doi">10.1016/j.tics.2006.08.004</pub-id>
<pub-id pub-id-type="pmid">16942895</pub-id>
</mixed-citation>
</ref>
<ref id="B18">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Matarese</surname>
<given-names>M.</given-names>
</name>
<name>
<surname>Rea</surname>
<given-names>F.</given-names>
</name>
<name>
<surname>Sciutti</surname>
<given-names>A.</given-names>
</name>
</person-group> (<year>2021</year>). <article-title>A user-centred framework for explainable artificial intelligence in human-robot interaction</article-title>.</mixed-citation>
</ref>
<ref id="B19">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Meyer</surname>
<given-names>M.</given-names>
</name>
<name>
<surname>Schnell</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2020</year>). <article-title>What counts as a &#x201c;good&#x201d; argument in school? how teachers grade students&#x2019; mathematical arguments</article-title>. <source>Educ. Stud. Math.</source> <volume>105</volume>, <fpage>35</fpage>&#x2013;<lpage>51</lpage>. <pub-id pub-id-type="doi">10.1007/s10649-020-09974-z</pub-id>
</mixed-citation>
</ref>
<ref id="B20">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Norris</surname>
<given-names>S. P.</given-names>
</name>
<name>
<surname>Guilbert</surname>
<given-names>S. M.</given-names>
</name>
<name>
<surname>Smith</surname>
<given-names>M. L.</given-names>
</name>
<name>
<surname>Hakimelahi</surname>
<given-names>S.</given-names>
</name>
<name>
<surname>Phillips</surname>
<given-names>L. M.</given-names>
</name>
</person-group> (<year>2005</year>). <article-title>A theoretical framework for narrative explanation in science</article-title>. <source>Sci. Educ.</source> <volume>89</volume>, <fpage>535</fpage>&#x2013;<lpage>563</lpage>. <pub-id pub-id-type="doi">10.1002/sce.20063</pub-id>
</mixed-citation>
</ref>
<ref id="B21">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Pitt</surname>
<given-names>J. C.</given-names>
</name>
</person-group> (<year>2009</year>). &#x201c;<article-title>Technological explanation</article-title>,&#x201d; in <source>Philosophy of technology and engineering sciences</source>. <source>Handbook of the philosophy of science</source>. Editor <person-group person-group-type="editor">
<name>
<surname>Meijers</surname>
<given-names>A.</given-names>
</name>
</person-group> (<publisher-loc>Amsterdam: North-Holland</publisher-loc>), <fpage>861</fpage>&#x2013;<lpage>879</lpage>. <pub-id pub-id-type="doi">10.1016/B978-0-444-51667-1.50035-5</pub-id>
</mixed-citation>
</ref>
<ref id="B22">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Prasad</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Zuluaga-Gomez</surname>
<given-names>J.</given-names>
</name>
<name>
<surname>Motlicek</surname>
<given-names>P.</given-names>
</name>
<name>
<surname>Sarfjoo</surname>
<given-names>S. S.</given-names>
</name>
<name>
<surname>Iuliia</surname>
<given-names>N.</given-names>
</name>
<name>
<surname>Ohneiser</surname>
<given-names>O.</given-names>
</name>
<etal/>
</person-group> (<year>2022</year>). &#x201c;<article-title>Grammar based speaker role identification for air traffic control speech recognition</article-title>,&#x201d; in <source>12th SESAR innovation days</source>.</mixed-citation>
</ref>
<ref id="B23">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Sakai</surname>
<given-names>T.</given-names>
</name>
<name>
<surname>Nagai</surname>
<given-names>T.</given-names>
</name>
</person-group> (<year>2022</year>). <article-title>Explainable autonomous robots: a survey and perspective</article-title>. <source>Adv. Robot.</source> <volume>36</volume>, <fpage>219</fpage>&#x2013;<lpage>238</lpage>. <pub-id pub-id-type="doi">10.1080/01691864.2022.2029720</pub-id>
</mixed-citation>
</ref>
<ref id="B24">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Setchi</surname>
<given-names>R.</given-names>
</name>
<name>
<surname>Dehkordi</surname>
<given-names>M. B.</given-names>
</name>
<name>
<surname>Khan</surname>
<given-names>J. S.</given-names>
</name>
</person-group> (<year>2020</year>). <article-title>Explainable robotics in human-robot interactions</article-title>. <source>Procedia Comput. Sci.</source> <volume>176</volume>, <fpage>3057</fpage>&#x2013;<lpage>3066</lpage>. <pub-id pub-id-type="doi">10.1016/j.procs.2020.09.198</pub-id>
</mixed-citation>
</ref>
<ref id="B25">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Stange</surname>
<given-names>S.</given-names>
</name>
<name>
<surname>Hassan</surname>
<given-names>T.</given-names>
</name>
<name>
<surname>Schr&#xf6;der</surname>
<given-names>F.</given-names>
</name>
<name>
<surname>Konkol</surname>
<given-names>J.</given-names>
</name>
<name>
<surname>Kopp</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2022</year>). <article-title>Self-explaining social robots: an explainable behavior generation architecture for human-robot interaction</article-title>. <source>Front. Artif. Intell.</source> <volume>5</volume>, <fpage>866920</fpage>. <pub-id pub-id-type="doi">10.3389/frai.2022.866920</pub-id>
<pub-id pub-id-type="pmid">35573901</pub-id>
</mixed-citation>
</ref>
<ref id="B26">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Stefani</surname>
<given-names>C.</given-names>
</name>
<name>
<surname>Tsaparlis</surname>
<given-names>G.</given-names>
</name>
</person-group> (<year>2009</year>). <article-title>Students&#x2019; levels of explanations, models, and misconceptions in basic quantum chemistry: a phenomenographic study</article-title>. <source>J. Res. Sci. Teach.</source> <volume>46</volume>, <fpage>520</fpage>&#x2013;<lpage>536</lpage>. <pub-id pub-id-type="doi">10.1002/tea.20279</pub-id>
</mixed-citation>
</ref>
<ref id="B27">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>van Eck</surname>
<given-names>D.</given-names>
</name>
</person-group> (<year>2015</year>). <article-title>Mechanistic explanation in engineering science</article-title>. <source>Eur. J. Philosophy Sci.</source> <volume>5</volume>, <fpage>349</fpage>&#x2013;<lpage>375</lpage>. <pub-id pub-id-type="doi">10.1007/s13194-015-0111-3</pub-id>
</mixed-citation>
</ref>
<ref id="B28">
<mixed-citation publication-type="journal">
<person-group person-group-type="author">
<name>
<surname>Zakershahrak</surname>
<given-names>M.</given-names>
</name>
<name>
<surname>Ghodratnama</surname>
<given-names>S.</given-names>
</name>
</person-group> (<year>2020</year>). <article-title>Are we on the same page? Hierarchical explanation generation for planning tasks in human-robot teaming using reinforcement learning</article-title>. <source>
<italic>Corr.</italic> abs/2012</source>, <fpage>11792</fpage>. <pub-id pub-id-type="doi">10.48550/arXiv.2012.11792</pub-id>
</mixed-citation>
</ref>
<ref id="B29">
<mixed-citation publication-type="book">
<person-group person-group-type="author">
<name>
<surname>Zuluaga-Gomez</surname>
<given-names>J.</given-names>
</name>
<name>
<surname>Sarfjoo</surname>
<given-names>S. S.</given-names>
</name>
<name>
<surname>Prasad</surname>
<given-names>A.</given-names>
</name>
<name>
<surname>Nigmatulina</surname>
<given-names>I.</given-names>
</name>
<name>
<surname>Motlicek</surname>
<given-names>P.</given-names>
</name>
<name>
<surname>Ondrej</surname>
<given-names>K.</given-names>
</name>
<etal/>
</person-group> (<year>2023</year>). &#x201c;<article-title>Bertraffic: Bert-based joint speaker role and speaker change detection for air traffic control communications</article-title>,&#x201d; in <source>2022 IEEE spoken Language technology workshop (SLT)</source>, <fpage>633</fpage>&#x2013;<lpage>640</lpage>. <pub-id pub-id-type="doi">10.1109/SLT54892.2023.10022718</pub-id>
</mixed-citation>
</ref>
</ref-list>
</back>
</article>