# I am Only Happy When There is Light: The Impact of Environmental Changes on
Affective Facial Expressions Recognition

Doreen Jirak, Alessandra Sciutti  Contact Unit
Italian Institute of Technology
Genoa, Italy
{doreen.jirak<EMAIL_ADDRESS>Pablo Barros  Sens.AI
R&D Center - Sony
Brussels, Belgium
<EMAIL_ADDRESS>Francesco Rea  RBCS
Italian Institute of Technology
Genoa, Italy
<EMAIL_ADDRESS>
###### Abstract

Human-robot interaction (HRI) benefits greatly from advances in the machine
learning field as it allows researchers to employ high-performance models for
perceptual tasks like detection and recognition. Especially deep learning
models, either pre-trained for feature extraction or used for classification,
are now established methods to characterize human behaviors in HRI scenarios
and to have social robots that understand better those behaviors. As HRI
experiments are usually small-scale and constrained to particular lab
environments, the questions are how well can deep learning models generalize
to specific interaction scenarios, and further, how good is their robustness
towards environmental changes? These questions are important to address if the
HRI field wishes to put social robotic companions into real environments
acting consistently, i.e. changing lighting conditions or moving people should
still produce the same recognition results. In this paper, we study the impact
of different image conditions on the recognition of arousal and valence from
human facial expressions using the FaceChannel framework [1]. Our results show
how the interpretation of human affective states can differ greatly in either
the positive or negative direction even when changing only slightly the image
properties. We conclude the paper with important points to consider when
employing deep learning models to ensure sound interpretation of HRI
experiments.

###### Index Terms:

Affective Computing, Facial Expression Recognition, Convolutional Neural
Networks, Human-Robot Interaction

##  I Introduction

Facial Expression Recognition (FER) emerged as an important topic in affective
computing with applications for social robots which are enabled to show and
infer emotional behaviors (for recent reviews on the topics we would like to
refer the interested reader to [2, 3]). Recent advances in machine learning,
especially deep learning, facilitate HRI research as popular models like
ResNet or VGG16 can be used, e.g., as state-of-the-art models for object
recognition to provide robust features and classification abilities to a robot
in HRI scenarios. Similarly, it is desirable to have a FER framework to be
used “out-of-the-box” to study affective states and emotional behaviors in
humans for collaborative tasks in domestic or working environments. [1]
introduced the so-called FaceChannel, a deep learning framework based on
convolutional neural networks (CNN) which implements both affective state
recognition in terms of arousal and valence, as well as classic categorical
emotion classification [4]. Other frameworks like the OpenFace consider so-
called action units that represent facial muscle movement involved in
emotional expressions [5]. However, all deep learning models are data-driven,
thus they might not well represent particular HRI scenarios and may not
capture differences in the environment such as lighting conditions as is the
case for, e.g., autonomously moving robots. Therefore, in this paper, we
address the question of robustness towards environmental changes for the
recognition performance of arousal and valence. We use the FaceChannel
framework as it provides easy access to FER and its lightweight implementation
allows the recognition in real-time, which renders this software interesting
for robotic applications.

As we want to understand if and how researchers address the robustness of FER
with state-of-the-art deep learning architectures, we chose publications that
deal with “in-the-wild” datasets or environments as they refer to the
reliability of FER classifiers. [6, 7] introduce a learning model based on
stacked autoencoders and CNNs, called SCAE, that can learn facial expressions
invariant to illumination changes and face poses. The authors show that pre-
training a CNN with their method achieves up to 28% performance boost on a
test set obtained from unconstrained environments compared to a standard CNN.
The authors highlight the comparative performance of their model compared to
state-of-the-art methods applied on popular datasets like JAFFE and CK+ and
also the significance of heterogeneous datasets when collected by the humanoid
NAO robot for robust recognition. [8] present a study using a mobile robot
platform and achieved good performance with an ensemble method for “in-the-
wild” images. However, it is a small-scale study because the authors used only
60 images for testing. [9] address the influence of what the authors call
”exogenous” variables like rotations and scale that can be considered image
manipulation on the recognition of digital numbers and shapes and introduce
the THIN architecture (THrowable Information Networks), which the authors also
apply to FER. Although they could show the superior performance of their model
compared to state-of-the-art, the authors target “identity” and do not opt for
image manipulations of the faces. [10] employed a social robot that motivates
participants to perform certain facial expressions. The goal of this study is
to collect data for comparison with a CNN-based recognition framework and
experts. The authors address the importance of dataset diversity, referred to
as ”cross dataset” training of CNNs but the authors did not further integrate
this approach into their framework.

##  II Methodology

We use the FaceChannel framework for affective state recognition, i.e.,
arousal and valence. Arousal is a measure of excitement while valence
describes the level of (un)pleasantness. Both metrics are evaluated
continuously in the range $[-1;1]$, i.e. depending on the value pair, a human
can be described as positively excited (both values close to 1) or sad (low
arousal and negative valence), etc. The FaceChannel used to obtain arousal-
valence is trained on the AffectNet dataset [11] using fewer parameters than
other models like the mentioned VGG16 but with similar to superior
performance. Due to its lightweight implementation, the FaceChannel can be
integrated into robotic systems or HRI scenarios. As a baseline for the
arousal-valence recognition, we use a subset of a dataset recorded at the
Istituto Italiano di Tecnologia (IIT) for a study addressing human performance
under cognitive load [12]. The 14 participants solved different tasks
sequentially in presence of the humanoid robot iCub, which showed either so-
called “non-social” or “social” behaviors. As a baseline, the participants
performed the task without the presence of the robot. The analysis of the
“social” condition revealed mostly positive arousal-valence patterns elicited
by the participants compared to the mixed results in the “non-social”
condition or mostly neutral states in the baseline [13]. Hence, we consider
the “social” subset as reasonable data baseline. First, we convert the
original video sequences into images (frames) and delete all images from the
experiment instructions as the participants looked mostly sideways or wore a
mask due to Covid19 restrictions. Thus, we obtain around $\approx$ 6000-7000
images per participant. Then, we alter the original images like this: We
create a bounding box for each participant that contains only the face and
crop all images. Then, we alter the brightness so that the images appear
lighter or darker. Also, we introduce image blur by applying a 2D Gaussian
filter (standard deviation $\sigma$=1). Additionally, we apply so-called salt-
and-pepper noise to the images with a level of 0.01, i.e., there is a 1%
chance for a pixel to be flipped. Finally, we simulate the horizontal camera
motion of 10 pixels. Figure 1 shows exemplary the resultant images. It also
shows that the facial expression is still perceivable, i.e., the image is not
too dark or distorted.

Figure 1: Example image of a participant (original) and the image conditions
that we apply to change the image properties. Note that for all conditions
the, e.g., smiling of the person is visible to ensure fair comparisons of the
FaceChannel output between the original and image conditions.

##  III Results and Evaluation

We present our results both from the qualitative and the quantitative point
where the baselines for comparison are the arousal-valence sequences obtained
from the FaceChannel applied to the original data described above. We first
use a scatter plot to visualize the data distribution of all conditions (left
out for brevity). For the ‘lighter’ and ‘darker’ conditions, we observe mostly
slight deviations from the original arousal-valence distribution with some
peaks in the negative or positive direction. The ‘Gaussian’ and ‘noise’
conditions reveal a large spread over the arousal-valence dimension, which
distorts the original arousal-valence responses. Interestingly, the ‘motion’
condition seems to contract the arousal-valence dimension as we observe
clusters around the neutral state (around (0,0)). We then compare the time
series for arousal and valence individually to analyze the trend of the
observed difference, i.e., we want to see the trend of dispersion. We simply
calculate, e.g. for arousal, $a_{cond}-a_{orig}$, which is either positive
(overestimation) or negative (underestimation) and quantifies the distance
between the original data ($a_{orig}$) and the respective image condition
($a_{cond}$). Figures 2 and 3 show a result of this simple scheme. We see how
the ‘lighter’ condition deviates in the positive and negative direction mostly
mildly but with some peaks diverging significantly from the original value
(cf. Figure 2). However, we also see segments that show consistent
classification between the original data and the ‘lighter’ condition, shown in
the green box. However, the figures are only exemplary, and our analysis
reveals much larger deviations for the ‘Gaussian‘, ‘noise’, and ‘motion’
conditions. For a better understanding of the trends, we then computed the
frequency of positive and negative values, i.e., how often they are
represented in a sequence, and calculated the percentage over all participants
and per image condition. The ‘noise’ and ‘darker’ conditions distort the
original arousal values into the positive direction, while a clear trend
toward negative values becomes visible for the ‘Gaussian’ and ‘motion’
conditions. This result supports the observed “attenuation’ effect of the
arousal dimension. The opposite is the case for valence, where the latter
conditions show trends towards positive values. Both conditions seem to
distract the interpretation of arousal-valence towards a more calm and
pleasant affective state and, thus, may underestimate the human’s real
emotion. The ‘darker’ and ‘noise’ conditions impact the valence more
negatively, i.e., both conditions can distort the interpretation of arousal-
valence towards a negatively excited affective state, hence, overestimating
the affective state of a calm person. Finally, the ‘lighter’ condition has a
very mixed result on the positive and negative trend but with fewer deviations
from the original value, hence this condition seems to deliver the most
reliable results.

Figure 2: Exemplary sequence of an original arousal sequence (black) compared
to the resultant arousal sequence obtained from images with lighter brightness
(blue). The red bars denote the amount of deviations in either positive or
negative direction. The green box shows a segment where the FaceChannel
produces a good agreement between the arousal values.

Figure 3: Exemplary sequence of an original valence sequence (black) compared
to the resultant valence sequence obtained from images with lighter brightness
(blue). The red bars denote the amount of deviations in either positive or
negative direction.

We compute the concordance correlation coefficient ($\rho_{ccc}$, cf. 1) which
is measure of agreement between two data sequences $x$ and $y$. We use this
coefficient to quantify the described deviations. It is defined as:

$\rho_{ccc}=\frac{2\rho_{p}\sigma_{x}\sigma_{y}}{\sigma_{x}^{2}+\sigma_{y}^{2}+(\mu_{x}-\mu_{y})^{2}}$
(1)

where $\rho_{p}$ is the Pearson correlation coefficient, $\sigma^{2}$ the
variance of the two variables $x$ and $y$ (here the original arousal-valence
sequence and sequences per image condition), and $\mu$ the mean values,
respectively. Figures 4 and 5 display the distribution of $\rho_{ccc}$ over
all participants and image condition for both arousal and valence. The results
support our qualitative impression from the visualizations (scatter plot,
trends in sequences). While the ‘lighter’ and ‘darker’ conditions show a high
correlation with the original data, which means that the conditions have only
a small impact on the arousal-valence evaluations, we observe a clear decline
for the remaining three conditions. Especially the ‘noise’ and the ‘motion’
conditions reveal only small to even no correlation, where the arousal
dimension seems more affected than the valence dimension. For a few individual
cases, we observe even slight negative correlations. The range of $\rho_{ccc}$
is further outlined in Table I, which supports that the arousal dimension is
more affected by the ‘Gaussian’, ‘noise’, and ‘motion’ condition compared to
the valence dimension.

Figure 4: Distribution of the concordance correlation coefficient
$\rho_{ccc}\in[-1;1]$ between the baseline of the arousal compared to the
image condition over all 14 participants. While the ‘lighter’ and ‘darker’
arousal sequences show high agreement with the original data, the
distributions for the other conditions show a clear decline.

Figure 5: Distribution of the concordance correlation coefficient $\rho_{ccc}\in[-1;1]$ between the baseline of the valence compared to the image condition over all 14 participants. Similarly to the arousal distribution, we observe a decline in the correlation values for the ‘noise’ and ‘motion‘ condition but less for the ‘Gaussian’ condition. TABLE I: CCC - Arousal & Valence | Arousal | Valence
---|---|---
condition | min $\rho_{ccc}$ | max $\rho_{ccc}$ | min $\rho_{ccc}$ | max $\rho_{ccc}$
lighter | 0.0825 | 0.9715 | 0.0725 | 0.9784
darker | 0.0941 | 0.9690 | 0.0823 | 0.9818
Gaussian | -0.0040 | 0.8099 | 0.0071 | 0.8568
noise | 0.0358 | 0.5824 | -0.0414 | 0.7022
motion | -0.0690 | 0.3639 | -0.0015 | 0.7825

##  IV Discussion and Conclusion

Our study shows how FER frameworks like the FaceChannel [1] can limit their
application when introducing small image modifications. In particular, our
study on arousal-valence sequences revealed high distortions in the arousal-
valence dimension when simulating camera movements as is the case for the
‘Gaussian’ blur (e.g. camera focus adjustment) and real movement (‘motion’)
even for a small amount of pixels involved. Also, darker light environments
and possible noise (e.g. image transmission, artifacts) impact arousal-valence
recognition. Consequently, minor changes in the environmental condition can
have a huge impact on the affective state’s interpretation of participants in
HRI studies. Our analysis revealed that, e.g., participants with mostly
positive arousal-valences responses can be misinterpreted by a robot as calm
or even bored people because camera motion attenuates the corresponding
signals. On the other hand, noise and different lighting conditions tend to
overestimate the real affective states as shown by deviations into the
positive direction. Although the issues might be known to many researchers in
the field, during our literature search we mostly encountered tailored
learning solutions in the field of FER, which complicates reproducibility, or
pure application of established software on rather small datasets without any
variations. “In-the-wild” solutions are a step in the right direction but more
studies are needed, especially as FER is already subject to misinterpretations
due to insufficient emotion categorizations and neglect of context and other
modalities. Therefore, we would like to point out the most critical aspects to
address in HRI to enforce robustness in learning models for robotic
applications beyond strict lab conditions:

  * •

Use data augmentation: many libraries such as PyTorch111https://pytorch.org/
allow data augmentation during training, i.e. the image manipulations as
carried out in this study can be easily integrated into the learning process.
It enhances the usually small data corpora collected in HRI studies and avoids
time-consuming labeling.

  * •

Re-train the last layer: recognition models usually rely on CNNs, whose last
layer can be re-trained to integrate the image properties of a particular
dataset. A recent paper provides a study on this topic [14].

  * •

Go multi-modal: the interpretation of FER can be highly subjective. Therefore,
it is common to add physiological sensors to measure electro-dermal activity
or to measure the heart rate. However, the instruments need individual
calibrations and are highly error-prone to a participant’s movement. A
holistic vision approach can corporate other modalities such as eye gaze or
(body) gestures to give also contextual information. For instance, we observed
participants who cover their face (hands-over-face gesture) or shrug their
shoulders, which can be signs of unpleasantness or negative surprise.

  * •

Make careful claims: a deep learning model may offer great support for HRI
studies but as we have shown, little modifications in the image may render an
excited person into a bored one.

We are also aware that our study has some limitations. First, 14 participants
can be considered a small number but due to the lack of similar studies, we
opt for establishing a reasonable data analysis pipeline first. For future
work, we would like to study other datasets and also consider emotion
classification using different models. It could be interesting to analyze
their deviations in labeling and the impact on human behavior interpretation.
Also, more sophisticated analysis tools or new metrics for robustness could be
established in the future. Finally, other image conditions might be added such
as small rotations or face occlusions. For those cases, it is also an
important question of how to interpolate affective states sensitively, e.g.
when persons move in the scene and do not always show their face. We hope our
current work inspires other researchers in the field of deep learning and
affective state recognition to develop and analyze FER models for effective
and sound employment in HRI research.

## Acknowledgment

This work has been supported by the project VOJEXT under the European Union’s
Horizon 2020 innovation programme, G.A. No 952197.

## References

  * [1] P. Barros, N. Churamani, and A. Sciutti, “The facechannel: A light-weight deep neural network for facial expression recognition.” in _2020 15th IEEE International Conference on Automatic Face and Gesture Recognition (FG 2020)_ , 2020, pp. 652–656.
  * [2] M. Spezialetti, G. Placidi, and S. Rossi, “Emotion recognition for human-robot interaction: Recent advances and future perspectives,” _Frontiers in Robotics and AI_ , vol. 7, 2020. [Online]. Available: https://www.frontiersin.org/articles/10.3389/frobt.2020.532279
  * [3] R. Stock-Homburg, “Survey of emotions in human–robot interactions: Perspectives from robotic psychology on 20 years of research,” _International Journal of Social Robotics_ , pp. 1–23, 2021.
  * [4] T. Baltrusaitis, A. Zadeh, Y. C. Lim, and L.-P. Morency, “Openface 2.0: Facial behavior analysis toolkit,” in _2018 13th IEEE International Conference on Automatic Face Gesture Recognition (FG 2018)_ , 2018, pp. 59–66.
  * [5] P. Ekman, “Universal Facial Expressions of Emotion,” _California Mental Health_ , vol. 8 (4), pp. 151–158, 1970.
  * [6] A. Ruiz-Garcia, N. Webb, V. Palade, M. Eastwood, and M. Elshaw, “Deep learning for real time facial expression recognition in social robots,” in _Neural Information Processing_ , L. Cheng, A. C. S. Leung, and S. Ozawa, Eds. Cham: Springer International Publishing, 2018, pp. 392–402.
  * [7] N. Webb, A. Ruiz-Garcia, M. Elshaw, and V. Palade, “Emotion recognition from face images in an unconstrained environment for usage on social robots,” in _2020 International Joint Conference on Neural Networks (IJCNN)_. IEEE, 2020, pp. 1–8.
  * [8] H. Han, O. Karadeniz, E. B. Sönmez, T. Dalyan, and B. Sarıoğlu, “Facial expression recognition in the wild with application in robotics,” in _2021 6th International Conference on Computer Science and Engineering (UBMK)_ , 2021, pp. 565–569.
  * [9] E. Arnaud, A. Dapogny, and K. Bailly, “Thin: Throwable information networks and application for facial expression recognition in the wild,” _IEEE Transactions on Affective Computing_ , 2022.
  * [10] S. Ramis, J. M. Buades, and F. J. Perales, “Using a social robot to evaluate facial expressions in the wild,” _Sensors_ , vol. 20, no. 23, p. 6716, 2020\.
  * [11] A. Mollahosseini, B. Hasani, and M. H. Mahoor, “Affectnet: A database for facial expression, valence, and arousal computing in the wild,” _IEEE Transactions on Affective Computing_ , vol. 10, no. 1, pp. 18–31, 2017.
  * [12] M. Aoki, F. Rea, D. Jirak, G. Sandini, T. Yanagi, A. Takamatsu, S. Bouet, and T. Yamamura, “On the influence of social robots in cognitive tasks,” _International Journal of Humanoid Robotics_ , 2022, (accepted for publication).
  * [13] D. Jirak, M. Aoki, T. Yanagi, A. Takamatsu, S. Bouet, T. Yamamura, G. Sandini, and F. Rea, “Is it me or the robot? a critical evaluation of human affective state recognition in a cognitive task,” _Frontiers in Neurorobotics_ , vol. 16, 2022.
  * [14] P. Barros and A. Sciutti, “Ciao! a contrastive adaptation mechanism for non-universal facial expression recognition,” _arXiv preprint arXiv:2208.07221_ , 2022.


Copyright for this paper by its authors. Use permitted under Creative Commons
License Attribution 4.0 International (CC BY 4.0).

Accepted in the IEEE Global Engineering Education Conference 2024 (EDUCON24),
Kos, Greece

[1] [1]You can use this document as the template for preparing your
publication. We recommend using the latest version of the ceurart style.

[orcid=0000-0002-2921-4809<EMAIL_ADDRESS>] [1]

[orcid=0000-0001-6606-5577<EMAIL_ADDRESS>]

[orcid=0000-0002-7602-9593 ]

[1]Corresponding author.

# Knowledge Graphs as Context Sources for LLM-Based Explanations of Learning
Recommendations

Hasan A. Rasheed  University of Siegen, Siegen, Germany  Christian Weber
Madjid Fathi

(2024)

###### Abstract

In the era of personalized education, the provision of comprehensible
explanations for learning recommendations is of a great value to enhance the
learner’s understanding and engagement with the recommended learning content.
Large language models (LLMs) and generative AI in general have recently opened
new doors for generating human-like explanations, for and along learning
recommendations. However, their precision is still far away from acceptable in
a sensitive field like education. To harness the abilities of LLMs, while
still ensuring a high level of precision towards the intent of the learners,
this paper proposes an approach to utilize knowledge graphs (KG) as a source
of factual context, for LLM prompts, reducing the risk of model
hallucinations, and safeguarding against wrong or imprecise information, while
maintaining an application-intended learning context. We utilize the semantic
relations in the knowledge graph to offer curated knowledge about learning
recommendations. With domain-experts in the loop, we design the explanation as
a textual template, which is filled and completed by the LLM. Domain experts
were integrated in the prompt engineering phase as part of a study, to ensure
that explanations include information that is relevant to the learner. We
evaluate our approach quantitatively using Rouge-N and Rouge-L measures, as
well as qualitatively with experts and learners. Our results show an enhanced
recall and precision of the generated explanations compared to those generated
solely by the GPT model, with a greatly reduced risk of generating imprecise
information in the final learning explanation.

###### keywords:

Large language models (LLMs) Knowledge graphs ChatGPT Generative AI (GenAI)
Learning recommendations explainable AI (XAI)

##  1 Introduction

In personalized education, the provision of precise and comprehensible
explanations for learning recommendations is both important and challenging.
Explainability of learning recommendations has been found to enhance the
student acceptance of the recommended content [1]. However, the precision of
the textual and visual explanations faces several limitations when these are
generated semi- or full-automatically. This is due to the level of knowledge,
understanding, and reflection, that the learner needs from the generated
explanation, which an automatic system may not be capable to offer. The recent
research on LLMs opened new possibilities for solutions to generate
explanations for learning recommendations on a deeper linguistic and semantic
level. The massive datasets used to train such LLMs, and the high number of
features considered by the model, enables generating more informative texts
for the explainability task. However, they face serious concerns about their
ability to generate a sufficiently precise text to reflect the learning intent
from the recommendation, especially in sensitive domains. On the one hand, the
technology readiness level (TRL) of the majority of LLMs still does not exceed
the level TRL-2 [2]. From an ethical perspective, the transparency of LLMs is
rarely more than Tier-1 [2], based on the classification of transparency by
Chaudhry et al. [3]. This apprehension aligns with the observations of Fullan
et al. [4], who also expressed concerns about various adverse effects of
ChatGPT in education. They highlighted issues such as the lack of originality
in its responses, potentially leading to answers that lack meaning and fail to
stimulate exploration or imagination due to their linearity or flatness [5].
Despite these drawbacks, Hargreaves [6] underscored that utilizing such
technology in education exhibits promise, advocating against its outright
rejection.

Our research addresses this challenge by combining the strengths of KGs and
Generative Pre-Trained Transformers (GPT) models, aiming to enhance the
precision, and thus reliability, of the explanations they generate for
learning recommendations. We utilize the features of KGs to enhance the
querying process of LLMs, through extracting contextual knowledge from the KG
and then performing an informed prompt engineering process that is supported
by pedagogy experts’ inputs. The resulting LLM prompt is then used to guide
the model away from generating wrong or irrelevant information and limit the
scope of answers it provides to the curated information provided from the
knowledge graph. This ensures more precise answers, while still utilizing the
model’s ability to combine pieces of information and phrase a human-like
explanation, which learners can easily comprehend

##  2 Background

Knowledge Graphs are structured representations of knowledge, composed of
entities and the relationships between them [7]. They serve as powerful tools
for organizing information, capturing semantic connections, and providing a
foundation for contextual understanding. A KG is defined as in (1). In
educational contexts, KGs can be constructed from curated educational
materials, forming a reliable source of factual knowledge [8].

$KG={(h,r,t)|h,t\in E,r\in R},$ (1)

Where h is the head entity, t is the tale entity, and r is the relation
between h and t. E is the entity group and R is the relation group.

The use of KGs to support LLMs is gaining an increased focus recently [9, 10,
11], which can be traced back to: 1) the new breakthroughs of LLMs, 2) the
growing concerns about their risks and limitations [2], and 3) the effective
role KGs can play in reducing LLM hallucinations and enhancing their accuracy
[12]. Sequeda et al. show that KGs-based querying enhanced the results of a
one-shot question answering task in comparison to SQL-querying, when a KG
representation of the SQL database was used [12]. KGs have also been well
utilized for explainability tasks in the literature. This is due to their
potential to provide causal reasoning [13], factual knowledge [11], and
interpretable semantic relations [10, 14, 15]. To that end, KGs not only
enhance the reasoning of the LLM with facts, but also offer more information,
which influences the precision of the automatically generated text. This
information is parsed to the LLM in form of a prompt context that is designed
during the prompt engineering phase. Depending on the LLM used, contextual
parts of the prompt act as guidelines that steer the model to generate more
relevant outputs. We build on the concepts in [14] and [9] to utilize KG’s
structure and semantic relations for enriching the contextual part of OpenAI’s
GPT-4 model prompt [16], thus enhancing the precision of its explanations of a
learning recommendation.

##  3 Methodology

To utilize the GPT-4 potentials while reducing the amount of irrelevant and
imprecise text it generates for the learning recommendation, we propose a
strategy for constructing the data structures and the LLM prompt to maximize
the amount of factual and contextual information that the model receives
before generating an explanation for the recommendation, see Fig. 1.
Contextual information that KG provides is acquired from the structural
relations and the metadata of the learning content connected to the
recommended elements. Both types of information are then translated into
textual strings that are inserted as prompt context in the LLM query.

###  3.1 Knowledge Graph Structure

We create the KG from educational materials, aligning with a pre-defined
taxonomy, to ensure comprehensive coverage of relevant topics. Our taxonomy
includes four levels: 1) Learning goals, 2) Courses, 3) Topics, and 4) Open
educational resources (OER). For simplicity, we use the term learning object
(LO) as defined in [17] hereafter to refer to any of the last three taxonomy
levels, unless they are explicitly named. Learning goals and LOs are
represented by graph nodes, who‘s properties include their titles and
descriptions among other metadata. We focus on textual properties of the LOs
to search for semantic relations amongst them. Semantic relations are
extracted because the educational content in our database is created by
different experts over time. A customized text mining pipeline is utilized to
extract the main topics covered each LO and compare them to topics covered by
other LOs in the graph [8]. A relation is created between the two LOs if the
semantic similarity is above a predefined threshold. Relations extracted
between LOs are used to enhance the coverage and composition of context, which
is provided to the LLM for generating an explanation of the connected
materials in the learning recommendation.

The recommendation algorithm we use is a graph exploration and path weighing
algorithm [18], based on Markov decision process (MDP) to identify an optimal
learning path for each learner. Recommended learning path is explained in
terms of its content selection (why each node is recommended), as well as its
relation to the learning goal (how a node supports achieving the desired
learning goal). To explain the recommended path, we extract four main types of
information from the KG, see Fig.1:

Figure 1: Structural information added to the LLM context from the KG. Top:
learning path as an output of the recommendation system. Bottom: recommended
path as it appears in the KG. Area (A): hierarchical structure of the learning
goal. Area (B) KG community around LO3 and LO4. Connection (C): semantic
relation extracted by the relation extraction algorithm.

  1. 1.

the hierarchical structure of the LO based on the pre-defined taxonomy: this
structure informs the LLM about the placement of a recommended LO within its
original curriculum, which is defined by the human content-curator of the
corresponding learning goal, see Fig. 1 area (A).

  2. 2.

Semantic relations to similar LOs in the KG: which is discovered by the
relation extraction algorithm based on the textual content and the semantic
similarity between the LOs, see Fig. 1 connection (C).

  3. 3.

KG communities around LOs: : which are areas on densely connected LOs in the
KG. These communities reflect in our KG fields of application, in which
several LOs are usually required together as a group, see Fig. 1 area (B).

  4. 4.

Supporting metadata from connected LOs in the KG: where not only the relations
to semantically similar LOs are utilized, but also the textual content of the
related LOs’ metadata, which sheds an additional light on the context of the
recommended LO.

Using this additional information from the KG, we construct the GPT-4 prompt
on the task level, as well as on the context one.

###  3.2 GPT-4 Prompt and Explanation Construction

The extended explanations for recommended learning paths are generated using
the “GPT4-1106-preview” model, which we will refer to here as GPT-4 for
simplicity. This model is the most capable model offered by OpenAI at the time
of conducting this research, with training data that is updated till April
2023. To use the model, we utilize OpenAI’s API, which allows parsing the
prompt to the GPT-4 model with additional data, information, and instructions,
in order to guide the model output generation. We design our pomp to include a
main body and a contextual part, see Fig. 2. Prompt’s body represents the
direct query from the user. It is constructed as a set of tasks that the model
ha to perform. This is to enhance the focus of the query and ensure less
deviation from the user intent.

The contextual part of the prompt is extracted directly from the KG, based on
a search strategy that integrates the four types of information discussed in
3.1, into the prompt’s context. The context is designed to include: 1) The
role that the model assumes when answering a user’s query, e.g., answering as
a teacher. 2) Required definitions that are needed to understand the
terminology, especially in the cases where the domain-specific meaning of a
word differs from its general meaning. 3) The information from semantically
connected LOs in the KG, which is provided to the model in the form of
“supporting content” in the query’s context. The model’s role and terminology
definitions are also influenced by a direct input from the domain experts, who
can set the pedagogical and domain related guidelines for the model.

The response of the GPT-4 model is used to fill the information gaps in an
explanation template. The design of explanations for the learning
recommendations is tightly connected to the pedagogical value of the
explanation, to ensure an improved learning outcome. For that reason, each
template includes specific information spaces or slots, which are filled by
the LLM, guided by the data of the KG. It is important to mention here that
parts of the explanation template can also be filled with a direct input from
the experts. In this paper, however, we limit the scope of information in the
explanation to that generated automatically by the GPT-4 model, in order to
evaluate its performance against a golden standard, which is extracted from
the expert’s input.

Figure 2: Proposed approach for constructing the GPT-4 prompt, with KG-based
contextualization, as well as the Chatbot-based user interaction, and the
expert roles in the design for context and explanation-templates.

###  3.3 Chatbot-based interaction with the explanations

Once the explanation is complete, it is provided to the user through an
interactive interface element, which represents the chat features that LLMs
offer. We refer to this approach as “conversational explainability”, which
differs from regular textual and visual explanations by its ability to provide
the explanation through a multi-step interaction with the user, taking into
account previous chat messages to influence the following model output. The
ability of GPT models to respond to individual questions, as well as to engage
in a multi-step chat with the user, means that explanations can be extended
with additional information based on user inputs and requests. This, however,
would induce the risk of deviating from the main point of the explanations.
Therefore, we limit the chatting feature of GPT-4 in this paper to a first
response with confirmation. This approach stands for a one-shot query that is
supported by a confirmation step from the model, to ensure that the chatbot
understands the user request correctly. With this approach, a learner has the
option to ask about the learning material itself, i.e., its content or why it
is relevant for their learning goal, as well as the relationships between the
learning materials are in the recommended path.

##  4 Evaluation and Results

To evaluate our proposed approach, we devise a hybrid quantitative/qualitative
evaluation strategy. The quantitative evaluation utilizes Rouge-based
measures, namely Rouge-N, Rouge-L and Rouge-Lsum. Qualitative evaluation is
conducted through a questionnaire-based user feedback on the explanation
approach and is outcomes. It involved domain experts and learners, who were
asked to evaluate the generated explanations and their relevance to the
learning materials and learning goal.

Through Rouge metric, we aim to measure the amount of text in the generated
explanation, which offers precise information, against the amount of
irrelevant text, which is either wrong, or simply a filler text that is task-
related but has low relevance to the goal of the explanation.

Figure 3: Recall, precision, and f1-measure values of the Rouge metric, for
both explanation types: 1) with KG-based contextualization (blue), and 2)
without contextualization (gray).

###  4.1 Experiment Set-up

Rouge (Recall-Oriented Understudy for Gisting Evaluation) [19] is an
evaluation metric commonly used in natural language processing (NLP) to assess
the quality of automated text summarization and machine translation systems.
It employs both recall and precision to compare the overlap of n-grams
(contiguous sequences of words) between model-generated summaries and human-
generated ones. We utilize this metric to measure the overlap between
reference explanations from a human text and each of the explanations
generated automatically by the GPT-4 model, i.e., with a KG-based
contextualization, and without it. To ensure a fair comparison between the two
explanation approaches, we fix the length of the text generated by the GPT-4
model. This is because Rouge measures take into consideration the total amount
of n-grams in the model generated text.

The reference text is composed from human defined descriptions and reflection
information in the LO’s metadata. In this paper, we do not account for the
phrasing of the explanation, i.e., sentence structures and writing styles,
since there is no certain phrasing or writing style that can be considered as
“correct” or “referential”. Instead, we focus on the word choice and word
patterns that appear in the generated text and match the patterns in the
reference text.

###  4.2 Dataset

To calculate Rouge values, we construct a reference data set of reference
explanations. 52 samples of human-generated texts were collected from
clarifications of the recommended content of 10 different learning-path
recommendations. For each reference explanation, we generate two candidate
explanations, one through the proposed KG-based contextualization approach,
and one without the context.

###  4.3 Results and Discussion

We calculate the recall, precision, and f1-measure from four Rouge measures:
Rouge-1, which is the measure used to for the overlap between single words,
i.e., unigrams, Rouge-2 that accounts for two-word patterns, i.e., bigrams,
Rouge-L that takes into account the longest matching patterns between the
reference text and the candidate one, and Rouge-Lsum which is a variant of
Rouge-L that calculates the overlap on the sentence level, not the complete
text. Calculated values of the different measures, see Fig. 3, show a clear
enhancement of the precision, recall, and thus f1-measure of the explanations
generated with KG-based context. The results also show that recall scores are
best with Rouge-Lsum measure, while the precision and f1-measure values are
better with Rouge-1. With a domain expert support, we evaluate that none of
the automatic explanation samples was wrong or misleading, which leads to the
conclusion that the amount of less irrelevant text in the non-contextualized
explanations was considerably higher than the one in the contextualized
explanations, since both have comparable lengths.

Qualitatively, the explanations were provided in a user study to a group of
eight learners and five domain experts. Participants included two PhD holders,
four PhD candidates and seven graduate students. We surveyed the participants
for their perception on the explanation quality, and the overall impressions,
remarks, and limitations of the two explanation approaches. The survey
evaluation revealed an enhanced acceptance of the explanations when it is
generated with KG-based context. On a Likert scale, the quality of the
contextualized explanation reached 4.7/5. The amount of irrelevant text, which
was correct in general but not related to the user intent from the
explanation, was also reported to be less in the contextualized explanations,
which aligns with quantitative results. Participants also highlighted
important limitations that the LLM revealed when generation the explanation.
Three out of five domain experts pointed out that not only the word selection,
but also the phrasing of the explanation plays an important role in
determining its meaning. Four experts also emphasized that the explanation is
not only a task of answering a user question, but also includes high-level
reflection information, which enables the learner to understand how the
learning content can affect their own context, e.g., their daily work. This
level of reflection exceeds the ability of the LLM and requires a human mentor
to provide it based on their understanding of the learner’s context.

This feedback shows a limitation in our valuation approach, which should also
include the effect of the explanation phrasing to the comparison with
reference explanations. The nature of LLMs and the complexity of evaluating
what a correct phrasing is, challenges this evaluation, and defines at the
same time several prospects for continuing this on-going research. Other
limitations that we address in our study include: 1) The limited sample sizes
in the experiment, which is used to provide a proof-of-concept and set the
starting point for a larger scale test. 2) The comparison between GPT-4 and
other LLMs is required to measure LLM-based performance deviations. 3) We do
not include user-specific date in our contextualization approach, to comply
with the GDPR, since GPT-4 is provided by a third party. A local LLM is
intended to be used for further evaluating the role of user data in enhancing
the relevance of the explanation to user contexts, as well as materials
contexts.

##  5 Conclusion

In this paper, we proposed an evaluated an approach for utilizing KGs as a
source of contextual information that supports LLMs in generating more
relevant explanations of learning recommendations. Our approach extracts
different types of information from the KG and constructs a contextual part of
a GPT-4 model’s prompt accordingly. The design of the prompt’s context is
conducted with experts-in-the-loop to ensure the fulfillment of the
pedagogical requirements from the explanation. Experts also participated in
the design of the final explanation shape and content, which was offered to
the learners as a textual template filled by the GPT-4 model. A chatbot-based
interaction with the user is used to provide the explanations as answers to
user questions. We evaluate the proposed approach qualitatively and
quantitatively using Rouge measures. Evaluation results provided a proof of
the proposed concept, showing a reduced amount of less-relevant text in the
generated explanation. The results of the evaluation also pointed out
limitations of the LLM’s performance which defines a starting point for future
work to further evaluate the role of the explanation phrasing and the use of
user-data for further personalization of the explanation text.

## References

  * Ooge et al. [2022] J. Ooge, S. Kato, K. Verbert,  Explaining Recommendations in E-Learning: Effects on Adolescents’ Trust,  in: 27th International Conference on Intelligent User Interfaces, ACM, Helsinki Finland, 2022, pp. 93–105. doi:10.1145/3490099.3511140.
  * Yan et al. [2023] L. Yan, L. Sha, L. Zhao, Y. Li, R. Martinez-Maldonado, G. Chen, X. Li, Y. Jin, D. Gašević,  Practical and Ethical Challenges of Large Language Models in Education: A Systematic Scoping Review,  British Journal of Educational Technology (2023) bjet.13370. doi:10.1111/bjet.13370, arXiv:2303.13379 [cs].
  * Chaudhry et al. [2022] M. A. Chaudhry, M. Cukurova, R. Luckin,  A Transparency Index Framework for AI in Education,  in: M. M. Rodrigo, N. Matsuda, A. I. Cristea, V. Dimitrova (Eds.), Artificial Intelligence in Education. Posters and Late Breaking Results, Workshops and Tutorials, Industry and Innovation Tracks, Practitioners’ and Doctoral Consortium, volume 13356, Springer International Publishing, Cham, 2022, pp. 195–198. doi:10.1007/978-3-031-11647-6_33, series Title: Lecture Notes in Computer Science.
  * Fullan et al. [2023] M. Fullan, C. Azorín, A. Harris, M. Jones,  Artificial intelligence and school leadership: challenges, opportunities and implications,  School Leadership & Management (2023) 1–8. doi:10.1080/13632434.2023.2246856.
  * Dana and Harouni [2023] K. Dana, H. Harouni, ChatGPT Is Unoriginal—and Exactly What Humans Need, 2023. URL: https://www.wired.com/story/chatgpt-education-originality/.
  * Hargreaves [2023] S. Hargreaves,  ‘Words Are Flowing Out Like Endless Rain Into a Paper Cup’: ChatGPT & Law School Assessments,  SSRN Electronic Journal (2023). doi:10.2139/ssrn.4359407.
  * Fensel et al. [2020] D. Fensel, U. Şimşek, K. Angele, E. Huaman, E. Kärle, O. Panasiuk, I. Toma, J. Umbrich, A. Wahler,  Introduction: What Is a Knowledge Graph?,  in: Knowledge Graphs, Springer International Publishing, Cham, 2020, pp. 1–10. doi:10.1007/978-3-030-37439-6_1.
  * Abu-Rasheed et al. [2023] H. Abu-Rasheed, M. Dornhöfer, C. Weber, G. Kismihók, U. Buchmann, M. Fathi,  Building Contextual Knowledge Graphs for Personalized Learning Recommendations Using Text Mining and Semantic Graph Completion,  in: 2023 IEEE International Conference on Advanced Learning Technologies (ICALT), IEEE, Orem, UT, USA, 2023, pp. 36–40. doi:10.1109/ICALT58122.2023.00016.
  * Pan et al. [2023] S. Pan, L. Luo, Y. Wang, C. Chen, J. Wang, X. Wu, Unifying Large Language Models and Knowledge Graphs: A Roadmap, 2023. ArXiv:2306.08302 [cs].
  * Luo et al. [2023] L. Luo, Y.-F. Li, G. Haffari, S. Pan, Reasoning on Graphs: Faithful and Interpretable Large Language Model Reasoning, 2023. URL: http://arxiv.org/abs/2310.01061, arXiv:2310.01061 [cs].
  * Logan et al. [2019] R. Logan, N. F. Liu, M. E. Peters, M. Gardner, S. Singh,  Barack’s Wife Hillary: Using Knowledge Graphs for Fact-Aware Language Modeling,  in: Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Association for Computational Linguistics, Florence, Italy, 2019, pp. 5962–5971. doi:10.18653/v1/P19-1598.
  * Sequeda et al. [2023] J. Sequeda, D. Allemang, B. Jacob, A Benchmark to Understand the Role of Knowledge Graphs on Large Language Model’s Accuracy for Question Answering on Enterprise SQL Databases, 2023. ArXiv:2311.07509 [cs].
  * Munch et al. [2019] M. Munch, J. Dibie-Barthélemy, P.-H. Wuillemin, C. Manfredotti,  Interactive Causal Discovery in Knowledge Graphs,  in: E. Demidova, S. Dietze, J. Breslin, S. Gottschalk, P. Cimiano, B. Ell, A. Lawrynowicz, L. Moss, A.-C. N. Ngomo (Eds.), Joint Proceedings of the 6th International Workshop on Dataset PROFlLing and Search & the 1st Workshop on Semantic Explainability, volume 2465 of CEUR Workshop Proceedings, CEUR, Auckland, New Zealand, 2019, pp. 78–93. ISSN: 1613-0073.
  * Abu-Rasheed et al. [2022] H. Abu-Rasheed, C. Weber, J. Zenkert, M. Dornhöfer, M. Fathi,  Transferrable Framework Based on Knowledge Graphs for Generating Explainable Results in Domain-Specific, Intelligent Information Retrieval,  Informatics 9 (2022) 6. doi:10.3390/informatics9010006, number: 1 Publisher: Multidisciplinary Digital Publishing Institute.
  * Rajabi and Etminani [2022] E. Rajabi, K. Etminani,  Knowledge-graph-based explainable AI: A systematic review,  Journal of Information Science (2022) 01655515221112844. doi:10.1177/01655515221112844, publisher: SAGE Publications Ltd.
  * OpenAI [2023] OpenAI, GPT-4 Technical Report, 2023. doi:10.48550/arXiv.2303.08774, arXiv:2303.08774 [cs].
  * noa [2020] IEEE Standard for Learning Object Metadata,  IEEE Std 1484.12.1-2020 (2020) 1–50. doi:10.1109/IEEESTD.2020.9262118.
  * Abu-Rasheed et al. [2023] H. Abu-Rasheed, C. Weber, M. Dornhöfer, M. Fathi,  Pedagogically-Informed Implementation of Reinforcement Learning on Knowledge Graphs for Context-Aware Learning Recommendations,  in: O. Viberg, I. Jivet, P. Muñoz-Merino, M. Perifanou, T. Papathoma (Eds.), Responsive and Sustainable Educational Futures, volume 14200, Springer Nature Switzerland, Cham, 2023, pp. 518–523. doi:10.1007/978-3-031-42682-7_35, series Title: Lecture Notes in Computer Science.
  * Lin [2004] C.-Y. Lin,  ROUGE: A Package for Automatic Evaluation of Summaries,  in: ACL 2004, 2004.