Emotion-enhanced historical session representation and drive response generation method
By employing an emotion-enhanced historical conversation representation method, and utilizing Large Language Model (LLM) for conversation preprocessing and emotion and stance recognition, an emotion-enhanced historical conversation vector representation is generated. This addresses the problem of existing intelligent customer service systems ignoring users' emotional states, thereby improving the empathic quality of dialogue generation and user satisfaction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-29
- Publication Date
- 2026-03-13
AI Technical Summary
Existing intelligent customer service systems ignore users' emotional state in historical conversations, resulting in generated responses that do not meet users' psychological expectations, lack empathy, and are not targeted enough.
By employing an emotion-enhanced historical conversation representation method, we utilize a Large Language Model (LLM) for conversation preprocessing, emotion recognition and encoding, and stance recognition and encoding to generate emotion-enhanced historical conversation vector representations. These vector representations are then combined with the current user input to generate intelligent customer service responses.
It significantly improved the emotional perception and stance recognition capabilities of the intelligent customer service system, and enhanced the empathy quality of the generated dialogue and user satisfaction.
Smart Images

Figure CN121660103A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and human-computer dialogue technology, specifically to a method for emotion-enhanced historical conversation representation and driven response generation. Background Technology
[0002] In the fields of artificial intelligence and human-computer dialogue technology, with the development of large language model (LLM) technology, intelligent customer service systems have made significant progress in understanding and generating natural language. They typically use historical dialogue records as context input models to maintain the coherence of the dialogue.
[0003] However, existing intelligent customer service systems primarily focus on semantic information (i.e., what the user "said") when encoding and utilizing historical conversations, generally neglecting explicit modeling and utilization of the user's emotional state (i.e., "with what emotions" the user is expressing). This results in the system's inability to understand the "emotional context" of the dialogue. Consequently, the generated responses may be emotionally detached and inappropriate, failing to effectively soothe angry or disappointed users or resonate with happy users, ultimately impacting user experience and problem-solving efficiency. For example, when a user exhibits persistent dissatisfaction due to product issues, existing customer service models may simply answer questions mechanically without proactively expressing apology or reassurance in their responses, potentially exacerbating the user's negative emotions.
[0004] Specifically, existing technologies that rely solely on text have two major problems: First, they lack the ability to perceive emotions, and the system cannot identify the user's emotional state in historical conversations, so the generated responses do not meet the user's psychological expectations; second, they cannot identify the user's stance or opinion, and the system has difficulty judging the user's attitude on a specific topic or subject, so the generation strategy lacks specificity.
[0005] In summary, existing intelligent customer service systems have significant shortcomings in utilizing historical conversations. There is an urgent need for a method that combines historical conversation texts with emotional and positional information to guide dialogue generation, thereby improving the empathy capabilities and generation quality of intelligent customer service systems. Summary of the Invention
[0006] To address the aforementioned problems in existing technologies, this invention provides an emotion-enhanced historical conversation representation and driven response generation method. This method effectively solves the problems of existing intelligent customer service systems that only focus on conversational semantics, ignore user emotions and stances, and lack empathy and specificity in their responses. It effectively improves the emotion perception and stance recognition capabilities of customer service systems, the empathy quality of generated dialogues, and the user satisfaction and problem-solving efficiency of intelligent customer service interactions.
[0007] To achieve the above objectives, this invention proposes an emotion-enhanced historical conversation representation and driven response generation method, comprising: S1. Historical conversation preprocessing: Collect historical conversation data and perform text normalization, outputting a normalized historical conversation text sequence; S2. Historical Conversation Text Encoding: The historical conversation text for each round is encoded using a Large Language Model (LLM) to generate a text vector representation (Text embedding). S3. Emotion Recognition and Encoding: An emotion recognition dataset is constructed based on historical conversations. The encoder of the large language model is used as a feature encoder to extract text features from historical conversations. A small emotion classifier is trained. The text of each round of historical conversations is input into the trained small emotion classifier to predict the emotion category and intensity, and then converted into an emotion vector representation, EmotionEmbedding. S4. Stance Recognition and Encoding: Construct a stance recognition dataset based on historical conversations. Use a large language model to extract the topics or stances in each round of historical conversations to train a small stance or opinion classifier. Input the text of each round of historical conversations into the trained small stance or opinion classifier to predict the stance under a specific topic and convert it into a stance vector representation, StanceEmbedding. S5. Historical Conversation Fusion: Text vectors, sentiment vectors, and stance vectors are merged using a splicing and fusion method to output a sentiment-enhanced historical conversation vector representation. S6. Intelligent Customer Service Response Generation: The system takes the emotionally enhanced historical conversation vector representation and the current user input vector as input, feeds them into the LLM to generate intelligent customer service response text, and can adjust the generation strategy according to the emotional intensity and stance trend.
[0008] Preferably, in S1, the collection of historical conversation data includes user-input text, responses generated by the customer service system, and timestamps; the text normalization includes noise removal, sentence segmentation, and annotation of dialogue roles, and the specific steps of the text normalization are as follows: S11. Text standardization: Convert full-width characters to half-width characters, standardize capitalization, regulate redundant spaces and consecutive punctuation marks, and convert common emoticons into text descriptions. S12. Noise Cleanup: Remove log symbols, garbled characters, invisible characters, duplicate messages, and empty messages; S13. Sentence segmentation: Use a text segmenter to segment sentences based on punctuation marks and semantic pauses, maintaining the semantic integrity of each sentence; S14. Dialogue Role Labeling: Label the user or customer service role according to the source of the message to form a standardized dialogue structure.
[0009] Preferably, in S2, the specific process of encoding the historical conversation text is as follows: the normalized historical conversation of each round is input into the encoder mode of the large language model, its semantic vector is extracted, and average pooling is applied to multiple sentences to generate the semantic vector corresponding to each round of conversation. ; In the formula, Indicates the first Semantic vectors for round-robin sessions.
[0010] Preferably, in S3, the specific steps of emotion recognition and encoding are as follows: S31. Emotion Classifier Construction: Determine the set of emotion categories for the target application scenario based on its requirements, design a lightweight emotion classifier, construct a conversation-level emotion annotation dataset and perform cleaning and balancing; train the emotion classifier based on the constructed dataset, input the training samples into the LLM encoder to generate text embeddings, use the text embeddings as input features for training the classifier, optimize the training, use the cross-entropy loss function for class discrimination training, use the Adam optimizer for parameter optimization, use validation set accuracy and F1 score as training termination conditions, and export the model after training the classifier; S32. Historical Conversation Emotion Recognition: Input the historical conversation text of each round into the LLM encoder to generate an embedding representation, then input it into the trained emotion classifier to obtain the emotion category and its probability distribution, and complete the emotion category prediction. S33. Emotion Vector Generation: The emotion categories output by the emotion classifier are mapped to dense vectors of fixed dimensions using a lookup table method to serve as emotion vectors.
[0011] Preferably, the lightweight structure of the emotion classifier includes: a feature extraction layer that uses an LLM encoder as the feature vector of the historical conversation text; a feature transformation layer that uses two fully connected layers to compress the high-dimensional encoded vector of the conversation text output by the LLM encoder to a medium- or low-dimensional space suitable for the classifier; and a classification and discrimination module that uses a Softmax classifier to implement the output of the emotion category probability.
[0012] Preferably, in S31, the specific steps for constructing, cleaning, and balancing the conversation-level sentiment annotation dataset are as follows: S311. Sample collection: Collect real historical conversations from the target business system, including dialogue text and dialogue role information, and cover multiple typical emotional scenarios. S312. Emotion labeling scheme development: Define labeling rules, such as using user expression as the primary factor to determine the emotion category, and combining customer service content to make a comprehensive judgment on the emotion context; S313. Emotion labeling execution: Emotion labeling is completed by human labelers or a large language model constrained by prompt words. The labeling content is the emotion category label for each round of conversation. S314. Data cleaning and balancing: Filter low-quality, noisy, or contradictory samples, and handle class imbalance by undersampling or oversampling to ensure the model training effect.
[0013] Preferably, in S4, the specific steps of position identification and encoding are as follows: S41. Topic Determination: Based on the target application scenario, a topic dictionary is formed by pre-defining a set of topics for the target scenario. Keywords appearing in the text are mapped to topics through the topic dictionary to complete topic extraction. The topic tags proposed from each historical conversation text are used as input for stance identification. S42. Stance Classifier Construction: The stance classifier determines the stance of each text for a specified topic. Stance categories are defined according to business needs, identifying positive, negative, and neutral stance categories. A lightweight classifier structure is designed, and a stance-labeled dataset is constructed, cleaned, and balanced. Based on the constructed dataset, the stance classifier is trained. Historical conversations and topics are fed into an LLM encoder to generate embedding vectors. These embedding vectors are used as input features for training and optimization of the classifier. Cross-entropy loss function is used for class discrimination training, and parameters are optimized using the Adam optimizer. Validation set accuracy and F1 score are used as training termination conditions. After training the classifier, the model is exported. S43. Historical Conversation Stance Recognition: After the stance classifier is constructed, stance recognition is performed on the normalized historical conversation text. The historical conversation text of each round is input into the LLM encoder to generate a semantic embedding representation, and then input into the trained stance classifier to obtain the stance category and its probability distribution, thus completing the stance category prediction. S44. Stance Vector Generation: The stance categories output by the stance classifier are mapped to dense vectors of fixed dimensions using a lookup table method.
[0014] Preferably, the lightweight structure of the stance classifier includes: a feature extraction layer that concatenates historical conversation text with topic information and inputs it into the LLM encoder; a feature transformation layer that uses two fully connected layers to encode and compress the stance features output by the LLM encoder in high dimension to a mid-to-low dimension space suitable for the classifier; and a stance discrimination layer that uses Softmax to output the stance probability distribution under the corresponding topic.
[0015] Preferably, in S42, the specific steps for constructing the position labeling dataset and performing cleaning and balancing are as follows: S421. Sample collection: Sample from historical sessions of specific business scenarios, covering various topics; S422. Topic Stance Labeling: Each historical conversation text is labeled with the corresponding topic and the stance category under that topic. The labeling method uses LLM-assisted generation + manual review. S423. Data cleaning and balancing: Remove noisy or conflicting samples; S424. Balance the class distribution: Filter low-quality, noisy or contradictory samples, and handle class imbalance by undersampling or oversampling to ensure the model training effect.
[0016] Preferably, in S6, the specific process of generating the intelligent customer service response is as follows: combining the emotion-enhanced historical conversation vector representation H with the current user input text U to construct a unified prompt word P, inputting the prompt word P into a pre-trained large language model LLM, and generating a response based on the context, emotion constraints, and stance information in the prompt word, wherein a soothing strategy is adopted for negative emotions and a reinforcement guidance strategy is adopted for positive emotions.
[0017] Therefore, this invention proposes an emotion-enhanced historical conversation representation and driven response generation method, the beneficial effects of which are as follows: (1) To enhance the expression of emotions in historical conversations, emotion and stance vectors are integrated on the basis of the traditional semantic information, so that historical conversations have both text content and emotional attitude information, thereby fundamentally improving the ability to express conversations.
[0018] (2) Accurately capture users’ emotional changes and stance tendencies under specific topics, significantly improving the emotional perception and stance recognition capabilities of intelligent customer service.
[0019] (3) Accurately capture users’ emotional changes and stance tendencies under specific topics, significantly improving the emotional perception and stance recognition capabilities of intelligent customer service.
[0020] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0021] Figure 1 This is a flowchart of the process for generating historical conversation responses based on emotion enhancement, as described in this invention. Figure 2 This is the historical session preprocessing flow of the present invention. Detailed Implementation
[0022] To make the technical solutions, advantages, and objectives of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below. The described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the protection scope of this application.
[0023] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0024] like Figures 1-2 As shown, the present invention provides a method for emotion-enhanced historical conversation representation and driven response generation, comprising: S1. Historical conversation preprocessing: Collect historical conversation data and perform text normalization, outputting a normalized historical conversation text sequence; Collecting historical conversation data includes user input text, responses generated by the customer service system, and timestamps; text normalization includes noise removal, sentence segmentation, and dialogue role labeling. The specific steps of text normalization are as follows: S11. Text standardization: Convert full-width characters to half-width characters, standardize capitalization, regulate redundant spaces and consecutive punctuation marks, and convert common emoticons into text descriptions. S12. Noise Cleanup: Remove log symbols, garbled characters, invisible characters, duplicate messages, and empty messages; S13. Sentence segmentation: Use a text segmenter to segment sentences based on punctuation marks and semantic pauses, maintaining the semantic integrity of each sentence; S14. Dialogue Role Labeling: Label the user or customer service role according to the source of the message to form a standardized dialogue structure.
[0025] S2. Historical Conversation Text Encoding: The historical conversation text for each round is encoded using a Large Language Model (LLM) to generate a text vector representation (Text embedding). The specific process of encoding historical conversation text is as follows: the normalized historical conversation of each round is input into the encoder mode of the large language model, its semantic vector is extracted, and average pooling is applied to multiple sentences to generate the semantic vector corresponding to each round of conversation. ; In the formula, Indicates the first Semantic vectors for round-robin sessions.
[0026] S3. Emotion Recognition and Encoding: An emotion recognition dataset is constructed based on historical conversations. The encoder of the large language model is used as a feature encoder to extract text features from historical conversations. A small emotion classifier is trained. The text of each round of historical conversations is input into the trained small emotion classifier to predict the emotion category and intensity, and then converted into an emotion vector representation, EmotionEmbedding. The lightweight structure of the emotion classifier includes: a feature extraction layer that uses an LLM encoder as the feature vector of the historical conversation text; a feature transformation layer that uses two fully connected layers to compress the high-dimensional encoded vector of the conversation text output by the LLM encoder to a medium-to-low-dimensional space suitable for the classifier; and a classification and discrimination module that uses a Softmax classifier to implement the output of the emotion category probability.
[0027] The specific steps of emotion recognition and encoding are as follows: S31. Emotion Classifier Construction: Determine the set of emotion categories for the target application scenario based on its requirements, design a lightweight emotion classifier, construct a conversation-level emotion annotation dataset and perform cleaning and balancing; train the emotion classifier based on the constructed dataset, input the training samples into the LLM encoder to generate text embeddings, use the text embeddings as input features for training the classifier, optimize the training, use the cross-entropy loss function for class discrimination training, use the Adam optimizer for parameter optimization, use validation set accuracy and F1 score as training termination conditions, and export the model after training the classifier; The specific steps for constructing, cleaning, and balancing a conversation-level sentiment annotation dataset are as follows: S311. Sample collection: Collect real historical conversations from the target business system, including dialogue text and dialogue role information, and cover multiple typical emotional scenarios. S312. Emotion labeling scheme development: Define labeling rules, such as using user expression as the primary factor to determine the emotion category, and combining customer service content to make a comprehensive judgment on the emotion context; S313. Emotion labeling execution: Emotion labeling is completed by human labelers or a large language model constrained by prompt words. The labeling content is the emotion category label for each round of conversation. S314. Data cleaning and balancing: Filter low-quality, noisy, or contradictory samples, and handle class imbalance by undersampling or oversampling to ensure the model training effect.
[0028] S32. Historical Conversation Emotion Recognition: Input the historical conversation text of each round into the LLM encoder to generate an embedding representation, then input it into the trained emotion classifier to obtain the emotion category and its probability distribution, and complete the emotion category prediction. S33. Emotion Vector Generation: The emotion categories output by the emotion classifier are mapped to dense vectors of fixed dimensions using a lookup table method to serve as emotion vectors.
[0029] S4. Stance Recognition and Encoding: Construct a stance recognition dataset based on historical conversations. Use a large language model to extract the topics or stances in each round of historical conversations to train a small stance or opinion classifier. Input the text of each round of historical conversations into the trained small stance or opinion classifier to predict the stance under a specific topic and convert it into a stance vector representation, StanceEmbedding. The lightweight structure of the stance classifier includes: a feature extraction layer that concatenates historical conversation text with topic information and inputs it into the LLM encoder; a feature transformation layer that uses two fully connected layers to encode and compress the high-dimensional stance features output by the LLM encoder into a mid-to-low-dimensional space suitable for the classifier; and a stance discrimination layer that uses Softmax to output the stance probability distribution under the corresponding topic.
[0030] The specific steps of position identification and coding are as follows: S41. Topic Determination: Based on the target application scenario, a topic dictionary is formed by pre-defining a set of topics for the target scenario. Keywords appearing in the text are mapped to topics through the topic dictionary to complete topic extraction. The topic tags proposed from each historical conversation text are used as input for stance identification. S42. Stance Classifier Construction: The stance classifier determines the stance of each text for a specified topic. Stance categories are defined according to business needs, identifying positive, negative, and neutral stance categories. A lightweight classifier structure is designed, and a stance-labeled dataset is constructed, cleaned, and balanced. Based on the constructed dataset, the stance classifier is trained. Historical conversations and topics are fed into an LLM encoder to generate embedding vectors. These embedding vectors are used as input features for training and optimization of the classifier. Cross-entropy loss function is used for class discrimination training, and parameters are optimized using the Adam optimizer. Validation set accuracy and F1 score are used as training termination conditions. After training the classifier, the model is exported. The specific steps for constructing, cleaning, and balancing the position labeling dataset are as follows: S421. Sample collection: Sample from historical sessions of specific business scenarios, covering various topics; S422. Topic Stance Labeling: Each historical conversation text is labeled with the corresponding topic and the stance category under that topic. The labeling method uses LLM-assisted generation + manual review. S423. Data cleaning and balancing: Remove noisy or conflicting samples; S424. Balance the class distribution: Filter low-quality, noisy or contradictory samples, and handle class imbalance by undersampling or oversampling to ensure the model training effect.
[0031] S43. Historical Conversation Stance Recognition: After the stance classifier is constructed, stance recognition is performed on the normalized historical conversation text. The historical conversation text of each round is input into the LLM encoder to generate a semantic embedding representation, and then input into the trained stance classifier to obtain the stance category and its probability distribution, thus completing the stance category prediction. S44. Stance Vector Generation: The stance categories output by the stance classifier are mapped to dense vectors of fixed dimensions using a lookup table method.
[0032] S5. Historical Conversation Fusion: Text vectors, sentiment vectors, and stance vectors are merged using a splicing and fusion method to output a sentiment-enhanced historical conversation vector representation. S6. Intelligent Customer Service Response Generation: The system takes the emotionally enhanced historical conversation vector representation and the current user input vector as input, feeds them into the LLM to generate intelligent customer service response text, and can adjust the generation strategy according to the emotional intensity and stance trend.
[0033] The specific process of generating intelligent customer service responses is as follows: combining the emotion-enhanced historical conversation vector representation H with the current user input text U to construct a unified prompt word P, inputting the prompt word P into a pre-trained large language model LLM, and generating responses based on the context, emotion constraints, and stance information in the prompt word. Negative emotions are addressed using a soothing strategy, while positive emotions are addressed using a reinforcement guidance strategy.
[0034] Example 1: Generation of Emotionally Enhanced Conversational Responses in Logistics Customer Service Scenarios This embodiment uses a logistics customer service scenario as its application object. The target scenario themes include delivery timeliness, express delivery status, receiving experience, customer service, and shipping policy. Emotional categories cover positive (satisfaction, approval), neutral (general inquiry), and negative (dissatisfaction, anxiety, complaint). Stance categories are divided into positive, negative, and neutral. The specific implementation steps are as follows: S1. Historical Session Preprocessing: Collect user-customer service conversation data from a logistics platform over the past 3 months, including user input text, customer service replies, and timestamps.
[0035] The conversation text is standardized as follows: full-width symbols are converted to half-width symbols, such as "!!!" to "!!!", and English capitalization is standardized (e.g., "LOGISTICS" to "logistics"). The corresponding emoticons are converted to emotion categories. Log symbols, garbled characters, and repeated messages of "My package hasn't arrived yet" are removed. Sentences are divided according to punctuation marks, such as splitting "My package is 3 days overdue and hasn't been delivered yet, and I contacted the courier but haven't received a reply" into "My package is 3 days overdue and hasn't been delivered yet" and "I contacted the courier but haven't received a reply yet". Roles are labeled to form a unified format of "[User]: My package is 3 days overdue and hasn't been delivered yet" and "[Customer Service]: Please provide your tracking number", and the standardized conversation text sequence is output.
[0036] S2, Historical Session Text Encoding: The normalized conversation for each round is input into the large language model encoder, and average pooling is applied to the multiple conversation sentences to generate semantic vectors. For example, the user input "My package is 3 days overdue and has not been delivered, and the courier has not replied to my inquiries" is encoded to obtain the corresponding text vector T.
[0037] S3. Emotion Recognition and Encoding: The user conversation text is input into the trained lightweight emotion classifier. After extracting the text features, the predicted emotion category is "dissatisfaction" (negative) and the emotion intensity is high. The emotion result is then mapped to a fixed-dimensional emotion vector E using a lookup table.
[0038] S4. Stance Identification and Coding: The user conversation topic "delivery timeliness" is extracted from the topic dictionary. The conversation text and topic information are concatenated and input into the stance classifier. The predicted stance is "negative" (opposing the current delivery timeliness), and it is converted into a stance vector P.
[0039] S5, Historical Conversation Integration: By using a splicing and fusion method, the text vector T, the emotion vector E, and the stance vector P are combined to output an emotion-enhanced historical conversation vector representation H.
[0040] S6 Intelligent Customer Service Response Generation: The user's current input is "When will it be delivered? I'll refund you if it doesn't arrive soon." This input vector is combined with the enhancement vector H to construct prompt words, which are then input into the large language model.
[0041] The model generates a response using a soothing strategy based on the intensity of emotion (high dissatisfaction) and the trend of stance (negative reinforcement): "We are very sorry for the inconvenience caused! We have urgently checked the delivery trajectory of your package. Due to the recent shortage of regional transportation capacity, the delivery has been delayed. The courier is currently expediting the delivery and it is expected to arrive within 2 hours. If you still have not received it, we will prioritize processing your refund or compensation, and we will notify you of any further developments as soon as possible."
[0042] Therefore, this invention provides an emotion-enhanced historical conversation representation and driven response generation method. Through a lightweight emotion and stance classifier, it accurately captures user emotional changes and topic attitudes, enabling customer service systems to understand both user needs and their emotions and stances. By leveraging emotion-constrained prompts, it achieves emotion-oriented generation control, specifically addressing negative emotions and strengthening positive guidance to generate empathetic and strategic responses. It requires no modification to the large language model structure, boasts strong compatibility and scalability, allows for independent module upgrades, is easy to deploy and integrate into various business systems, reduces emotion-related communication errors, improves dialogue quality and user satisfaction, and promotes more intelligent and human-centered human-computer dialogue systems.
[0043] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for emotion-enhanced historical conversation representation and driven response generation, characterized in that, include: S1. Historical conversation preprocessing: Collect historical conversation data and perform text normalization, outputting a normalized historical conversation text sequence; S2. Historical Conversation Text Encoding: The historical conversation text for each round is encoded using a Large Language Model (LLM) to generate a text vector representation (Text embedding). S3. Emotion Recognition and Encoding: An emotion recognition dataset is constructed based on historical conversations. The encoder of the large language model is used as a feature encoder to extract text features from historical conversations. A small emotion classifier is trained. The text of each round of historical conversations is input into the trained small emotion classifier to predict the emotion category and intensity, and then converted into an emotion vector representation, EmotionEmbedding. S4. Stance Recognition and Encoding: Construct a stance recognition dataset based on historical conversations. Use a large language model to extract the topics or stances in each round of historical conversations to train a small stance or opinion classifier. Input the text of each round of historical conversations into the trained small stance or opinion classifier to predict the stance under a specific topic and convert it into a stance vector representation, StanceEmbedding. S5. Historical Conversation Fusion: Text vectors, sentiment vectors, and stance vectors are merged using a splicing and fusion method to output a sentiment-enhanced historical conversation vector representation. S6. Intelligent Customer Service Response Generation: The system takes the emotionally enhanced historical conversation vector representation and the current user input vector as input, feeds them into the LLM to generate intelligent customer service response text, and can adjust the generation strategy according to the emotional intensity and stance trend.
2. The method according to claim 1, characterized in that, In S1, the collection of historical conversation data includes user-input text, responses generated by the customer service system, and timestamps; the text normalization includes noise removal, sentence segmentation, and annotation of dialogue roles. The specific steps of the text normalization are as follows: S11. Text standardization: Convert full-width characters to half-width characters, standardize capitalization, regulate redundant spaces and consecutive punctuation marks, and convert common emoticons into text descriptions. S12. Noise Cleanup: Remove log symbols, garbled characters, invisible characters, duplicate messages, and empty messages; S13. Sentence segmentation: Use a text segmenter to segment sentences based on punctuation marks and semantic pauses, maintaining the semantic integrity of each sentence; S14. Dialogue Role Labeling: Label the user or customer service role according to the source of the message to form a standardized dialogue structure.
3. The method according to claim 1, characterized in that, In S2, the specific process of encoding the historical conversation text is as follows: the normalized historical conversation of each round is input into the encoder mode of the large language model, its semantic vector is extracted, and average pooling is applied to multiple sentences to generate the semantic vector corresponding to each round of conversation. ; In the formula, Indicates the first Semantic vectors for round-robin sessions.
4. The method according to claim 1, characterized in that, In S3, the specific steps of emotion recognition and encoding are as follows: S31. Emotion Classifier Construction: Determine the set of emotion categories for the target application scenario based on the requirements of the target application scenario, design a lightweight emotion classifier, construct a conversation-level emotion annotation dataset, and clean and balance it. Based on the constructed dataset, the emotion classifier is trained. The training samples are input into the LLM encoder to generate text embeddings. The text embeddings are used as input features for training the classifier. The training is optimized by using the cross-entropy loss function for class discrimination training and the Adam optimizer for parameter optimization. The validation set accuracy and F1 score are used as training termination conditions. After training the classifier, the model is exported. S32. Historical Conversation Emotion Recognition: Input the historical conversation text of each round into the LLM encoder to generate an embedding representation, then input it into the trained emotion classifier to obtain the emotion category and its probability distribution, and complete the emotion category prediction. S33. Emotion Vector Generation: The emotion categories output by the emotion classifier are mapped to dense vectors of fixed dimensions using a lookup table method to serve as emotion vectors.
5. The method according to claim 4, characterized in that, The lightweight structure of the emotion classifier includes: a feature extraction layer that uses an LLM encoder as the feature vector of the historical conversation text; a feature transformation layer that uses two fully connected layers to compress the high-dimensional encoded vector of the conversation text output by the LLM encoder to a medium- or low-dimensional space suitable for the classifier; and a classification and discrimination module that uses a Softmax classifier to implement the output of the emotion category probability.
6. The method according to claim 4, characterized in that, In S31, the specific steps for constructing, cleaning, and balancing a conversation-level sentiment annotation dataset are as follows: S311. Sample collection: Collect real historical conversations from the target business system, including dialogue text and dialogue role information, and cover multiple typical emotional scenarios. S312. Emotion labeling scheme development: Define labeling rules, such as using user expression as the primary factor to determine the emotion category, and combining customer service content to make a comprehensive judgment on the emotion context; S313. Emotion labeling execution: Emotion labeling is completed by human labelers or a large language model constrained by prompt words. The labeling content is the emotion category label for each round of conversation. S314. Data cleaning and balancing: Filter low-quality, noisy, or contradictory samples, and handle class imbalance by undersampling or oversampling to ensure the model training effect.
7. The method according to claim 1, characterized in that, In S4, the specific steps of position identification and encoding are as follows: S41. Topic Determination: Based on the target application scenario, a topic dictionary is formed by pre-defining a set of topics for the target scenario. Keywords appearing in the text are mapped to topics through the topic dictionary to complete topic extraction. The topic tags proposed from each historical conversation text are used as input for stance identification. S42. Stance Classifier Construction: The stance classifier determines the stance of each text for a specified topic, defines stance categories according to business needs, determines positive, negative, and neutral stance categories, designs a lightweight classifier structure, constructs a stance labeling dataset, and cleans and balances it. Based on the constructed dataset, the stance classifier is trained. Historical conversations and topics are fed into the LLM encoder to generate embedding vectors. The embedding vectors are used as input features for training and optimization of the classifier. The cross-entropy loss function is used for class discrimination training. The parameters are optimized by the Adam optimizer. The validation set accuracy and F1 score are used as training termination conditions. After training the classifier, the model is exported. S43. Historical Conversation Stance Recognition: After the stance classifier is constructed, stance recognition is performed on the normalized historical conversation text. The historical conversation text of each round is input into the LLM encoder to generate a semantic embedding representation, and then input into the trained stance classifier to obtain the stance category and its probability distribution, thus completing the stance category prediction. S44. Stance Vector Generation: The stance categories output by the stance classifier are mapped to dense vectors of fixed dimensions using a lookup table method.
8. The method according to claim 7, characterized in that, The lightweight structure of the position classifier includes: a feature extraction layer that concatenates historical conversation text with topic information and inputs it into the LLM encoder; a feature transformation layer that uses two fully connected layers to encode and compress the position features output by the LLM encoder in high dimension to a mid-to-low dimension space suitable for the classifier; and a position discrimination layer that uses Softmax to output the position probability distribution under the corresponding topic.
9. The method according to claim 7, characterized in that, In S42, the specific steps for constructing, cleaning, and balancing the position labeling dataset are as follows: S421. Sample collection: Sample from historical sessions of specific business scenarios, covering various topics; S422. Topic Stance Labeling: Each historical conversation text is labeled with the corresponding topic and the stance category under that topic. The labeling method uses LLM-assisted generation + manual review. S423. Data cleaning and balancing: Remove noisy or conflicting samples; S424. Balance the class distribution: Filter low-quality, noisy or contradictory samples, and handle class imbalance by undersampling or oversampling to ensure the model training effect.
10. The method according to claim 1, characterized in that, In S6, the specific process of generating the intelligent customer service response is as follows: combine the emotion-enhanced historical conversation vector representation H with the current user input text U to construct a unified prompt word P, input the prompt word P into the pre-trained large language model LLM, and the model generates a response based on the context, emotion constraints and stance information in the prompt word, wherein a soothing strategy is adopted for negative emotions and a reinforcement guidance strategy is adopted for positive emotions.