Psychological counseling dialogue evaluation system based on large language model

By constructing a psychological counseling dialogue assessment system and utilizing low-rank adaptation and keyword extraction techniques, the professional application of the large language model in psychological counseling has been enhanced, achieving effective dialogue assessment and emotional connection, and solving the problem of the universality of the large language model in professional psychological counseling.

CN118983091APending Publication Date: 2024-11-19EAST CHINA NORMAL UNIV
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202411001697.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

Existing large language models generally perform poorly in the field of professional psychological counseling dialogue. They are unable to effectively establish psychological connections, and their responses are generic and impractical, failing to meet the needs of professional psychological counseling.

Method used

A psychological counseling dialogue evaluation system based on a large language model is constructed, including a psychological counseling dialogue model and an evaluation model. The psychological counseling dialogue model is trained by fine-tuning the large language model to simulate the speaking style of a psychological counselor using a low-rank adaptation method; the psychological counseling evaluation model identifies relevant dialogue segments and generates evaluation reports through keyword extraction and cosine similarity calculation.

Benefits of technology

It enables the professional application of the large language model in psychological counseling, effectively listening to and providing reasonable assessment suggestions, establishing emotional connections, and improving the effectiveness of psychological counseling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118983091A_ABST
    Figure CN118983091A_ABST
Patent Text Reader

Abstract

The invention discloses a psychological counseling dialogue evaluation system based on a large language model, and belongs to the field of natural language processing. A data set required for training a large language model comes from a real dialogue, and a model training method adopts low-rank adaptive efficient fine tuning. By applying the data and the training method, a psychological counseling dialogue evaluation system jointly composed of a semi-structured psychological counseling dialogue model and a psychological counseling evaluation model is realized, and AI (Artificial Intelligence) psychological counseling dialogue evaluation service is provided for an interviewee; and meanwhile, an evaluation report for the interviewee to refer to can be generated according to the dialogue content and the evaluation score. According to the method, the psychological consultation dialogue evaluation effect of the large language model can be improved, listening inquiry can be effectively carried out in the psychological consultation process, emotional connection is established, and reasonable evaluation suggestions and emotional support are provided for interviewees.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to the application of large language models in psychological counseling and evaluation scenarios. Background Art

[0002] Text generation is a basic task in the field of natural language processing. This task generates text that meets user expectations based on user input requirements. It has a wide range of applications in downstream tasks such as machine translation and dialogue generation. In recent years, with the vigorous development of artificial intelligence technology, researchers have found that increasing the number of model parameters and training data of pre-trained language models can improve the performance of downstream tasks, and such large-scale models are called large language models. In recent years, with the release and popularity of ChatGPT (OpenAI Inc.), a dialogue generation model based on large language models, the dialogue AI model has left a deep impression on people in open domain question-answering scenarios.

[0003] Empathy text generation aims to better understand the speaker's mood and cognitive perspective, so as to express appropriate responses. The main application scenarios include psychological healing models, stress relief models, etc. Although large language models represented by ChatGPT have good performance in open domain dialogue scenarios, they often perform relatively average in task-oriented dialogue fields that require professional requirements, and cannot establish an effective psychological connection with the interlocutor. The content of the response is often general and impractical. How to make the general model quickly and stably professionally applied to specific task-oriented dialogue fields is a topic that needs to be studied urgently.

[0004] In today's society, people of different ages often have some psychological problems that need timely guidance and communication. In school education, respondents often have psychological problems due to academic performance, relationships with classmates, family problems and other factors. It is very meaningful to use the good conversation ability of the large language model and use more professional psychological counseling knowledge to teach the model so that the model can better meet the requirements of professional psychological counseling and establish effective psychological connections. It is a very meaningful thing to design an AI psychological counseling dialogue evaluation system that can communicate in real time. Summary of the invention

[0005] The purpose of the present invention is to provide a psychological counseling dialogue evaluation system for respondents, which includes a psychological counseling dialogue model and a psychological counseling evaluation model. The psychological counseling dialogue model can simulate the speaking style of a real psychological counselor, understand the problems and situations of the respondents, and provide appropriate opinions to the visiting respondents through semi-structured inquiry. The psychological counseling evaluation model analyzes the historical dialogues in detail to obtain supporting dialogue fragments of the evaluation dimensions, evaluates and scores the visiting respondents through these dialogue fragments, and generates an evaluation report for the interviewed respondents to refer to and evaluate.

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

[0007] A psychological consultation dialogue evaluation system based on a large language model, the system comprising:

[0008] (1) Psychological Counseling Dialogue Model

[0009] Based on the big language model, we collected data from real psychological counseling scenarios. The data included semi-structured psychological counseling dialogues formed by counselors implicitly asking respondents based on sixteen evaluation dimensions. We fed the data to the big language model to learn and build a psychological counseling dialogue model.

[0010] Specific process: Organize each piece of training data into the following form for model fine-tuning:

[0011] Input text: Historical dialogue

[0012] Target output text: expected model response

[0013] Fine-tune the model using the standard loss of the large language model, namely:

[0014] h 0 =UW e +W p (1)

[0015] h l = transformer_block(h l-1 ) (2)

[0016]

[0017] where U={u 1 ,…,u n}; U represents the entire sentence, u i represents each field token, w represents the context window size, and n represents the number of tokens contained in the sentence; W e represents the embedding matrix, W p represents the position encoding matrix, h 0 represents the initial vector of the hidden state, hl represents the hidden state vector of the model layer l, h m represents the hidden state vector of the last layer of the model, and P(u) represents the i The output probability distribution of , L(U) represents the loss of the entire sentence, θ 0 Represents the model pre-training weight parameters;

[0018] Use the Low-Rank Adapter fine-tuning method to freeze the pre-trained parameters θ 0 , only the low-rank adaptation matrix ΔW is updated, and the fine-tuning loss becomes:

[0019] h l =W 0 h l-1 +ΔWh l-1 =W 0 h l-1 +BAh l-1 (5)

[0020]

[0021] Where matrix A is the Gaussian initialization matrix, matrix B is the all-zero matrix, w represents the context window size, W 0 represents the frozen original parameter matrix, W e represents the embedding matrix, h l represents the hidden state vector of the model layer l, h m represents the hidden state vector of the last layer of the model, and P(u) represents the i The output probability distribution of , L(U) represents the loss of the entire sentence, θ 0 represents the model pre-training weight parameter, Δθ represents the low-rank adaptation matrix parameter;

[0022] (2) Psychological Counseling Assessment Model

[0023] Extract keywords from the evaluation dimension q to obtain several keywords k i , counted as K, and obtained the supporting fragments of the sixteen evaluation dimensions in the long text dialogue history; the entire historical dialogue content C i The dialogue turns are divided into a series of sentence-level retrieval segments {D 1 ,...,D M}, to achieve fine-grained retrieval, by calculating the correlation score between keywords and retrieval fragments, identify and find the most relevant paragraphs; for the D j The relevance score of a fragment with all keywords K is expressed as:

[0024] S ij =∑ k∈K f(E(k i ),E(Dj )) (8)

[0025] Where E(·) is the embedding function based on Sentence-Transformer, f(·) is the cosine similarity function, S ij is the score calculated by the cosine similarity method; according to the relevance score, several related single-round dialogue segments are recalled, denoted as P top , ensuring the order of the conversation; at the same time, using the knowledge richness of the large language model, train an auxiliary large language model M R To determine whether the dialogue segment is valid, this process is called the reflection mechanism; assisting the large language model M R The recall result of is expressed as:

[0026]

[0027] Among them, h i indicates a helpful description of the relevant dialogue segment, while r i represents the answer to the evaluation dimension q, Represents the large language model M R The output probability distribution, p top Represents a related single-turn conversation segment;

[0028] The conversation history of the psychological counseling conversation model is handed over to the psychological counseling evaluation model for evaluation, so as to form a psychological counseling conversation evaluation system; the conversation model provides consultation in real time by using Web services, the evaluation model retrieves psychological counseling conversation fragments according to the conversation history, scores the evaluation dimensions according to the retrieved conversation fragments, and generates an evaluation report according to the scoring results.

[0029] The present invention can improve the evaluation effect of the large language model in psychological counseling dialogues, can effectively listen and inquire during the psychological counseling process, establish emotional connections, and give interviewees reasonable evaluation suggestions and emotional support. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 The figure is a flow chart of a psychological counseling dialogue evaluation system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The present invention is further described in detail with reference to the following specific embodiments and drawings. The process, conditions, experimental methods, etc. for implementing the present invention, except for the contents specifically mentioned below, are common knowledge and common common sense in the art and are not particularly limited by the present invention.

[0032] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0033] Example

[0034] See also Figure 1 , this embodiment includes the following specific processes:

[0035] Psychological consultation dialogue model (academic stress dialogue model)

[0036] The large language model selects the open source model GLM4-Chat. The model uses a Transformer Decoder structure and uses mean normalization, rotation position encoding and other technologies to optimize the model training process. This embodiment uses the use of efficient fine-tuning technology to fine-tune the large language model GLM4-Chat as an example for description.

[0037] Example dialogue dataset construction format:

[0038] {"messages":[{"role":"system","content":"If you are a psychological counselor, please empathize with the interviewee based on the systematic and professional psychological counseling dialogue knowledge, and then give a counseling reply based on the historical dialogue content I gave you."},{"role":"users","content":"Historical dialogue: Counselor: Hello, classmate. Thank you very much for participating in this interview. Our interview today is about your academic performance and academic status, and then we will conduct a semi-structured interview. Next, we will officially start our interview. What grade are you in now?\nInterviewee: I am now in our school A third-year interviewee from the School of Computer Science and Technology. \nCounselor: Do you think psychological counseling is big? \nInterviewee: Psychological counseling is okay this semester, because I have suffered before, so this semester is okay. Before this semester, I was preparing for graduate school, but this semester I found that I am not that interested in research. I may just go to graduate school to find a job, so if I find some internship opportunities this semester, I will have internship opportunities that can be converted to full-time internships. It is also difficult to find a job now. \n"},{"role":"assistant","content":"So you seem to have made a decision now, and you have a clear goal of not going to graduate school but looking for a job, right? \n"}]}. Among them, the messages field represents a complete conversation, which can be a multi-round conversation format or a single-round conversation format. The role field represents the role in the conversation. The role system represents the global prompt word definition, users represents the user input role, which is the historical conversation in this embodiment, and assistant represents the model reply role. The content field corresponding to each role represents the specific conversation content of the current role.

[0039] The dataset is constructed as the above input example, and then divided into training set and test set, and then the fine-tuning code is executed. The fine-tuning task is defined as: the model calculates the loss of the content field of the assistant role based on the content field of the users role, and the loss function is the standard language model loss function (Formula 4, Formula 7).

[0040] Psychological Counseling Assessment Model (Academic Stress Assessment Model)

[0041] Note: The meanings of all fields are consistent with those of all fields in the example conversation dataset.

[0042] Example reflection mechanism dataset construction format:

[0043] {"messages":[{"role":"system","content":"If you are a psychological counselor, please screen the support segments based on the system's professional psychological counseling dialogue knowledge, combined with the historical dialogues and evaluation dimensions given to you, and select the most effective support segments."},{"role":"users","content":"Historical dialogue: Counselor: Do you think psychological counseling is important?\nInterviewee: I feel that my mental energy is exhausted recently, and I procrastinate on everything. I feel quite stressed.\nCounselor: Do your parents put some pressure on your studies?\nInterviewee: No. The pressure of studying is mostly self-generated.\nEvaluation dimension: Psychological counseling perceived by the interviewee"},{"role":"assistant","content":"Support segment: Counselor: Do you think psychological counseling is important?\nInterviewee: I feel that my mental energy is exhausted recently, and I procrastinate on everything. I feel quite stressed.\n"}]}. The historical conversations in this example are obtained by vector retrieval of the complete conversation in strict accordance with the retrieval method of the psychological counseling assessment model in the manual. Then, the reflection mechanism of the large language model is used to conduct a secondary check on the retrieved conversation content to screen out useful related conversation fragments.

[0044] Example evaluation dataset construction format:

[0045] {"messages":[{"role":"system","content":"If you are a psychological counselor, please rate the evaluation dimensions given based on the system's professional knowledge of psychological counseling dialogues and historical dialogues. The scores can only be 0 or 1, where 0 represents a low degree and 1 represents a high degree."},{"role":"users","content":"Historical dialogue: Counselor: Do you think psychological counseling is important?\nInterviewee: I feel that my mental energy is being drained recently. I procrastinate on everything and feel quite stressed.\nEvaluation dimension: Psychological counseling as perceived by the interviewee"},{"role":"assistant","content":"1\n"}]}.

[0046] Example evaluation report dataset construction format:

[0047] {"messages":[{"role":"system","content":"If you are a psychological counselor, please generate an evaluation report based on the system's professional knowledge of psychological counseling dialogues, combined with your historical dialogues and the scores of the evaluation dimensions."},{"role":"users","content":"Historical dialogues: ...\nEvaluation dimensions: 1. Psychological counseling perceived by the interviewee: 1\n2. The degree of distress caused by academic problems to the interviewee: 0\n3. The interviewee's recognition of his or her academic performance: 0\n4. The interviewee's recognition of his or her academic status: 0\n5. The interviewee's sense of academic efficacy: 1\n6. Whether the interviewee's academic goals are clear: 1 7. The degree of academic adaptation of the respondents: 1\n8. The employment pressure perceived by the respondents: 0\n9. The peer pressure perceived by the respondents in their studies: 1\n10. The degree to which the respondents care about the evaluation of others: 0\n11. The self-worth of the respondents: 1\n12. The degree of social support perceived by the respondents: 1\n13. The degree of academic involution perceived by the respondents: 1\n14. The negative impact of involution on the respondents: 0\n15. The response of the respondents to academic setbacks: 1\n16. The respondents' attitude towards school Education recognition: 0"},{"role":"assistant","content":"Analysis summary report: 1. English listening and speaking skills are relatively weak, which sometimes makes me feel inferior and I am trying to make up for it. \n2. The time for general education courses in school is relatively concentrated, which is not reasonable. I want to study my weak courses but I am too busy. \n3. The analysis shows that the current pressure and dilemma are mainly due to practical factors, such as personal English proficiency level and school curriculum setting, and have no obvious relationship with the personal mentality and behavior of the respondents. \n"}]}

[0048] According to the above data construction format, the evaluation model is trained.

[0049] This example uses Flask and Faiss to build the backend communication service and vector database respectively. Flask is a lightweight web framework based on Python, which is simple and easy to use. Faiss is an open source vector database framework released by Meta AI, which supports vector calculation and query. The flowchart of the psychological consultation dialogue evaluation system is shown in the attached figure. Figure 1 shown.

[0050] 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.

Claims

1. A psychological consultation dialogue evaluation system based on a large language model, characterized in that: The system comprises: (1) Psychological Counseling Dialogue Model Based on the big language model, we collected data from real psychological counseling scenarios. The data included semi-structured psychological counseling dialogues formed by counselors implicitly asking respondents based on sixteen evaluation dimensions. We fed the data to the big language model to learn and build a psychological counseling dialogue model. Specific process: Organize each piece of training data into the following form for model fine-tuning: Input text: Historical dialogue Target output text: expected model response Fine-tune the model using the standard loss of the large language model, namely: h0=UW e +W p (1) h l =transformer_block(h l-1 ) (2) Where U={u1,...,u n }; U represents the entire sentence, u t represents each field token, w represents the context window size, and n represents the number of tokens contained in the sentence; W e represents the embedding matrix, W p represents the position encoding matrix, h0 represents the initial vector of the hidden state, and h l represents the hidden state vector of the model layer l, h m represents the hidden state vector of the last layer of the model, and P(u) represents the t The output probability distribution of , L(U) represents the loss of the entire sentence, and θ0 represents the model pre-training weight parameter; Using the Low-Rank Adapter fine-tuning method, freeze the pre-training parameters θ0 and only update the low-rank adaptation matrix ΔW. The fine-tuning loss becomes: h l =W0h l-1 +ΔWh l-1 =W0h l-1 +BAh l-1 (5) Where matrix A is the Gaussian initialization matrix, matrix B is the all-zero matrix, w represents the context window size, W0 represents the frozen original parameter matrix, and W e represents the embedding matrix, h l represents the hidden state vector of the model layer l, h m represents the hidden state vector of the last layer of the model, and P(u) represents the t The output probability distribution of , L(U) represents the loss of the entire sentence, θ0 represents the model pre-training weight parameter, and Δθ represents the low-rank adaptation matrix parameter; (2) Psychological Counseling Assessment Model Extract keywords from the evaluation dimension q to obtain several keywords k i , counted as K, and obtained the supporting fragments of the sixteen evaluation dimensions in the long text dialogue history; the entire historical dialogue content C i The dialogue is divided into a series of sentence-level retrieval segments {D1,..., D M }, to achieve fine-grained retrieval, by calculating the correlation score between keywords and retrieval fragments, identify and find the most relevant paragraphs; for the D j The relevance score of a fragment with all keywords K is expressed as: S tj =∑ k∈K f(E(k i ),E(D j )) (8) Where E(·) is the embedding function based on Sentence-Transformer, f(·) is the cosine similarity function, S ij is the score calculated by the cosine similarity method; according to the relevance score, several related single-round dialogue segments are recalled, denoted as P top , ensuring the order of the conversation; at the same time, using the knowledge richness of the large language model, train an auxiliary large language model M R To determine whether the dialogue segment is valid, this process is called the reflection mechanism; assisting the large language model M R The recall result of is expressed as: Among them, h i indicates a helpful description of the relevant dialogue segment, while r i represents the answer to the evaluation dimension q, Represents the large language model M R The output probability distribution, P top Represents a related single-turn conversation segment; The conversation history of the psychological counseling conversation model is handed over to the psychological counseling evaluation model for evaluation, so as to form a psychological counseling conversation evaluation system; the conversation model provides consultation in real time by using Web services, the evaluation model retrieves psychological counseling conversation fragments according to the conversation history, scores the evaluation dimensions according to the retrieved conversation fragments, and generates an evaluation report according to the scoring results.

Citation Information

Cited By

  • Evaluation method for vision-language model alignment limitation

    CN119249115A

  • Multi-agent interpretable text mental health level assessment method and system

    CN119626534A

  • Mental health dialogue model evaluation method, equipment and medium

    CN119908726A

  • Assessment method and device of intelligent agent and large language model, medium and electronic equipment

    CN120508507A

  • Evaluation methods, devices, media, and electronic equipment for intelligent agents and large language models

    CN120508507B