Empathetic Dialogue Model for Humanoid Robot Head Using Large Language Models

As a researcher in the field of human-robot interaction, I have long been fascinated by the potential of humanoid robots to engage in meaningful, emotionally resonant exchanges with humans. The head of a humanoid robot serves as a critical interface for such interactions, housing sensors and actuators that enable perception and expression. However, a persistent challenge has been the inability of these systems to perceive user emotions in real-time with high accuracy and to generate empathetic responses that feel natural and contextually appropriate. Traditional approaches often result in robotic, formulaic dialogues that fail to establish genuine emotional connections. This limitation stems from immature emotional perception systems and a lack of dynamic integration of emotional semantics into response generation.

The advent of large language models (LLMs) offers a transformative opportunity to address these issues. LLMs, with their profound capabilities in deep semantic understanding and contextual reasoning, can be harnessed to enhance the emotional intelligence of humanoid robots. Yet, current integrations often fall short: emotional exchanges between humanoid robots and users tend to rely on superficial information, neglecting deeper cognitive and affective cues. Moreover, there is a disconnect between emotion recognition modules and the LLM’s cognitive processes, where emotional vectors are not embedded into the LLM’s reasoning layers, leading to a separation between semantic comprehension and emotional judgment.

To overcome these limitations, I propose a novel empathetic response dialogue model for humanoid robot heads based on LLMs. This model establishes a theoretical framework encompassing speech recognition, emotion recognition, and empathetic response generation. It leverages implicit and explicit emotion enhancement techniques to perform deep semantic parsing, accurately identifying user emotions. Furthermore, it constructs an emotional transfer matrix to determine the probabilistic emotional stance for responses, which is then integrated into the LLM to generate dialogues infused with emotional information. This approach aims to significantly enhance the empathetic capabilities of humanoid robot heads in vocal interactions, paving the way for more natural and humanized human-computer interaction.

The design and implementation of this model for humanoid robot heads involve both hardware and software architectures. The hardware platform typically includes a computing unit such as Jetson Orin, a circular microphone array for sound source localization and voice capture, a speech synthesis sensor, binocular cameras for visual input, and an expression panel for facial display. These components are integrated within the head’s structural framework, connected to the outer shell. This setup ensures robust sensorimotor capabilities essential for interactive tasks. On the software side, the architecture comprises three core modules: the emotion recognition module, the AI processing module (centered on the LLM), and the speech conversion module. The workflow begins with the user’s speech signal input. The emotion recognition module extracts emotional information and dialogue text, providing data for subsequent AI processing. The AI module then generates contextually relevant dialogue text incorporating emotional insights, which is passed to the speech conversion module. Finally, this module synthesizes the text into natural speech, enabling empathetic dialogue between the humanoid robot and the user.

To systematically present the hardware interfaces and software flow, I summarize them in the following tables. These components are crucial for enabling the humanoid robot head to perform complex interaction tasks.

Hardware Components of the Humanoid Robot Head System
Component Function Integration
Computing Unit (e.g., Jetson Orin) Processes sensor data and runs AI models Central processing, connected to all sensors and actuators
Circular Microphone Array Captures voice signals with noise reduction and sound localization Deployed around the head for omnidirectional pickup
Speech Synthesis Sensor Converts text to natural speech output Linked to the AI module for response generation
Binocular Cameras Provides visual input for potential multimodal emotion recognition Positioned to simulate human eye gaze and perception
Expression Panel Displays facial expressions to complement vocal responses Synchronized with emotional output from the AI module
Software Module Flow for Human-Robot Interaction
Step Module Action Output
1 Emotion Recognition Processes speech input to extract text and emotional features Dialogue text and emotional labels
2 AI Processing (LLM-based) Generates empathetic response text using emotional context Contextual dialogue text with emotional infusion
3 Speech Conversion Synthesizes text into speech for vocal output Natural spoken response from the humanoid robot

The core of my model lies in the emotion recognition and empathetic response generation processes. For emotion recognition, I employ a hybrid approach that combines implicit and explicit emotion enhancement techniques. This is essential because human emotions are often conveyed not just through explicit words but also through subtle cues in speech and context. The process starts with speech recognition. The raw audio signal, denoted as $x_{\text{audio}} \in \mathbb{R}^{T \times F}$ where $T$ is the number of time frames and $F$ is the feature dimension, undergoes preprocessing. Noise is mitigated through hardware design like the circular microphone array and software algorithms including echo cancellation, multi-channel speech enhancement, and neural network-based denoising. The enhanced signal is then processed using an attention-based deep neural network for automatic speech recognition (ASR). The goal is to find the most probable word sequence $W$ given the acoustic feature sequence $X$:

$$W^* = \arg\max_{W} P(W | X)$$

The ASR pipeline involves framing, windowing, and extracting Mel-frequency cepstral coefficients (MFCCs) to form a feature sequence. This sequence is fed into an acoustic model to produce phoneme sequences, which are then decoded into text $x_{\text{text}} = \{\omega_1, \omega_2, \dots, \omega_n\}$, where $\omega_n$ represents a word and $n$ is the sequence length. The predicted emotion category is $y \in Y$, with $Y = \{y_1, y_2, \dots, y_C\}$ as the set of emotional labels and $C$ the number of categories.

For explicit emotion extraction, I use prompt learning to derive emotional cues from both text and acoustic features. A text prompt is constructed as $x_p = [\text{CLS}] x_{\text{text}}, \text{ my feeling is [MASK]}$. A pre-trained model like BERT predicts the masked emotion word:

$$p(v | x_p) = \text{Softmax}(\text{BERT}(x_p)_{[\text{MASK}]}) \in \mathbb{R}^{V_y}$$

where $V_y$ is the set of emotion words. The emotion classification probability is computed by summing over words mapped to each emotion:

$$p(y | x_{\text{text}}) = \sum_{v \in V_y} p(v | x_p) \cdot \mathbb{I}(v \rightarrow y)$$

Here, $\mathbb{I}(v \rightarrow y)$ is an indicator function that maps word $v$ to emotion $y$. The explicit emotion feature from text is $f_{\text{explicit-text}} = [\text{BERT}(x_p)_{[\text{MASK}]}, p(y | x_{\text{text}})] \in \mathbb{R}^{d_e}$. To incorporate acoustic cues, I define acoustic prompt rules based on features like fundamental frequency $f_0$ and speech rate. For instance:

$$\text{Prompt}_{\text{acoustic}} =
\begin{cases}
\text{“excited”} & \text{if } f_0 > \theta_1 \text{ and speech\_rate} > \theta_2 \\
\text{“frustrated”} & \text{if } f_0 < \theta_3 \text{ and energy} < \theta_4 \\
\vdots &
\end{cases}$$

The acoustic features are combined with text prompts using a multimodal model, yielding $f_{\text{explicit-acoustic}} = \text{MLP}([f_{\text{acoustic}}, \text{Prompt}_{\text{acoustic}}]) \in \mathbb{R}^{d_e}$. The fused explicit emotion feature is then $f_{\text{explicit}} = \text{Concat}(f_{\text{explicit-text}}, f_{\text{explicit-acoustic}}) \in \mathbb{R}^{2d_e}$. The loss for explicit emotion is the cross-entropy:

$$L_{\text{explicit}} = -\sum_{i=1}^{M} \sum_{y \in Y} y_i \log(p(y | x^{(i)}_{\text{text}}, x^{(i)}_{\text{audio}}))$$

where $M$ is the number of samples.

For implicit emotion extraction, I utilize topic modeling to uncover latent emotional themes. The input is a bag-of-words representation $x_{\text{bow}} \in \mathbb{R}^V$ from the recognized text. This is mapped to latent variable parameters via neural networks: $\mu = f_\mu(x_{\text{bow}})$ and $\log \sigma = f_\sigma(x_{\text{bow}})$. A latent variable $z$ is sampled from a Gaussian distribution: $z \sim \mathcal{N}(\mu, \sigma^2)$. The topic distribution is $\theta = \text{Softmax}(z)$, and the word distribution is $p_\omega = \text{Softmax}(W_\phi \theta)$, where $W_\phi$ is the topic-word matrix. The loss for the neural topic model is the evidence lower bound (ELBO):

$$L_{\text{NTM}} = \mathbb{E}_{q(z | x_{\text{bow}})}[\log p(x_{\text{bow}} | z)] – \text{KL}(q(z | x_{\text{bow}}) \| p(z))$$

where $p(z)$ is the prior distribution. A mapping function $f_{\text{map}}: \theta \rightarrow f_{\text{implicit}} = \text{MLP}(\theta) \in \mathbb{R}^{d_i}$ converts topic distributions to implicit emotional features (e.g., $\theta_{\text{“hospital”}} \rightarrow \text{“sadness”}$). These are fused with acoustic features: $f_{\text{implicit-acoustic}} = \text{MLP}([\theta, f_{\text{acoustic}}]) \in \mathbb{R}^{d_i}$, and the combined implicit feature is $f_{\text{implicit}} = \text{Concat}(f_{\text{map}}(\theta), f_{\text{implicit-acoustic}}) \in \mathbb{R}^{2d_i}$.

The final step in emotion recognition is fusion and classification. All features—acoustic $f_{\text{acoustic}}$, semantic $f_{\text{semantic}}$, explicit $f_{\text{explicit}}$, and implicit $f_{\text{implicit}}$—are concatenated: $f_{\text{fused}} = \text{Concat}(f_{\text{acoustic}}, f_{\text{semantic}}, f_{\text{explicit}}, f_{\text{implicit}})$. An attention mechanism models these to produce $f_{\text{att}}$, and a fully connected layer predicts the emotion probability:

$$p(y | f_{\text{att}}) = \text{Softmax}(\text{FC}(f_{\text{att}})) \in \mathbb{R}^C$$

The classification loss is $L_{\text{class}} = -\sum_{i=1}^{M} \sum_{y \in Y} y_i \log(p(y | f^{(i)}_{\text{att}}))$. The total loss is a weighted sum: $L = L_{\text{class}} + \lambda_1 L_{\text{explicit}} + \lambda_2 L_{\text{NTM}}$, with $\lambda_1$ and $\lambda_2$ as weighting coefficients.

Once the user’s emotion is recognized, the model generates an empathetic response. I employ the LLaMA2 LLM, a decoder-only Transformer with 32 layers, for conditional text generation. The input text is converted into word embeddings, processed through the decoder to learn semantic relationships, and generates responses autoregressively. For each Transformer sub-layer with input $h_{\text{in}} = (h_1, h_2, \dots, h_n)$, the output is $h_{\text{out}} = \text{FFN}(\text{Attention}(h_{\text{in}}))$, using techniques like Rotary Position Embedding (RoPE) and multi-head attention.

To infuse emotional context into the LLM, I construct an empathetic dialogue emotional transfer matrix. This matrix models how emotions transition between the user and the humanoid robot during dialogue, based on Ekman’s six basic emotions (joy, disgust, surprise, sadness, anger, fear) plus a neutral state. The matrix $M$ is a $7 \times 7$ matrix where $M_{ij}$ represents the transfer strength from user emotion $i$ to humanoid robot emotion $j$. The values indicate levels of empathy, opposition, or neutrality, as summarized below:

Empathetic Dialogue Emotional Transfer Matrix for Humanoid Robot Responses
Emotion Joy Disgust Surprise Sadness Anger Fear Neutral
Joy ++ + + +
Disgust ++ + +
Surprise + ++ + 0
Sadness + ++ + 0
Anger + + ++ + 0
Fear + + + ++ 0
Neutral + 0 0 0 0 ++

In this table, “++” denotes strong emotional empathy (high connection), “–” strong opposition (conflict), “+” moderate empathy, “-” moderate opposition, and “0” neutrality. Given the predicted emotion probability vector $p_{\text{pred}}$ from the recognition module, the humanoid robot’s response emotion probability is computed as:

$$P_{\text{response}} = M \cdot p_{\text{pred}}$$

This $P_{\text{response}}$ is then used as a conditioning input to the LLaMA2 decoder, guiding it to generate dialogue text that aligns with the desired emotional stance. For example, if the user is detected as sad, the matrix may weight sadness and comfort highly, leading the LLM to produce a consoling response.

The final step is text-to-speech (TTS) synthesis to vocalize the generated text. I utilize the CosyVoice model, which combines autoregressive sequence generation with conditional flow matching and vector quantization. It integrates a multilingual automatic speech recognition (ASR) model to enhance naturalness and emotional expressiveness in speech output. This ensures that the humanoid robot’s vocal responses are not only semantically appropriate but also delivered with prosodic cues that match the emotional content.

To validate the model, I conducted extensive experiments deploying it on an embedded system within a humanoid robot head. The hardware setup included a Jetson Orin computing unit, a circular microphone array (e.g., iFlytek M260C), and other peripherals, running on Ubuntu 22.04. The software modules were integrated into a cohesive pipeline. The evaluation focused on emotion recognition accuracy and empathetic response appropriateness. I established objective criteria through manual annotation: for emotion recognition, the model’s identified emotions were compared against labeled ground truth; for emotion response, the model’s generated emotional tone was assessed against expected emotional responses. The metrics were defined as follows:

$$\text{Accuracy}_{\text{rec}} = \frac{\text{TE}_{\text{rec}}}{\text{TE}_{\text{rec}} + \text{FE}_{\text{rec}}}$$

$$\text{Accuracy}_{\text{res}} = \frac{\text{TE}_{\text{res}}}{\text{TE}_{\text{res}} + \text{FE}_{\text{res}}}$$

where $\text{TE}_{\text{rec}}$ and $\text{FE}_{\text{rec}}$ are the counts of true and false emotion recognitions, and $\text{TE}_{\text{res}}$ and $\text{FE}_{\text{res}}$ are the counts of true and false emotion responses. The experimental procedure involved: (1) powering on the humanoid robot head, which initializes with a facial expression and a greeting; (2) user activation via a wake word like “hello”; (3) automatic launch of the empathetic dialogue system, which processes speech input and generates responses.

After multiple test rounds, the results demonstrated high efficacy. The emotion recognition accuracy reached 92.8%, and the emotion response accuracy achieved 90.6%. These figures indicate a substantial improvement over traditional methods, confirming that the model effectively enhances emotional resonance in human-robot interactions. The humanoid robot head was able to perceive subtle emotional cues and respond in a manner that felt more natural and engaging to users.

In conclusion, the humanoid robot head, as a pivotal element in human-robot interaction, holds immense potential for fostering empathetic communication. My proposed model, leveraging LLMs with advanced emotion recognition and integration techniques, addresses key limitations in current systems. By accurately discerning user emotions through implicit and explicit enhancement and generating emotionally infused dialogues via an emotional transfer matrix, it enables deeper, more meaningful interactions. This work contributes to the development of highly biomimetic humanoid robot heads, enhancing their emotional expressiveness and natural interaction capabilities. Future directions may include expanding the model to incorporate multimodal inputs like visual cues from the binocular cameras, refining the emotional transfer matrix through learning from real-world dialogues, and optimizing the LLM for low-latency deployment on resource-constrained hardware. Ultimately, such advancements will bring us closer to humanoid robots that can truly understand and resonate with human emotions, transforming fields from healthcare to companion robotics.

Throughout this research, the focus has remained on the humanoid robot as a holistic system, with the head serving as the emotional and communicative core. The integration of LLMs not only boosts semantic understanding but also embeds emotional intelligence directly into the dialogue generation process. This synergy is crucial for creating humanoid robots that can navigate complex social environments and build trust with users. As technology progresses, I believe that empathetic humanoid robots will become increasingly prevalent, offering support and companionship in diverse scenarios. The journey toward emotionally intelligent machines is challenging, but with continued innovation in models like the one presented here, the vision of truly empathetic humanoid robots is within reach.

Scroll to Top