Psychological counseling supervision method and system based on fine-tuning large language model

By fine-tuning and evaluating the large language model, the problem of the inability to comprehensively and accurately evaluate the reliability and effectiveness of the model in the field of psychological counseling in the existing technology is solved, and the optimization and performance improvement of the model in the field of psychological counseling is achieved.

CN119884298APending Publication Date: 2025-04-25SHIRAN TECHNOLOGY (SUZHOU) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411831844.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The prior art cannot comprehensively and accurately evaluate the reliability and effectiveness of large language models in the field of psychological counseling, resulting in inaccurate or misleading information that may appear in the model when answering psychological counseling-related questions.

Method used

By dividing the psychological counseling supervision data set into training set, verification set and test set, the large language model is fine-tuned, and evaluation indicators such as BLEU score, ROUGE score and confusion degree are used to evaluate the accuracy and effectiveness of the generated text and Q&A results of the model.

Benefits of technology

The optimization and selection of large language models in the field of psychological counseling supervision has been realized, the performance and practicality of the model in practical applications has been improved, and the reliability and effectiveness of the model in the field of psychological counseling has been ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884298A_ABST
    Figure CN119884298A_ABST
Patent Text Reader

Abstract

The invention provides a psychological counseling supervision method and system based on a fine-tuning large language model, and the method comprises the steps: carrying out the fine tuning of a preset large language model based on a training set, and obtaining a fine-tuning large language model; inputting the verification set into the fine-tuned large language model to obtain a generated text and a generated abstract; determining a plurality of evaluation indexes of the fine-tuned large language model based on the generated text and the generated abstract; inputting the test set into the fine-tuned large language model to obtain a question and answer result; determining a plurality of test indexes based on the question and answer result; determining a target fine-tuning large language model based on the plurality of evaluation indexes and the plurality of test indexes; obtaining a psychological consultation supervision question input by the user; inputting the psychological counseling supervision question into the target fine-tuning large language model to obtain an output psychological counseling supervision result; according to the method, optimization and selection of the big language model in the field of psychological counseling and supervision are realized, and the performance and practicability of the model in practical application are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a psychological consultation supervision method and system based on fine-tuning a large language model. Background Art

[0002] As society pays more attention to mental health, the psychological counseling industry has developed rapidly, and more and more people are seeking psychological counseling services. As the number of psychological counselors increases, the demand for professional supervision is also increasing to ensure the quality of counseling and service level.

[0003] Although the large language model can be fine-tuned to improve the knowledge level in specific fields (such as psychological counseling), the fine-tuned model may still not be able to fully cover these professional knowledge because the field of psychological counseling involves extensive and in-depth professional knowledge, including psychological theories, psychological counseling skills, psychological assessment methods, etc. This may cause the model to give inaccurate or misleading information when answering questions related to psychological counseling. This lack of knowledge may reduce the reliability and effectiveness of the model, thereby affecting the effectiveness of psychological counseling.

[0004] This shows that the evaluation methods in related technologies cannot comprehensively and accurately evaluate the reliability and effectiveness of the model in the field of psychological counseling. Summary of the invention

[0005] The present invention provides a psychological counseling supervision method and system based on fine-tuning a large language model, which is used to solve the defect that the evaluation method in the prior art cannot comprehensively and accurately evaluate the reliability and effectiveness of the model in the field of psychological counseling, realizes the optimization and selection of the large language model in the field of psychological counseling supervision, and improves the performance and practicability of the model in practical applications.

[0006] The present invention provides a psychological consultation supervision method based on fine-tuning a large language model, comprising the following steps.

[0007] The psychological counseling supervision data set is divided into a training set, a validation set and a test set according to a preset ratio; based on the training set, the preset large language model is fine-tuned to obtain a fine-tuned large language model; the validation set is input into the fine-tuned large language model to obtain a generated text and a generated summary output by the fine-tuned large language model; based on the generated text and the generated summary, multiple evaluation indicators of the fine-tuned large language model are determined, wherein the multiple evaluation indicators include: BLEU score, ROUGE score and perplexity; the test set is input into the fine-tuned large language model to obtain a question-answering result output by the fine-tuned large language model; based on the question-answering result, multiple test indicators of the fine-tuned large language model are determined, wherein the multiple test indicators include: accuracy and F1 score; based on the multiple evaluation indicators and the multiple test indicators, a target fine-tuned large language model is determined; the psychological counseling supervision question input by the user is obtained; the psychological counseling supervision question is input into the target fine-tuned large language model to obtain the psychological counseling supervision result output by the target fine-tuned large language model.

[0008] According to a psychological counseling supervision method based on a fine-tuned large language model provided by the present invention, multiple evaluation indicators of the fine-tuned large language model are determined based on the generated text and the generated summary, including: determining the BLEU score of the fine-tuned large language model based on the similarity between the generated text and the reference text in the verification set; determining the ROUGE score of the fine-tuned large language model based on the overlap between the generated summary and the reference summary in the verification set; and determining the perplexity of the fine-tuned large language model for the verification set.

[0009] According to a psychological counseling supervision method based on a fine-tuned large language model provided by the present invention, the determining the perplexity of the fine-tuned large language model on the verification set includes: determining the perplexity of the fine-tuned large language model on the verification set according to the following formula: ; in, Indicates confusion, represents the total number of words in the validation set, Indicates the first words, Indicates that the fine-tuned large language model is word, predict the The probability of a word.

[0010] According to a psychological counseling supervision method based on a fine-tuned large language model provided by the present invention, multiple test indicators of the fine-tuned large language model are determined based on the question and answer results, including: determining the accuracy of the fine-tuned large language model based on the similarity between the question and answer results and the real answers in the test set; determining the F1 score of the fine-tuned large language model based on the overlap between the question and answer results and the real answers in the test set.

[0011] According to a psychological counseling supervision method based on fine-tuning a large language model provided by the present invention, before dividing the psychological counseling supervision data set into a training set, a validation set and a test set according to a preset ratio, the method also includes: obtaining a psychological counseling supervision case, wherein the psychological counseling supervision case includes initial text data, audio data and video data; performing text conversion on the audio data and the video data to obtain converted text data; converting the initial text data and the converted text data according to a question-and-answer mode to obtain psychological question-and-answer corpus data, and using the psychological question-and-answer corpus data as the psychological counseling supervision data set.

[0012] The present invention also provides a psychological consultation supervision system based on fine-tuning a large language model, comprising the following modules: A data set module is used to divide the psychological counseling supervision data set into a training set, a validation set and a test set according to a preset ratio; a fine-tuning module is used to fine-tune the preset large language model based on the training set to obtain a fine-tuned large language model; an input module is used to input the validation set into the fine-tuned large language model to obtain a generated text and a generated summary output by the fine-tuned large language model; an evaluation module is used to determine multiple evaluation indicators of the fine-tuned large language model based on the generated text and the generated summary, wherein the multiple evaluation indicators include: BLEU score, ROUGE score and perplexity; the input module is also used to The test set is input into the fine-tuned large language model to obtain the question and answer results output by the fine-tuned large language model; a testing module is used to determine multiple test indicators of the fine-tuned large language model based on the question and answer results, wherein the multiple test indicators include: accuracy and F1 score; a determination module is used to determine the target fine-tuned large language model based on the multiple evaluation indicators and the multiple test indicators; an acquisition module is used to obtain the psychological counseling supervision questions input by the user; an output module is used to input the psychological counseling supervision questions into the target fine-tuned large language model to obtain the psychological counseling supervision results output by the target fine-tuned large language model.

[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, psychological counseling supervision based on a fine-tuned large language model as described in any one of the above methods is implemented.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements psychological counseling supervision based on a fine-tuned large language model as described in any one of the above.

[0015] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned psychological counseling supervision based on the fine-tuning large language model.

[0016] The psychological counseling supervision method and system based on fine-tuning large language model provided by the present invention ensure the independence and fairness of model training, verification and testing processes by dividing the psychological counseling supervision data set into training set, verification set and test set according to preset ratios, and fine-tuning the preset large language model by using the training set. The fine-tuned model can more accurately understand and generate texts related to psychological counseling supervision, thereby improving the practicality and accuracy of the model; by inputting the verification set into the fine-tuned large language model and generating text and summary, the performance of the model in the generation task can be evaluated, and the BLEU score and ROUGE score can reflect the difference between the text generated by the model and the reference text. The similarity and consistency between the two versions, and the perplexity is used to evaluate the fluency and readability of the text generated by the model; the test set is input into the fine-tuned large language model, and the question and answer results are obtained to further verify the performance of the model in practical applications; the accuracy and F1 score can reflect the accuracy and completeness of the model in answering questions related to psychological counseling supervision; based on multiple evaluation indicators and test indicators, the target fine-tuned large language model is determined to ensure that the final selected model has excellent performance and practicality in the field of psychological counseling supervision, thereby solving the technical problem that the evaluation methods in related technologies cannot comprehensively and accurately evaluate the reliability and effectiveness of the model in the field of psychological counseling. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced one by one below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 It is a flow chart of the psychological counseling supervision method based on fine-tuning the large language model provided by the present invention.

[0019] Figure 2 It is a structural schematic diagram of an application system based on target fine-tuning of a large language model provided by the present invention.

[0020] Figure 3 It is a structural diagram of the psychological counseling supervision system based on the fine-tuning large language model provided by the present invention.

[0021] Figure 4 It is a schematic diagram of the physical structure of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] As society pays more attention to mental health, the psychological counseling industry has developed rapidly, and more and more people are seeking psychological counseling services. As the number of psychological counselors increases, the demand for professional supervision is also increasing to ensure the quality of counseling and service level.

[0024] Despite the high demand, there is a relatively insufficient number of qualified supervisors, especially in some remote areas or areas with low economic development. Although there are certain training and certification standards, in actual operation, the standards between different institutions may vary greatly, lacking uniformity and authority. For some small institutions or independent practicing psychological counselors, regular professional supervision may bring great financial pressure.

[0025] Psychological supervision work requires rich experience in the psychology industry, and requires working with psychological counselors to complete case discussions, consultations, counseling relationship analysis, counselor training and other tasks. The technical presentation of these contents is all language-related.

[0026] In recent years, big language models have made significant progress in the field of natural language processing. These models use deep learning technology to learn language rules from a large amount of text data and have the ability to generate coherent and meaningful text. Fine-tuning a big language industry model for psychological supervision based on a large amount of industry corpus will make psychological supervision intelligent and automated, greatly improve the professional ability of psychological supervision, and cover the supervision needs of a large number of psychological counselors.

[0027] Compared with the traditional expert mode, the present invention has standardization, normative unification, strong professional ability, and covers more needs through software and Internet mode. At present, there is no similar intelligent psychological supervision product realized by statistical large language model technology in the industry.

[0028] Optionally, the psychological counseling supervision method based on the fine-tuning large language model of the embodiment of the present application can be executed by a server, or by a terminal device, or jointly by a server and a terminal device, taking the example of the psychological counseling supervision method based on the fine-tuning large language model in this embodiment being executed by a server.

[0029] Figure 1 is a flow chart of a psychological counseling supervision method based on fine-tuning a large language model provided by the present invention, such as Figure 1 As shown, the method includes the following steps.

[0030] Step 101, divide the psychological counseling supervision data set into a training set, a validation set and a test set according to a preset ratio.

[0031] In an embodiment of the present invention, 80% of the data in the psychological counseling supervision data set is randomly selected as a training set, 10% as a validation set, and 10% as a test set.

[0032] For example, use a random number generator or data partitioning tool to randomly partition the data set into training, validation, and test sets according to a preset ratio. Ensure the randomness of the data during the partitioning process to avoid bias caused by uneven data distribution.

[0033] Check the divided dataset to ensure that each subset contains the key features and diversity in the psychological counseling supervision dataset. The validation set and test set should be independent of the training set to ensure the generalization ability of the model on unknown data.

[0034] According to a psychological counseling supervision method based on fine-tuning a large language model provided by the present invention, before dividing the psychological counseling supervision data set into a training set, a validation set, and a test set according to a preset ratio, the method further includes: Obtaining psychological counseling supervision cases, wherein the psychological counseling supervision cases include initial text data, audio data, and video data; Performing text conversion on the audio data and the video data to obtain converted text data; The initial text data and the converted text data are converted according to the question-answer mode to obtain psychological question-answer corpus data, and the psychological question-answer corpus data is used as the psychological counseling supervision data set.

[0035] In the embodiment of the present invention, the audio data is converted into text data using speech recognition technology. For video data, if it contains speech, the same speech recognition technology as audio can be used for conversion. If the video contains subtitles or text information, OCR (optical character recognition) technology can also be used to extract text.

[0036] Analyze the original text data and the converted text data to identify question-answer patterns, which include questions and answers from both parties. Adjust the identified question-answer patterns into a format suitable for machine learning or natural language processing tasks, including separating the question-answer pairs, labeling the identities of the two parties in the conversation (such as counselor, supervisor, visitor, etc.), and adding any necessary metadata (such as timestamps, conversation topics, etc.) The processed initial text data, converted text data, and psychological question and answer corpus data are integrated together to form a psychological counseling supervision data set.

[0037] In some embodiments, the quantity and quality of the data set are the most critical content for fine-tuning the large language model. In this embodiment of the present invention, a large amount of text, audio, and video source data related to psychological counseling and psychological supervision is collected, and the data is sorted and cleaned. The steps are as follows: The data was collected through research institutions, psychological supervision practitioners, and public Internet data in the field of psychological counseling, mainly including psychological counseling case supervision, psychology professional textbooks, and books. The source data has been anonymized (removing the identity information of the relevant person), and the data has been preliminarily processed: audio and video are converted to text; Classify the data into psychological counseling case analysis, psychological professional knowledge (theories, schools, norms, laws, etc.), convert all into question-and-answer mode, and form themes and rounds; All corpus data will be carefully checked, and non-compliant and poor-quality data will be deleted. For example, the system based on corpus quality inspection calls multiple large language models to vote to obtain the quality score of each corpus, which will be reviewed by psychological supervisors and psychological industry experts to obtain the final corpus data that meets the requirements.

[0038] Finally, the corpus data is obtained, and the statistics are as follows Table 1 and Table 2: Table 1: Source Data

[0039] Table 2: Preprocessed data

[0040] Through the embodiments of the present invention, psychological counseling supervision cases including initial text data, audio data and video data are collected, and the audio and video data are converted into text data, thereby enriching the content of the data set; at the same time, the question-answering pattern is identified and converted, making the data set more suitable for training the question-answering system or dialogue model; this helps the model to be more accurate and efficient in processing question-answering tasks related to psychological counseling supervision.

[0041] Step 102: fine-tune the preset large language model based on the training set to obtain a fine-tuned large language model.

[0042] In the embodiment of the present invention, one of the existing large language models is selected as the base model. These models are usually pre-trained on a large amount of text data. According to the selected model and the characteristics of the task, appropriate hyperparameters such as learning rate, batch size, number of training rounds, etc. are set; the preset large language model and its pre-trained weights are loaded. Fine-tuning the model using the training set usually involves multiple iterations (epochs), and in each iteration, the model updates its weights based on the training data.

[0043] In some embodiments, GLM4-9b is selected as the basic model. The above model is an open source large language model. GLM4-9b leads the large language model of the same level in terms of comprehensive evaluation scores, long text support, logical understanding (psychological industry needs), etc. It also has a professional model fine-tuning framework. Use the following resources and environment for fine-tuning: Ubuntu 20.04 operating system, PyTorch; CUDA 12.3; TensorBoard monitoring and logging; Server configuration: Intel Xeon 8375c*2; 512G memory; A100 (80G video memory)*8; Configure config file parameters, including data storage path, SFT fine-tuning parameters, etc. Execute train.py and monitor the log.

[0044] One round of model fine-tuning takes 4.5 days (about 106 hours), and a total of 8 rounds are performed to obtain the round with the best results.

[0045] Step 103: input the verification set into the fine-tuned large language model to obtain the generated text and generated summary output by the fine-tuned large language model.

[0046] The data in the validation set has been preprocessed and is in the same format as the training set used when fine-tuning the model. The validation set contains conversations or text data related to psychological counseling supervision, which is used to evaluate the performance of the model in real scenarios.

[0047] Input the data in the validation set one by one or in batches into the fine-tuned large language model. The model will receive the input data and generate the corresponding generated text and generated summary based on its internal representation and the knowledge learned during training.

[0048] The model generates complete responses or dialogue texts (i.e. generated texts) based on the input data. The generated texts are used to reflect the model's understanding and generation capabilities of the input content. For longer input texts, the model also has the ability to generate summaries, which are used to summarize the main content of the generated texts.

[0049] Step 104, based on the generated text and the generated summary, determine multiple evaluation indicators of the fine-tuned large language model, where the multiple evaluation indicators include: BLEU score, ROUGE score and perplexity.

[0050] The BLEU score (Bilingual Evaluation Understudy) is used to measure the degree of n-gram matching between the generated text and the reference text. The higher the BLEU score, the more similar the generated text is to the reference text, which reflects the quality of the generated text to a certain extent.

[0051] ROUGE score (Recall-Oriented Understudy for Gisting Evaluation) is a commonly used text generation evaluation metric, especially suitable for summary generation tasks. It includes multiple variants, such as ROUGE-N (n-gram-based recall), ROUGE-L (F-measure based on the longest common subsequence), ROUGE-W (weighted longest common subsequence), etc. The ROUGE score mainly measures the degree of overlap between the generated summary and the reference summary, especially the information recall rate. For the summary generation task of psychological counseling supervision, the ROUGE score can evaluate whether the model accurately captures the key information in the input text.

[0052] Perplexity is an important indicator for evaluating the performance of language models. It measures the uncertainty of the model in generating text given a context. The lower the perplexity, the more confident the model is in generating text, that is, the model believes that the generated text better matches the context. However, perplexity does not directly reflect the quality or accuracy of the generated text, but rather reflects the model's predictive ability. In the dialogue generation task of psychological counseling supervision, perplexity can be used as an auxiliary indicator to help understand the fluency and coherence of the model when generating dialogues.

[0053] According to a psychological counseling supervision method based on fine-tuning a large language model provided by the present invention, multiple evaluation indicators of the fine-tuned large language model are determined based on generated text and generated summary, including: Determine the BLEU score of the fine-tuned large language model based on the similarity between the generated text and the reference text in the validation set; Determine the ROUGE score of the fine-tuned large language model based on the overlap between the generated summary and the reference summary in the validation set; Determine the perplexity of the fine-tuned large language model on the validation set.

[0054] In an embodiment of the present invention, the BLEU score is used to evaluate the similarity between the generated text and the reference text. The higher the BLEU score, the closer the generated text is to the reference text. The BLEU score includes the precision score, the geometric mean, and the penalty term.

[0055] Precision score: Calculate the n-gram overlap between the generated text and the reference text. For details, refer to the following formula: in, Represents the precision score of n-gram, which is used to measure the accuracy of n-gram in the generated text; represents the maximum sum of the number of times all n-grams in the machine-generated text appear in the reference text set (i.e., the sum of the “clipped” counts), Indicates the operation of "pruning" or "limiting" n-grams. Represents the count of n-grams after "pruning"; represents the total number of occurrences of all n-grams in the machine-generated text, Represents the count of n-grams in machine-generated text.

[0056] The geometric mean is used to represent the geometric mean of the precision scores of each n-gram, which can be represented by the following parameters: in, represents the penalty term, represents the exponential function, Represents the weight of each n-gram, Indicates the total number of precision scores, represents the accuracy score, Represents the logarithm of the precision score for each n-gram.

[0057] The penalty term can be expressed by the following formula: in, is the length of the generated text, is the effective length of the reference text. If the length of the generated text Greater than the effective length of the reference text , no penalty is imposed and the BP value is 1. If the length of the generated text Less than or equal to the effective length of the reference text , then a penalty is imposed. The degree of penalty increases as the length of the generated text decreases, through an exponential function accomplish.

[0058] The length penalty factor (i.e., penalty term) is introduced to encourage the generation of texts that are close in length to the reference text, because texts that are too short may miss important information, while texts that are too long may contain redundant or irrelevant information. By penalizing texts that are too short, the BLEU score can more accurately reflect the quality of the generated text.

[0059] The ROUGE score is mainly used to evaluate the summary generation task and calculate the degree of overlap between the generated summary and the reference summary. The ROUGE scores include: ROUGE-N, ROUGE-L and ROUGE-W.

[0060] ROUGE-N is used to calculate the n-gram overlap between the generated summary and the reference summary, which can be expressed by the following formula: represents the text summary evaluation index N, Indicates the number of n-grams that match between the generated summary and the reference summary; Represents the number of all n-grams in the reference summary; represents the sum of all possible n-grams. In actual calculations, this usually means traversing all n-grams in the reference summary and the generated summary and counting their number.

[0061] ROUGE-L is used to calculate the longest common subsequence between the generated summary and the reference summary, which can be specifically expressed by the following formula: represents the text summary evaluation index L, the longest common subsequence (LCS, Longest Common Subsequence) between the generated summary (Y) and the reference summary (X), Indicates a reference summary and generate a summary The length of the longest common subsequence between Indicates a reference summary The module length, Generate summary The module length, Represents the maximum value function.

[0062] ROUGE-W is used to calculate weighted n-gram overlap, taking into account the position information of n-grams.

[0063] In order to comprehensively evaluate the quality of the generated summary, multiple evaluation indicators including ROUGE-N, ROUGE-L and ROUGE-W are usually used. These indicators can reflect the similarities and differences between the generated summary and the reference summary from different perspectives.

[0064] Through the embodiments of the present invention, the BLEU score can quantitatively evaluate the quality of the translation or generated text by comparing the n-gram matching degree between the generated text and the reference text; the ROUGE score can evaluate the accuracy and completeness of the summary by calculating the overlap between the generated summary and the reference summary.

[0065] According to a psychological counseling supervision method based on fine-tuning a large language model provided by the present invention, determining the perplexity of the fine-tuned large language model on a validation set includes: According to the following formula, the perplexity of the fine-tuned large language model on the validation set is determined: ; in, Indicates confusion, represents the total number of words in the validation set, Indicates the first words, It means that the fine-tuned large language model is word, predict the The probability of a word.

[0066] In the embodiment of the present invention, perplexity is used to measure the uncertainty of the model on the test data. The lower the perplexity, the more accurate the model's understanding of the text is, and the more the generated text conforms to the context.

[0067] Perplexity can be used as an auxiliary indicator for model tuning to identify the weaknesses of the model on specific tasks. By reducing the perplexity, the performance of the model on the generation task can be further improved.

[0068] Through the embodiments of the present invention, the perplexity evaluation method is consistent in different generation tasks and can objectively reflect the performance differences of the model in different tasks.

[0069] Step 105: input the test set into the fine-tuned large language model to obtain the question-answering result output by the fine-tuned large language model.

[0070] Prior to this, the large language model should have been fine-tuned for a specific task or dataset, which aims to make the model better adapt to the types of questions and answer patterns in the test set. The test set contains a series of targeted questions designed to comprehensively evaluate the performance of the model. The type, difficulty, and scope of the questions should be consistent with the training data used in the fine-tuning process.

[0071] The formatted question is input into the fine-tuned large language model, which will generate answers based on the input question and the knowledge learned during the fine-tuning process.

[0072] Step 106, based on the question-answering results, determine multiple test indicators of the fine-tuned large language model, where the multiple test indicators include: accuracy and F1 score.

[0073] In the embodiment of the present invention, accuracy refers to the proportion of questions that the model correctly answers. For question-answering tasks, the answer to each question can be regarded as a binary classification problem (correct / wrong), and then the overall accuracy is calculated.

[0074] The F1 score is the harmonic mean of precision and recall, which is used to comprehensively evaluate the performance of the model. In question-answering tasks, precision indicates the proportion of correct answers generated by the model to all generated answers, while recall indicates the proportion of correctly generated answers to all correct answers.

[0075] According to a psychological counseling supervision method based on fine-tuning a large language model provided by an embodiment of the present invention, multiple test indicators of the fine-tuned large language model are determined, including: Determine the accuracy of the fine-tuned large language model based on the similarity between the question-answer results and the true answers in the test set; Determine the F1 score of the fine-tuned large language model based on the overlap between the question-answer results and the true answers in the test set.

[0076] In some embodiments, the question-answering task applies professional knowledge, including psychology, relevant ethics, and regulatory content.

[0077] Among them, accuracy (EM, Exact Match) is the proportion of samples whose answers generated by the calculation model are exactly the same as the true answers. It can be specifically expressed by the following formula: in, Indicates accuracy.

[0078] The F1 score is used to calculate the overlap between the answers generated by the model and the true answers, which can be expressed by the following formula: in, represents the F1 score, Indicates the accuracy, represents the recall rate, and 2 represents the preset weight coefficient.

[0079] Precision is used to measure the proportion of instances predicted by the model as positive samples that are truly positive samples, while recall is used to measure the proportion of all truly positive samples that are successfully predicted by the model as positive samples.

[0080] Among them, the precision can be expressed by the following formula: in, (True Positive) represents the true positive examples, that is, the number of instances correctly predicted by the model as positive samples. (False Positive) represents false positive examples, that is, the number of negative sample instances that the model incorrectly predicts as positive samples.

[0081] The recall rate can be expressed by the following formula: in, (True Positive) represents true positive examples, that is, the number of instances correctly predicted by the model as positive samples; (False Negative) represents false negative examples, that is, the number of positive sample instances that the model incorrectly predicts as negative samples.

[0082] Through the embodiments of the present invention, by comprehensively considering the precision, recall and F1 score, the performance of the model can be more comprehensively understood, and the model can be adjusted and optimized accordingly.

[0083] Step 107: Determine a target fine-tuned large language model based on multiple evaluation indicators and multiple test indicators.

[0084] In the embodiment of the present invention, multiple evaluation indicators include: BLEU score, ROUGE score and perplexity; multiple test indicators include: accuracy and F1 score; after multiple iterations and optimizations, the model with the best performance is selected as the target model. This model exceeds the preset thresholds in multiple evaluation indicators and test indicators and can meet the needs of actual application scenarios.

[0085] In some embodiments, the average statistical values ​​of the comprehensive 8 rounds of test results are as shown in Table 3 below, and the corresponding model is selected according to the best performance round result: Table 3

[0086] Based on the results, the model of the seventh round is selected as the target fine-tuning large language model.

[0087] refer to Figure 2 , Figure 2 It is a structural diagram of the application system based on the target fine-tuning large language model provided by the present invention, which includes: speaker 1 (visitor) speaker 2 (psychological counselor); input types include video, text, audio; system functions include: information visit report, consultation feedback, optimized interpretation and AI supervision; the question template library includes: consultation direction, professional knowledge, consultation technology and visit interpretation.

[0088] Step 108, obtaining the psychological counseling supervision questions input by the user.

[0089] In an embodiment of the present invention, psychological counseling supervision questions input by a user are obtained through a user interface or a chat robot, and the psychological counseling supervision questions input by the user are input into a target fine-tuned large language model.

[0090] Step 109, input the psychological counseling supervision questions into the target fine-tuned large language model to obtain the psychological counseling supervision results output by the target fine-tuned large language model.

[0091] In the embodiment of the present invention, the pre-processed psychological counseling supervision questions are passed as input to the fine-tuned large language model. After receiving the input, the model will understand and analyze the questions based on its internal knowledge structure and the patterns learned during the training process.

[0092] The target fine-tuning large language model generates corresponding psychological counseling supervision results based on the input questions. The psychological counseling supervision results include suggestions, explanations, analysis and other forms, which are designed to help users understand the problem, find solutions or get emotional support. The results generated by the model are presented in the target format, such as text, voice or chart. At the same time, relevant background information, references or suggested further action steps can also be provided.

[0093] Through the embodiments of the present invention, the large language model can generate feedback and suggestions in real time. At the same time, through continuous model optimization and iteration, the system performance and user experience can be continuously improved.

[0094] Through the above-mentioned embodiments provided by the present invention, the large language model can generate feedback and suggestions in real time, greatly shortening the time that counselors wait for supervisory opinions. It can handle requests from multiple counselors at the same time, improving work efficiency, especially when there are a large number of counselors. Reduce labor costs: reduce dependence on full-time supervisors and save human resource costs. As the number of users increases, the marginal cost of the large language model is low and easy to expand. The large language model can provide more consistent and standardized supervisory opinions, reducing inconsistencies caused by individual differences. Through preset standards and rules, ensure the high quality and reliability of the supervision process. The large language model can maintain the latest professional knowledge and research results through continuous training and updating. It can obtain and integrate information from multiple sources to provide more comprehensive supervisory suggestions. Use advanced encryption technology to ensure the security of user data. Strictly comply with data protection regulations to protect user privacy.

[0095] The following describes the psychological counseling supervision system based on the fine-tuning large language model provided by the present invention. The psychological counseling supervision system based on the fine-tuning large language model described below and the psychological counseling supervision method based on the fine-tuning large language model described above can refer to each other.

[0096] refer to Figure 3 , Figure 3 It is a structural diagram of the psychological counseling supervision system based on the fine-tuning large language model provided by the present invention.

[0097] The data set module 301 is used to divide the psychological counseling supervision data set into a training set, a validation set and a test set according to a preset ratio; A fine-tuning module 302 is used to fine-tune the preset large language model based on the training set to obtain a fine-tuned large language model; An input module 303 is used to input the verification set into the fine-tuned large language model to obtain the generated text and generated summary output by the fine-tuned large language model; An evaluation module 304 is used to determine multiple evaluation indicators of the fine-tuned large language model based on the generated text and the generated summary, wherein the multiple evaluation indicators include: BLEU score, ROUGE score and perplexity; The above-mentioned input module 303 is also used to input the test set into the fine-tuned large language model to obtain the question-answering result output by the fine-tuned large language model; A testing module 305 is used to determine multiple test indicators of the fine-tuned large language model based on the question-answering results, wherein the multiple test indicators include: accuracy and F1 score; The determination module 306 is used to determine the target fine-tuning large language model based on multiple evaluation indicators and multiple test indicators.

[0098] The acquisition module 307 is used to acquire the psychological counseling supervision questions input by the user; The output module 308 is used to input the psychological counseling supervision questions into the target fine-tuned large language model to obtain the psychological counseling supervision results output by the target fine-tuned large language model.

[0099] Specifically, the psychological counseling supervision system based on fine-tuning the large language model provided by the present invention can implement all the method steps implemented in the above-mentioned psychological counseling supervision method embodiment based on fine-tuning the large language model, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.

[0100] Figure 4 is a schematic diagram of the physical structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other via the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute a psychological counseling supervision method based on a fine-tuned large language model, the method comprising: dividing the psychological counseling supervision data set into a training set, a verification set and a test set according to a preset ratio; fine-tuning the preset large language model based on the training set to obtain a fine-tuned large language model; inputting the verification set into the fine-tuned large language model to obtain a generated text and a generated summary output by the fine-tuned large language model; based on the generated text and the generated summary, determining multiple evaluation indicators of the fine-tuned large language model, wherein the multiple evaluation indicators Including: BLEU score, ROUGE score and perplexity; input the test set into the fine-tuned large language model to obtain the question and answer results output by the fine-tuned large language model; based on the question and answer results, determine multiple test indicators of the fine-tuned large language model, where the multiple test indicators include: accuracy and F1 score; based on multiple evaluation indicators and multiple test indicators, determine the target fine-tuned large language model; obtain the psychological counseling supervision questions input by the user; input the psychological counseling supervision questions into the target fine-tuned large language model to obtain the psychological counseling supervision results output by the target fine-tuned large language model.

[0101] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0102] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the psychological counseling supervision method based on the fine-tuning large language model provided by the above methods. The method includes: dividing the psychological counseling supervision data set into a training set, a verification set and a test set according to a preset ratio; fine-tuning the preset large language model based on the training set to obtain a fine-tuned large language model; inputting the verification set into the fine-tuned large language model to obtain a generated text and a generated summary output by the fine-tuned large language model; and generating a generated summary based on the generated text and the verification set. Generate a summary, determine multiple evaluation indicators of the fine-tuned large language model, where the multiple evaluation indicators include: BLEU score, ROUGE score and perplexity; input the test set into the fine-tuned large language model, and obtain the question and answer results output by the fine-tuned large language model; based on the question and answer results, determine multiple test indicators of the fine-tuned large language model, where the multiple test indicators include: accuracy and F1 score; determine the target fine-tuned large language model based on the multiple evaluation indicators and the multiple test indicators; obtain the psychological counseling supervision questions input by the user; input the psychological counseling supervision questions into the target fine-tuned large language model, and obtain the psychological counseling supervision results output by the target fine-tuned large language model.

[0103] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the psychological counseling supervision method based on the fine-tuned large language model provided by the above-mentioned methods, the method comprising: dividing the psychological counseling supervision data set into a training set, a verification set, and a test set according to a preset ratio; fine-tuning the preset large language model based on the training set to obtain a fine-tuned large language model; inputting the verification set into the fine-tuned large language model to obtain a generated text and a generated summary output by the fine-tuned large language model; determining the fine-tuned large language model based on the generated text and the generated summary. Multiple evaluation indicators of the model, wherein the multiple evaluation indicators include: BLEU score, ROUGE score and perplexity; input the test set into the fine-tuned large language model to obtain the question and answer results output by the fine-tuned large language model; based on the question and answer results, determine multiple test indicators of the fine-tuned large language model, wherein the multiple test indicators include: accuracy and F1 score; based on the multiple evaluation indicators and the multiple test indicators, determine the target fine-tuned large language model; obtain the psychological counseling supervision questions input by the user; input the psychological counseling supervision questions into the target fine-tuned large language model to obtain the psychological counseling supervision results output by the target fine-tuned large language model.

[0104] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A psychological counseling supervision method based on fine-tuning a large language model, characterized in that: include: The psychological counseling supervision dataset is divided into a training set, a validation set, and a test set according to the preset ratio; Fine-tune the preset large language model based on the training set to obtain a fine-tuned large language model; Inputting the verification set into the fine-tuned large language model to obtain a generated text and a generated summary output by the fine-tuned large language model; Based on the generated text and the generated summary, determining multiple evaluation indicators of the fine-tuned large language model, wherein the multiple evaluation indicators include: BLEU score, ROUGE score and perplexity; Inputting the test set into the fine-tuned large language model to obtain a question-answering result output by the fine-tuned large language model; Based on the question-answering result, determining a plurality of test indicators of the fine-tuned large language model, wherein the plurality of test indicators include: accuracy and F1 score; Determining a target fine-tuning large language model based on the multiple evaluation indicators and the multiple test indicators; Obtain psychological counseling supervision questions input by users; The psychological counseling supervision questions are input into the target fine-tuned large language model to obtain the psychological counseling supervision results output by the target fine-tuned large language model.

2. The psychological counseling supervision method based on fine-tuning the large language model according to claim 1 is characterized in that: The step of determining multiple evaluation indicators of the fine-tuned large language model based on the generated text and the generated summary includes: Determining a BLEU score of the fine-tuned large language model based on the similarity between the generated text and the reference text in the validation set; Determining a ROUGE score of the fine-tuned large language model based on an overlap between the generated summary and a reference summary in the validation set; Determine the perplexity of the fine-tuned large language model on the validation set.

3. The psychological counseling supervision method based on fine-tuning the large language model according to claim 2 is characterized in that: Determining the perplexity of the fine-tuned large language model on the validation set includes: The perplexity of the fine-tuned large language model on the validation set is determined according to the following formula: ; in, Indicates confusion, represents the total number of words in the validation set, Indicates the first words, Indicates that the fine-tuned large language model is word, predict the The probability of a word.

4. The psychological counseling supervision method based on fine-tuning the large language model according to claim 1 is characterized in that: Determining multiple test indicators of the fine-tuned large language model based on the question-answering result includes: Determining the accuracy of the fine-tuned large language model based on the similarity between the question-answer result and the real answer in the test set; Based on the overlap between the question-answer result and the true answer in the test set, an F1 score of the fine-tuned large language model is determined.

5. The psychological counseling supervision method based on fine-tuning the large language model according to claim 1 is characterized in that: Before dividing the psychological counseling supervision data set into a training set, a validation set, and a test set according to a preset ratio, the method further includes: Obtaining a psychological counseling supervision case, wherein the psychological counseling supervision case includes initial text data, audio data, and video data; Performing text conversion on the audio data and the video data to obtain converted text data; The initial text data and the converted text data are converted according to a question-answering mode to obtain psychological question-answering corpus data, and the psychological question-answering corpus data is used as a psychological counseling supervision data set.

6. A psychological counseling supervision system based on fine-tuning a large language model, characterized in that: include: The data set module is used to divide the psychological counseling supervision data set into a training set, a validation set, and a test set according to a preset ratio; A fine-tuning module, used to fine-tune the preset large language model based on the training set to obtain a fine-tuned large language model; An input module, used to input the verification set into the fine-tuned large language model to obtain a generated text and a generated summary output by the fine-tuned large language model; An evaluation module, configured to determine a plurality of evaluation indicators of the fine-tuned large language model based on the generated text and the generated summary, wherein the plurality of evaluation indicators include: a BLEU score, a ROUGE score, and a perplexity; The input module is further used to input the test set into the fine-tuned large language model to obtain the question-answering result output by the fine-tuned large language model; A testing module, used to determine a plurality of testing indicators of the fine-tuned large language model based on the question-answering result, wherein the plurality of testing indicators include: accuracy and F1 score; A determination module, configured to determine a target fine-tuned large language model based on the multiple evaluation indicators and the multiple test indicators; The acquisition module is used to obtain the psychological counseling supervision questions input by the user; An output module is used to input the psychological counseling supervision questions into the target fine-tuned large language model to obtain the psychological counseling supervision results output by the target fine-tuned large language model.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the psychological counseling supervision method based on the fine-tuning large language model as described in any one of claims 1 to 5 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the psychological counseling supervision method based on the fine-tuning large language model as described in any one of claims 1 to 5 is implemented.

9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the psychological counseling supervision method based on the fine-tuning large language model as described in any one of claims 1 to 5 is implemented.

Citation Information

Cited By

  • Digital intelligent treatment auxiliary method based on generative AI large model

    CN120278403A