A human-computer interaction method for psychological counseling based on large models

By adopting large-modal data processing technology in psychological counseling systems, the shortcomings of existing systems in data quality, multimodal information integration and professional knowledge integration are solved, and more efficient and professional psychological counseling support is achieved.

CN119170204BInactive Publication Date: 2025-04-18CHONGQING NORMAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411376858.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-04-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing psychological counseling human-computer interactive system has shortcomings in data quality, multimodal information integration, feature fusion methods and professional psychological knowledge integration, resulting in poor performance of the model when dealing with complex psychological problems.

Method used

A human-computer interaction method based on a large model is proposed. By collecting multimodal data (text, audio, video), a multimodal feature extraction module, an adaptive multimodal feature fusion module and a three-dimensional attention decoder are constructed, and combined with multi-task knowledge distillation loss function, the deep fusion of multimodal data and professional psychological support are achieved.

Benefits of technology

It improves the multimodal information fusion effect of the psychological counseling system, enhances the adaptability and professionalism of the model, can more accurately understand and respond to the client's psychological state, and provides more effective psychological support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119170204B_ABST
    Figure CN119170204B_ABST
Patent Text Reader

Abstract

The present invention provides a psychological counseling human-computer interaction method based on a large model. Based on the collected and preprocessed psychological counseling data set, a psychological counseling large model is constructed, including a multimodal feature extraction module, an encoder stacking structure, a decoder stacking structure and a prediction output module; wherein each encoder in the encoder stacking structure adopts a designed adaptive multimodal feature fusion module; each decoder in the decoder stacking structure adopts a designed three-dimensional attention decoder; the large model is fine-tuned and trained using a training set and a designed training strategy to obtain a final psychological counseling large model for psychological counseling human-computer interaction. The multimodal feature extraction method of the present invention significantly improves the model's ability to understand complex psychological states, the adaptive attention fusion mechanism greatly improves the model's efficiency and accuracy in processing multimodal information, and the three-dimensional attention decoder design enables the model to generate more comprehensive and professional counseling suggestions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of psychological consultation based on computer data processing, and in particular relates to a human-computer interaction method for psychological consultation based on a large model. Background Art

[0002] With the rapid development of modern society, people are facing increasing pressure and psychological problems, and the demand for mental health services is rising. However, in the face of this growing demand, traditional psychological counseling methods are often limited by factors such as human resources, time costs and geographical location, making it difficult to meet the mental health needs of the general public.

[0003] In recent years, artificial intelligence technology, especially large language models, has made breakthrough progress in natural language processing and human-computer interaction. These models have demonstrated the ability to understand complex contexts and generate coherent dialogues, bringing new opportunities to the field of psychological counseling. Applying these advanced technologies to psychological counseling is expected to significantly improve the accessibility, efficiency and personalization of mental health services.

[0004] The application of big models in psychological counseling has many potential advantages: first, it can provide round-the-clock service, so that people seeking help can get timely support at any time; second, models trained based on massive data can integrate diverse consulting experiences and strategies to provide more comprehensive advice; third, artificial intelligence systems will not feel fatigued or have mood swings, and can always maintain a stable service quality; finally, through natural language interaction, it can reduce the psychological barriers for some people to seek psychological help.

[0005] However, applying large models to psychological counseling also faces many challenges. The first is how to ensure that the AI ​​system can accurately understand the psychological state of the client, which requires not only understanding of the language content, but also capturing non-verbal information such as voice and expression. Secondly, how to effectively integrate professional psychological knowledge and counseling skills into the model so that it can not only conduct conversations, but also provide professional and effective psychological support.

[0006] In this context, developing a human-computer interaction method for psychological counseling based on a large model, which can not only ensure professionalism and safety, but also improve service efficiency and accessibility, has become an important direction of current research. This method requires the integration of advanced technologies and knowledge in multiple fields such as multimodal data processing, deep learning, and psychological theory to build an intelligent, effective, and safe psychological counseling assistance system. However, there are often the following problems:

[0007] 1. Insufficient data quality and diversity: Existing psychological counseling human-computer interaction systems often rely on limited data sets and lack real and diverse psychological counseling cases, resulting in poor performance of the model when dealing with complex and diverse psychological problems.

[0008] 2. Insufficient integration of multimodal information: Most existing systems rely mainly on text information, ignoring the importance of other modal information such as audio and video, and are unable to fully capture non-verbal clues in the consultation process, thus affecting the effectiveness of the consultation.

[0009] 3. The feature fusion method is simple and lacks adaptability: Existing multimodal feature fusion methods often use simple splicing or averaging, without considering the dynamic importance of different modal features, and it is difficult to adjust the contribution of each modality according to specific circumstances.

[0010] 4. Lack of deep integration of professional psychological knowledge: Existing human-computer interaction systems often simply imitate human conversations and lack a deep understanding and application of professional psychological counseling theories and techniques, making it difficult to provide truly effective mental health support and intervention. Summary of the invention

[0011] In view of the above problems, the present invention proposes a human-computer interaction method for psychological consultation based on a large model, which includes the following processes:

[0012] S1, collects and constructs the original psychological counseling dataset, including text conversation data, audio data, and video data;

[0013] S2, preprocess and annotate the three types of data, including topic categories, emotion categories, and coping strategies, and divide them into training sets, validation sets, and test sets;

[0014] S3, building a large psychological counseling model, including a multimodal feature extraction module, an encoder stacking structure, a decoder stacking structure, and a prediction output module;

[0015] The multimodal feature extraction module includes a text feature extraction submodule, an audio feature extraction submodule and an image feature extraction submodule, which respectively perform three types of feature extraction;

[0016] Each encoder in the encoder stack structure adopts a designed adaptive multi-modal feature fusion module to dynamically adjust the weights of different modal features in the fusion process according to their importance, so as to achieve adaptive feature fusion;

[0017] Each decoder in the decoder stack structure adopts a designed three-dimensional attention decoder, which consists of three parallel attention decoders that share the same input but have independent parameters and attention mechanisms to capture specific features of different tasks, and each attention decoder is responsible for one output category;

[0018] The prediction output module uses a specific output layer to output the features of the three different tasks obtained by the decoder stacking structure;

[0019] S4, use the training set and the designed training strategy to fine-tune the large model to obtain the final psychological counseling large model;

[0020] S5, deploy the final psychological counseling model obtained through training for human-computer interaction in psychological counseling.

[0021] Preferably, in S2, the text conversation data is preprocessed, including anomaly removal, text segmentation, deletion and restoration; the anomaly removal is to set upper and lower limits of text length, identify and remove extremely short or extremely long texts, and data containing inappropriate or offensive language; the text segmentation is to divide the text data into individual words or phrases to help the psychological counseling model better understand the text content; the deletion is to delete common words that are meaningless to the analysis; and the restoration is to restore the words to their stem form.

[0022] Preferably, in S2, the audio data is preprocessed by reducing the background noise in the audio through the Wiener filtering technology, thereby improving the clarity and quality of the audio signal; and dividing the long audio data into shorter segments for easy analysis and processing.

[0023] Preferably, in S2, the video data is preprocessed, including extracting key frames from the video to obtain image data, reducing the amount of data while retaining important information; at the same time, the Dlib face detection algorithm is used to locate the face area, and then the expression ROI area is intercepted based on the face landmark points; Gaussian filtering is used to remove noise in the image to make the image smoother;

[0024] In Gaussian filtering, the filter kernel size is (2k+1)×(2k+1), and the mathematical expression of the Gaussian kernel G(x, y) is:

[0025]

[0026] Where m, n are the row and column indices of the filter kernel coordinates, x, y are the positions of the pixels in the image relative to the core pixels, and σ is the standard deviation of the Gaussian kernel, which controls the smoothness of the filter.

[0027] Preferably, the text feature extraction submodule can capture context-related semantic information, which is particularly important for understanding complex psychological counseling dialogues. It consists of a self-attention mechanism and a feedforward neural network, and performs word segmentation and tokenization on the input text t to obtain a token sequence [t1, t2, ..., t n ]; the last hidden state is used as the text feature representation, denoted as where d t is the feature dimension, I is the sequence length;

[0028] The audio feature extraction submodule uses Mel-frequency cepstral coefficients (MFCC) to extract features from audio data to obtain an input sequence, specifically including:

[0029] Pre-emphasis: Pre-emphasize the audio data after noise removal to enhance the energy of the high-frequency part;

[0030] Framing: The pre-emphasized signal is divided into adjacent short-time frames, with a frame shift of 10ms and a frame length of 25ms;

[0031] Windowing: Apply a window function to each frame of data to smooth it and reduce the spectral ripple effect, thereby obtaining a window-weighted sequence for each frame;

[0032] Fourier transform: Perform fast Fourier transform on the window weighted sequence of each frame to obtain the frequency domain Church;

[0033] Mel frequency mapping: Map the frequency domain Church to the Mel frequency scale, which is more consistent with the human ear's perception of sound, thereby obtaining the Mel frequency triangular filter bank coefficients;

[0034] Triangular bandpass filtering: Design a set of triangular bandpass filters on the Mel scale, filter the mapped Mel spectrum, and obtain the Mel frequency triangular filter group coefficients;

[0035] Discrete cosine transform: Finally, the logarithmic Mel spectrum coefficients are subjected to discrete cosine transform to obtain the MFCC coefficients, which are the audio features and are recorded as where d a is the feature dimension, T is the number of time steps;

[0036] The image feature extraction submodule extracts image features by adjusting the size of the image data g to 224×224, normalizing its pixel values ​​to the range of [0, 1] to eliminate the influence of illumination changes, and extracting features using the core idea of ​​the residual block. Finally, the image features are obtained, which are recorded as where d g is the feature dimension.

[0037] Preferably, the adaptive multimodal feature fusion module includes a feature alignment layer, an adaptive attention layer, a context-aware feature enhancement layer, a cross-modal interaction layer, an adaptive fusion layer and a fusion feature splicing layer;

[0038] The feature alignment layer is used to align the feature dimensions of the three modes. First, the features of different modes are mapped to the same dimensional space d, and the linear projection layer is used to align F t , F a , F g Mapped to F t ′,F a ′,F g ′:

[0039]

[0040] in, is the mapped feature, m∈{t,a,g},T m is the time step or sequence length of the mode, is the learnable projection matrix and bias term of the linear projection layer;

[0041] The adaptive attention layer is used to assign dynamic weights to each modality feature to highlight important information. For each modality m∈{t, a, g}, its attention weight is calculated:

[0042]

[0043] α m =softmax(e m )

[0044] Among them, e m is the attention score of modality m, represented by the vector and the linear transformation W m F′ m +b m It is used to calculate the attention weight later; v m is the learnable attention parameter vector, W m , b m are linear transformations that can be learned by weight and bias; softmax(·) is the activation function; α m is the attention weight of modality m;

[0045] The context-aware feature enhancement layer enhances the important features in each modality based on the calculated attention weights, and enhances the features of each modality using the attention weights;

[0046] The cross-modal interaction layer is used to capture the relationship between modalities and uses a multi-head self-attention mechanism;

[0047] The adaptive fusion layer introduces a gating mechanism to adaptively fuse the original features and the interacted features: First, the gating value u is calculated m :

[0048]

[0049] in, are learnable weights and bias terms; the sigmoid function limits the gate value to the range of [0, 1] so that it can be interpreted as the ratio of the original features and the interaction features.

[0050] Use gated values ​​for weighted fusion:

[0051]

[0052] Allow the model to adaptively adjust the importance of original features and interaction features according to different situations;

[0053] The fusion feature concatenation layer is used to integrate the fusion features of all modalities, generate a comprehensive multimodal representation, and concatenate the fusion features of all modalities to obtain the final multimodal fusion feature:

[0054]

[0055] Among them, F fused The final fusion feature contains information from three modalities: text, audio, and image.

[0056] Preferably, the attention decoder includes a self-attention layer: for each task t∈{topic, emotion, strategy}, each corresponding decoder uses a self-attention mechanism to process the fused features to obtain the feature Attention t :

[0057]

[0058] in, K t , V t is the learnable weight matrix, d k is the attention dimension;

[0059] At the same time, use the cross-task attention layer to obtain the feature CrossAtt t , ensuring effective flow of information and coordination between tasks:

[0060]

[0061] Among them, K other and V other It is the concatenation of the keys and values ​​of the other two tasks;

[0062] Then, the output of the self-attention layer and the output of the cross-task attention layer are fused to obtain the fusion feature H t :

[0063] H t =LayerNorm(Attention t +CrossAtt t )

[0064] Among them, H t It is the combined output of the self-attention mechanism and the cross-task attention mechanism. LayerNorm is the normalization layer.

[0065] Finally, a feedforward neural network and a normalization layer are used to obtain the final state representation H of each task t∈{topic, emotion, strategy} t ′:

[0066] H t ′=LayerNorm(H t +FFN(H t )).

[0067] Preferably, the prediction output module includes topic category output:

[0068] O topic =softmax(W topic H′ topic +b topic )

[0069] Among them, W topi c and b topic is the learnable weight matrix and bias term corresponding to the topic category output layer, which displays the predicted main topics and their probability distribution;

[0070] Includes sentiment category output:

[0071] O emotion =softmax(W emotion H′ emotion +b emotion )

[0072] Among them, W emotion and b emotion is the learnable weight matrix and bias term corresponding to the emotion category output layer, which displays the recognized emotion state and its intensity;

[0073] Including recommended outputs of coping strategies:

[0074] Since the response strategy requires generating multiple suggestions, a generation mechanism based on a pointer network is used:

[0075] O strategy =PointerNetwork(H′ strategy , F fused )

[0076] Among them, PointerNetwork is a generation mechanism function based on pointer network. This operation allows the psychological counseling model to select relevant information from the input to generate strategy recommendations, and the output layer generates a sequence of strategy recommendations.

[0077] Preferably, the specific process of the designed training strategy includes:

[0078] S41, initialize the initial training weight of each data sample. Since the total number of data samples is N, the training weight of each sample is initialized as:

[0079]

[0080] Where i∈[1,N];

[0081] Initialize the parameter Y0 of the psychological counseling model; and select the model parameter optimization algorithm as the gradient descent method;

[0082] S42, based on the constructed psychological counseling dataset, the model is iteratively trained. In order to optimize the three tasks at the same time, a weighted multi-task loss function is designed:

[0083] L=λ1L topic +λ2L emotion +λ3L strategy +λ4L kd

[0084] Among them, L topic and L emotion For the loss function of topic category prediction and sentiment category prediction, cross entropy loss is used; L strategy To deal with the strategy recommendation loss function, the sequence-generated negative log-likelihood loss is used; λ1, λ2, λ3, and λ4 are hyperparameters for balancing the loss terms; the multi-task knowledge distillation loss loss of each sample is calculated based on the loss function and the sample training weights. i And the overall loss Loss1 of this iteration:

[0085] loss i =ω i ·L i

[0086]

[0087] Among them, L i is the calculation result of the multi-task knowledge distillation loss function for sample i during training, loss i is the weighted loss calculation result of the i-th sample, and Loss1 is the calculation result of the overall loss function of the first iteration; based on the loss calculation result, the gradient descent method is used to optimize the parameters, and the parameter γ1 of the psychological counseling model after the first training is obtained;

[0088] S43, based on the calculation results of the loss function of each sample loss1, loss2, ..., loss N , update the weighted training value of each data sample, that is:

[0089] ω i =ω i ·exp(-θ·loss i )

[0090] Among them, θ is the preset training weight learning rate, which is used to control the speed of updating the sample training weight, and θ>0; for sample data with large training loss, its corresponding training weight will be increased;

[0091] S44, repeat steps S42 and S43, iterate M times in total, and obtain the total losses Loss1, Loss2, ..., Loss of M iterations. M , and the model parameters γ1, γ2, ..., γ of the psychological counseling model M ; Each updated set of model parameters corresponds to a large psychological counseling model;

[0092] S45, obtain the fusion weight factor μ of each model in the M psychological counseling models k :

[0093]

[0094] Among them, μ k is the fusion weight factor of the k-th psychological counseling model, and k∈[1,M];

[0095] S46, weighted fusion of the parameters of the M psychological counseling models based on the fusion weight factor:

[0096]

[0097] Among them, γ mix is the parameter of the integrated psychological counseling model, γ k is the parameter of the k-th psychological counseling model;

[0098] S47, using the fusion model parameters obtained in S46 as the final psychological counseling model parameters.

[0099] Compared with the prior art, the present invention has the following beneficial effects:

[0100] 1. Multimodal feature extraction module: Traditional methods often use simple feature splicing when processing multimodal data, which makes it difficult to fully utilize the characteristics of each modality. The present invention introduces an innovative multimodal feature extraction method, and designs special feature extraction modules for text, audio, and image data respectively. For text data, a pre-trained psychological counseling large model is used as an encoder to capture context-related semantic information; for audio data, an improved MFCC algorithm is used to better represent the dynamic characteristics of speech; for image data, the core idea of ​​residual blocks is introduced to effectively extract non-verbal clues such as expressions and postures. This method can comprehensively and accurately extract key features in multimodal data, laying the foundation for subsequent fusion and analysis.

[0101] 2. Adaptive multimodal feature fusion module: Existing multimodal fusion methods have problems of information imbalance and insufficient interaction between modalities. The adaptive multimodal feature fusion module designed in the present invention innovatively introduces three key steps: feature dimension unification, adaptive attention calculation, and context-aware feature enhancement. First, the features of different modalities are mapped to a unified dimensional space through linear projection; then, the self-attention mechanism is used to calculate the attention weights within and between modalities; finally, the importance of each modal feature is adjusted dynamically based on the current conversation. This mechanism can effectively handle the complex relationship between modalities and significantly improve the fusion effect of multimodal information.

[0102] 3. Three-dimensional attention decoder design: The output layer of the traditional decoder usually only focuses on a single dimension, which is difficult to meet the multi-faceted needs of psychological counseling. The three-dimensional attention decoder proposed in the present invention considers topic categories, emotional categories, and coping strategies at the same time. In the specific implementation, an improved multi-head attention mechanism is used, and each attention head focuses on one dimension. Through this design, the model can comprehensively consider the consultation content, emotional state, and intervention strategy when generating responses, and produce more professional and targeted consulting suggestions.

[0103] 4. Multi-task knowledge distillation loss function: Traditional model training methods often only focus on the performance of a single task and find it difficult to balance the needs of multiple consultation-related tasks. This invention proposes an innovative multi-task knowledge distillation loss function, which comprehensively considers the main task loss, auxiliary task loss and knowledge distillation loss. The main task loss ensures that the model can accurately generate consultation responses; the auxiliary task loss includes topic classification, emotion recognition and strategy selection, which enhances the model's multi-dimensional understanding ability; the knowledge distillation loss retains the general knowledge of the pre-trained model by imitating the output distribution of the teacher model. This method of combining multi-task learning and knowledge distillation effectively improves the professionalism and generalization ability of the model in the field of psychological counseling. BRIEF DESCRIPTION OF THE DRAWINGS

[0104] In order to more clearly illustrate the technical solutions of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, what is described below is only one embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0105] Figure 1 This is a structural diagram of the psychological counseling model of the present invention;

[0106] Figure 2 It is a multimodal feature extraction module of the present invention;

[0107] Figure 3 It is an adaptive multimodal feature fusion module in the encoder stack structure;

[0108] Figure 4 A three-dimensional attention decoder in a decoder stack;

[0109] Figure 5 Fine-tune the training flow chart for the psychological counseling model. DETAILED DESCRIPTION

[0110] The method of the present invention is further described below in conjunction with specific embodiments.

[0111] 1. Data Collection and Labeling

[0112] 1. Data collection:

[0113] Data collection is the first and most important step in building a psychological counseling model. A large amount of real and diverse psychological counseling-related data needs to be collected to ensure that the psychological counseling model can learn a wealth of psychological counseling knowledge and skills. The main sources of data collection include cases provided by professional psychological counselors and social media platforms.

[0114] (1) Professional psychological counseling data: The source of professional psychological counseling data mainly includes anonymous counseling records and experience summaries. To ensure the professionalism and authenticity of the data, we cooperate with a number of psychological counseling institutions to collect and organize counseling records while protecting the privacy of visitors. In addition, we also collect experience summaries and case analyses of psychological counselors through questionnaire surveys and in-depth interviews.

[0115] (2) Social media data: Social media data comes from public posts on Xiaohongshu and Weibo platforms. Although these data may not be as standardized as professional consultation records, their advantage lies in reflecting people's real psychological distress and emotional expressions in daily life. The conversation content of online forums and support groups related to mental health was also analyzed, and these data often contain valuable information on how people support and comfort each other.

[0116] Based on the above two data sources, the original psychological consultation data was collected and the collected data was divided into three categories: text dialogue data with the storage format of txt; audio data with the storage format of wav; video data with the storage format of MP4.

[0117] 2. Data preprocessing:

[0118] (1) Text dialogue data: Remove abnormal text data: Set the upper and lower limits of text length, identify and remove extremely short or extremely long texts, as well as data containing inappropriate or offensive language. Text tokenization: Split the text data into individual words or phrases, which helps the large psychological consultation model better understand the text content; delete common words that are meaningless for analysis, such as "de", "le", "he", etc., to reduce noise interference; reduce words to their stem forms to facilitate the processing of the same words in different forms and improve the generalization ability of the model.

[0119] (2) Audio data: Reduce the background noise in the audio through Wiener filtering technology, thereby improving the clarity and quality of the audio signal; split the long audio data into shorter segments for easy analysis and processing.

[0120] (3) Video data: Extract key frames from the video to obtain image data, reducing the data volume while retaining important information for subsequent processing and analysis; use the Dlib face detection algorithm to locate the face area, and then intercept the expression ROI area based on the face landmark points; use Gaussian filtering to remove the noise in the image and make the image smoother;

[0121] In Gaussian filtering, the size of the filter kernel is (2k + 1)×(2k + 1), and the mathematical expression of the Gaussian kernel G(x, y) is:

[0122]

[0123] where m and n are the row and column indices of the filter kernel coordinates, x and y are the positions of the pixel points in the image relative to the core pixel point, and σ is the standard deviation of the Gaussian kernel, which controls the smoothness of the filtering.

[0124] The preprocessed text dialogue data is denoted as t, the audio data is denoted as a, and the image data is denoted as g. The total data is denoted as D = [t, a, g].

[0125] 3. Data labeling:

[0126] Data labeling is to add meaningful labels to the preprocessed data so that the model can learn the intrinsic characteristics and relationships of the data. Data labeling is performed by an expert team of psychologists and counselors with rich clinical experience.

[0127] (1) Label determination process:

[0128] Form an expert team: recruit psychologists and counselors with extensive clinical experience; ensure that team members have diverse professional backgrounds, covering different schools of psychology and treatment methods.

[0129] Develop labeling guidelines: Define the specific meaning and boundaries of each label category in detail; provide labeling examples and FAQs to ensure labeling consistency.

[0130] Labeling process: The double cross labeling method was adopted, and each data was independently labeled by two experts. When there was a disagreement, the third expert arbitrated.

[0131] After the above label determination method, three types of labels are obtained:

[0132] Topic categories: family, work, health and study, denoted by L topic .

[0133] Emotion categories: happiness, sadness, anger and grievance, denoted as L emotion .

[0134] Coping strategy categories: listening, guiding and suggesting, denoted as L strategy .

[0135] The labels after label determination are collectively referred to as L.

[0136] 4. Dataset construction:

[0137] In order to divide the labeled data into training set, validation set and test set, and prepare for model training, evaluation and testing, it is necessary to construct a data set: the labeled data set is denoted as (D, L), and the training set, validation set and test set are divided into 8:1:1 ratio.

[0138] In order to divide the labeled data into training set, validation set and test set in preparation for model training, evaluation and testing, the data set (D, L) needs to be divided in a ratio of 8:1:1. The specific steps are as follows:

[0139] Divide the labeled data set (D, L) according to the following ratio:

[0140] 80% of the data is used as training set

[0141] 10% of the data is used as a validation set.

[0142] 10% of the data is used as a test set (Test Set)

[0143] Such a division can ensure that there is sufficient data for parameter adjustment and optimization during the model training process, and perform evaluation of the validation set and final performance verification of the test set after model training to ensure the generalization ability and effectiveness of the model.

[0144] 2. Constructing a large model of psychological counseling

[0145] The constructed psychological counseling model includes a multimodal feature extraction module, an encoder stacking structure, a decoder stacking structure and a prediction output module, wherein each encoder in the encoder stacking structure adopts the adaptive multimodal feature fusion module designed by the present invention, and each decoder in the decoder stacking structure adopts the three-dimensional attention decoder designed by the present invention. The specific structure is as follows: Figure 1 shown.

[0146] 1. Multimodal feature extraction module

[0147] In the process of psychological counseling, information from different modalities is crucial to accurately understand the client's psychological state. Text conversation data contains semantic information, reflecting the client's thinking logic and expression; voice features in audio data reveal subtle changes in emotions and tone; image data captures non-verbal clues such as facial expressions and body language. The comprehensive analysis of these multimodal features can provide a more comprehensive and in-depth assessment of the psychological state, help identify potential psychological problems and develop more targeted intervention strategies. The structure of the multimodal feature extraction module is as follows: Figure 2 shown.

[0148] (1) Text feature extraction submodule:

[0149] For the text conversation data t, feature extraction is performed based on the psychological counseling model. This model can capture context-related semantic information, which is particularly important for understanding complex psychological counseling conversations.

[0150] The processed text is input into the text feature extraction module of the psychological counseling model, which consists of a self-attention mechanism and a feedforward neural network. The input text t is segmented and tokenized to obtain a token sequence [t1, t2, ..., t n ].

[0151] Extract the last hidden state of the text feature extraction module of the psychological counseling model as the text feature representation, denoted as where d tis the feature dimension, and I is the sequence length.

[0152] (2) Audio feature extraction submodule:

[0153] In the psychological counseling model, the Mel-frequency cepstral coefficient (MFCC) is used to extract features from the audio data to obtain the input sequence, which is as follows:

[0154] Pre-emphasis: Pre-emphasize the audio data after noise removal to enhance the energy of the high-frequency part.

[0155] Framing: The pre-emphasized signal is divided into adjacent short-time frames with a frame shift of 10ms and a frame length of 25ms.

[0156] Windowing: Apply a window function to each frame of data to perform smoothing and reduce the spectral ripple effect, thereby obtaining a window-weighted sequence for each frame.

[0157] Fourier transform: Perform fast Fourier transform (FFT) on the window weighted sequence of each frame to obtain the frequency domain Church.

[0158] Mel frequency mapping: The frequency domain Church map is converted to the Mel frequency scale. The Mel frequency scale is more consistent with the human ear's perception of sound, thereby obtaining the Mel frequency triangular filter bank coefficients.

[0159] Triangular bandpass filtering: A set of triangular bandpass filters is designed on the Mel scale, and the mapped Mel spectrum is filtered to obtain the Mel frequency triangular filter group coefficients.

[0160] Discrete cosine transform: Finally, the logarithmic Mel spectrum coefficients are subjected to discrete cosine transform (DCT) to obtain the MFCC coefficients, which are the audio features and are recorded as where d a is the feature dimension and T is the number of time steps.

[0161] (3) Image feature extraction submodule:

[0162] In the psychological counseling model, image feature extraction requires adjusting the size of the image data g to 224×224, normalizing its pixel values ​​to the range of [0, 1] to eliminate the influence of illumination changes, and using the core idea of ​​the residual block to extract features, and finally obtaining the image features, which are recorded as where d g is the feature dimension.

[0163] 2. Multimodal feature fusion module

[0164] In order to effectively fuse the features of different modalities, this method constructs an adaptive multimodal feature fusion module as a single encoder of the encoder stack structure. Figure 3As shown in the figure. This module can dynamically adjust the weights of different modal features in the fusion process according to their importance, thereby achieving adaptive feature fusion. The design of this module aims to solve the following problems in multimodal data fusion: the dynamic changes in the importance of different modal features, the complex interaction between modalities, and the heterogeneity of different modal data. This module includes the following structure:

[0165] (1) Feature alignment layer: For subsequent multimodal feature fusion, the feature dimensions of the three modalities need to be aligned. First, the features of different modalities need to be mapped to the same dimensional space d, and the linear projection layer is used to align F t , F a , F g Mapped to F t ′,F a ′,F g ′:

[0166]

[0167] in, is the mapped feature, m∈{t,a,g},T m is the time step or sequence length of the mode, is the learnable projection matrix and bias term of the linear projection layer. This step ensures that all modal features have the same dimension d, which facilitates subsequent attention calculation and feature fusion.

[0168] (2) Adaptive attention layer: In order to assign dynamic weights to each modality feature and highlight important information, for each modality m∈{t,a,g}, its attention weight is calculated:

[0169]

[0170] α m =softmax(e m )

[0171] Among them, e m is the attention score of modality m, represented by the vector and the linear transformation W m F′ m +b m It is used to calculate the attention weight later; v m is the learnable attention parameter vector, W m , b m are linear transformations that can be learned by weight and bias; softmax(·) is the activation function; α m is the attention weight of modality m.

[0172] (3) Context-aware feature enhancement layer: Based on the calculated attention weights, the important features in each modality are enhanced. The features of each modality are enhanced using the attention weights:

[0173]

[0174] Among them, ⊙ is the element-by-element multiplication. This step highlights the features considered important in each modality and suppresses less relevant information.

[0175] (4) Cross-modal interaction layer: In order to capture the relationship between modalities, a multi-head self-attention mechanism is used:

[0176]

[0177] Among them, Q, K, and V are query sequence, key sequence, and value sequence, respectively. k is the dimension of the attention head. The calculation result of the i-th attention head is expressed as:

[0178]

[0179] Among them, W i Q , W i K , W i V are the linear transformation weight matrices of query, key, and value respectively. Connect h attention heads to get a multi-head attention mechanism:

[0180] F interaction =Concat(head1, head2,..., head h )W o

[0181] Among them, Wo is the linear transformation weight matrix output by the multi-head attention mechanism.

[0182] (5) Adaptive fusion layer: The psychological counseling model introduces a gating mechanism in the adaptive fusion mechanism to achieve adaptive fusion of original features and interacted features: First, the gating value u is calculated. m :

[0183]

[0184] in, are learnable weights and bias terms; the sigmoid function limits the gate value to the range of [0, 1] so that it can be interpreted as preserving the ratio of original features and interaction features.

[0185] Use gated values ​​for weighted fusion:

[0186]

[0187] This mechanism allows the model to adaptively adjust the importance of original features and interaction features according to different situations.

[0188] (6) Fusion feature concatenation layer: Integrate the fusion features of all modalities to generate a comprehensive multimodal representation. Specifically, concatenate the fusion features of all modalities to obtain the final multimodal fusion feature:

[0189]

[0190] Among them, F fused is the final fusion feature, which contains information from three modalities: text, audio, and image. This adaptive attention fusion mechanism achieves highly flexible and effective multimodal feature fusion through multiple steps. It can dynamically adjust the importance of features in different modalities while taking into account important information within the modality and the complex interactions between modalities. The final F fused It is a comprehensive feature representation that contains multimodal information, which will be used as input for subsequent work to make more accurate topic and emotion predictions and personalized coping strategy recommendation results.

[0191] 3. 3D Attention Decoder

[0192] Based on the fused feature F fused , design an innovative multi-task output structure called "Tri-Dimensional Attention Decoder" (TDAD), using the TDAD as a single decoder in the decoder stacking structure. This structure can simultaneously output topic categories, emotion categories, and response strategy recommendation results.

[0193] The TDAD structure is as follows Figure 4 As shown: The TDAD structure consists of three parallel attention decoders, each of which is responsible for one output category. These three attention decoders share the same input F fused , but with independent parameters and attention mechanisms to capture the specific features of different tasks and exchange information with each other through the cross-attention mechanism. Its mathematical expression is:

[0194] TDAD(F fused )=soffmax(H topic , H emotion , H strategy )

[0195] Among them, H topic , H emotion , H strategyThey represent the state representations of topic category, emotion category and coping strategy respectively.

[0196] The structure of the attention decoder is as follows:

[0197] Self-attention layer: For each task t∈{topic, emotion, strategy}, each corresponding decoder uses the self-attention mechanism to process the fusion features to obtain feature Attention t :

[0198]

[0199] in, K t , V t is a learnable weight matrix and dk is the attention dimension.

[0200] At the same time, use the cross-task attention layer to obtain the feature CrossAtt t , ensuring effective flow of information and coordination between tasks:

[0201]

[0202] Among them, K other and V other is the concatenation of the keys and values ​​of the other two tasks. For example, when t = topic, K other =[K emotion ; K strategy ],V other =[V emotion ; V strategy ].

[0203] Then, the output of the self-attention layer and the output of the cross-task attention layer are fused to obtain the fusion feature H t :

[0204] H t =LayerNorm(Attention t +CrossAtt t )

[0205] Among them, H t It is the combined output of the self-attention mechanism and the cross-task attention mechanism, and LayerNorm is the normalization layer.

[0206] Finally, a feedforward neural network and a normalization layer are used to obtain the final state representation H of each task t∈{topic, emotion, strategy} t ′:

[0207] H t′=LayerNorm(H t +FFN(H t ))

[0208] 4. Prediction output module

[0209] For the features of the three different tasks obtained by the decoder stacking structure, a specific output layer design is used:

[0210] Topic category output:

[0211] O topic =softmax(W topic H′ topic +b topic )

[0212] Among them, W topic and b topic is the learnable weight matrix and bias term corresponding to the topic category output layer. The output layer displays the predicted main topics and their probability distribution, for example: "Current conversation topic distribution: family (0.6), work (0.3), health (0.1)".

[0213] Sentiment category output:

[0214] O emotion =softmax(W emotion H′ emotion +b emotion )

[0215] Among them, W emotion and b emotion is the learnable weight matrix and bias term corresponding to the emotion category output layer. This output layer displays the recognized emotional state and its intensity, for example: "Detected emotions: mainly sadness (intensity: 0.7), with slight anxiety (intensity: 0.3)".

[0216] Response strategy recommendation output: Since the response strategy may require the generation of multiple suggestions, a generation mechanism based on a pointer network is used:

[0217] O strategy =PointerNetwork(H′ strategy , F fused )

[0218] Among them, PointerNetwork is a generative mechanism function based on pointer network. This operation allows the psychological counseling model to select relevant information from the input to generate strategy suggestions. The output layer generates a sequence of strategy suggestions, for example:

[0219] Recommended strategies:

[0220] First of all, please listen to the other person's ideas patiently and don't rush to interrupt or offer suggestions.

[0221] Next, try to use empathy to understand and validate the other person’s emotional experience.

[0222] Then, guide the other person to think about the root cause of the problem and ask some open-ended questions.

[0223] Finally, explore possible solutions together, but remember to respect the other person's choices.

[0224] 3. Fine-tuning training of the psychological counseling model

[0225] The present invention adds training weights to each training data sample and dynamically adjusts the training weights of each sample during the training iteration process; that is, for samples with poor response effects in the last training, increase their training weights so that they gain higher attention in the next training, thereby ensuring the accuracy of the model in responding to complex samples. At the same time, save the model parameters of each training and the calculation results of the multi-task knowledge distillation loss function L, and finally design a model weighted fusion method to obtain the final psychological counseling model; the specific process includes:

[0226] S31, initialize the initial training weight of each data sample. Since the total number of data samples is N, the training weight of each sample is initialized as:

[0227]

[0228] Where i∈[1,N].

[0229] Initialize the parameter Y0 of the psychological counseling model; and select the model parameter optimization algorithm as the gradient descent method;

[0230] S32. Perform iterative model training based on the psychological counseling dataset constructed in S1. In order to optimize the three tasks at the same time, a weighted multi-task loss function is designed:

[0231] L=λ1L topic +λ2L emotion +λ3L strategy +λ4L kd

[0232] Among them, L topic and L emotion For the loss function of topic category prediction and sentiment category prediction, cross entropy loss is used; L strategy To deal with the strategy recommendation loss function, the sequence-generated negative log-likelihood loss is used; λ1, λ2, λ3, and λ4 are hyperparameters for balancing the loss terms. The multi-task knowledge distillation loss of each sample is calculated based on the loss function and the sample training weights. iAnd the overall loss Loss1 of this iteration:

[0233] loss i =ω i ·L i

[0234]

[0235] Among them, L i is the calculation result of the multi-task knowledge distillation loss function for sample i during training, loss i is the weighted loss calculation result of the i-th sample, and Loss1 is the calculation result of the overall loss function of the first iteration; based on the loss calculation result, the gradient descent method is used to optimize the parameters, and the parameter γ1 of the psychological counseling model after the first training is obtained;

[0236] S33, according to the calculation results of each sample loss function loss1, loss2, ..., loss N , update the weighted training value of each data sample, that is:

[0237] ω i =ω i ·exp(-θ·loss i )

[0238] Among them, θ is the preset training weight learning rate, which is used to control the speed of updating the sample training weight, and θ>0. According to this strategy, the corresponding training weight will be increased for sample data with large training loss. Therefore, this reinforcement learning mechanism enables the model to dynamically adjust the importance of samples in each iteration, so that samples with poor prediction effects can receive more training attention. This process gradually improves the detection accuracy of the psychological counseling large model for samples with small changes.

[0239] S34, repeat steps S32 and S33, iterate M times in total, and obtain the total losses Loss1, Loss2, ..., Loss of M iterations. M , and the model parameters γ1, γ2, ..., γ of the psychological counseling model M ; Each set of model parameters obtained through each update corresponds to a large psychological counseling model, and due to the different calculated values ​​of the loss function, the psychological counseling response performance of each model is different.

[0240] S35. Based on the principle that a larger loss function value indicates a poorer sample coping performance, and vice versa, a fusion weighted combination method is proposed to design the final psychological counseling model. Obtain the fusion weight factor μ of each model in the M psychological counseling models k :

[0241]

[0242] Among them, μ k is the fusion weight factor of the k-th psychological counseling model, and k∈[1,M];

[0243] S36. Perform weighted fusion on the parameters of the M psychological counseling models based on the fusion weight factor:

[0244]

[0245] Among them, γ mix is the parameter of the integrated psychological counseling model, γ k is the parameter of the k-th psychological counseling model;

[0246] S37. Apply the fusion model parameters obtained in S36 to the psychological counseling big model, and use it as the final psychological counseling human-computer interaction big model.

[0247] IV. Deployment and Synchronous Optimization of the Psychological Counseling Big Model

[0248] 1. Deployment of trained models:

[0249] Model export: Export the trained psychological counseling model from the training environment, save the model architecture and weights; convert the model format to ensure compatibility with the deployment environment.

[0250] Server configuration: Select appropriate hardware configuration, including high-performance GPU and large-capacity memory, to support real-time inference of the model; configure the load balancer to ensure that it can handle a large number of concurrent requests.

[0251] Interface design: Design RESTful API, including user authentication, conversation history acquisition, and psychological counseling request interface; implement WebSocket interface to support real-time two-way communication and provide a smooth conversation experience.

[0252] Containerized deployment: Use Docker to package the psychological counseling model and its dependent environment into a container image. Use Kubemetes for container orchestration to achieve automated deployment, expansion, and management.

[0253] 2. Real-time data collection and preprocessing:

[0254] Multimodal data collection: Realize real-time collection of text data, including text information input by users; configure audio data collection module to capture user voice input; set up video data collection system to obtain user facial expressions and body language.

[0255] Data preprocessing: reuse the above data preprocessing methods to clean and standardize the real-time collected data; perform word segmentation on text data; perform noise reduction and segmentation on audio data; perform key frame extraction and face detection on video data.

[0256] Feature extraction: Apply the above-mentioned multimodal feature extraction method: use the psychological counseling model to extract text features; apply the MFCC method to extract audio features; use the pre-trained visual model to extract image features.

[0257] 3. Model reasoning and output generation

[0258] Feature fusion: Use the above-mentioned adaptive multimodal feature fusion method to integrate text, audio and video features.

[0259] Model reasoning: Input the fused features into the deployed psychological counseling model; use the designed improved Transformer structure for reasoning to generate psychological counseling responses.

[0260] Output generation: Generate appropriate psychological counseling coping strategies based on the output of the model.

[0261] 4. Feedback collection and synchronization optimization

[0262] User feedback collection: Design a user feedback interface that allows users to rate and comment on the responses of the psychological counseling model; record user interaction data in real time, including conversation duration, user emotional changes, etc.

[0263] Expert evaluation: Psychology experts are regularly invited to evaluate the performance of the model and provide professional advice.

[0264] Model update: Based on the collected feedback, use the above training method for incremental learning; regularly retrain the model with newly collected data and update the model parameters.

[0265] Online Learning: Implements a lightweight online learning mechanism that allows the model to fine-tune its behavior based on real-time feedback.

[0266] A / B testing: Deploy an A / B testing framework to run multiple model versions simultaneously and compare their performance; based on the test results, select the best model version for full deployment.

[0267] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0268] Although the above describes the specific implementation methods of the present invention, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A human-computer interaction method for psychological consultation based on a large model, characterized in that: The process includes: S1, collects and constructs the original psychological counseling dataset, including text conversation data, audio data, and video data; S2, preprocess and annotate the three types of data, including topic categories, emotion categories, and coping strategies, and divide them into training sets, validation sets, and test sets; S3, building a large psychological counseling model, including a multimodal feature extraction module, an encoder stacking structure, a decoder stacking structure, and a prediction output module; The multimodal feature extraction module includes a text feature extraction submodule, an audio feature extraction submodule and an image feature extraction submodule, which respectively perform three types of feature extraction; Each encoder in the encoder stack structure adopts a designed adaptive multi-modal feature fusion module to dynamically adjust the weights of different modal features in the fusion process according to their importance, so as to achieve adaptive feature fusion; Each decoder in the decoder stack structure adopts a designed three-dimensional attention decoder, which consists of three parallel attention decoders that share the same input but have independent parameters and attention mechanisms to capture specific features of different tasks, and each attention decoder is responsible for one output category; The prediction output module uses a specific output layer to output the features of the three different tasks obtained by the decoder stacking structure; S4, use the training set and the designed training strategy to fine-tune the large model to obtain the final psychological counseling large model; S5, deploy the final psychological counseling model obtained through training for human-computer interaction in psychological counseling.

2. A human-computer interaction method for psychological consultation based on a large model as claimed in claim 1, characterized in that: In S2, the text conversation data is preprocessed, including anomaly removal, text segmentation, deletion and restoration; the anomaly removal is to set upper and lower limits of text length, identify and remove extremely short or extremely long texts, and data containing inappropriate or offensive language; the text segmentation is to divide the text data into individual words or phrases to help the psychological counseling model better understand the text content; the deletion is to delete common words that are meaningless to the analysis; and the restoration is to restore the words to their stem form.

3. A large model-based human-computer interaction method for psychological consultation as claimed in claim 1, characterized in that: In S2, the audio data is pre-processed by reducing the background noise in the audio through the Wiener filtering technology, thereby improving the clarity and quality of the audio signal; and dividing the long audio data into shorter segments for easy analysis and processing.

4. A large model-based human-computer interaction method for psychological consultation as claimed in claim 1, characterized in that: In S2, the video data is preprocessed, including extracting key frames from the video to obtain image data, reducing the amount of data while retaining important information; at the same time, the Dlib face detection algorithm is used to locate the face area, and then the expression ROI area is intercepted based on the face landmark points; Use Gaussian filtering to remove noise from the image and make the image smoother; In Gaussian filtering, the filter kernel size is (2k+1)×(2k+1), and the mathematical expression of the Gaussian kernel G(x, y) is: Where m, n are the row and column indices of the filter kernel coordinates, x, y are the positions of the pixels in the image relative to the core pixels, and σ is the standard deviation of the Gaussian kernel, which controls the smoothness of the filter.

5. A large model-based human-computer interaction method for psychological consultation as claimed in claim 1, characterized in that: The text feature extraction submodule can capture context-related semantic information, which is particularly important for understanding complex psychological counseling conversations. It consists of a self-attention mechanism and a feedforward neural network, and performs word segmentation and tokenization on the input text t to obtain a token sequence [t1, t2, ..., t n ]; the last hidden state is used as the text feature representation, denoted as where d t is the feature dimension, I is the sequence length; The audio feature extraction submodule uses Mel-frequency cepstral coefficients (MFCC) to extract features from audio data to obtain an input sequence, specifically including: Pre-emphasis: Pre-emphasize the audio data after noise removal to enhance the energy of the high-frequency part; Framing: The pre-emphasized signal is divided into adjacent short-time frames, with a frame shift of 10ms and a frame length of 25ms; Windowing: Apply a window function to each frame of data to perform smoothing and reduce spectrum leakage effects, thereby obtaining a window-weighted sequence for each frame; Fourier transform: Perform fast Fourier transform on the window weighted sequence of each frame to obtain frequency domain features; Mel frequency mapping: Mapping frequency domain features to the Mel frequency scale, which is more consistent with the human ear's perception of sound, thereby obtaining the Mel frequency triangular filter bank coefficients; Triangular bandpass filtering: Design a set of triangular bandpass filters on the Mel scale, filter the mapped Mel spectrum, and obtain the Mel frequency triangular filter group coefficients; Discrete cosine transform: Finally, the logarithmic Mel spectrum coefficients are subjected to discrete cosine transform to obtain the MFCC coefficients, which are the audio features and are recorded as where d a is the feature dimension, T is the number of time steps; The image feature extraction submodule extracts image features by adjusting the size of the image data g to 224×224, normalizing its pixel values ​​to the range of [0,1] to eliminate the influence of illumination changes, and extracting features using the core idea of ​​the residual block. Finally, the image features are obtained, which are recorded as where d g is the feature dimension.

6. A large model-based human-computer interaction method for psychological consultation as claimed in claim 5, characterized in that: The adaptive multimodal feature fusion module includes a feature alignment layer, an adaptive attention layer, a context-aware feature enhancement layer, a cross-modal interaction layer, an adaptive fusion layer, and a fusion feature splicing layer; The feature alignment layer is used to align the feature dimensions of the three modes. First, the features of different modes are mapped to the same dimensional space d, and the linear projection layer is used to align F t , F a , F g Mapped to F t ′,F a ′,F g ′: in, is the mapped feature, m∈{t,a,g},T m is the time step or sequence length of the mode, is the learnable projection matrix and bias term of the linear projection layer; The adaptive attention layer is used to assign dynamic weights to each modality feature to highlight important information. For each modality m∈{t,a,g}, its attention weight is calculated: a m =softmax(e m ) Among them, e m is the attention score of modality m, represented by the vector and the linear transformation W m F′ m +b m It is used to calculate the attention weight later; v m is the learnable attention parameter vector, W m 、b m are linear transformations that can be learned by weight and bias; softmax(·) is the activation function; α m is the attention weight of modality m; The context-aware feature enhancement layer enhances the important features in each modality based on the calculated attention weights, and enhances the features of each modality using the attention weights; The cross-modal interaction layer is used to capture the relationship between modalities and uses a multi-head self-attention mechanism; The adaptive fusion layer introduces a gating mechanism to adaptively fuse the original features and the interacted features: First, the gating value u is calculated m : in, are learnable weights and bias terms; the sigmoid function limits the gate value to the range of [0,1] so that it can be interpreted as retaining the ratio of original features and interaction features; Use gated values ​​for weighted fusion: Allow the model to adaptively adjust the importance of original features and interaction features according to different situations; The fusion feature concatenation layer is used to integrate the fusion features of all modalities, generate a comprehensive multimodal representation, and concatenate the fusion features of all modalities to obtain the final multimodal fusion feature: Among them, F fused The final fusion feature contains information from three modalities: text, audio, and image.

7. A large model-based human-computer interaction method for psychological consultation as claimed in claim 1, characterized in that: The attention decoder includes a self-attention layer: for each task t∈{topic,emotion,strategy}, each corresponding decoder uses the self-attention mechanism to process the fusion feature to obtain the feature Attention t : in, is the learnable weight matrix, d k is the attention dimension; At the same time, use the cross-task attention layer to obtain the feature CrossAtt t , ensuring effective flow of information and coordination between tasks: Among them, K other and V other It is the concatenation of the keys and values ​​of the other two tasks; Then, the output of the self-attention layer and the output of the cross-task attention layer are fused to obtain the fusion feature H t : H t =LayerNorm(Attention t +CrossAtt t ) Among them, H t It is the combined output of the self-attention mechanism and the cross-task attention mechanism. LayerNorm is the normalization layer. Finally, a feedforward neural network and a normalization layer are used to obtain the final state representation H of each task t∈{topic,emotion,strategy} t ′: H t ′=LayerNorm(H t +FFN(H t ))。 8. A large model-based human-computer interaction method for psychological consultation as claimed in claim 1, characterized in that: The prediction output module includes topic category output: O topic =softmax(W topic H′ topic +b topic ) Among them, W topic and b topic is the learnable weight matrix and bias term corresponding to the topic category output layer, which displays the predicted main topics and their probability distribution; Includes sentiment category output: O emotion =softmax(W emotion H′ emotion +b emotion ) Among them, W emotion and b emotion is the learnable weight matrix and bias term corresponding to the emotion category output layer, which displays the recognized emotion state and its intensity; Including recommended outputs of coping strategies: Since the response strategy requires generating multiple suggestions, a generation mechanism based on a pointer network is used: O strategy =PointerNetwork(H′ strategy ,F fused ) Among them, PointerNetwork is a generation mechanism function based on pointer network. This operation allows the psychological counseling model to select relevant information from the input to generate strategy recommendations, and the output layer generates a sequence of strategy recommendations.

9. A large model-based human-computer interaction method for psychological consultation as claimed in claim 1, characterized in that: The specific process of the training strategy designed includes: S41, initialize the initial training weight of each data sample. Since the total number of data samples is N, the training weight of each sample is initialized as: Where i∈[1,N]; Initialize the parameter γ0 of the psychological counseling model; and select the model parameter optimization algorithm as the gradient descent method; S42, based on the constructed psychological counseling dataset, the model is iteratively trained. In order to optimize the three tasks at the same time, a weighted multi-task loss function is designed: L=λ1L topic +λ2L emotion +λ3L strategy +λ4L kd Among them, L topic and L emotion For the loss function of topic category prediction and sentiment category prediction, cross entropy loss is used; L strategy To deal with the strategy recommendation loss function, the sequence-generated negative log-likelihood loss is used; λ1, λ2, λ3, and λ4 are hyperparameters for balancing the loss terms; the multi-task knowledge distillation loss loss of each sample is calculated based on the loss function and the sample training weights i And the overall loss Loss1 of this iteration: loss i =ω i ·L i Among them, L i is the calculation result of the multi-task knowledge distillation loss function for sample i during training, loss i is the weighted loss calculation result of the i-th sample, and loss1 is the calculation result of the overall loss function of the first iteration; based on the loss calculation result, the gradient descent method is used to optimize the parameters, and the parameter γ1 of the psychological counseling model after the first training is obtained; S43, according to the calculation results of the loss function of each sample loss1, loss2, ..., loss N , update the weighted training value of each data sample, that is: oh i =ω i ·exp(-θ·loss i ) Among them, θ is the preset training weight learning rate, which is used to control the speed of updating the sample training weight, and θ>0; for sample data with large training loss, its corresponding training weight will be increased; S44, repeat steps S42 and S43, iterate M times in total, and obtain the total losses Loss1, Loss2, ..., Loss of M iterations M , and the model parameters γ1,γ2,...,γ of the psychological counseling model M ; Each updated set of model parameters corresponds to a large psychological counseling model; S45, obtain the fusion weight factor μ of each model in the M psychological counseling models k : Among them, μ k is the fusion weight factor of the k-th psychological counseling model, and k∈[1,M]; S46, weighted fusion of the parameters of the M psychological counseling models based on the fusion weight factor: Among them, γ mix is the parameter of the integrated psychological counseling model, γ k is the parameter of the k-th psychological counseling model; S47, using the fusion model parameters obtained in S46 as the final psychological counseling model parameters.

Citation Information

Patent Citations

  • Psychological counseling method and device based on Internet of Things big data and server

    CN116631583A

  • Social media negative emotion recognition method based on generative artificial intelligence

    CN117493973A