Consultation reply method and device, and computer readable storage medium

By aligning and adjusting medical consultation responses with language models and emotion/intent analysis models, the problem of existing systems being unable to understand patients' true needs is solved, resulting in more accurate and effective medical consultations.

CN117312514BActive Publication Date: 2026-07-10SHANG HAI TAN SHI JIAN KANG KE JI YOU XIAN GONG SI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANG HAI TAN SHI JIAN KANG KE JI YOU XIAN GONG SI
Filing Date
2023-09-26
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing medical consultation systems are unable to effectively integrate patients' scattered information and understand their true needs, resulting in responses that do not meet patients' needs and poor medical consultation outcomes.

Method used

The initial response is generated using a language model, and alignment detection is performed by combining an emotion recognition model and an intent analysis model. The initial response information is then adjusted to generate the target response information, thereby improving the comprehensiveness and effectiveness of the alignment detection.

Benefits of technology

It improves the accuracy and efficiency of medical consultations, meets patient needs, and enhances user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312514B_ABST
    Figure CN117312514B_ABST
Patent Text Reader

Abstract

The application provides a consultation reply method and device and a computer readable storage medium, and relates to the technical field of artificial intelligence. The method comprises the following steps: replying to the question information proposed by a user based on a language model to obtain initial reply information; extracting question features in the question information and initial reply features in the initial reply information by using an alignment detection model; performing alignment detection on the question features and the initial reply features to obtain an alignment result; and adjusting the initial reply information based on the alignment result to obtain target reply information. By performing alignment detection and adjustment processing on the question of the user and the reply of the language model, the actual situation and the demand of the user can be more comprehensively understood, the accuracy and effectiveness of the reply information are effectively improved, the accuracy and efficiency of medical consultation are improved, corresponding suggestions and help are provided for the user, and the satisfaction of the user during use is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a consultation response method, apparatus, and computer-readable storage medium. Background Technology

[0002] Artificial intelligence systems have been widely applied in various consulting fields, such as rule-based systems, knowledge graph-based systems, or deep learning-based systems. For example, in the field of medical consultation, these systems learn medical knowledge and simulate doctors' judgments to answer patients' questions.

[0003] In actual conversations, the issues typically involve multiple aspects, including the patient's chief complaint, past medical history, emotional state, and living environment. However, current consultation and response methods fail to align the understanding and response process effectively, and cannot effectively integrate scattered information. This leads to a failure to understand the patient's true needs and provide answers that meet those needs, resulting in poor medical consultation outcomes and an inability to offer effective help to the patient. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a consultation response method, apparatus and computer-readable storage medium to improve the problem of poor medical consultation effect in the prior art.

[0005] To address the aforementioned problems, in a first aspect, embodiments of this application provide a consultation response method, the method comprising:

[0006] The language model responds to the user's question and obtains an initial response.

[0007] The problem features in the problem information and the initial response features in the initial response information are extracted using an alignment detection model.

[0008] Alignment detection is performed on the question features and the initial response features to obtain the alignment result;

[0009] The initial response information is adjusted based on the alignment result to obtain the target response information.

[0010] In the above implementation process, a language model answers the user's question to obtain an initial response. An alignment detection model extracts feature information from both the question and initial response for alignment detection. Based on the alignment result, the initial response is adjusted to obtain the aligned target response. This approach allows for a more comprehensive understanding of the user's actual situation and needs, effectively improving the accuracy and effectiveness of the responses, thereby enhancing the accuracy and efficiency of medical consultations, providing users with relevant advice and assistance, and increasing user satisfaction.

[0011] Optionally, the alignment detection model includes an emotion recognition model and an intent analysis model; the question features include user emotion features and user intent features; and the initial response features include response emotion features and response intent features.

[0012] The step of extracting question features from the question information and initial response features from the initial response information using an alignment detection model includes:

[0013] The emotion recognition model is used to extract the user's emotional features from the question information and the response's emotional features from the initial response information.

[0014] The intent analysis model is used to extract the user intent features from the question information and the response intent features from the initial response information.

[0015] In the above implementation process, during alignment detection, an emotion recognition model and an intent analysis model can be set up to extract emotional and intent features from questions and responses from both emotional and intent perspectives. By recognizing and analyzing these features, key information can be extracted from the question and initial response information, helping to understand the user's emotions and needs. This effectively improves the comprehensiveness and effectiveness of alignment detection by performing alignment detection processing on the user's question information and the provided initial response information from both emotional and intent perspectives.

[0016] Optionally, the emotion recognition model is constructed in the following manner:

[0017] Collect a first dialogue dataset with emotion labels; wherein, the first dialogue dataset includes multiple sets of historical question information and historical response information;

[0018] Based on the initial detection model, feature extraction and encoding are performed on the first dialogue dataset to obtain encoded data;

[0019] The initial detection model is subjected to classification layer combination processing to obtain the initial recognition model;

[0020] The encoded data is classified using the initial recognition model to obtain the classification result;

[0021] The initial recognition model is iteratively trained based on the first dialogue dataset and the classification results to obtain the emotion recognition model.

[0022] In the above implementation process, to extract feature information from the data, a corresponding initial detection model can be pre-built and trained. For emotion recognition, a first dialogue dataset with emotion labels can be pre-collected as the dataset for the initial detection model. Feature extraction and encoding are performed to obtain corresponding encoded data. Based on the initial detection model, a classification layer is combined to construct a corresponding initial recognition model. The encoded data is then classified based on the initial recognition model to map the encoding to the corresponding emotion label space, obtaining the corresponding classification results. The initial recognition model is then iteratively trained based on the first dialogue set and the classification results to obtain an emotion recognition model with high accuracy. The ability to build and train the corresponding emotion recognition model based on historical data to extract emotion features effectively improves the efficiency, accuracy, and effectiveness of the extraction.

[0023] Optionally, the intent analysis model is constructed in the following manner:

[0024] Collect a second dialogue dataset with intent annotations; wherein, the second dialogue dataset includes multiple sets of historical question information, historical response information, and nodes in the associated target knowledge graph;

[0025] The second dialogue dataset is preprocessed to obtain the input vector;

[0026] The initial detection model is subjected to classification layer combination processing to obtain the initial analysis model;

[0027] The input vector is analyzed using the initial analysis model to obtain the analysis results;

[0028] The initial analysis model is trained based on the second dialogue dataset, the analysis results, and the constructed target knowledge graph to obtain the intent analysis model.

[0029] In the above implementation process, to identify emotions, a second dialogue dataset with intent annotations and a knowledge graph can be pre-collected and preprocessed to obtain corresponding input vectors. To extract feature information, an initial detection model can be pre-built and trained, and a classification layer can be applied to the initial detection model to construct a corresponding initial analysis model. The input vector is used as the input data for the initial analysis model for analysis, and the nodes in the corresponding target knowledge graph are used as the corresponding analysis results. The initial analysis model is further trained by combining the corresponding second dialogue set, the analysis results, and the constructed target knowledge graph to obtain an intent analysis model with high relevance to intent analysis. The ability to build and train corresponding intent analysis models based on historical data to extract intent features effectively improves the efficiency, accuracy, and effectiveness of the extraction.

[0030] Optionally, the alignment result includes emotion alignment result and intention alignment result;

[0031] The alignment detection of the question features and the initial response features to obtain the alignment result includes:

[0032] Alignment detection is performed on the user's emotional features and the response's emotional features to obtain the emotional alignment result;

[0033] Alignment detection is performed on the user intent features and the response intent features to obtain the intent alignment result.

[0034] In the above implementation process, when performing alignment detection, alignment detection can be performed separately for the two features of emotion and intention to obtain the corresponding emotion alignment results and intention alignment results respectively, which effectively improves the comprehensiveness and effectiveness of alignment detection.

[0035] Optionally, the target response information includes: updating sentiment information and / or updating intent information; adjusting the initial response information based on the alignment result to obtain the target response information includes:

[0036] If the user's emotional characteristics or the response's emotional characteristics show a negative trend, the emotional alignment result is determined to be misaligned, and the language model is controlled to generate the updated emotional information based on the preset emotional cues.

[0037] If the relevance of the user intent feature or the response intent feature exceeds a set threshold node, the intent alignment result is determined to be misaligned, and the excess node is added to the language model to generate the updated intent information.

[0038] In the above implementation process, when adjusting the initial response information, the emotional and / or intentional content in the initial response information can be updated accordingly based on the actual situation of the emotion alignment and / or intention alignment results. This updated emotional and / or intentional information is then combined with other content to generate the corresponding target response information. This allows for adjustments to the initial response information to regenerate emotionally consistent and highly relevant target response information to meet the user's consultation needs even when the emotion alignment and / or intention alignment results are misaligned. This optimizes the effectiveness of medical consultation and effectively improves user satisfaction.

[0039] Optionally, the method further includes:

[0040] If the user intent feature, the response intent feature, or the update intent information contains a pre-marked danger label, a manual review prompt message is generated.

[0041] In the above implementation process, it is possible to detect whether there are pre-set danger labels in the user intent characteristics, response intent characteristics, or update intent information. In the case of danger labels that represent potential risks or hazards, corresponding manual review prompts are generated to notify manual review, thereby improving the security and compliance of consultation responses.

[0042] Optionally, the method further includes:

[0043] Alignment detection is performed on the question features and the updated response features in the target response information to obtain the updated alignment result;

[0044] If the updated alignment result is determined to be misaligned, a manual response prompt message is generated.

[0045] In the above implementation process, after obtaining the target response information, the updated response characteristics in the target response information can be extracted and aligned with the question features to obtain the corresponding updated alignment results. After multiple alignment checks and adjustments, if the updated alignment results are still misaligned, it indicates that the automatic response function is not suitable for the current user inquiry and can generate corresponding manual response prompts to notify humans to respond to the user's question and provide more accurate and professional manual replies to meet the user's needs.

[0046] Optionally, the language model is constructed in the following manner:

[0047] The initial language model is pre-trained based on multiple language tasks to obtain the trained language model;

[0048] The trained language model is adjusted based on the consultation needs of the consultation scenario to obtain the language model.

[0049] In the above implementation process, to respond appropriately to user-submitted questions, an initial language model can be pre-trained based on various language tasks to obtain a trained language model. Furthermore, considering the differences in terminology, knowledge, and other features across different consultation scenarios, corresponding consultation needs can be determined based on the scenario. The trained language model can then be adjusted accordingly to obtain a language model capable of understanding scenario-specific terminology and dialogue. This ability to pre-train the initial language model and adjust it based on the scenario effectively optimizes the language model's response performance, thereby improving the effectiveness and accuracy of the initial response information.

[0050] Secondly, this application also provides a consultation response device, which includes: a response module, a feature extraction module, an alignment module, and an adjustment module;

[0051] The response module is used to respond to the user's question information using a language model, and obtain initial response information.

[0052] The feature extraction module is used to extract the question features from the question information and the initial response features from the initial response information using an alignment detection model.

[0053] The alignment module is used to perform alignment detection on the question features and the initial response features to obtain an alignment result;

[0054] The adjustment module is used to adjust the initial response information based on the alignment result to obtain the target response information.

[0055] In the above implementation process, the response module uses a language model to answer the questions raised by the user to obtain the corresponding initial response information. The feature extraction model uses an alignment detection model to extract the feature information from the question information and the initial response information. The alignment module performs alignment detection based on the feature information of the two to obtain the corresponding alignment result. The adjustment module adjusts the initial response information based on the actual situation of the alignment result to obtain the aligned target response information.

[0056] Thirdly, embodiments of this application also provide a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform steps in any of the above-described consultation and response methods.

[0057] In summary, the embodiments of this application provide a consultation response method, apparatus, and computer-readable storage medium. By performing alignment detection and adjustment processing on the user's questions and the responses of the language model, it is possible to more comprehensively understand the user's actual situation and needs, effectively improve the accuracy and effectiveness of the response information, thereby improving the accuracy and efficiency of medical consultation, providing users with corresponding suggestions and assistance, and enhancing user satisfaction. Attached Figure Description

[0058] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0059] Figure 1 A block diagram illustrating an electronic device provided in an embodiment of this application;

[0060] Figure 2 A flowchart illustrating a consultation response method provided in an embodiment of this application;

[0061] Figure 3 A detailed flowchart of step S300 provided for an embodiment of this application;

[0062] Figure 4 A detailed flowchart of step S400 provided for an embodiment of this application;

[0063] Figure 5 A detailed flowchart of step S500 provided for an embodiment of this application;

[0064] Figure 6 This is a schematic diagram of a consultation response device provided in an embodiment of this application.

[0065] Icons: 100 - Electronic device; 111 - Memory; 112 - Memory controller; 113 - Processor; 114 - Peripheral interface; 115 - Input / output unit; 116 - Display unit; 600 - Consultation and response device; 610 - Response module; 620 - Feature extraction module; 630 - Alignment module; 640 - Adjustment module. Detailed Implementation

[0066] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.

[0067] In the field of medical consultation, artificial intelligence (AI) systems are typically used to converse with users and answer their questions. In actual conversations, the issues involved usually include the patient's chief complaint, past medical history, emotional state, and living environment. However, current consultation response methods fail to align understanding with the response process. For example, when a patient is emotionally agitated, the AI ​​system may still provide a cold, medical response; or when a patient's expression is ambiguous, the AI ​​may lack the ability to accurately understand their true needs, leading to inaccurate responses. Furthermore, processing is usually limited to a single conversation, failing to effectively integrate fragmented information. For instance, patients may gradually provide their medical history during the conversation, but current AI systems cannot effectively integrate this fragmented information, resulting in an inability to understand the patient's true needs and provide answers that meet those needs. Consequently, the effectiveness of medical consultations is poor, and the system fails to provide effective help to patients.

[0068] To address the aforementioned issues, this application provides a consultation and response method applicable to electronic devices. These devices can be servers, personal computers (PCs), tablets, smartphones, personal digital assistants (PDAs), or other electronic devices with logical computing capabilities. The method can interact with users to obtain their question information and provide accurate and effective responses based on that information for the user's reference.

[0069] Optionally, please refer to Figure 1 , Figure 1 This is a block diagram illustrating an electronic device according to an embodiment of this application. The electronic device 100 may include a memory 111, a memory controller 112, a processor 113, a peripheral interface 114, an input / output unit 115, and a display unit 116. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device 100. For example, the electronic device 100 may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0070] The aforementioned memory 111, memory controller 112, processor 113, peripheral interface 114, input / output unit 115, and display unit 116 are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The aforementioned processor 113 is used to execute executable modules stored in the memory.

[0071] The memory 111 can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory 111 stores programs. After receiving execution instructions, the processor 113 executes the programs. The methods executed by the electronic device 100 as defined in any embodiment of this application can be applied to the processor 113, or implemented by the processor 113.

[0072] The aforementioned processor 113 may be an integrated circuit chip with signal processing capabilities. The processor 113 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a digital signal processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor.

[0073] The peripheral interface 114 described above couples various input / output devices to the processor 113 and the memory 111. In some embodiments, the peripheral interface 114, the processor 113, and the memory controller 112 can be implemented on a single chip. In other instances, they can be implemented on separate chips.

[0074] The input / output unit 115 described above is used to provide user input data. The input / output unit 115 can be, but is not limited to, a mouse and a keyboard.

[0075] The aforementioned display unit 116 provides an interactive interface (e.g., a user interface) between the electronic device 100 and the user, or displays image data for the user's reference. In this embodiment, the display unit can be a liquid crystal display (LCD) or a touch display. If it is a touch display, it can be a capacitive touchscreen or a resistive touchscreen that supports single-point and multi-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations generated simultaneously from one or more locations on the touch display and pass the sensed touch operations to the processor for calculation and processing. In this embodiment, the display unit 116 can display various information such as initial response information provided to the user and adjusted target response information.

[0076] The electronic device in this embodiment can be used to execute various steps in the consultation and response methods provided in the embodiments of this application. The implementation process of the consultation and response methods is described in detail below through several embodiments.

[0077] Please see Figure 2 , Figure 2 This is a flowchart illustrating a consultation response method provided in an embodiment of this application. The method may include steps S200-S500.

[0078] Step S200: The language model responds to the user's question information to obtain initial response information.

[0079] Users can be different types of users in various consultation scenarios. For example, users in legal consultation scenarios can be legal consultants, while users in medical consultation scenarios can be patients or their families. Correspondingly, the questions raised by users can also be related to the consultation scenario. For example, in medical consultation scenarios, users can raise questions about symptoms such as "What are the symptoms of cough, runny nose, and fever?" or questions about the condition such as "Which department should I go to for high blood pressure?"

[0080] Optionally, the electronic device can acquire user input information through voice, typing, or other means, and then recognize and process the input information to obtain question information in text form. The language model can process the recognized question information to obtain initial response information. The initial response information may include relevant answers to the user's question, such as: "For hypertension, you can consult a cardiologist."

[0081] It should be noted that the language model for responding can be constructed in the following way: An initial language model is pre-trained based on multiple language tasks to obtain a trained language model; the trained language model is then adjusted based on the consultation needs of the consultation scenario to obtain the final language model. The initial language model can be various large-scale language dialogue models, such as GPT or BERT. Pre-training the initial language model on a large amount of data through multiple language tasks yields a trained language model with rich language understanding and generation capabilities. Furthermore, considering the differences in terminology and knowledge characteristics across different consultation scenarios—for example, legal consultation and medical consultation scenarios involve significantly different terminology and knowledge graphs—the corresponding consultation needs can be determined based on the consultation scenario. For instance, in a medical consultation scenario, the corresponding consultation needs are medical consultation needs. Various fine-tuning data can be determined based on these medical consultation needs. This fine-tuning data can include medical literature, clinical cases, doctor-patient dialogues, and other data. The trained language model is then adjusted accordingly based on this fine-tuning data to obtain a language model capable of understanding medical terminology and medical dialogue. It can pre-train the initial language model and adjust the model according to the scenario, effectively optimizing the response performance of the language model, thereby improving the effectiveness and accuracy of the initial response information.

[0082] Step S300: Extract problem features from the problem information and initial response features from the initial response information using the alignment detection model.

[0083] In view of the alignment issue between the question and the answer, this application sets up a self-learning alignment detection model. The alignment detection model extracts feature information from the question information and the initial response information to judge the alignment between the question and the answer from multiple aspects.

[0084] Step S400: Alignment detection is performed on the question features and the initial response features to obtain the alignment result.

[0085] Among these methods, alignment detection can be performed based on various extracted feature information to assess the degree of alignment between the response device and the user during consultation, and to obtain the corresponding alignment results.

[0086] Optionally, the alignment result can be in percentage form. When the alignment result is greater than 95%, it indicates alignment; when the alignment result is less than or equal to 95%, it indicates non-alignment.

[0087] Step S500: Adjust the initial response information based on the alignment result to obtain the target response information.

[0088] In this process, the initial response information can be adjusted to align with the question information when the initial response information does not match the question information, based on the actual alignment results, so as to obtain the corresponding target response information.

[0089] Optionally, if the alignment result indicates that the initial response features are aligned with the question features, then no adjustment is required, and the initial response information can be directly used as the target response information for responding.

[0090] It should be noted that the alignment detection model has self-learning capabilities. When staff select or write new responses, or perform alignment checks and adjustments, the updated information can be used to update the alignment detection model, thereby reinforcing the learning process. Through continuous trial and error and feedback, the alignment detection model learns how to perform alignment checks and adjustments more accurately.

[0091] exist Figure 2 In the illustrated embodiments, a more comprehensive understanding of the user's actual situation and needs is achieved, effectively improving the accuracy and effectiveness of the response information, thereby enhancing the accuracy and efficiency of medical consultation, providing users with corresponding suggestions and assistance, and increasing user satisfaction.

[0092] Optionally, to achieve multi-faceted alignment detection and adjustment, the alignment detection model may include an emotion recognition model and an intent analysis model. Correspondingly, the question features may include user emotion features and user intent features, and the initial response features may include response emotion features and response intent features. Therefore, the alignment detection model in this application is context-sensitive, capable of extracting and analyzing user emotion features and user intent features, as well as response emotion features and response intent features from the initial response information, within a certain window of continuous dialogue, to more comprehensively understand the user's needs and situation.

[0093] Please see Figure 3 , Figure 3 This is a detailed flowchart of step S300 provided in an embodiment of the present application. Step S300 may include steps S310-S320.

[0094] Step S310: Extract user emotion features from question information and response emotion features from initial response information using an emotion recognition model.

[0095] Specifically, based on the emotion recognition model, user emotion features in the question information and response emotion features in the initial response can be extracted for further processing.

[0096] It should be noted that the emotion recognition model can be constructed as follows: First, a first dialogue dataset with emotion labels is collected; this dataset includes multiple sets of historical question and response information; features are extracted and encoded from the first dialogue dataset based on an initial detection model to obtain encoded data; a classification layer is applied to the initial detection model to obtain an initial recognition model; the encoded data is classified using the initial recognition model to obtain classification results; the initial recognition model is iteratively trained based on the first dialogue dataset and the classification results to obtain the emotion recognition model. This approach enables the construction and training of corresponding emotion recognition models based on historical data to extract emotion features, effectively improving the efficiency, accuracy, and effectiveness of the extraction.

[0097] Optionally, to extract feature information from the information, a corresponding initial detection model can be pre-built and trained. To effectively capture and process the contextual information of dialogue elements, a small Transformer network based on DistilBERT can be used as the initial detection model. DistilBERT is a compressed Transformer model that, compared to the original BERT, reduces model size and computation by 40% while maintaining most of the performance, enabling it to effectively handle long-range dependency problems and perform massively parallel computations in resource-constrained environments. Two independent networks can be trained based on the DistilBERT model for emotion recognition and intent analysis, respectively.

[0098] Optionally, to identify emotions, a first dialogue dataset with emotion labels can be pre-collected, ensuring that the first dialogue dataset contains the dialogue text and the emotion label (such as positive, negative, or neutral) for each dialogue. Data preprocessing, such as cleaning, word segmentation, and tokenization, can also be performed on the first dialogue dataset to reduce the adverse effects of irrelevant information on emotion recognition.

[0099] Optionally, the DistilBERT model has already learned rich semantic information during the pre-training stage, so it can be directly used to extract and encode features from the first dialogue dataset to obtain the corresponding encoded data. By inputting the dialogue text from the first dialogue dataset into the DistilBERT model, the corresponding context-aware word embedding representations can be obtained.

[0100] Optionally, the DistilBERT model can be combined with appropriate classification layers to construct the corresponding initial recognition model. A fully connected layer or other classifier can be added on top of the DistilBERT model as the initial recognition model, and the encoded data can be classified based on the initial recognition model, mapping the encoded data representation of the dialogue to the emotion label space, and then outputting the corresponding classification results through a multi-class classifier.

[0101] Optionally, the initial recognition model can be iteratively trained using a first dialogue dataset labeled with emotions and the classification results to obtain an emotion recognition model with higher accuracy. For example, the DistilBERT encoded representation of the dialogue can be used as input, the emotion label as the target, and backpropagation and optimization algorithms (such as AdamW) can be used to adjust the model parameters. Through multiple iterations of training, the final emotion recognition model can accurately predict the emotions in the dialogue. AdamW (Adam with Weight Decay) is an optimization algorithm that improves upon the Adam optimization algorithm by introducing a weight decay mechanism to regularize the model parameters.

[0102] It's worth noting that by introducing a weight decay mechanism, AdamW can better control the model's regularization effect, preventing overfitting and improving training performance. During model training, F1 metric and accuracy can be used as evaluation metrics to measure model performance on the validation set. For example, hyperparameters, optimization strategies, or model architecture can be adjusted based on changes in evaluation metrics to achieve better classification performance. Accuracy is a commonly used evaluation metric for classification models, measuring the model's accuracy across the entire dataset. To comprehensively evaluate model performance, F1 metric and accuracy can be combined. F1 metric focuses on the balance between precision and recall, while accuracy emphasizes overall classification accuracy. Using these two metrics together provides a more comprehensive and accurate model evaluation, helping to select the optimal fine-tuning strategy. The F1 metric is a commonly used binary classification evaluation metric, measuring the balance between precision and recall in a classification model. In binary classification problems, positive and negative examples can be considered as the two categories. Precision represents the proportion of samples correctly predicted as positive out of all samples correctly predicted as positive. Recall represents the proportion of samples correctly predicted as positive out of all true positive samples. The F1 score is the harmonic mean of precision and recall, which comprehensively considers the accuracy and comprehensiveness of the classification model. During model fine-tuning, the F1 score can be used as an evaluation metric to measure the model's performance on the validation set. By calculating the precision and recall on the validation set, the corresponding F1 value can be obtained. During fine-tuning, the model's hyperparameters, optimization strategies, or model architecture can be adjusted based on changes in the F1 score to achieve better classification performance. Using the F1 score as an evaluation metric helps balance precision and recall in classification tasks, especially important in cases of imbalanced samples. During fine-tuning, choosing appropriate optimization objectives and tuning strategies to maximize the F1 score can improve the model's classification ability and performance.

[0103] For example, the performance of the emotion recognition model can be evaluated using an independent test dataset. The difference between the predicted results and the actual emotion labels is calculated, and metrics such as accuracy, precision, and recall are evaluated. The model is then tuned and improved based on the evaluation results. The trained DistilBERT emotion recognition model can be applied to an alignment detection model. By inputting the dialogue text into the DistilBERT model, the encoded dialogue data is obtained, and then the emotion recognition model performs emotion classification. Based on the recognition results, the alignment detection model can perform corresponding alignment operations to generate responses that better match emotional needs. The DistilBERT model, through a multi-layered self-attention mechanism, can perform global context modeling of the input text, generating corresponding context-aware representations for each dialogue turn. These representations can incorporate contextual information from the dialogue history, providing more accurate input for emotion recognition. When using the DistilBERT model to build an emotion recognition model for emotion recognition, the context-awareness and semantic representation capabilities of DistilBERT can be leveraged to more accurately identify emotional states in dialogue, improving the emotional intelligence and interaction efficiency of the dialogue system.

[0104] Step S320: Extract user intent features from the question information and response intent features from the initial response information using the intent analysis model.

[0105] Specifically, user intent features in the question information and response intent features in the initial response can be extracted based on the intent recognition model for further processing.

[0106] It should be noted that the intent analysis model can be constructed as follows: A second dialogue dataset with intent annotations is collected; this dataset includes multiple sets of historical question information, historical response information, and nodes from the associated target knowledge graph; the second dialogue dataset is preprocessed to obtain input vectors; a classification layer is applied to the initial detection model to obtain an initial analysis model; the input vectors are analyzed using the initial analysis model to obtain analysis results; the initial analysis model is trained based on the second dialogue dataset, the analysis results, and the constructed target knowledge graph to obtain the intent analysis model. This approach enables the construction and training of corresponding intent analysis models based on historical data to extract intent features, effectively improving the efficiency, accuracy, and effectiveness of the extraction.

[0107] Optionally, to identify emotions, a second dialogue dataset with intent annotation and a knowledge graph can be pre-collected. This second dialogue dataset can contain dialogue content and nodes from a related rehabilitation medicine knowledge graph, and a corresponding target knowledge graph can be established. The target knowledge graph can be selected and constructed according to the consultation scenario. For example, when the consultation scenario is medical consultation, the corresponding target knowledge graph can be a rehabilitation medicine knowledge graph, including entities, relationships, and semantic information in the rehabilitation medicine field. This can be constructed by integrating expert knowledge, research literature, and organizing databases. The second dialogue dataset can also be preprocessed, including operations such as word segmentation, stop word removal, and converting text into vector representations to obtain corresponding input vectors, which can then be used as input to the model.

[0108] Optionally, the initial detection model can be combined with a classification layer to construct a corresponding initial analysis model. The input vector is used as the input data for the initial analysis model, and the nodes in the target knowledge graph are obtained as the corresponding analysis results. For example, in a medical consultation scenario, the output analysis results can be nodes in a rehabilitation medicine knowledge graph, which can infer rehabilitation medicine knowledge graph nodes that the user may be interested in based on the dialogue content, thereby meeting user needs and providing relevant academic information. Mapping the nodes in the rehabilitation medicine knowledge graph to the output of the initial analysis model can be achieved by performing similarity matching between the network output and the knowledge graph nodes in the vector space.

[0109] Optionally, the initial analysis model can be further trained by combining the corresponding second dialogue set, analysis results, and the constructed target knowledge graph to obtain an intent analysis model with higher relevance to intent analysis. During training, the intent analysis model will learn to map dialogue content to relevant knowledge graph nodes, and the training method of the intent analysis model is similar to that of emotion recognition networks, which will not be elaborated further. Based on the output of the intent analysis model and the mapping of knowledge graph nodes, the rehabilitation medicine knowledge graph nodes that the user may be interested in can be predicted and returned to the user as output. These nodes can be related academic information such as rehabilitation treatment methods, rehabilitation equipment, and rehabilitation diseases. By combining the intent recognition network with the rehabilitation medicine knowledge graph, the user's intent can be better understood, and academic knowledge and information related to the field of rehabilitation medicine can be provided, helping users obtain accurate and academic rehabilitation medicine advice, improving the effectiveness of rehabilitation treatment and academic experience.

[0110] exist Figure 3In the illustrated embodiment, key information can be extracted from the question information and initial response information through identification and analysis, which helps to understand the user's emotions and needs. This allows for alignment detection processing of the user's question information and the provided initial response information from both emotional and intentional perspectives, effectively improving the comprehensiveness and effectiveness of alignment detection.

[0111] Please see Figure 4 , Figure 4 This is a detailed flowchart of step S400 provided in an embodiment of the present application. Step S400 may include steps S410-S420.

[0112] Step S410: Alignment detection is performed on the user's emotional features and the response's emotional features to obtain the emotional alignment result.

[0113] Step S420: Alignment detection is performed on the user intent features and response intent features to obtain intent alignment results.

[0114] In the alignment detection process, alignment detection can be performed separately for both emotion and intention features. Therefore, the alignment results can include emotion alignment results and intention alignment results.

[0115] It should be noted that there is no restriction on the execution order of steps S410 and S420. They can be executed in the appropriate order according to the actual situation, or they can be executed simultaneously.

[0116] exist Figure 4 In the described embodiments, corresponding emotion alignment results and intention alignment results can be obtained respectively, which effectively improves the comprehensiveness and effectiveness of alignment detection.

[0117] Optionally, when adjusting the initial response information, the decision tree can select the corresponding alignment operation to update the emotional content and / or intention content in the initial response information according to the actual situation of the emotion alignment result and / or intention alignment result. Therefore, the target response information may include: updated emotional information and / or updated intention information.

[0118] Please see Figure 5 , Figure 5 This is a detailed flowchart of step S500 provided in an embodiment of the present application. Step S500 may include steps S510-S520.

[0119] Step S510: If the user's emotional characteristics or the emotional characteristics of the response show a negative trend, the emotional alignment result is determined to be misaligned, and updated emotional information is generated based on the preset emotional cue control language model.

[0120] When the user's emotional characteristics or the response's emotional characteristics show a negative trend, it indicates that there is a large difference between the user's emotional characteristics and the response's emotional characteristics. The emotional alignment result is determined to be misaligned. Based on the pre-injected emotional cues, the language model can be controlled to regenerate updated emotional information corresponding to the user's emotional characteristics.

[0121] Step S520: If the relevance of the user intent feature or the response intent feature exceeds the set threshold node, the intent alignment result is determined to be misaligned, and the excess node is added to the language model to generate updated intent information.

[0122] Specifically, when the relevance of user intent features or response intent features exceeds a set threshold node, such as when the output of the intent analysis model contains nodes whose relevance to the current dialogue exceeds the set threshold node, the set threshold is the number of nodes set according to the actual situation and needs of the target knowledge graph. It can change accordingly based on changes in the actual situation and needs, and can add the excess nodes as additional information to the context of the language model to generate updated intent information that satisfies the user's intent.

[0123] It should be noted that if the user intent characteristics, response intent characteristics, or update intent information contain pre-marked danger tags, a manual review prompt will be generated. Danger tags can be labels that identify topics with potential danger or risk, such as inquiries about prohibited drugs. Danger tags can be pre-set in the corresponding dialogue. By detecting whether these danger tags are present in the user intent characteristics, response intent characteristics, or update intent information, a corresponding manual review prompt will be generated to notify a human to review the dangerous topic if a danger tag is present, thereby improving the safety and compliance of consultation responses.

[0124] It should be noted that after obtaining the target response information, alignment detection can be performed on the question features and the updated response features in the target response information to obtain an updated alignment result. If the updated alignment result is determined to be misaligned, a human response prompt message is generated. After multiple alignment checks and adjustments, if the updated alignment result is still misaligned, it indicates that the automatic response function is not suitable for the current user inquiry and cannot accurately align with the user's needs. In this case, a corresponding human response prompt message can be generated to notify a human to respond to the user's question and provide a more accurate and professional human reply tailored to the user's needs. Staff can select or write the best response based on the options generated by the alignment detection model. The human response process also provides new training samples for the alignment detection model, helping it to continuously learn and improve.

[0125] exist Figure 5In the illustrated embodiment, even when the emotion alignment result and / or intention alignment result are misaligned, the initial response information can be adjusted to regenerate emotionally consistent and highly relevant target response information to meet the user's consultation needs, thereby optimizing the effectiveness of medical consultation and effectively improving user satisfaction.

[0126] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a consultation response device provided in an embodiment of this application. The consultation response device 600 may include a response module 610, a feature extraction module 620, an alignment module 630, and an adjustment module 640.

[0127] The response module 610 is used to respond to the user's question information through a language model and obtain initial response information;

[0128] The feature extraction module 620 is used to extract question features from the question information and initial response features from the initial response information through the alignment detection model;

[0129] Alignment module 630 is used to perform alignment detection on question features and initial response features to obtain alignment results;

[0130] The adjustment module 640 is used to adjust the initial response information based on the alignment result to obtain the target response information.

[0131] In an optional implementation, the alignment detection model includes an emotion recognition model and an intent analysis model; the question features include user emotion features and user intent features; the initial response features include response emotion features and response intent features; and the feature extraction module 620 is specifically used to: extract user emotion features from the question information and response emotion features from the initial response information through the emotion recognition model; and extract user intent features from the question information and response intent features from the initial response information through the intent analysis model.

[0132] In an optional implementation, the consultation response device 600 may further include a construction module for collecting a first dialogue dataset with emotion labels; wherein the first dialogue dataset includes multiple sets of historical question information and historical response information; feature extraction and encoding processing is performed on the first dialogue dataset based on an initial detection model to obtain encoded data; classification layer combination processing is performed on the initial detection model to obtain an initial recognition model; the encoded data is classified through the initial recognition model to obtain a classification result; and the initial recognition model is iteratively trained based on the first dialogue dataset and the classification result to obtain an emotion recognition model.

[0133] In an optional implementation, the construction module is further configured to: collect a second dialogue dataset with intent annotations; wherein the second dialogue dataset includes multiple sets of historical question information, historical response information, and nodes in the associated target knowledge graph; preprocess the second dialogue dataset to obtain an input vector; perform classification layer combination processing on the initial detection model to obtain an initial analysis model; analyze the input vector through the initial analysis model to obtain analysis results; and train the initial analysis model based on the second dialogue dataset, the analysis results, and the constructed target knowledge graph to obtain an intent analysis model.

[0134] In an optional implementation, the alignment result includes an emotion alignment result and an intent alignment result; the alignment module 630 is specifically used to: perform alignment detection on the user's emotion features and the response's emotion features to obtain an emotion alignment result; and perform alignment detection on the user's intent features and the response's intent features to obtain an intent alignment result.

[0135] In an optional implementation, the target response information includes: updated emotion information and / or updated intent information; the adjustment module 640 is specifically used to: if the user's emotion characteristics or the response's emotion characteristics show a negative trend, determine that the emotion alignment result is misaligned, and generate updated emotion information based on a preset emotion cue control language model; if the relevance of the user's intent characteristics or the response's intent characteristics exceeds a set threshold node, determine that the intent alignment result is misaligned, and add the excess node to the language model to generate updated intent information.

[0136] In an optional implementation, the consultation response device 600 may further include a prompting module for generating a manual review prompt if the user intent characteristics, response intent characteristics, or update intent information contain a pre-marked danger label.

[0137] In an optional implementation, the alignment module 630 is further configured to perform alignment detection on the question features and the updated response features in the target response information to obtain an updated alignment result; the prompting module is further configured to generate a manual response prompt if the updated alignment result is determined to be misaligned.

[0138] In an optional implementation, the building module is further configured to: pre-train an initial language model based on multiple language tasks to obtain a trained language model; and adjust the trained language model based on the consultation needs of the consultation scenario to obtain a language model.

[0139] Since the principle of the consultation response device 600 in this embodiment is similar to that of the aforementioned consultation response method, the implementation of the consultation response device 600 in this embodiment can refer to the description in the above-mentioned consultation response method, and the repeated parts will not be described again.

[0140] This application also provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, they perform the steps of any of the consultation and response methods provided in this embodiment.

[0141] In the several embodiments provided in this application, it should be understood that the disclosed device can also be implemented in other ways. The device embodiments described above are merely illustrative; for example, the block diagrams in the accompanying drawings illustrate the possible architecture, functions, and operations of the device according to various embodiments of this application. In this regard, each block in the block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram, and combinations of block diagrams, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0142] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0143] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0144] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0145] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

[0146] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A consultation response method, characterized in that, The method includes: The language model responds to the user's question and obtains an initial response. The problem features in the problem information and the initial response features in the initial response information are extracted using an alignment detection model. Alignment detection is performed on the question features and the initial response features to obtain the alignment result; The initial response information is adjusted based on the alignment result to obtain the target response information; The alignment detection model includes an emotion recognition model and an intent analysis model; the question features include user emotion features and user intent features; the initial response features include response emotion features and response intent features; the step of extracting the question features from the question information and the initial response features from the initial response information through the alignment detection model includes: extracting the user emotion features from the question information and the response emotion features from the initial response information through the emotion recognition model; extracting the user intent features from the question information and the response intent features from the initial response information through the intent analysis model, and predicting the knowledge graph nodes that the user is interested in; The alignment result includes emotion alignment result and intent alignment result; the target response information includes: updated emotion information and / or updated intent information; adjusting the initial response information based on the alignment result to obtain the target response information includes: if the user's emotion feature or the response's emotion feature shows a negative trend, then the emotion alignment result is determined to be misaligned, and the language model is controlled to generate the updated emotion information based on a preset emotion cue; if the user's intent feature or the response's intent feature contains nodes whose relevance to the current dialogue exceeds a set threshold, then the intent alignment result is determined to be misaligned, and the excess nodes are added to the language model to generate the updated intent information.

2. The method according to claim 1, characterized in that, in, The emotion recognition model is constructed in the following way: Collect a first dialogue dataset with emotion labels; wherein, the first dialogue dataset includes multiple sets of historical question information and historical response information; Based on the initial detection model, feature extraction and encoding are performed on the first dialogue dataset to obtain encoded data; The initial detection model is subjected to classification layer combination processing to obtain the initial recognition model; The encoded data is classified using the initial recognition model to obtain the classification result; The initial recognition model is iteratively trained based on the first dialogue dataset and the classification results to obtain the emotion recognition model.

3. The method according to claim 1, characterized in that, in, The intent analysis model is constructed in the following way: Collect a second dialogue dataset with intent annotations; wherein, the second dialogue dataset includes multiple sets of historical question information, historical response information, and nodes in the associated target knowledge graph; The second dialogue dataset is preprocessed to obtain the input vector; The initial detection model is subjected to classification layer combination processing to obtain the initial analysis model; The input vector is analyzed using the initial analysis model to obtain the analysis results; The initial analysis model is trained based on the second dialogue dataset, the analysis results, and the constructed target knowledge graph to obtain the intent analysis model.

4. The method according to claim 1, characterized in that, The alignment detection of the question features and the initial response features to obtain the alignment result includes: Alignment detection is performed on the user's emotional features and the response's emotional features to obtain the emotional alignment result; Alignment detection is performed on the user intent features and the response intent features to obtain the intent alignment result.

5. The method according to claim 1, characterized in that, The method further includes: If the user intent feature, the response intent feature, or the update intent information contains a pre-marked danger label, a manual review prompt message is generated.

6. The method according to claim 1, characterized in that, The method further includes: Alignment detection is performed on the question features and the updated response features in the target response information to obtain the updated alignment result; If the updated alignment result is determined to be misaligned, a manual response prompt message is generated.

7. The method according to claim 1, characterized in that, in, The language model is constructed in the following way: The initial language model is pre-trained based on multiple language tasks to obtain the trained language model; The trained language model is adjusted based on the consultation needs of the consultation scenario to obtain the language model.

8. A consultation response device, characterized in that, The device includes: a response module, a feature extraction module, an alignment module, and an adjustment module; The response module is used to respond to the user's question information using a language model, and obtain initial response information. The feature extraction module is used to extract the question features from the question information and the initial response features from the initial response information using an alignment detection model. The alignment module is used to perform alignment detection on the question features and the initial response features to obtain an alignment result; The adjustment module is used to adjust the initial response information based on the alignment result to obtain the target response information; The alignment detection model includes an emotion recognition model and an intent analysis model; the question features include user emotion features and user intent features; the initial response features include response emotion features and response intent features; the feature extraction module is specifically used to: extract the user emotion features from the question information and the response emotion features from the initial response information using the emotion recognition model; extract the user intent features from the question information and the response intent features from the initial response information using the intent analysis model, and predict the knowledge graph nodes that the user is interested in; The alignment result includes emotion alignment result and intent alignment result; the target response information includes: updated emotion information and / or updated intent information; the adjustment module is specifically used to: if the user's emotion feature or the response emotion feature has a negative trend, determine that the emotion alignment result is misaligned, and control the language model to generate the updated emotion information based on preset emotion cues; if the user's intent feature or the response intent feature contains nodes whose relevance to the current dialogue exceeds a set threshold, determine that the intent alignment result is misaligned, and add the excess nodes to the language model to generate the updated intent information.

9. A computer-readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when executed by a processor, perform the steps of the method according to any one of claims 1-7.