Psychological state tracking fused interview dialogue model construction method

By integrating psychological state tracking into a large language model, subdividing and dynamically generating psychological states, the problem that existing interview and dialogue systems are difficult to capture patient changes is solved, and the precise tracking and response of dialogue is achieved, which improves the pertinence of dialogue. and accuracy.

CN119416891AActive Publication Date: 2025-02-11EAST CHINA NORMAL UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411458228.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-02-11
Estimated Expiration
2044-10-18

AI Technical Summary

Technical Problem

Existing interview and dialogue systems are difficult to effectively capture the changing information, feelings or symptoms of patients during the conversation, and lack data-driven methods that integrate the theoretical framework of psychology, resulting in ineffective communication and experience impact.

Method used

By integrating psychological state tracking into the large language model, the psychological state is subdivided into the current stage, patient information, predicted results and next strategy according to the psychological theoretical model, and fine-tuning it through the large language model to dynamically generate psychological states to assist Dialogue response is generated, and the interview dialogue model is obtained.

Benefits of technology

Accurate tracking and real-time response to the patient's psychological state is achieved, the targetedness and accuracy of the dialogue are improved, the consultation strategy of psychologists is simulated, and the performance of the model in the professional consultation process is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119416891A_ABST
    Figure CN119416891A_ABST
Patent Text Reader

Abstract

The invention discloses a psychological state tracking fused interview dialogue model construction method, which is characterized in that a psychological state tracking mechanism is integrated into a large language model (LLM) to clearly guide psychological interview dialogues. Specifically, the psychological state is adapted from a theoretical model of a cognitive behavior therapy, and comprises four components: a current stage, patient information, a prediction result and a next strategy. The interview dialogue model is generated by generating dynamic psychological state data and finely adjusting the large language model, so that the interview process of professional psychological therapists is simulated, and technical support is provided for early recognition and troubleshooting of psychological problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a method for constructing an interview dialogue model integrating psychological state tracking. Background Art

[0002] Psychological problems are one of the rising mental health threats worldwide, mainly due to the severe shortage of professional mental health service providers and limited access to these services. To alleviate this situation, computational methods are gradually gaining attention as an emerging tool for large-scale psychological problem detection and prediction. Mental health-related conversational agents have become a promising technical solution due to their non-invasive early detection of psychological problems, while traditional detection mechanisms are often invasive. The current popular conversational robot implementations are based on self-rating scales or prediction criteria, and the target topics in the scale are covered through conversational interactions, which in turn limits the patient's ability to express their feelings. Therefore, there are still many deficiencies in providing chat-like interview dialogue prediction systems in clinical settings.

[0003] In actual psychotherapy, psychiatrists collect and integrate key symptom information from patients while providing appropriate strategies, such as emotional support. To simulate this process, some scholars defined this conversation as task-oriented chat and collected the first dataset D4 for interview conversations. However, most existing studies focus on shallow heuristic attempts, such as predicting topics and generating empathetic responses, and fail to capture the patient's changing information, feelings, or symptoms during the conversation.

[0004] Recently, large language models (LLMs) have achieved remarkable success in various text reasoning tasks. In the field of psychology, ChatGPT and GPT-4 have achieved good performance in predicting psychological states. Although the original researchers envisioned further leveraging this capability for complex psychological tasks, most research still focuses on developing dialogue systems for emotional support. In addition, most of these studies are data-driven and do not integrate relevant psychological theoretical frameworks to guide the dialogue, which also leads to some invalid communication and affects the experience. Summary of the invention

[0005] The purpose of the present invention is to solve the limitations of the interview dialogue system in the prior art. By integrating psychological state tracking into a large language model, a novel method for constructing an interview dialogue model is proposed. Based on the psychological theoretical model, this method subdivides the psychological state into four components: the current stage, patient information, predicted results, and next step strategy. It also fine-tunes the large language model to dynamically generate the psychological state to assist in the response generation of each conversation, train the interview dialogue model, and simulate the psychologist's questioning strategy. Through a dialogue method based on psychological state tracking, the present invention achieves accurate tracking of the patient's psychological state and provides professional explanations and strategies, thereby improving the effect of the interview dialogue, and has broad application prospects and commercial development value.

[0006] The specific technical solution for achieving the purpose of the present invention is:

[0007] A method for constructing an interview dialogue model integrating psychological state tracking, wherein the method specifically includes:

[0008] Step 1: Constructing the interview dialogue dataset

[0009] 1.1: Preliminary construction of interview dialogue dataset

[0010] Construct an interview dialogue dataset based on the ABC model in cognitive behavioral therapy. The dataset will cover various conversation scenarios related to interview dialogues. The conversation content in the dataset will simulate the interaction between doctors and patients in the real world, aiming to provide rich psychological state transfer information for interview dialogues.

[0011] 1.2: Fine-grained mental state annotation

[0012] 1.2.1: Based on the large language model, each round of dialogue is annotated in a fine-grained manner to reflect the current stage of the consultation process, the patient's current information, the predicted results of the patient's condition, and the next dialogue strategy to be taken; this detailed annotation method will provide a guiding framework for model training, thereby improving the accuracy and interpretability of interview dialogue generation;

[0013] 1.2.2: Each round of dialogue will be marked with psychological state:<Stage,Info,Summary,Next> , where Stage represents the current consultation stage, Info represents the patient information, Summary represents the predicted result of the patient's psychological condition, and Next represents the next dialogue strategy;

[0014] Step 2: Mental State Tracking

[0015] 2.1: Construction of mental state tracking framework

[0016] By integrating the POST mental state tracking framework into the large language model, the model will be able to dynamically generate mental states based on the conversation context and generate conversation responses based on this. The core of this approach is to simulate the thinking mode of professional psychologists during the consultation process, so as to generate conversation content that is more in line with professional standards. The mental state tracking framework is expressed by the following formula (a):

[0017]

[0018] Among them, State t is the mental state of the patient in round t; S is a connector; t For the current stage; I t For patient information; Sum t Predict results for psychological conditions; N t For the next strategy;

[0019] 2.2: Dynamic psychological state prediction

[0020] 2.2.1: Based on the large language model, identify the stages of the current consultation process. The stages are divided into three types: identifying the triggering event, analyzing the patient's beliefs, and evaluating the consequences. The identification process is expressed by the following formula (b):

[0021]

[0022] Among them, S t-1 is the stage of the previous round, π represents the large language model, θ represents the parameters of the model, and h t represents the current conversation history, including the conversation up to round t and the patient's speech, which is expressed by the following formula (c):

[0023]

[0024] in, represents the speech of the patient in round t, represents the speech of the model in round t;

[0025] 2.2.2: Based on the conversation history, summarize the symptom information expressed by the patient. The summarization process is expressed by the following formula (d):

[0026]

[0027] Among them, I t-1 Patient information for the t-1 round of conversation;

[0028] 2.2.3: Based on the patient information and symptoms, the real-time psychological condition prediction results are obtained. The process is expressed by the following formula (e):

[0029]

[0030] Among them, Sum t-1 Predict the psychological status of the t-1th round of dialogue;

[0031] 2.2.4: Based on the current stage, patient information and psychological status prediction results, predict the answer strategy that should be adopted in the next round of dialogue, which is expressed by the following formula (f):

[0032]

[0033] 2.3: Dialogue Generation for Interviews

[0034] After the large language model completes the generation of the above mental state, it combines the current round of dialogue history and the patient's mental state to generate the doctor's next response, which is expressed by the following formula (g):

[0035]

[0036] Step 3: Model training

[0037] 3.1: In the process of fine-tuning the large language model, LoRA technology is used to introduce auxiliary dimension reduction and dimension increase matrices, namely matrix A and matrix B, into the architecture of the original model to achieve parameter update; matrix A is initialized with random Gaussian distribution, while matrix B is initialized to a zero matrix; in this process, the parameters of the original model remain unchanged, and only the newly added matrix is ​​trained. The fine-tuning update of the specific model is expressed by the following formula (h):

[0038]

[0039] Among them, W is the weight parameter of the initial model; W′ is the weight parameter after LoRA fine-tuning; B is the zero matrix; A is the matrix initialized by random Gaussian distribution; d is the input dimension of the model weight; k is the output dimension of the model weight; r is the size of the low-rank dimension; In this way, Lora can achieve an effect close to full parameter fine-tuning by adjusting a small number of low-rank parameters;

[0040] 3.2: Input conversation history h t After being processed by the fine-tuned large language model, it is first encoded as a feature vector H, and then combined with the original model parameters and the matrix parameters after Lora fine-tuning. The two parts of the parameters are added through formula (h) to calculate the output sequence Y of the following formula (i), whose length is T:

[0041] Y=[y1,y2,...,y T ] (i);

[0042] 3.3: In the decoding stage, the large language model predicts the response of the next sentence based on the currently generated output sequence and input features; this process is expressed as the following formula (i):

[0043] P(y t |y <t , H)=Dec(E y<t , H, θ; A, B) (j);

[0044] Among them, y <t is the output sequence generated before round t; E y<t is the hidden layer representation of the output sequence; H is the input feature vector; yt represents the output of the model at round t; θ represents the fixed parameters of the model; Dec represents the decoder, which generates a response based on the current model parameters and context information;

[0045] 3.4: In order to train the model to minimize the difference between the generated output and the real dialogue, a loss function is defined It is expressed by the following formula (k):

[0046]

[0047] Where P is the conditional probability in formula (j); T is the length of the sequence of generated results; Represents the loss function, calculates the difference between the generated sequence and the target sequence; trains an interview dialogue model that integrates mental state tracking.

[0048] Compared with the prior art, the present invention has the following beneficial technical effects and significant technical progress:

[0049] 1) By integrating the Post-mental State Tracking (POST) model into the Large Language Model (LLM), the conversation-oriented chat was clearly guided, which enabled dynamic capture and real-time response to changes in patient symptoms, significantly improving the pertinence of the conversation and the accuracy of prediction;

[0050] 2) The POST mechanism defined based on Albert Ellis’ ABC model is adopted to divide the psychological state into four fine-grained components, and the LLM is used for joint optimization, which effectively simulates the consultation strategy of psychologists and improves the performance of the model in simulating professional consultation processes;

[0051] 3) By using LoRA technology to fine-tune the large language model, the model's adaptability in interview dialogue tasks can be quickly improved at a low computational cost. At the same time, combined with the powerful language understanding and generation capabilities of the large model, the efficiency and effectiveness of the dialogue are significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1is a flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0053] See also Figure 1 , the present invention specifically comprises the following steps:

[0054] Step 1: Constructing the interview dialogue dataset

[0055] 1.1: Preliminary construction of interview dialogue dataset

[0056] Construct an interview dialogue dataset based on the ABC model in cognitive behavioral therapy. The dataset will cover various conversation scenarios related to interview dialogues. The conversation content in the dataset will simulate the interaction between doctors and patients in the real world, aiming to provide rich psychological state transfer information for interview dialogues;

[0057] 1.2: Fine-grained mental state annotation

[0058] 1.2.1: Based on a large language model, each round of dialogue is annotated in a fine-grained manner to reflect the current stage of the consultation process, the patient's current information, the predicted results of the patient's condition, and the next dialogue strategy. This detailed annotation method will provide a guiding framework for model training, thereby improving the accuracy and interpretability of interview dialogue generation. ;

[0059] 1.2.2: Each round of dialogue will be marked with psychological state:<Stage,Info,Summary,Next> , where Stage represents the current consultation stage, Info represents the patient information, Summary represents the patient's predicted result, and Next represents the next dialogue strategy;

[0060] Step 2: Mental State Tracking

[0061] 2.1: Construction of mental state tracking framework

[0062] By integrating the POST mental state tracking framework into the large language model, the model will be able to dynamically generate mental states based on the conversation context and generate conversation responses based on this. The core of this method is to simulate the thinking mode of professional psychologists during the consultation process, so as to generate conversation content that is more in line with professional standards. The mental state tracking framework is expressed by the following formula (a):

[0063]

[0064] Among them, State t is the mental state of the patient in round t; S is a connector; t For the current stage; I t For patient information; Sum tis the prediction result; N t For the next strategy;

[0065] 2.2: Dynamic psychological state prediction

[0066] 2.2.1: Based on the large language model, identify the stages of the current consultation process. There are three stages: identifying the triggering event, analyzing the patient's beliefs, and evaluating the consequences. The reasoning process is expressed by the following formula (b):

[0067]

[0068] Among them, S t-1 is the stage of the previous round, π POST represents our POST model, θ represents the parameters of the model, and h t represents the current conversation history, including the conversation up to round t and the patient's speech, which is expressed by the following formula (c):

[0069]

[0070] 2.2.2: Based on the conversation history, summarize the symptom information expressed by the patient. The reasoning process is expressed by the following formula (d):

[0071]

[0072] Among them, I t-1 Patient information for the t-1 round of conversation;

[0073] 2.2.3: Get real-time psychological condition prediction results based on patient information and symptoms. The reasoning process is expressed by the following formula (e):

[0074]

[0075] Among them, Sum t-1 Predict the psychological status of the t-1th round of dialogue;

[0076] 2.2.4: Based on the current stage, patient information and prediction results, predict the answer strategy that should be adopted in the next round of dialogue. The reasoning process is expressed by the following formula (f):

[0077]

[0078] 2.3: Dialogue Generation for Interviews

[0079] After the large language model completes the generation of the above mental state, it combines the current round of dialogue history and the patient's mental state to generate the doctor's next response, which is expressed by the following formula (g):

[0080]

[0081] Step 3: Model training

[0082] 3.1: In the process of fine-tuning the large model, LoRA technology is used to update the parameters by introducing auxiliary dimensionality reduction and dimensionality increase matrices, namely matrix A and matrix B, into the architecture of the original model. Matrix A is initialized with a random Gaussian distribution, while matrix B is initialized to a zero matrix. In this process, the parameters of the original model remain unchanged, and only the newly added matrix is ​​trained. The fine-tuning update of the specific model is expressed by the following formula (h):

[0083]

[0084] Among them, W is the weight parameter of the initial model; W′ is the weight parameter after LoRA fine-tuning; B is the zero matrix; A is the matrix initialized by random Gaussian distribution; d is the input dimension of the model weight; k is the output dimension of the model weight; r is the size of the low-rank dimension. In this way, Lora can achieve an effect close to full parameter fine-tuning by adjusting a small number of low-rank parameters.

[0085] 3.2: Input conversation history h t After being processed by the fine-tuned large model, it is first encoded as a feature vector H, and then combined with the original model parameters and the matrix parameters after Lora fine-tuning. The two parts of the parameters are added through formula (h) to calculate the output sequence Y of the following formula (i), whose length is T:

[0086] Y=[y1,y2,...,y T ] (i);

[0087] 3.3: In the decoding stage, the model predicts the next sentence response based on the currently generated output sequence and input features. This process can be expressed as the following formula (i):

[0088] P(y t |y <t , H)=Dec(E y<t , H, θ; A, B) (j);

[0089] Among them, y <t is the output sequence generated before round t; E y<t is the hidden layer representation of the output sequence; H is the input feature vector; yt represents the output of the model in round t; θ represents the fixed parameters of the model; Dec represents the decoder, which generates a response based on the current model parameters and context information.

[0090] 3.4: In order to train the model to minimize the difference between the generated output and the real dialogue, a loss function is defined It is expressed by the following formula (k):

[0091]

[0092] Where P is the conditional probability in formula (j); T is the length of the sequence of generated results; Represents the loss function, calculates the difference between the generated sequence and the target sequence; trains an interview dialogue model that integrates mental state tracking.

[0093] Example 1

[0094] The conversation history content is described as follows:

[0095] Patient: I feel a little depressed recently.

[0096] Doctor: Yes, can you tell me more about it?

[0097] Patient: I was admitted to graduate school a while ago, but I just missed the mark and didn’t make it.

[0098] Doctor: A little lost?

[0099] Patient: Yes, the classmate in front of me got in with extra points. Doctor: How long will this emotion last?

[0100] Patient: I was very sad during the days when the rankings came out. Doctor: Did you feel helpless and pessimistic? Did you feel worthless?

[0101] Patient: No, I always think I am better than that classmate.

[0102] Doctor: You will definitely feel uncomfortable with this experience.

[0103] Patient: I feel a little disappointed. The number of places for our class has been reduced again, and we may not be able to be admitted to this major.

[0104] Based on the above conversation history, the big language model summarizes: Current stage: C (consequence assessment stage); Patient information: It is known that the patient feels lost due to failure in the postgraduate study; Prediction result: 0 (no psychological problem); Next strategy: empathy and comfort; Doctor's reply: Don't be so pessimistic, it is also very impressive to be qualified for postgraduate study, which shows that you are still recognized. The postgraduate entrance examination may not be as difficult as you think.

[0105] Combined with this sample, the specific process of the interview dialogue is as follows:

[0106] (1) Construction of interview dialogue dataset

[0107] Initial construction of the interview dialogue dataset: By simulating the consultation dialogue between doctors and patients, a dialogue dataset similar to the above examples was collected. In the example dialogue, the patient's stressful event (failure to be admitted to graduate school) was identified, and the doctor guided the conversation by asking for details to collect patient information. The patient's loss of emotions and reactions to the event were recorded as a basis for prediction.

[0108] Fine-grained psychological state annotation: Based on the construction of the dataset, fine-grained psychological state annotation was performed to provide a guiding framework for model training. Based on the large language model, each round of dialogue was carefully annotated, including the consultation stage, patient information, predicted results, and the next dialogue strategy. For example, in the conversation, the patient expressed disappointment about the failure of the postgraduate study. The doctor gradually guided the patient to share more information by asking questions and listening. In this process, the patient's psychological state in the conversation was annotated.

[0109] (2) Psychological state tracking

[0110] Dynamic mental state prediction: In this step, the mental state tracking framework is used to dynamically update the patient's mental state. Based on the conversation history, the large language model recognizes that the current stage is C (consequence assessment stage), that is, the impact of the patient's failure to be admitted to graduate school on the patient. The current stage is represented by S t = "C". Then, the large language model summarizes the symptom information expressed by the patient. In this example, the patient's information is that he feels lost because of his failure to be admitted to graduate school, that is, I t = "It is known that the patient feels lost because of the failure of the postgraduate study." Combined with the context information and the patient's symptoms, the large language model obtains real-time psychological condition prediction results. In this example, the prediction result is c (no psychological problem), that is, Sum t = "0". Finally, based on the other psychological states that have been summarized, predict the answer strategy for the next round of dialogue. In this example, the next strategy is empathy and comfort, expressed as N t = "Empathy and comfort".

[0111] Interview-oriented dialogue generation: Combined with the context information of the dialogue, the large language model summarizes the patient's psychological state and generates the doctor's next response. Based on the context dialogue, the input dialogue history h can be obtained. t:″Patient: I’ve been feeling a little depressed lately\nDoctor: Yeah, can you tell me more about it?\nPatient: I was admitted to graduate school a while ago, but I just missed the mark.\nDoctor: Are you feeling a little disappointed?\nPatient: Yes, the student ahead of me got in with extra points\nDoctor: How long did this feeling last?\nPatient: I was quite sad during those few days when the rankings came out\nDoctor: Do you feel helpless and pessimistic? Do you feel that you have no value?\nPatient: No, I always feel that I am better than that student\nDoctor: You will definitely feel uncomfortable with this experience\nPatient: It’s a bit disappointing, um. The number of places for this year has been reduced again, and I may not be able to get into this major.″, input the data into the large language model, and get the output:″<Stage>C <info>It is known that the patient felt lost due to failure to obtain postgraduate study<Summary>0 <next>Empathy and comfort: "Doctor," Don't be so pessimistic. It's impressive that you are qualified for admission to graduate school. It means you are recognized. The entrance exam may not be as difficult as you think."

[0112] (3) Model training

[0113] Large language models generally have a large number of parameters. When performing full parameter training on large language models, there is often a high demand for computing power and equipment, which also increases the complexity of the entire system. Therefore, in the process of fine-tuning large language models, LoRA technology is used to introduce auxiliary dimensionality reduction and dimensionality increase matrices, namely matrix A and matrix B, into the architecture of the original model to achieve parameter updates, thereby ensuring the quality of fine-tuning while greatly reducing the computing power cost of model fine-tuning. Matrix A is initialized with a random Gaussian distribution, while matrix B is initialized to a zero matrix. In this process, the parameters of the original model remain unchanged, and only the newly added matrix is ​​trained. The fine-tuning update of the specific model is expressed by the following formula (h):

[0114]

[0115] Among them, W is the weight parameter of the initial model; W′ is the weight parameter after LoRA fine-tuning; B is the zero matrix; A is the matrix initialized by random Gaussian distribution; d is the input dimension of the model weight; k is the output dimension of the model weight; r is the size of the low-rank dimension. In this way, Lora can achieve an effect close to full parameter fine-tuning by adjusting a small number of low-rank parameters.

[0116] Enter the conversation history t After being processed by the fine-tuned large language model, it is first encoded as a feature vector H, and then combined with the original model parameters and the matrix parameters after Lora fine-tuning. The two parts of the parameters are added through formula (h) to calculate the output sequence Y of the following formula (i), whose length is T:

[0117] Y=[y1,y2,...,y T ] (i);

[0118] In the decoding stage, the large language model predicts the next sentence response based on the currently generated output sequence and input features. This process can be expressed as the following formula (i):

[0119] P(y t |y <t , H)=Dec(E y<t , H, θ; A, B) (j);

[0120] Among them, y <t is the output sequence generated before round t; E y<t is the hidden layer representation of the output sequence; H is the input feature vector; yt represents the output of the model in round t; θ represents the fixed parameters of the model; Dec represents the decoder, which generates a response based on the current model parameters and context information.

[0121] To train the model to minimize the difference between the generated output and the real conversation, a loss function is defined It is expressed by the following formula (k):

[0122]

[0123] Where P is the conditional probability in formula (j); T is the length of the sequence of generated results; Represents the loss function, calculates the difference between the generated sequence and the target sequence; trains an interview dialogue model that integrates mental state tracking.

[0124] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.< / next> < / info>

Claims

1. A method for constructing an interview dialogue model integrating psychological state tracking, characterized in that the method specifically includes: Step 1: Constructing the interview dialogue dataset 1.1: Preliminary construction of interview dialogue dataset Construct an interview dialogue dataset based on the ABC model in cognitive behavioral therapy. The dataset will cover various conversation scenarios related to interview dialogues. The conversation content in the dataset will simulate the interaction between doctors and patients in the real world, aiming to provide rich psychological state transfer information for interview dialogues. 1.2: Fine-grained mental state annotation 1.2.1: Based on the large language model, each round of dialogue is annotated in a fine-grained manner to reflect the current stage of the consultation process, the patient's current information, the predicted results of the patient's condition, and the next dialogue strategy; 1.2.2: Each round of dialogue will be marked with psychological state:<Stage,Info,Summary,Next> , where Stage represents the current consultation stage, Info represents the patient information, Summary represents the predicted result of the patient's psychological condition, and Next represents the next dialogue strategy; Step 2: Mental State Tracking 2.1: Construction of mental state tracking framework By integrating the POST mental state tracking framework into the large language model, the model will be able to dynamically generate mental states based on the conversation context and generate conversation responses based on this; the mental state tracking framework is expressed by the following formula (a): in, State t is the mental state of the patient in round t; S is a connector; t For the current stage; I t For patient information; Sum t Predict results for psychological conditions; N t For the next strategy; 2.2: Dynamic psychological state prediction 2.2.1: Based on the large language model, identify the stages of the current consultation process. The stages are divided into three types: identifying the triggering event, analyzing the patient's beliefs, and evaluating the consequences. The identification process is expressed by the following formula (b): in, S &' is the stage of the previous round, π represents the large language model, θ represents the parameters of the model, and h represents the current conversation history, including the conversation up to round t and the patient's speech, which is expressed by the following formula (c): in, represents the speech of the patient in round t, represents the speech of the model in round t; 2.2.2: Based on the conversation history, summarize the symptom information expressed by the patient. The summarization process is expressed by the following formula (d): in, I t-1 Patient information for the t-1 round of conversation; 2.2.3: Based on the patient information and symptoms, the real-time psychological condition prediction results are obtained. The process is expressed by the following formula (e): in, Sum t-1 Predict the psychological status of the t-1th round of dialogue; 2.2.4: Based on the current stage, patient information and psychological status prediction results, predict the answer strategy that should be adopted in the next round of dialogue, which is expressed by the following formula (f): 2.3: Dialogue Generation for Interviews After the large language model completes the generation of the above mental state, it combines the current round of dialogue history and the patient's mental state to generate the doctor's next response, which is expressed by the following formula (g): Step 3: Model training 3.1: In the process of fine-tuning the large language model, LoRA technology is used to introduce auxiliary dimension reduction and dimension increase matrices, namely matrix A and matrix B, into the architecture of the original model to achieve parameter update; matrix A is initialized with random Gaussian distribution, while matrix B is initialized to a zero matrix; in this process, the parameters of the original model remain unchanged, and only the newly added matrix is ​​trained. The fine-tuning update of the specific model is expressed by the following formula (h): in, W is the weight parameter of the initial model; W C is the weight parameter after LoRA fine-tuning; B is the zero matrix; A is the matrix initialized by random Gaussian distribution; d is the input dimension of the model weight; k is the output dimension of the model weight; r is the size of the low-rank dimension; 3.2: The input conversation history h is processed by the fine-tuned large language model and first encoded as a feature vector H. Then, the original model parameters and the matrix parameters after Lora fine-tuning are combined and the two parts of the parameters are added through formula (h) to calculate the output sequence Y of the following formula (i), whose length is T: Y = [y ' ,y0,…,y X ] (i); 3.3: In the decoding stage, the large language model predicts the response of the next sentence based on the currently generated output sequence and input features; this process is expressed as the following formula (j): P(y Z |y \Z ,H)= Dec-E _\ ,H,θ;A,B2 (j); Among them, y \Z is the output sequence generated before round t; E _\ is the hidden layer representation of the output sequence; H is the input feature vector; y Z represents the output of the model at round t; θ represents the fixed parameters of the model; Dec represents the decoder, which generates a response based on the current model parameters and context information; 3.4: Defining the loss function It is expressed by the following formula (k): Where P is the conditional probability in formula (j); T is the length of the sequence of generated results; Represents the loss function, calculates the difference between the generated sequence and the target sequence; trains an interview dialogue model that integrates mental state tracking.

Citation Information

Patent Citations

  • Depression interview dialogue generation method based on pre-training language model

    CN113780012A

  • Mental health screening auxiliary diagnosis and dialogue data set generation method

    CN117912667A

  • AI suicide risk analysis method and system based on digital doctors

    CN118098587A