Multi-layer expert type psychological crisis early warning method based on long time series context understanding

CN121920379BActive Publication Date: 2026-08-07ZHENGZHOU NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHENGZHOU NORMAL UNIV
Filing Date
2026-01-07
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]本发明提出一种基于长时序语境理解的多层专家型心理危机早期预警方法,用于解决现有的预警模型决策过程缺乏透明度和可解释性的问题,包括:

Benefits of technology

[0006]本发明通过构建长时序语境记忆,并结合前期危机等级对该记忆进行调整,能够检测用户心理状态的长期演变轨迹和关键事件的累积效应。构建了块稀疏化多层专家网络,将心理学先验知识融入模型结构设计,并在训练中根据语境复杂度和概念风险度对网络的不同功能区块进行稀疏化处理,压缩了模型规模,降低了运算资源消耗,便于实际部署,使模型的推理过程与具体的心理学概念关联,提升了预警结果的可解释性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121920379B_ABST
    Figure CN121920379B_ABST
Patent Text Reader

Abstract

The application provides a multi-layer expert type psychological crisis early warning method and system based on long time sequence context understanding, acquires user historical time sequence text data and current text data; extracts core event vectors from historical time sequence text segmentation, and fuses the initial long time sequence context memory representation according to time attenuation weighting; calculates a risk adjustment amount based on a crisis level of a previous time window and a current text sentiment polarity, modulates the initial representation to obtain a long time sequence context memory representation; uses a pre-trained block sparsification multi-layer expert network model for reasoning, and outputs a warning signal of a crisis level, type and confidence; the model is obtained by the following way: constructing a multi-layer expert network model, structuring block partition according to a psychology concept dictionary and behavior characteristics; setting a pruning threshold for each block by combining context complexity and concept prior risk degree during training, and pruning blocks with an activation gradient norm lower than the threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of artificial intelligence, and in particular relates to a multi-layered expert-based early warning method for psychological crises based on long-term temporal contextual understanding. Background Technology

[0002] Analyzing publicly posted text data using natural language processing and artificial intelligence technologies can enable early detection and intervention of psychological crises. Deep learning models, such as recurrent neural networks, long short-term memory networks, or transformer architectures, can perform sentiment analysis, topic extraction, and behavioral pattern recognition on user content to determine the presence of suicide risk or other mental health issues. However, these methods often focus on analyzing short-term or immediate text, neglecting the fact that psychological crisis is a long-term, gradual process. This makes it difficult for models to detect and represent the cumulative impact of a user's historical state trajectory over several days or months and core life events. Furthermore, when assessing risk, using static or simple time-decay models to integrate historical information lacks sensitivity in determining the level of risk.

[0003] Existing early warning models lack transparency and interpretability in their decision-making processes. There is no clear correspondence between the model's internal parameters and specific psychological concepts, increasing the difficulty of model debugging and optimization. Intervention personnel struggle to understand the specific causes of the crisis based on the model's output. Deep learning models typically have a large number of parameters, resulting in parameter redundancy and high training and inference costs. Most pruning methods employ unstructured approaches or uniform pruning strategies, failing to incorporate prior psychological knowledge or perform sparsity processing based on the importance and context of different psychological concepts. This makes it difficult to achieve both high early warning accuracy and lightweight models that incorporate domain knowledge. Summary of the Invention

[0004] This invention proposes a multi-layered expert-based early warning method for psychological crises based on long-term temporal contextual understanding, to address the lack of transparency and interpretability in the decision-making process of existing early warning models, including: Obtain historical time-series text data and current text data of users to be warned; extract core event vectors from the historical time-series text data in segments, and perform attenuation weighting according to time, and fuse them into an initial long-term time-series contextual memory representation; Based on the crisis level of the previous time window and the sentiment polarity of the current text data, a risk adjustment amount is calculated, and the adjustment amount is used to modulate the initial long-term contextual memory representation to obtain a long-term contextual memory representation. The long-term contextual memory representation is concatenated with the embedding vector of the current text data to form an input vector; The input vector is inferred using a pre-trained block-sparse multilayer expert network model, which outputs a warning signal containing crisis level, crisis type, and confidence level. The block-sparse multilayer expert network model is obtained by constructing a multilayer expert network model, wherein the expert layer of the model performs structured block partitioning based on a predefined psychological concept dictionary and user behavior statistical features. During training, the contextual complexity determined by the long-term contextual memory representation norm and the prior risk of the concepts associated with each block are combined to set a pruning threshold for each block partition, and blocks with activation gradient norms lower than the corresponding thresholds are pruned.

[0005] Furthermore, this invention also relates to a multi-layered expert-based early warning system for psychological crises based on long-term temporal contextual understanding, comprising the following modules: The fusion module is used to acquire historical time-series text data and current text data of users to be warned; extract core event vectors from the historical time-series text data in segments, and perform attenuation weighting according to time to fuse them into an initial long-term time-series contextual memory representation; The modulation module is used to calculate the risk adjustment amount based on the crisis level of the previous time window and the sentiment polarity of the current text data, and to modulate the initial long-term contextual memory representation using the adjustment amount to obtain the long-term contextual memory representation. The concatenation module is used to concatenate the long-term contextual memory representation with the embedding vector of the current text data to form an input vector; The pruning module is used to infer the input vector using a pre-trained block-sparse multilayer expert network model and output a warning signal containing crisis level, crisis type, and confidence level. The block-sparse multilayer expert network model is obtained by constructing a multilayer expert network model, wherein the model expert layer performs structured block partitioning based on a predefined psychological concept dictionary and user behavior statistical features. During training, a pruning threshold is set for each block partition by combining the contextual complexity determined by the long-term contextual memory representation norm and the prior risk of the concepts associated with each block, and blocks with activation gradient norms lower than the corresponding thresholds are pruned.

[0006] This invention constructs long-term contextual memories and adjusts these memories based on prior crisis levels to detect the long-term evolution of a user's psychological state and the cumulative effect of key events. A block-sparse multilayer expert network is constructed, integrating prior psychological knowledge into the model structure design. During training, different functional blocks of the network are sparsified according to contextual complexity and conceptual risk, compressing the model size, reducing computational resource consumption, facilitating practical deployment, and associating the model's reasoning process with specific psychological concepts, thereby improving the interpretability of the warning results. Attached Figure Description

[0007] Figure 1 A flowchart of the first embodiment; Figure 2 A schematic diagram for risk modulation and contextual representation generation; Figure 3 This is a schematic diagram illustrating the concatenation of the input vectors. Figure 4 This is a schematic diagram of a block-sparse multilayer expert network structure. Detailed Implementation

[0008] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0009] The term "multiple" in this application refers to two or more. Furthermore, it should be understood that the terms "first," "second," etc., used in the description of this application are used only for descriptive purposes and should not be construed as indicating or implying relative importance, nor as indicating or implying order.

[0010] In the first embodiment, the present invention proposes a multi-layered expert-based early warning method for psychological crises based on long-term temporal contextual understanding, such as... Figure 1 ,include: S1, Obtain the historical time-series text data and current text data of the user to be warned; Extract the core event vector from the historical time-series text data in segments, and perform attenuation weighting according to time, and fuse them into an initial long-term time-series contextual memory representation; By using the API provided by the social media platform, all publicly posted historical blog posts of the target user are scraped as historical time-series text data, and posts published within the last 24 hours are used as current text data. The text data is then cleaned to remove links, emojis, and irrelevant characters, and segmented using a Chinese word segmentation tool. In another embodiment, the data could also be the user's historical access records or diary entries.

[0011] The user's total historical text data is divided into multiple time periods by month. For each month's data, all text is concatenated and input into a pre-trained BERT model. The model's CLS vector is extracted as the core event vector for that month. An exponential decay function is used to calculate the weight of each core event vector, with the weight being higher for months closer to the current time. All core event vectors are weighted and summed to obtain an initial long-term temporal contextual memory representation vector with a fixed dimension.

[0012] In an optional embodiment, the step of segmenting the historical time-series text data to extract core event vectors, and then applying attenuation weights based on time to fuse them into an initial long-term temporal contextual memory representation includes: The historical time-series text data is divided into time periods of 15 consecutive days. For all text within each time period, the TextRank algorithm is used to extract the three sentences with the highest weight as core events; The three sentences are converted into 768-dimensional event vectors using a pre-trained BERT model, and the average value is taken to obtain the core event vector for the time period. Using an exponential decay function Calculate the time decay weight for each core event vector, where This is the current timestamp. The timestamp of when the event occurred; The initial long-term contextual memory representation is obtained by summing the weighted core event vectors of all time periods.

[0013] Specifically, suppose we need to process a user's posting data from the past 90 days, with the current date being day 91. The 90 days of data are divided into six consecutive 15-day periods. For the first period, i.e., all posts from day 1 to day 15, the TextRank algorithm is used to analyze all content, identifying three key sentences, such as "I feel very lonely," "I've recently lost interest in everything," and "Life has no meaning." These three sentences are considered the core events of this period. A pre-trained BERT model transforms each of the three sentences into three 768-dimensional vectors, and the average of these three vectors is calculated to obtain a 768-dimensional vector representing the core event of this period.

[0014] This process is repeated for all six time periods, generating six core event vectors. The time decay weight of each vector is calculated. For the core event vector in the first time period, which occurred approximately 83 days ago, the weight calculated using the exponential decay function is very small, indicating a weak influence on the current state. However, for the core event vectors in the last time period, from day 76 to day 90, these vectors are more recent, resulting in much larger weights. Each of the six core event vectors is multiplied by its corresponding time decay weight, and all resulting vectors are summed to form a 768-dimensional vector. This vector represents the initial long-term contextual memory representation, encompassing the user's core psychological state evolution over 90 days and highlighting the impact of recent events.

[0015] S2, based on the crisis level of the previous time window and the sentiment polarity of the current text data, calculate the risk adjustment amount, and use the adjustment amount to modulate the initial long-term contextual memory representation to obtain the long-term contextual memory representation; Obtain the crisis level value output in the previous warning period, such as the previous day, for example, level 4; simultaneously, input the current text data into a sentiment classification model to obtain a sentiment polarity score between -1 and 1, such as -0.9 indicating strong negative sentiment; according to preset rules, for example, when a high crisis level and strong negative sentiment occur simultaneously, generate a large positive adjustment scalar, broadcast this scalar as an adjustment vector, and add it element-wise to the initial long-term contextual memory representation to obtain the long-term contextual memory representation after the current risk state is enhanced or weakened, such as... Figure 2 .

[0016] In an optional embodiment, the step of calculating a risk adjustment amount based on the crisis level of the previous time window and the sentiment polarity of the current text data, and using the adjustment amount to modulate the initial long-term contextual memory representation to obtain a long-term contextual memory representation, includes: The crisis level of the previous time window Represented as integers between 0 and 4; Calculate the sentiment polarity of the current text data using a sentiment analysis model. The value ranges from -1 to +1; Through formula Calculate the risk adjustment factor ; The risk adjustment factor Modulation is achieved by applying element-wise multiplication to the initial long-term contextual memory representation.

[0017] Assuming yesterday's assessment of user status was crisis level 2, therefore the crisis level for the previous time window was... The value is assigned to 2. Today, a user posted a new text message: "The weather is great today, but I'm in a terrible mood." The built-in sentiment analysis model will process the text and output a sentiment polarity score. Given the negative sentiment expressed in the text, the score might be -0.8.

[0018] The risk adjustment factor ΔR is calculated using a formula. Substituting the value, ΔR is 2.52. An adjustment factor greater than 1 indicates that the user's current state is riskier than the historical average, as strong negative emotions are exhibited on top of an already certain level of crisis. This adjustment factor of 2.52 is then multiplied element-wise with the 768-dimensional initial long-term contextual memory representation generated in the previous step. That is, each element in the vector is multiplied by 2.52, thereby amplifying the overall strength of the memory representation and generating a long-term contextual memory representation that reflects the current escalation of risk.

[0019] S3, the long-term contextual memory representation is concatenated with the embedding vector of the current text data to form an input vector; The BERT model described above is used to encode the current text data to obtain the corresponding embedding vector. At the vector level, a concatenation operation is performed, placing the long temporal context memory representation vector at the front end and the embedding vector of the current text data at the back end. The two are then connected end to end to form a longer-dimensional fusion feature vector.

[0020] In an optional embodiment, concatenating the long-term contextual memory representation with the embedding vector of the current text data to form an input vector includes: Using the same pre-trained BERT model as that used to extract the core event vector, the current text data is converted into a 768-dimensional embedding vector; The 768-dimensional long temporal contextual memory representation is concatenated with the 768-dimensional embedding vector of the current text data in terms of dimensions to form a 1536-dimensional input vector.

[0021] Specifically, suppose a user has just posted a new text message saying, "I don't want to keep going." The pre-trained BERT model is then invoked to process this text. This BERT model is the same one used to process historical data, ensuring consistency in the vector space. The model converts the text into a 768-dimensional floating-point vector, which detects the semantic information of the text and is called the current text embedding vector.

[0022] Meanwhile, a long-term contextual memory representation has been generated through the preceding steps. This is also a 768-dimensional vector, condensing the user's historical psychological state and recent risk changes. A concatenation operation is then performed. This connects the two 768-dimensional vectors end-to-end, forming a longer vector. Specifically, the 768 values ​​of the memory representation vector are placed first, followed by the 768 values ​​of the current text embedding vector. This results in a combined input vector with a total dimension of 1536, as shown below. Figure 3 The combined vector contains both the user's historical background information and their current real-time expression, serving as the complete input for the next step of the multi-layer expert network to determine the crisis level.

[0023] S4, the input vector is inferred using a pre-trained block-sparse multilayer expert network model, and an early warning signal containing crisis level, crisis type, and confidence level is output. The block-sparse multilayer expert network model is obtained by constructing a multilayer expert network model, wherein the model expert layer performs structured block partitioning based on a predefined psychological concept dictionary and user behavior statistical features. During training, the contextual complexity determined by the long-term contextual memory representation norm and the prior risk of the concepts associated with each block are combined to set a pruning threshold for each block partition, and blocks with activation gradient norms lower than the corresponding thresholds are pruned.

[0024] A multi-layer expert network is constructed, comprising multiple expert subnetworks. The weight matrix of each expert is divided into several parameter blocks, each block being associated with a psychological concept, such as despair, social isolation, or self-harming ideation. This association is established based on a psychological lexicon. During training, for each training sample, the L2 norm of the sample's long-term contextual memory representation is calculated; a larger norm indicates a more complex context. Simultaneously, a fixed prior risk is pre-defined for each concept block; for example, the risk of self-harming ideation is higher than that of despair. The network is then calculated based on contextual complexity and prior risk. Calculate the pruning threshold for each block; lower thresholds are used for high-risk or complex contexts, and higher thresholds for less complex ones. After backpropagation, calculate the L2 norm of the gradient on each parameter block. If the norm is lower than the corresponding threshold, set all parameters of that block to zero and freeze them, achieving structured pruning. After model training, the input vector is used for forward inference. The model output layer calculates the probability of each crisis level using the Softmax function, takes the highest probability as the predicted level, and determines the crisis type based on the activated expert blocks. The highest probability value is used as the confidence level, together forming the early warning signal. Figure 4 .

[0025] In an optional embodiment, the expert layer performs structured block partitioning based on a predefined psychological concept dictionary and user behavior statistical features, including: Based on the DSM-5 diagnostic criteria, a psychological concept dictionary was constructed that includes four categories: "depressed mood", "loss of interest", "suicidal ideation" and "anxiety". In each expert layer of the multi-layer expert network model, a dedicated neuron block is pre-defined for each of the four concept categories mentioned above; Keywords under the category of "depressed mood" in the dictionary are mapped to the weight matrix of the neuron block of "depressed mood", and so on, to achieve structured partitioning.

[0026] Specifically, a professional psychological dictionary was constructed based on the Diagnostic and Statistical Manual of Mental Disorders, Fifth Edition (DSM-5). This dictionary contains four core categories; for example, the category for depressive mood includes words related to despair, helplessness, and emptiness, while the category for suicidal ideation includes words related to wanting to die, seeking relief, and leaving. This transforms abstract psychological concepts into a concrete set of vocabulary.

[0027] When planning the structure of a multi-layer expert network model, each layer, such as a fully connected layer with 1024 neurons, is pre-divided into four regions. For example, neurons 1 to 256 are designated as the depressive mood block, neurons 257 to 512 as the loss of interest block, and so on. Dedicated computational resources are allocated to each psychological concept. During model initialization or training, the dictionary is mapped to neuron blocks. For example, word vectors of words like despair and helplessness are used to influence or initialize the weights of the depressive mood neuron block. This neuron block is inherently sensitive to input patterns related to depressive mood, thus embedding prior knowledge from the field of psychology into the structure of the neural network. In an optional embodiment, the keywords under the "depressive mood" category in the dictionary are mapped to the weight matrix of the "depressive mood" neuron block, and so on, to achieve structured partitioning, specifically: Using a pre-trained language model, all keywords under the category of "depressed mood" are converted into high-dimensional semantic vectors; Aggregate the vectors of the keywords to obtain a concept vector that can represent the concept of "depressive mood"; When constructing a multi-layer expert network, the aggregated concept vectors are used to initialize the weight matrix of the "depressive mood" neuron block; Perform the same operation as above for the three categories of "loss of interest", "suicidal ideation" and "anxiety".

[0028] Specifically, for the category of "depressed mood," a pre-trained BERT model is used to convert all keywords in this category, such as "despair," "helplessness," and "emptiness," into 768-dimensional word vectors. By averaging or weighted averaging these word vectors element by element, they are aggregated into a 768-dimensional concept vector that can represent the semantics of "depressed mood."

[0029] When initializing the weight matrix of the "depressed mood" neuron block, a targeted bias initialization strategy is implemented: for the portion of the weight matrix corresponding to the "current text data embedding" (last 768 dimensions) in the input vector, the previously aggregated "depressed mood" concept vector is used as the initial mean of the weights for that portion. For example, this portion of the weights can be sampled from a normal distribution with a small variance and a mean of concept vectors. Meanwhile, the portion of the weight matrix corresponding to the final long-term contextual memory representation (first 768 dimensions) in the input vector is still initialized using standard Xavier or He methods. The neurons within this expert block exhibit a higher activation tendency towards semantic patterns related to "depressed mood" in the current text from the beginning of training, thus precisely embedding abstract psychological knowledge into the network structure. In another optional embodiment, the aggregated concept vectors are passed through an MLP network to obtain the weight matrix of the "depressed mood" neuron block.

[0030] In an optional embodiment, setting pruning thresholds for each block partition includes: During training, the L2 norm of the long-term temporal contextual memory representation of each training sample is calculated as the contextual complexity. ; For each concept block, a priori risk level is assigned based on historical data statistics. The value ranges from 0 to 1; Through formula Calculate the pruning threshold for the i-th block partition. ,in α and β are preset positive real hyperparameters to ensure that blocks with high contextual complexity or high prior risk have low pruning thresholds.

[0031] When the model processes a training sample, it calculates the long-term temporal contextual memory representation vector of that sample, a 768-dimensional vector. The L2 norm of this vector, which is the square root of the sum of the squares of all its elements, is calculated, yielding a value, for example, 15.7. This value is defined as the contextual complexity. The higher the value, the more complex or volatile the user's historical context. At the same time, each concept block is assigned a priori risk level, set based on clinical experience. For example, the risk level for the suicidal ideation block is set at 0.9, while the risk level for the loss of interest block is set at 0.4, reflecting that the former is usually more critical in crisis assessment.

[0032] A pruning threshold is calculated for each block using a formula. Assume a base threshold. The pruning threshold τ is 0.01, with hyperparameters α = 0.0001 and β = 0.005. For a suicidal ideation block with a risk level of 0.9, the pruning threshold τ is approximately 0.00393. For a loss-of-interest block with a risk level of 0.4, the threshold is approximately 0.00643. For concept blocks with complex contexts or high prior risk, the pruning threshold is lower, tending to preserve key neuron blocks, making them less likely to shut down during training.

[0033] In an optional embodiment, pruning blocks whose activation gradient norm is below a corresponding threshold includes: During the backpropagation process of model training, the L2 norm of the gradient of the weight matrix corresponding to the i-th structured block partition is calculated. ; Compare Pruning threshold corresponding to the block ; like In the next training iteration, all weight and bias parameters of the block will be set to 0, and it will not be activated in the forward and backward propagation of the model.

[0034] Specifically, during model training, after a data sample completes forward propagation and the loss is calculated, the backpropagation algorithm begins calculating the gradients of all parameters in the model and updating the weights. During this process, special attention is paid to each structured block partition. Taking the suicidal ideation block as an example, the gradient values ​​of all weight parameters within that block are collected, and these gradient values ​​are used to construct a vector. The L2 norm of this gradient vector is then calculated to obtain a scalar value. Let's assume the value is 0.0025.

[0035] The calculated gradient norm Compared to the pruning threshold previously set for this block Compare the values. Based on the calculations in the previous example, the threshold for suicidal ideation blocks... The value is 0.00393. Since 0.0025 is less than 0.00393, the pruning condition is met. Therefore, it is decided to prune the suicidal ideation block. Before processing new training samples, the weights and biases of all neurons in this block will be forcibly set to 0. In subsequent calculations, this block will no longer have any impact on the model's output, and no gradients will be generated, as if it has been temporarily removed from the network. This process allows the model to ignore expert blocks that do not contribute much, based on the characteristics of each sample, thereby improving training efficiency and the model's generalization ability.

[0036] In the second embodiment, the present invention also proposes a multi-layered expert-based early warning system for psychological crises based on long-term temporal contextual understanding, comprising the following modules: The fusion module is used to acquire historical time-series text data and current text data of users to be warned; extract core event vectors from the historical time-series text data in segments, and perform attenuation weighting according to time to fuse them into an initial long-term time-series contextual memory representation; The modulation module is used to calculate the risk adjustment amount based on the crisis level of the previous time window and the sentiment polarity of the current text data, and to modulate the initial long-term contextual memory representation using the adjustment amount to obtain the long-term contextual memory representation. The concatenation module is used to concatenate the long-term contextual memory representation with the embedding vector of the current text data to form an input vector; The pruning module is used to infer the input vector using a pre-trained block-sparse multilayer expert network model and output a warning signal containing crisis level, crisis type, and confidence level. The block-sparse multilayer expert network model is obtained by constructing a multilayer expert network model, wherein the model expert layer performs structured block partitioning based on a predefined psychological concept dictionary and user behavior statistical features. During training, a pruning threshold is set for each block partition by combining the contextual complexity determined by the long-term contextual memory representation norm and the prior risk of the concepts associated with each block, and blocks with activation gradient norms lower than the corresponding thresholds are pruned.

[0037] In an optional embodiment, the step of segmenting the historical time-series text data to extract core event vectors, and then applying attenuation weights based on time to fuse them into an initial long-term temporal contextual memory representation includes: The historical time-series text data is divided into time periods of 15 consecutive days. For all text within each time period, the TextRank algorithm is used to extract the three sentences with the highest weight as core events; The three sentences are converted into 768-dimensional event vectors using a pre-trained BERT model, and the average value is taken to obtain the core event vector for the time period. Using an exponential decay function Calculate the time decay weight for each core event vector, where This is the current timestamp. The timestamp of when the event occurred; The initial long-term contextual memory representation is obtained by summing the weighted core event vectors of all time periods.

[0038] In an optional embodiment, the step of calculating a risk adjustment amount based on the crisis level of the previous time window and the sentiment polarity of the current text data, and using the adjustment amount to modulate the initial long-term contextual memory representation to obtain a long-term contextual memory representation, includes: The crisis level of the previous time window Represented as integers between 0 and 4; Calculate the sentiment polarity of the current text data using a sentiment analysis model. The value ranges from -1 to +1; Through formula Calculate the risk adjustment factor ; The risk adjustment factor Modulation is achieved by applying element-wise multiplication to the initial long-term contextual memory representation.

[0039] In an optional embodiment, the expert layer performs structured block partitioning based on a predefined psychological concept dictionary and user behavior statistical features, including: Based on the DSM-5 diagnostic criteria, a psychological concept dictionary was constructed that includes four categories: "depressed mood", "loss of interest", "suicidal ideation" and "anxiety". In each expert layer of the multi-layer expert network model, a dedicated neuron block is pre-defined for each of the four concept categories mentioned above; Keywords under the category of "depressed mood" in the dictionary are mapped to the weight matrix of the neuron block of "depressed mood" to achieve structured partitioning.

[0040] In an optional embodiment, setting pruning thresholds for each block partition includes: During training, the L2 norm of the long-term temporal contextual memory representation of each training sample is calculated as the contextual complexity. ; For each concept block, a priori risk level is assigned based on historical data statistics. The value ranges from 0 to 1; Through formula Calculate the pruning threshold for the i-th block partition. ,in α and β are preset positive real hyperparameters to ensure that blocks with high contextual complexity or high prior risk have low pruning thresholds.

[0041] In an optional embodiment, pruning blocks whose activation gradient norm is below a corresponding threshold includes: During the backpropagation process of model training, the L2 norm of the gradient of the weight matrix corresponding to the i-th structured block partition is calculated. ; Compare Pruning threshold corresponding to the block ; like In the next training iteration, all weight and bias parameters of the block will be set to 0, and it will not be activated in the forward and backward propagation of the model.

[0042] In an optional embodiment, concatenating the long-term contextual memory representation with the embedding vector of the current text data to form an input vector includes: Using the same pre-trained BERT model as that used to extract the core event vector, the current text data is converted into a 768-dimensional embedding vector; The 768-dimensional long temporal contextual memory representation is concatenated with the 768-dimensional embedding vector of the current text data in terms of dimensions to form a 1536-dimensional input vector.

[0043] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0044] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0045] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A multi-layered expert-based early warning method for psychological crises based on long-term temporal contextual understanding, characterized in that... Includes the following steps: Obtain historical time-series text data and current text data of users to be warned; extract core event vectors from the historical time-series text data in segments, and perform attenuation weighting according to time, and fuse them into an initial long-term time-series contextual memory representation; Based on the crisis level of the previous time window and the sentiment polarity of the current text data, a risk adjustment amount is calculated, and the initial long-term contextual memory representation is modulated using the adjustment amount to obtain a long-term contextual memory representation. The process of calculating the risk adjustment amount based on the crisis level of the previous time window and the sentiment polarity of the current text data, and modulating the initial long-term contextual memory representation using the adjustment amount to obtain a long-term contextual memory representation, includes: adjusting the crisis level of the previous time window... Represented as integers between 0 and 4; the sentiment polarity of the current text data is calculated using a sentiment analysis model. The value ranges from -1 to +1; through the formula Calculate the risk adjustment factor The risk adjustment factor Modulation is achieved by applying element-wise multiplication to the initial long-term contextual memory representation; The long-term contextual memory representation is concatenated with the embedding vector of the current text data to form an input vector; The input vector is inferred using a pre-trained block-sparse multilayer expert network model, which outputs a warning signal containing crisis level, crisis type, and confidence level. The block-sparse multilayer expert network model is obtained by constructing a multilayer expert network model, wherein the expert layer of the model performs structured block partitioning based on a predefined psychological concept dictionary and user behavior statistical features. During training, the contextual complexity determined by the long-term contextual memory representation norm and the prior risk of the concepts associated with each block are combined to set a pruning threshold for each block partition, and blocks with activation gradient norms lower than the corresponding thresholds are pruned.

2. The method according to claim 1, characterized in that, The process of segmenting and extracting core event vectors from the historical time-series text data, and then weighting and attenuating them according to time to fuse them into an initial long-term temporal contextual memory representation includes: The historical time-series text data is divided into time periods of 15 consecutive days. For all text within each time period, the TextRank algorithm is used to extract the three sentences with the highest weight as core events; The three sentences are converted into 768-dimensional event vectors using a pre-trained BERT model, and the average value is taken to obtain the core event vector for the time period. Using an exponential decay function Calculate the time decay weight for each core event vector, where This is the current timestamp. The timestamp of when the event occurred; The initial long-term contextual memory representation is obtained by summing the weighted core event vectors of all time periods.

3. The method according to claim 1, characterized in that, The expert layer partitions the data into structured blocks based on a predefined dictionary of psychological concepts and user behavior statistical features, including: Based on the DSM-5 diagnostic criteria, a dictionary of psychological concepts was constructed, including four categories: "depressed mood", "loss of interest", "suicidal ideation" and "anxiety". In each expert layer of the multi-layer expert network model, a dedicated neuron block is pre-defined for each of the four concept categories mentioned above; Keywords under the "depressed mood" category in the dictionary are mapped to the weight matrix of the "depressed mood" neuron block to achieve structured partitioning.

4. The method according to claim 1, characterized in that, Setting pruning thresholds for each partition includes: During training, the L2 norm of the long-term temporal contextual memory representation of each training sample is calculated as the contextual complexity. ; For each concept block, a priori risk level is assigned based on historical data statistics. The value ranges from 0 to 1; Through formula Calculate the pruning threshold for the i-th block partition. ,in , , To predetermine positive real hyperparameters, ensure that blocks with high contextual complexity or high prior risk have a low pruning threshold.

5. The method according to claim 1, characterized in that, The pruning of blocks whose activation gradient norm is lower than the corresponding threshold includes: During the backpropagation process of model training, the L2 norm of the gradient of the weight matrix corresponding to the i-th structured block partition is calculated. ; Compare Pruning threshold corresponding to the block ; like In the next training iteration, all weight and bias parameters of the block will be set to 0, and it will not be activated in the forward and backward propagation of the model.

6. The method according to claim 1, characterized in that, The step of concatenating the long-term contextual memory representation with the embedding vector of the current text data to form an input vector includes: Using the same pre-trained BERT model as that used to extract the core event vector, the current text data is converted into a 768-dimensional embedding vector; The 768-dimensional long temporal contextual memory representation is concatenated with the 768-dimensional embedding vector of the current text data in terms of dimensions to form a 1536-dimensional input vector.

7. The method according to claim 3, characterized in that, The process of mapping keywords under the "depressed mood" category in the dictionary to the weight matrix of "depressed mood" neuron blocks to achieve structured partitioning is as follows: Using a pre-trained language model, all keywords under the category of "depressed mood" are converted into high-dimensional semantic vectors; Aggregate the vectors of the keywords to obtain a concept vector that can represent the concept of "depressive mood"; When constructing a multi-layer expert network, the aggregated concept vectors are used to initialize the weight matrix of the "depressive mood" neuron block; Perform the same operation as above for the three categories of "loss of interest", "suicidal ideation" and "anxiety".

Citation Information

Patent Citations

  • A social media user psychological crisis early warning method

    CN109671487A

  • Interactive microblog text emotion mining method based on emotion migration perception in social network

    CN113051916A