A method for constructing an interview dialogue model integrating psychological state tracking
By integrating the mental state tracking framework and LoRA technology into the large language model and building an interview dialogue model, the problem of insufficient tracking of patients' mental states in existing technologies is solved, dynamic capture and real-time response of dialogues are achieved, and the professionalism and efficiency of the dialogue system are improved.
Patent Information
- Application Number
- CN202411458228.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2044-10-18
AI Technical Summary
Existing interview dialogue systems in the field of mental health lack dynamic tracking and real-time response to patients' mental states, and most studies fail to effectively integrate psychological theoretical frameworks, resulting in ineffective communication.
Integrate mental state tracking into the large language model, build an interview dialogue model, simulate the psychologist's questioning strategy through fine-grained annotation and mental state tracking framework, and use LoRA technology for fine-tuning to improve the model's adaptability.
It achieves accurate tracking and real-time response to the patient's mental state, improves the pertinence and predictive accuracy of the conversation, simulates the consultation process of a professional psychologist, and improves the efficiency and effectiveness of the conversation.
Smart Images

Figure CN119416891B_ABST
Abstract
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 a growing threat to mental health worldwide, primarily due to a severe shortage of professional mental health providers and limited access to these services. To alleviate this situation, computational methods are gaining attention as emerging tools for large-scale detection and prediction of psychological problems. Mental health-related conversational agents are a promising technical solution due to their non-invasive ability to detect early-stage psychological problems, while traditional detection mechanisms are often invasive. Currently popular conversational bot implementations are based on self-rating scales or prediction criteria, covering the target topics in the scale through conversational interaction, which in turn limits the patient's ability to express their feelings. Therefore, there are still many shortcomings in providing chat-like interview conversation 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 researchers have defined this type of conversation as task-oriented chat and collected the first dataset for interview conversations, D4. However, existing research has mostly focused on superficial heuristic attempts, such as predicting topics and generating empathetic responses, failing to capture the patient's constantly changing information, feelings, or symptoms during the conversation.
[0004] Large language models (LLMs) have recently achieved remarkable success in various textual reasoning tasks. In the field of psychology, ChatGPT and GPT-4 have demonstrated strong performance in predicting mental states. While initial researchers envisioned further leveraging this capability for complex psychological tasks, most research has focused on developing conversational systems for emotional support. Furthermore, much of this research is data-driven and lacks the integration of relevant psychological theoretical frameworks to guide conversations, resulting in ineffective communication and a diminished user experience. Summary of the Invention
[0005] The purpose of the present invention is to address 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 the 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. The interview dialogue model is trained to simulate the interview strategy of the psychologist. 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 effectiveness of the interview dialogue. It 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 is characterized in that 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. This 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 transition information for interview dialogues.
[0011] 1.2: Fine-grained mental state annotation
[0012] 1.2.1: Based on the large language model, each conversational turn is annotated in a fine-grained manner to reflect the current stage of the consultation, the patient's current information, the predicted patient condition, and the next conversational strategy. 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 the 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, thereby generating conversation content that is more in line with professional standards. The mental state tracking framework is expressed as the following formula (a):
[0017]
[0018] Among them, State t is the mental state of the patient in round t; is a connector; S 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 Mental 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 categories: identifying the triggering event, analyzing the patient's beliefs, and evaluating the consequences. The identification process is expressed as follows (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, and 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 The 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 conversation 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 update the parameters by introducing auxiliary dimensionality reduction and dimensionality increase matrices, namely matrix A and matrix B, into the original model architecture. Matrix A is initialized using a random Gaussian distribution, while matrix B is initialized to a zero matrix. During this process, the parameters of the original model remain unchanged, and only the newly added matrices are trained. The specific model fine-tuning update 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 The fine-tuned large language model is processed and first encoded into 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 together through formula (h). The output sequence Y of the following formula (i) is calculated, and its length is T:
[0041] Y=[y1,y2,...,y T ] (i);
[0042] 3.3: In the decoding phase, the large language model predicts the next sentence response 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-Psychological State Tracking (POST) model into the Large Language Model (LLM), we explicitly guided the conversation-oriented chat during the interview, enabling dynamic capture and real-time response to changes in patient symptoms, significantly improving the pertinence of the conversation and the accuracy of predictions.
[0050] 2) Using the POST mechanism defined based on Albert Ellis's ABC model, the psychological state is divided into four fine-grained components and jointly optimized through LLM, effectively simulating the psychologist's consultation strategy and improving the model's performance 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 1Flowchart of an embodiment of the present invention. DETAILED DESCRIPTION
[0053] See Figure 1 , the present invention specifically includes 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. This dataset will cover various conversational 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 transition information for interview dialogues.
[0057] 1.2: Fine-grained mental state annotation
[0058] 1.2.1: Based on a large language model, each conversational turn is annotated in a fine-grained manner to reflect the current stage of the consultation, the patient's current information, the predicted patient condition, and the next conversational strategy. This detailed annotation approach 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 the 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 a large language model, the model can dynamically generate mental states based on the conversation context and generate conversational responses based on them. The core of this approach is to simulate the thinking patterns of professional psychologists during consultations, thereby generating conversational content that is more in line with professional standards. The mental state tracking framework is expressed as follows (a):
[0063]
[0064] Among them, State t is the mental state of the patient in round t; is a connector; S 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 Mental State Prediction
[0066] 2.2.1: Based on the large language model, identify the stages of the current consultation process. The stages are divided into three categories: identifying the triggering event, analyzing the patient's beliefs, and evaluating the consequences. The reasoning process is expressed as follows:
[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, h t represents the current conversation history, including the conversation up to round t and the patient's speech, and 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 The patient information for the t-1 round of conversation;
[0073] 2.2.3: Based on the patient information and symptoms, the real-time psychological condition prediction results are obtained. The reasoning process is expressed as 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 conversation 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: During fine-tuning of 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 original model architecture. Matrix A is initialized using a random Gaussian distribution, while matrix B is initialized to a zero matrix. During this process, the parameters of the original model remain unchanged, and only the newly added matrices are trained. The specific model fine-tuning update is expressed as follows (h):
[0083]
[0084] Where W is the initial model weight parameter; W′ is the weight parameter after LoRa fine-tuning; B is the zero matrix; A is the matrix initialized with a random Gaussian distribution; d is the input dimension of the model weight; k is the output dimension of the model weight; and 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 The fine-tuned large model is processed and first encoded into a feature vector H. Then, the original model parameters and the matrix parameters fine-tuned by Lora are combined and the two parts of the parameters are added together by formula (h). The output sequence Y of the following formula (i) is calculated, and its length is T:
[0086] Y=[y1,y2,...,y T ] (i);
[0087] 3.3: In the decoding phase, 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’ve been feeling a little depressed lately.
[0096] Doctor: Yes, can you tell me more about it?
[0097] Patient: I was admitted to graduate school a while ago, but I was just a little short of the mark and didn’t make it.
[0098] Doctor: Feeling a little lost?
[0099] Patient: Yes, the classmate in front of me got in by getting extra points. Doctor: How long will this feeling last?
[0100] Patient: I was very sad during those few days when the rankings came out. Doctor: Did you feel helpless, pessimistic, and worthless?
[0101] Patient: No, I always feel that I am better than that classmate.
[0102] Doctor: You will definitely feel uncomfortable with this experience.
[0103] Patient: I feel a little bit disappointed. Hmm. The number of places for our class has been reduced again, so we may not be able to get into this major.
[0104] Based on the above conversation history, the large 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 entrance examination; 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 entrance examination. It shows that you are still recognized. The postgraduate entrance examination may not be as difficult as you think.
[0105] Based on this example, 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 consultation conversations between doctors and patients, we collected a conversation dataset similar to the examples above. In this example conversation, the patient's stressful event (failure to be admitted to graduate school) was identified, and the doctor guided the conversation by asking for details, thereby collecting patient information. The patient's feelings of loss and reactions to the event were recorded and used as a basis for prediction.
[0108] Fine-grained psychological state annotation: Based on 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 meticulously annotated, including the consultation phase, patient information, predicted results, and next step dialogue strategy. For example, during the conversation, the patient expressed disappointment at failing to be admitted to graduate school. The doctor, through questioning and listening, gradually guided the patient to share more information, annotating the patient's psychological state during the conversation.
[0109] (2) Mental 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 identifies 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". Subsequently, 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 he failed to get into graduate school, that is, I t = "It is known that the patient feels lost due to failure in the postgraduate study." Combining contextual 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 problems), that is, Sum t = "0". Finally, based on the rest of the psychological states that have been summarized, the answer strategy for the next round of dialogue is predicted. 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 contextual information of the dialogue, the large language model summarizes the patient's psychological state and generates the doctor's next response. Based on the contextual dialogue, the input dialogue history h can be obtained. t:″Patient: I’ve been feeling a little depressed lately\nDoctor: Yes, can you tell me more about it?\nPatient: I missed the postgraduate entrance exam a while ago, but I just missed out.\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 were announced.\nDoctor: Do you feel helpless or pessimistic? Do you feel like you have no value?\nPatient: No, I always feel that I am better than that student.\nDoctor: You must feel uncomfortable with this experience.\nPatient: It’s a bit hard to accept, yes. The number of places for this year has been reduced, and I may not be able to get into this major.\nThe data is input into the large language model and the output is:″<Stage>C <info>It is known that the patient felt lost due to failure to get into postgraduate study<Summary>0 <next>Empathy and comfort: "Doctor," don't be so pessimistic. It's impressive that you've been admitted to graduate school. It means you've been 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 a large language model, 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 the large language model, 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, and 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] Where W is the initial model weight parameter; W′ is the weight parameter after LoRa fine-tuning; B is the zero matrix; A is the matrix initialized with a random Gaussian distribution; d is the input dimension of the model weight; k is the output dimension of the model weight; and 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 conversation history t The fine-tuned large language model is processed and first encoded into 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 together through formula (h). The output sequence Y of the following formula (i) is calculated, and its length is T:
[0117] Y=[y1,y2,...,y T ] (i);
[0118] In the decoding phase, 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. This 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 transition information for interview dialogues. 1.2: Fine-grained mental state annotation 1.2.1: Based on the large language model, each conversation round is annotated in a fine-grained manner to reflect the current stage of the consultation, the patient's current information, the predicted patient condition, and the next conversation strategy to be adopted; 1.2.2: Each round of dialogue will be marked with the 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 them; the mental state tracking framework is expressed as follows (a): in, State t is the mental state of the patient in round t; is a connector; S 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 Mental 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 categories: identifying the triggering event, analyzing the patient's beliefs, and evaluating the consequences. The identification process is expressed as follows (b): in, 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, and 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 The 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 conversation 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 update the parameters by introducing auxiliary dimensionality reduction and dimensionality increase matrices, namely matrix A and matrix B, into the original model architecture. Matrix A is initialized using a random Gaussian distribution, while matrix B is initialized to a zero matrix. During this process, the parameters of the original model remain unchanged, and only the newly added matrices are trained. The specific model fine-tuning update is expressed by the following formula (h): in, 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; 3.2: The input conversation history h is processed by the fine-tuned large language model and first encoded into a feature vector H. Then, the original model parameters and the matrix parameters fine-tuned by Lora are combined and the two parts of parameters are added together through formula (h). The output sequence Y is calculated by the following formula (i), whose length is T: Y = [y1,y2,…,y T ] (i); 3.3: 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 is expressed as the following formula (j): P(y t |y <t ,H)= Dec(E y<t ,H,θ;A,B) (j); 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; y t 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
AI suicide risk analysis method and system based on digital doctors
CN118098587A