Methods, devices, and electronic equipment for generating training data based on psychological process modeling
By using binary classification model screening, sequence labeling model extraction, and psychological link information processing generated by causal language model, the problem of low training data quality for large language models was solved, and the depth and accuracy of the training data were improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG INTELL VISION TECH CO LTD
- Filing Date
- 2026-04-23
- Publication Date
- 2026-06-30
Smart Images

Figure CN122087121B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, and electronic device for generating training data based on psychological process modeling. Background Technology
[0002] With the continuous iteration of computer technology and breakthroughs in the field of artificial intelligence, large language models, with their outstanding semantic parsing, generative creation, long-range contextualization capture, and complex logical deduction capabilities, are deeply integrated into various vertical application scenarios, such as intelligent dialogue, role-playing, social survey simulation, and emotional companionship. In the development of large language models, training data, as the core foundation for the iteration of model capabilities and performance optimization, is a key factor determining the upper limit of model performance, particularly in terms of its quality and depth.
[0003] The training data used in related technologies for large language models mainly comes from dialogue texts obtained from the Internet, data from question-and-answer communities, and manually annotated instruction-response data pairs, which are primarily in the form of "input-output" binary structures. The training data used in these large language models is limited to the surface layer of text, does not match the actual cognitive process, is of low quality, and affects the subsequent training effect of the large language model. Summary of the Invention
[0004] This application provides a training data generation method, apparatus, and electronic device based on psychological process modeling. It solves the problem that the training data used by large language models in related technologies is limited to the surface layer of text, does not match the actual cognitive process, has low quality, and affects the training effect of subsequent large language models. It can achieve explicit modeling of the psychological motivation behind human interaction behavior through the whole process of cognitive linkage information filtering, linkage data group extraction, and psychological link information generation, improve the quality of training data, and provide training corpora with deep psychological mapping for the use of large language models in various application scenarios.
[0005] In a first aspect, embodiments of this application provide a method for generating training data based on psychological process modeling, the method comprising:
[0006] Obtain a set of target text segments, input the set of target text segments into a trained binary classification model, and obtain the classification result corresponding to each text segment in the set of target text segments. The classification result is used to indicate whether the text segment contains cognitive linkage information.
[0007] From the set of target text segments, at least one target text segment whose classification result indicates that it contains cognitive linkage information is selected, and the at least one target text segment is input into the trained sequence labeling model to obtain at least one linkage data group corresponding to each target text segment;
[0008] The at least one linked data group and the preset constraint rule information are input into the trained causal language model to obtain the psychological link information corresponding to each linked data group.
[0009] Training data is constructed based on each of the aforementioned linked data groups and their corresponding psychological link information.
[0010] Secondly, embodiments of this application also provide a training data generation device based on psychological process modeling, comprising:
[0011] The acquisition module is configured to acquire a set of target text segments;
[0012] The first model processing module is configured to input the target text segment set into a trained binary classification model to obtain a classification result for each text segment in the target text segment set. The classification result is used to indicate whether the text segment contains cognitive linkage information.
[0013] The filtering module is configured to filter out at least one target text segment from the target text segment set, indicating that the classification result contains cognitive linkage information;
[0014] The second model processing module is configured to input the at least one target text segment into the trained sequence labeling model to obtain at least one linked data group corresponding to each target text segment;
[0015] The third model processing module is configured to input the at least one linked data group and preset constraint rule information into the trained causal language model to obtain the psychological link information corresponding to each linked data group.
[0016] The module is configured to construct training data based on each of the linked data groups and their corresponding psychological link information.
[0017] Thirdly, embodiments of this application also provide an electronic device, the device comprising:
[0018] One or more processors;
[0019] Memory, used to store one or more computer programs;
[0020] When one or more computer programs are executed by one or more processors, an electronic device implements a training data generation method based on psychological process modeling, as in any of the first aspects.
[0021] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a training data generation method based on psychological process modeling as described in any of the first aspects.
[0022] In this embodiment, a binary classification model is first used to filter irrelevant text, then a sequence labeling model is used to accurately locate the positions of linked data groups, and finally a causal language model is used to infer and generate psychological link information. Combining multiple models for collaborative processing ensures processing accuracy and improves processing efficiency. Simultaneously, it fills in the missing intermediate layer of psychological motivation in existing training data, ensuring the integrity of the training data. This solution, through the entire process of cognitive linkage information filtering, linked data group extraction, and psychological link information generation, achieves explicit modeling of the psychological motivations behind human interaction behavior, improves training data quality, and provides training corpora with deep psychological mapping for the use of large language models in various application scenarios. Attached Figure Description
[0023] Figure 1 A flowchart illustrating a training data generation method based on psychological process modeling, provided for embodiments of this application;
[0024] Figure 2 A flowchart illustrating the specific training process of a binary classification model provided in this application embodiment;
[0025] Figure 3 A flowchart illustrating the annotation process of a sequence labeling model provided in this application embodiment;
[0026] Figure 4 A flowchart illustrating the specific training process of a sequence labeling model provided in this application embodiment;
[0027] Figure 5 A flowchart illustrating the specific training process of a causal language model provided in this application embodiment;
[0028] Figure 6 A flowchart illustrating the process of constructing training data based on various linked data groups and their corresponding psychological link information, provided in this application embodiment;
[0029] Figure 7 A structural block diagram of a training data generation device based on psychological process modeling provided in an embodiment of this application;
[0030] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0031] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and not for limiting the invention. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention and not the entire structure.
[0032] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0033] It should be noted that, due to space limitations, this application specification does not exhaustively list all possible implementation methods. Those skilled in the art should be able to conceive after reading this application specification that, as long as the technical features do not contradict each other, any combination of technical features can constitute an optional implementation method.
[0034] The training data generation method based on psychological process modeling provided in this application embodiment can be executed by a computer device. The computer device refers to any electronic device with data computing, processing and storage capabilities, such as mobile phones, PCs (Personal Computers), tablet computers and other terminal devices, or servers, etc. This application embodiment does not limit the scope of the method.
[0035] The training data used in related technologies for large language models mainly comes from dialogue texts obtained from the internet, data from question-and-answer communities, and manually annotated instruction-response pairs, which are primarily in the form of an "input-output" binary structure. During the process of training large language models using the aforementioned training data, the inventors discovered that, firstly, existing dialogue data typically records "what was said" and "what was done," but fails to capture the crucial psychological intermediate process of "why it was said / done." For example, when a news report describes someone making a specific decision in the face of a crisis, existing dialogue data only retains the event and the decision itself, while the complete psychological chain from situational awareness to cognitive evaluation, emotional arousal, motivation formation, and finally behavioral output is completely missing. This leads to large language models trained on such data performing poorly in tasks requiring empathy, role consistency, or deep understanding. Secondly, current mainstream data augmentation techniques include back-translation, synonym replacement, syntactic transformation, and rewriting and continuation based on large language models. These methods essentially transform at the lexical and syntactic levels without altering the semantic structure and cognitive depth of the data. Even when using large language models for open-ended data generation, the lack of explicit constraints on the cognitive structure of "stimulus-psychology-response" makes it difficult to guarantee the rationality, consistency, and interpretability of the generated data in terms of psychological processes. Furthermore, unstructured materials such as biographies, in-depth interviews, news reports, and video transcripts naturally contain numerous implicit patterns of "facing a specific situation → generating a specific psychological response → performing a specific behavior." However, these patterns are scattered throughout long texts in natural language, with blurred boundaries and diverse expressions, making manual extraction extremely costly and difficult to scale, and lacking automated identification and structuring methods. Finally, even when attempting to use large language models to infer and generate psychological activities from text, the lack of constraints from a cognitive psychology theoretical framework often results in highly disjointed outcomes, incomplete logical connections, and discrepancies with actual cognitive processes, and the results cannot be quality-assessed and screened using automated indicators. Based on this, embodiments of this application provide a training data generation method, apparatus, and electronic device based on psychological process modeling, aiming to solve the problem that the training data used by large language models in related technologies is limited to the surface layer of text, does not match the actual cognitive process, has low quality, and affects the training effect of subsequent large language models.
[0036] The embodiments of the present invention will be described in detail below.
[0037] Figure 1 A flowchart illustrating a training data generation method based on psychological process modeling, as provided in this application embodiment, is shown below. Figure 1 As shown, the training data generation method based on psychological process modeling includes the following steps:
[0038] Step S101: Obtain the target text segment set, input the target text segment set into the trained binary classification model, and obtain the classification result corresponding to each text segment in the target text segment set. The classification result is used to indicate whether the text segment contains cognitive linkage information.
[0039] The target text segment set can be a collection of standardized text segments obtained after preprocessing (e.g., cleaning, segmentation, format standardization) of the input unstructured text (e.g., biographies, news reports, in-depth interviews, video transcripts, etc.). The binary classification model can be a lightweight classification model used to determine whether a text segment contains cognitive linkage information. In one optional implementation, the binary classification model can be a fine-tuned binary classifier of a pre-trained language model (e.g., BERT, RoBERTa, etc.), with a fully connected classification head following the text encoding layer to output the classification result. It should be noted that the binary classification model, as well as the sequence labeling model and causal language model in subsequent steps, can be independently trained and deployed models, each with independent model parameters and inference instances. The advantage is that each model can be independently optimized and upgraded, and the failure of a single model does not affect other models, making it suitable for scenarios with large differences in the performance requirements of each model. In another optional implementation, the binary classification model can be a binary classification task head based on a unified base model (e.g., a unified Transformer encoder), sharing the underlying encoding parameters with the sequence labeling model and causal language model mentioned in subsequent steps. It should be noted that binary classification models, sequence labeling models, and causal language models share the same pre-trained base model. This has the advantage of sharing encoding parameters, reducing the total number of parameters and inference overhead, and allowing for cross-task transfer of underlying semantic understanding capabilities; it is suitable for scenarios with limited deployment resources. The classification result can be a determination of whether a text segment output by the binary classification model contains cognitive linkage information. For example, the classification result... ,in, This indicates that the text segment contains cognitive linkage information. This indicates that the text segment does not contain cognitive linkage information. Cognitive linkage information can be content within the text segment that includes "observable behaviors, decisions, verbal responses, emotional responses, etc., generated by the subject after facing a specific external stimulus, and the two are causally or temporally related," corresponding to the "stimulus-response" cognitive structure. For example, in the text segment "Upon hearing the news of her child's acceptance, the mother was so excited that she burst into tears and immediately decided to treat the whole family to a celebratory meal," the cognitive linkage information could be "hearing the acceptance news—bursting into tears and deciding to celebrate," where "hearing the acceptance news" is equivalent to the "stimulus," and "bursting into tears and deciding to celebrate" is equivalent to the "response."
[0040] In an optional embodiment, the following processing steps are included before obtaining the target text segment set:
[0041] Obtain the raw text data;
[0042] The original text data is cleaned to obtain the first text data;
[0043] The first text data is semantically segmented to obtain the original text segment set;
[0044] The original text segment set is formatted and standardized to obtain the target text segment set.
[0045] The original text data can be unstructured text data without any processing, including biographies, news reports, in-depth interviews, video transcripts, novels, and documentary literature. Text cleaning processes include removing HTML tags, special characters, repeated whitespace, and other noise, as well as speaker tagging, filtering interjections, and correcting sentence breaks in video transcripts. Semantic segmentation involves dividing long texts into semantically complete segments. Format standardization involves unifying the segmented text into a standard format, including standardized encoding, punctuation, and adding paragraph numbers, forming a standardized set of text segments. As can be seen, text cleaning removes noise and invalid content from the original text, ensuring the purity and effectiveness of the text content in subsequent processing; semantic segmentation divides long texts into semantically complete segments suitable for model processing; and format standardization ensures the standardization and consistency of subsequent model inputs.
[0046] Specifically, semantic segmentation is performed on the first text data to obtain a set of original text segments, including:
[0047] The first text data is split based on a preset sliding window and a preset step size to obtain window text data corresponding to multiple windows respectively;
[0048] Based on the semantic similarity of the text data of adjacent windows in multiple windows, the first text data is segmented to obtain the original text segment set.
[0049] The preset sliding window can be a window of fixed word length used for text splitting, with a typical value of 512 words. The preset step size can be the word step size at which the preset sliding window moves each time, with a typical value of 256 words, ensuring overlap between adjacent windows and avoiding loss of semantic information. The window text data can be the fixed-length text content truncated by the preset sliding window each time. Semantic similarity can be calculated by encoding semantic vectors into the window text data using a pre-trained language model and calculating the cosine similarity of adjacent semantic vectors. If the semantic similarity between two adjacent windows is lower than a preset similarity threshold, the text is split at the overlapping position of the adjacent windows.
[0050] In one optional embodiment, a specific training process for a binary classification model is described; please refer to [reference needed]. Figure 2 , Figure 2 This is a flowchart illustrating the specific training process of a binary classification model provided in an embodiment of this application. Figure 2 As shown, the specific implementation steps of the training process for the binary classification model are as follows:
[0051] Step S201: Obtain multiple original text segments from the original corpus, input the multiple original text segments and the set prompt word information into the pre-trained large language model for the first annotation process, and obtain the label value and label confidence of each original text segment.
[0052] The original corpus can store unstructured text such as biographies, news reports, in-depth interviews, and video transcripts. This unstructured text can contain one or more original text segments. The prompt word information can be a structured instruction template set for the large language model, specifically including system instructions, definitions of cognitive linkage information (such as the cognitive structure of "stimulus-response"), judgment criteria, few-sample examples, and output format requirements. This guides the large language model to complete the first annotation process, which can be the judgment and annotation of whether the original text segment contains cognitive linkage information. For example, cognitive linkage information can be content information corresponding to the cognitive structure "stimulus-response," and the content of the prompt word information is as follows:
[0053] [System Command]
[0054] You are a cognitive psychology and behavioral analysis expert. Your task is to determine whether a given text contains a stimulus-response pattern.
[0055] The definition of the "stimulus-response" pattern: The text describes one or more subjects who, in response to a specific external situation / event / information (stimulus), produce observable behaviors, decisions, verbal or emotional expressions (response).
[0056] Judgment criteria:
[0057] 1. There must be a clear external stimulus (such as an event, situation, or the behavior of others).
[0058] 2. There must be an identifiable subject response (e.g., behavior, decision-making, speech, emotional expression, etc.);
[0059] 3. There is an inferable causal or temporal relationship between the stimulus and the response.
[0060] [Example with few samples]
[0061] Example 1:
[0062] Text: "Upon hearing the news of her child's acceptance, the mother was so excited that she burst into tears and immediately decided to treat the whole family to a celebratory meal."
[0063] Judgment: Includes. Stimulus = Hearing the acceptance message; Response = Shedding tears and deciding to celebrate.
[0064] Tag: 1.
[0065] Example 2:
[0066] Text: "The region has an average annual rainfall of 1200 mm and is classified as a subtropical monsoon climate."
[0067] Judgment: Not included. This is a factual description and does not include the subject's behavioral response to the stimulus.
[0068] Tag: 0.
[0069] [Text to be annotated]
[0070] Text: "{input_text}"
[0071] Please output in the following JSON format:
[0072] {"contains_sr": 0 or 1,
[0073] "confidence": a confidence level between 0.0 and 1.0.
[0074] “brief_reason”: “A brief reason for the judgment”.
[0075] Of course, the aforementioned prompt information is only an illustrative description and can be adjusted to meet the psychological analysis needs of actual application scenarios. This application does not limit it here.
[0076] Therefore, by using the aforementioned prompt word information, multiple original text segments in the original corpus can be batch-annotated. The annotation result for each original text segment includes a label value and a label confidence score. The label value can be a binary classification label, corresponding to the "contains_sr" field in the prompt word information of the previous example, where "1" indicates the presence of cognitive linkage information and "0" indicates the absence of cognitive linkage information. The label confidence score can be a deterministic score for the annotation result, ranging from 0 to 1, and is used for subsequent stratified filtering.
[0077] Step S202: Based on the label confidence scores corresponding to each original text segment, perform hierarchical filtering on multiple original text segments to obtain multiple target text segments, and construct a training dataset based on the multiple target text segments and their corresponding label values.
[0078] The stratified filtering process can be implemented by dividing the original text segments into three intervals—high confidence, medium confidence, and low confidence—based on the label confidence level, and then applying different processing strategies to each interval. Optionally, to obtain multiple target text segments by performing stratified filtering on multiple original text segments based on their respective label confidence levels, a first confidence threshold and a second confidence threshold can be pre-set, where the first confidence threshold is greater than or equal to the second confidence threshold. If the label confidence level of an original text segment is greater than the first confidence threshold (example value 0.9), then that original text segment can be identified as a target text segment. If the label confidence level of an original text segment is less than the second confidence threshold (example value 0.6), then that original text segment can be discarded. If the label confidence level of an original text segment is between the second and first confidence thresholds, then that original text segment can be added to a manual verification queue for secondary confirmation by annotators. In this process, manual verification employs an active learning strategy to prioritize the annotation and confirmation of the most informative original text segments, minimizing manual costs. Furthermore, the original text segments that pass verification can be redefined as target text segments. After obtaining multiple target text segments, a training dataset can be constructed based on these segments and their corresponding label values. For example, a portion of the data can be extracted from these multiple target text segments and their corresponding label values according to a preset ratio to serve as the training dataset, with the remainder used as the validation dataset. Alternatively, negative sample data can be added to the multiple target text segments and their corresponding label values to construct a balanced training dataset.
[0079] Step S203: Based on the training dataset, the large language model, and the set first loss function, perform knowledge distillation training on the pre-built initial binary classification model to obtain the trained binary classification model.
[0080] After obtaining the training dataset, a lightweight student model is trained using a large language model as the teacher model. This student model is a pre-built initial binary classification model. In one embodiment, the initial binary classification model can be a fine-tuned binary classifier of a pre-trained language model (e.g., BERT, RoBERTa, etc.), with a fully connected classification head following the text encoding layer to output the classification result. In another embodiment, the initial binary classification model can be a binary classification task head based on a unified base model (e.g., a unified Transformer encoder), sharing the underlying encoding parameters with the sequence labeling model and causal language model mentioned in subsequent steps. Optionally, the specific formula for the first loss function is as follows:
[0081]
[0082]
[0083]
[0084] in, The first target loss value, The cross-entropy loss value is used to measure the difference between the prediction result of the initial binary classification model and the true label. The actual label value. These are the predicted label values from the initial binary classification model. The knowledge distillation loss value (for example, which can be calculated using KL divergence). This represents the classification probability distribution of the large language model's output for the same input text segment. This represents the initial binary classification model's output classification probability distribution for the same input text segment. This is the balance coefficient.
[0085] In the specific implementation process, the training dataset can be divided into multiple training batches. For each training batch, the target text segment is input into the initial binary classification model to obtain the classification probability distribution output by the model. and predicted label values Furthermore, by inputting the target text segment into a large language model, the classification probability distribution output by the model is obtained. Based on real label values and predicted label values It can calculate the cross-entropy loss value, and, based on the classification probability distribution output by the initial binary classification model,... The classification probability distribution output by the large language model The distillation loss value under KL divergence can be calculated. Then, the cross-entropy loss value and the distillation loss value are weighted and calculated to obtain the first target loss value. Based on this first target loss value, the gradient of the loss with respect to each parameter of the initial binary classification model is calculated through backpropagation. The optimizer updates the model parameters according to the gradient. Through repeated iterative training, training is stopped when the first target loss value converges or when the preset training epoch limit is reached, so as to obtain the trained binary classification model.
[0086] As described above, inputting multiple original text segments and set prompt word information into a pre-trained large language model for the first annotation process can quickly and accurately generate labeled training data using the large language model. Layered filtering of multiple original text segments yields multiple target text segments, and a training dataset is constructed based on these target text segments and their corresponding label values. This results in a high-quality training dataset, ensuring the training effect of the subsequent binary classification model. Knowledge distillation training of the pre-constructed initial binary classification model based on the training dataset, the large language model, and the set first loss function allows the semantic understanding capability of the large language model to be transferred to a lightweight binary classification model, enabling the binary classification model to possess both high accuracy and high efficiency.
[0087] Reference Figure 1 It also includes step S102, which involves selecting at least one target text segment from the target text segment set whose classification result indicates that it contains cognitive linkage information, inputting at least one target text segment into the trained sequence labeling model, and obtaining at least one linkage data group corresponding to each target text segment.
[0088] The target text segment can be a text paragraph determined by a binary classification model to contain cognitive linkage information. The sequence labeling model can be used to extract linkage data groups from the target text segment. These linkage data groups can consist of a set of stimulus data segments and response data segments that have causal or temporal correlations. This sequence labeling model can support the extraction of multiple linkage data groups from a single text segment. In one optional implementation, the sequence labeling model can be a sequence labeling framework based on a pre-trained language model (e.g., BERT, RoBERTa, etc.), with a CRF (Conditional Random Field) layer following the text encoding layer to output the relevant positions of the extracted linkage data groups. In another optional implementation, the binary classification model can be based on a unified base model (e.g., a unified Transformer encoder), connected to the sequence labeling task header and the CRF layer, sharing the underlying encoding parameters with the binary classification model mentioned in the preceding steps. Specifically, sequence labeling models can combine sequence labeling with data fragment extraction. Each term in the text segment is labeled with one of the following tags: "BS"—the starting term of the stimulus data fragment; "IS"—an internal term of the stimulus data fragment; "BR"—the starting term of the response data fragment; "IR"—an internal term of the response data fragment; "O"—another term that is neither a stimulus nor a response. For example, the target text segment is: 'Everyone come quickly to help, saving lives is the priority!' As the auxiliary police officer shouted loudly, more and more passersby noticed the situation and rushed over from all directions. The corresponding labeling results are: '(O)Everyone (BS) come quickly (IS) to help (IS), (O) Saving lives (IS) is the priority (IS)! (O)' (O)As (IS)the auxiliary police officer (IS) (IS) shouted loudly (IS) (IS), (O)more and more (BR) (IR) passersby (IR) noticed (IR) the situation (IR) and rushed over (IR) from (IR) all directions (IR). According to the annotation results, the stimulus data segment is "Everyone come quickly to help, saving lives is the priority!" as the auxiliary police officer shouted loudly, and the response data segment is "More and more passers-by rushed over from all directions after discovering the situation."
[0089] In one embodiment, the sequence labeling model supports labeling multiple sets of discontinuous stimulus and response data segments within the same text segment. Please refer to [reference needed]. Figure 3 , Figure 3 This is a flowchart illustrating the annotation process of a sequence labeling model provided in an embodiment of this application. Figure 3 As shown, the specific implementation steps for inputting at least one target text segment into the trained sequence labeling model to obtain at least one linked data set corresponding to each target text segment are as follows:
[0090] Step S301: Label each target text segment with stimulus data fragments and response data fragments. For target text segments containing multiple stimulus data fragments and / or multiple response data fragments, extract stimulus data fragment sets and response data fragment sets.
[0091] The stimulus data fragments can be text segments from the target text segment that describe the external situation, events, information, or other triggering content faced by the subject. The response data fragments can be text segments from the target text segment that describe the observable behaviors, decisions, speech, and emotional expressions of the subject after the stimulus. Since a single target text segment may contain only one stimulus data fragment and one response data fragment, or it may contain multiple stimulus data fragments and / or multiple response data fragments, and each linked data set is formed by pairing a single stimulus data fragment with a single response data fragment, for a target text segment containing multiple stimulus data fragments and / or multiple response data fragments, a set of stimulus data fragments and a set of response data fragments are first extracted from the target text segment. The set of stimulus data fragments can be a set consisting of all stimulus data fragments extracted from the same target text segment. The set of response data fragments can be a set consisting of all response data fragments extracted from the same target text segment.
[0092] Step S302: Group and correlate each stimulus data segment in the stimulus data segment set and each response data segment in the response data segment set to obtain the correlation score for each group of data segments.
[0093] The group association calculation can involve pairwise combining all segments in the stimulus data segment set and the response data segment set, calculating the degree of causal association between each pair, and obtaining a quantified association score. This association score can be a quantitative rating of the degree of causal association between a stimulus data segment and a response data segment; a higher score indicates a stronger causal association. Optionally, the group association calculation can be performed by pairwise combining segments in both sets. First, each stimulus data segment and each response data segment is encoded as a semantic vector. The semantic similarity of the semantic vectors corresponding to each pair of data segments is calculated (using the result of cosine similarity calculation). Then, based on the word distance between the two data segments in the target text segment, the positional proximity is calculated (using the inverse normalized result of the word distance between the stimulus data segment and the response data segment in the target text segment). Finally, the semantic similarity and positional proximity are weighted to obtain the association score for each pair of data segments. For example, the formula for calculating the association score is as follows:
[0094]
[0095] in, For related scores, For semantic similarity, For location proximity, For the first data segment in the stimulus data set A stimulus data segment, In response to the first data fragment in the data fragment set A response data fragment, These are the weighting coefficients.
[0096] Step S303: Based on the association scores of each set of data segments, determine multiple linked data groups from the stimulus data segment set and the response data segment set.
[0097] In one embodiment, multiple linked data groups can be determined using a greedy matching algorithm. The data is sorted by association score from highest to lowest, and each stimulus data segment is matched sequentially with the response data segment that has the highest association score and has not yet been matched, thus forming a linked data group. In another embodiment, multiple linked data groups can be determined using the Hungarian algorithm. This algorithm solves for the globally optimal bipartite graph matching based on the association score matrix, achieving the globally optimal pairing of stimulus and response data segments and ensuring the highest possible overall association score for the paired data.
[0098] As described above, by labeling stimulus and response data fragments and extracting stimulus and response data fragment sets, all stimulus and response data fragments in the target text segment can be accurately identified and extracted, enabling parallel splitting of multiple causal units. Grouping and associating each stimulus data fragment in the stimulus data fragment set and each response data fragment in the response data fragment set allows for quantifying the causal association strength between stimulus and response data fragments, providing a reliable basis for subsequent correct grouping. Determining multiple linked data groups from the stimulus and response data fragment sets based on the association scores of each group of data fragments achieves optimal pairing between stimulus and response data fragments, ensuring the accuracy of the causal association in each linked data group.
[0099] In one optional embodiment, a specific training process for a sequence labeling model is described; please refer to [reference needed]. Figure 4 , Figure 4 This is a flowchart illustrating the specific training process of a sequence labeling model provided in an embodiment of this application. Figure 4 As shown, the specific implementation steps of the training process for the sequence labeling model are as follows:
[0100] Step S401: Obtain multiple sample text segments, where each sample text segment contains cognitive linkage information.
[0101] The sample text segment can be a pre-selected text segment containing cognitive linkage information.
[0102] Step S402: Input multiple sample text segments into the pre-trained large language model for second annotation processing to obtain the location information of the linkage data group corresponding to the cognitive linkage information in each sample text segment.
[0103] The linked data group includes stimulus data fragments and response data fragments. The second annotation process can identify the stimulus data fragments and response data fragments in the sample text segment according to the set prompt word information, and annotate the start and end positions of each fragment. Specifically, this position information can be the start and end word positions of the stimulus data fragment and response data fragment in the sample text segment. For details, please refer to the annotation-related content described above; this application will not elaborate further.
[0104] Step S403: Based on the location information of each sample text segment, the corresponding linked data group, and the set second loss function, train the pre-constructed initial sequence labeling model to obtain the trained sequence labeling model.
[0105] The second loss function can be the CRF conditional log-likelihood loss function, and the relevant formula is as follows:
[0106]
[0107] in, The second objective loss value, It is a real label sequence (constructed based on the location information of sample text segments and corresponding linked data groups). This is a sample text segment. Given a sample text segment as input, the probability that the initial sequence labeling model outputs the true label sequence. For the complete set of all possible label sequences, The total number of tokens in the input sample text segment. For the first input sample text segment The position index of each word element For the first The input feature vector of each word element For the first The actual label corresponding to each word element For the first A word element in a possible label sequence The tags in The first emission fraction is output by the coding layer, i.e., the [missing information]. Input features of each word Labeled as real The score, The second emission fraction is output by the coding layer, i.e., the [missing information]. Input features of each word Labeled as a certain hypothesis tag The score, The first transition score is output by the CRF layer, i.e., from the first... The true label of each word element , transferred to the The true label of each word element Rate, The second transition score is output by the CRF layer, i.e., from the first... A hypothesis label for a word element , transferred to the A hypothesis label for a word element The score, It is a logarithmic function. It is a natural exponential function.
[0108] In the specific implementation process, each sample text segment is first lexicalized, and the positional information of the corresponding linked data group for each sample text segment can be converted into a real label sequence. The lexicalized sample text segments and real label sequences are divided into multiple training batches. For each training batch, the second target loss value is calculated based on the lexicalized sample text segments and real label sequences using the aforementioned second loss function. Based on this second target loss value, the gradient of the loss with respect to each parameter of the initial sequence labeling model is calculated through backpropagation, and the model parameters are updated using an optimizer based on the gradient. Training is repeated iteratively until the second target loss value converges, or training stops when the preset upper limit of training epochs is reached, thus obtaining the trained sequence labeling model.
[0109] As can be seen from the above, by inputting multiple sample text segments into a pre-trained large language model for secondary annotation processing, the large language model can be used to quickly generate high-precision boundary labels required for training the sequence labeling model. Based on the location information of each sample text segment, the corresponding linked data group, and the set second loss function, the pre-constructed initial sequence labeling model can be trained to obtain a sequence labeling model with accurate boundary localization capabilities.
[0110] Reference Figure 1 It also includes step S103, inputting at least one linked data group and preset constraint rule information into the trained causal language model to obtain the psychological link information corresponding to each linked data group.
[0111] The pre-defined constraint rules can be constructed in advance based on a structured constraint framework provided by a cognitive psychology process ontology template. For example, the cognitive psychology process ontology template models the human psychological process from receiving stimuli to generating a response as the following six ordered stages: P1-Perceptual Encoding (Definition: Receiving and initially processing stimulus information; Example: Seeing / hearing / feeling something), P2-Cognitive Appraisal (Definition: Evaluating the meaning, relevance, and impact of stimuli; Example: Judging the importance / urgency / relevance to oneself of an event), P3-Emotional Arousal (Definition: Emotional response based on cognitive appraisal; Example: Generating emotions such as fear / anger / joy / anxiety), P4-Memory and Experience Association (Definition: Associating the current situation with past experiences and knowledge; Example: Recalling similar experiences / calling domain knowledge), P5-Decision Formation (Definition: Forming behavioral intentions and decisions by integrating the aforementioned information; Example: Weighing pros and cons / determining action plans), P6-Behavioral Preparation (Definition: Preparatory mental activities for executing decisions; Example: Developing specific plans / estimating results / adjusting plans). Based on the aforementioned cognitive psychology process ontology template, the remaining content of the pre-defined constraint rules is as follows:
[0112] "Integrity constraint: Each mental activity chain must include five core stages, P1-P5 (P6 is an optional stage), and skipping core stages is not allowed."
[0113] Order constraint: Each stage must be arranged in the order of P1→P2→P3→P4→P5→P6, and reverse order is not allowed.
[0114] Causal coherence constraint: There must be an inferable causal or logical connection between adjacent stages, that is, the content of the later stage must be reasonably deduced from the previous stage.
[0115] Anchoring constraint: Phase P1 must be anchored to the input stimulus content (S), and the output in Phase P5 or P6 must be reasonably directed to the input response content (R).
[0116] The linked data set can include stimulus data fragments and response data fragments. The linked data set and pre-defined constraint rules can serve as input information for the causal language model. The causal language model can be used to infer and generate intermediate psychological link information based on the linked data set under pre-defined constraint rules. The psychological link information can be a structured description of the phased psychological process from stimulus to response, conforming to the laws of cognitive psychology, covering core stages such as perceptual encoding, cognitive evaluation, emotional arousal, memory association, and decision formation. In one optional implementation, the causal language model can be a constraint-generating model of a natural language processing model (e.g., the GPT series), which forces the output of JSON conforming to the cognitive psychology process ontology template through a restricted encoding strategy during the decoding stage. In another optional implementation, the causal language model can be an autoregressive generation task header based on a unified base model (e.g., a unified Transformer encoder), sharing the underlying encoding parameters with the aforementioned binary classification model. It should be noted that the inference constraints of the causal language model are implemented through the following mechanism:
[0117] 1. The cognitive psychology process ontology template is embedded in the preset constraint rule information, which explicitly requires the model to reason step by step in six stages and output in JSON format.
[0118] 2. During the decoding process, the generation order of the JSON structure is controlled by a finite state machine to ensure that the output strictly conforms to the field structure and stage order constraints of the CPOT template.
[0119] 3. After generation, the semantic correlation between the P1 perception encoding stage and the input stimulus data segment S, as well as the semantic correlation between the P5 decision formation stage / P6 behavior preparation stage and the input response data segment R are automatically verified. If the correlation is lower than the threshold, regeneration is triggered.
[0120] For example, the following is a structured JSON output of the mental activity chain for each set of stimulus and response data fragments:
[0121] {
[0122] “stimulus”: “original stimulus text”
[0123] "response": "raw response text",
[0124] "subject": "Description of the identity / role of the actor"
[0125] “cognitive_chain”: [
[0126] {
[0127] "phase": "P1_Perception",
[0128] "content": "Description of stimulus information perceived by the subject"
[0129] "intensity": 0.0-1.0
[0130] },
[0131] {
[0132] "phase": "P2_Appraisal",
[0133] "content": "The subject's cognitive assessment of the stimulus".
[0134] “appraisal_dimensions”: {
[0135] “relevance”: 0.0-1.0,
[0136] "urgency": 0.0-1.0,
[0137] "controllability": 0.0-1.0
[0138] }
[0139] },
[0140] {
[0141] "phase": "P3_Emotion",
[0142] "content": "Description of the subject's emotional response"
[0143] “emotion_labels”: [“list of emotion labels”],
[0144] "valence": -1.0 to 1.0,
[0145] "arousal": 0.0-1.0
[0146] },
[0147] {
[0148] “phase”: “P4_Memory”,
[0149] "content": "Description of memories / experiences related to the subject"
[0150] "association_type": "Analogy / Comparison / Knowledge Retrieval"
[0151] },
[0152] {
[0153] "phase": "P5_Decision",
[0154] "content": "Description of the decision-making process and reasons behind the formation of the subject"
[0155] "decision_factors": ["List of factors to consider in decision-making"]
[0156] },
[0157] {
[0158] "phase": "P6_Preparation",
[0159] "content": "Preliminary description of the subject's behavior (optional)"
[0160] "expected_outcome": Description of the expected result.
[0161] }
[0162] ],
[0163] “metadata”: {
[0164] "source_text_id": "A unique identifier for the source text segment",
[0165] "generation_timestamp": "Generation timestamp",
[0166] "model_version": "Causal language model version number"
[0167] }
[0168] }
[0169] Therefore, the cognitive psychology process ontology template is introduced to provide clear structural constraints for the causal language model, ensuring that the generated psychological activity chain is complete, orderly and interpretable at the cognitive process level.
[0170] In an optional embodiment, a specific training process for a causal language model is described; please refer to [reference needed]. Figure 5 , Figure 5 This is a flowchart illustrating the specific training process of a causal language model provided in an embodiment of this application. Figure 5 As shown, the specific implementation steps of the training process for the causal language model are as follows:
[0171] Step S501: Obtain multiple sample linkage data groups.
[0172] The sample linkage data set can be extracted based on the sample text segments mentioned in the aforementioned embodiments. Each sample linkage data set can contain stimulus data segments and causal data segments. The stimulus data segments can be extracted text segments describing the external situations, events, information, and other triggering content faced by the subject. The response data segments can be extracted text segments describing the observable behaviors, decisions, speech, and emotional expressions of the subject after the stimulus.
[0173] Step S502: Input multiple sample linkage data groups and preset constraint rule information into the pre-trained large language model for third annotation processing to obtain the psychological link information corresponding to each sample linkage data group.
[0174] The third annotation process can be a large language model that, according to preset constraint rules, infers and generates structured psychological link information that conforms to the laws of cognitive psychology based on stimulus data fragments and response data fragments in the sample linkage data group.
[0175] Step S503: Based on the linked data groups of each sample and their corresponding psychological link information, and the set third loss function, train the pre-constructed initial causal language model to obtain the trained causal language model.
[0176] Optionally, the specific formula for the third loss function is as follows:
[0177]
[0178] in, The third objective loss value, The cross-entropy loss is generated for autoregression (calculated based on the psychological link information corresponding to the sample linked data group and the predicted psychological link information output by the initial causal language model). Anchoring loss (measures the semantic alignment between the P1 perception encoding stage and stimulus data segment S, and the P5 decision formation stage / P6 behavior preparation stage and response data segment R, which can be calculated using vector similarity). This is the order constraint loss (punishing the generation of order errors in the penalty phase). and These are the weighting coefficients.
[0179] In the specific implementation process, each sample linkage data group and its corresponding psychological link information are divided into multiple training batches. For each training batch, the sample linkage data group is input into the initial causal language model to obtain predicted psychological link information. Based on the predicted psychological link information and the aforementioned real psychological link information, the aforementioned third loss function is calculated to obtain the third target loss value. Based on this third target loss value, the gradient of the loss with respect to each parameter of the initial causal language model is calculated through backpropagation, and the optimizer is used to update the model parameters according to the gradient. Through repeated iterative training, training is stopped when the third target loss value converges or the preset training epoch limit is reached, so as to obtain the trained causal language model.
[0180] As can be seen from the above, by inputting multiple sample linkage data groups and preset constraint rule information into a pre-trained large language model for third annotation processing, a large amount of psychological link annotation data that conforms to the norms of cognitive psychology can be quickly generated using the large language model. Based on each sample linkage data group and its corresponding psychological link information, and the set third loss function, the pre-constructed initial causal language model can be trained to obtain a causal language model with structured constraint reasoning ability.
[0181] Step S104: Construct training data based on each linked data group and its corresponding psychological link information.
[0182] In one embodiment, each linked data group and its corresponding psychological link information can be directly used to construct triplet data. The data structure of the triplet data can be [stimulus data fragment, psychological link information, response data fragment]. The resulting triplet data can be used as training data.
[0183] As described above, the process involves first using a binary classification model to filter irrelevant text, then using a sequence labeling model to accurately locate linked data groups, and finally using a causal language model to infer and generate psychological link information. Combining multiple models for collaborative processing ensures processing accuracy and improves efficiency. Simultaneously, it fills in the missing intermediate layer of psychological motivation in the existing training data, ensuring the integrity of the training data. This approach, through the entire process of cognitive linkage information filtering, linked data group extraction, and psychological link information generation, achieves explicit modeling of the psychological motivations behind human interaction behavior, improves training data quality, and provides training corpora with deep psychological mapping for the use of large language models in various application scenarios.
[0184] In one embodiment, a specific training process for constructing training data based on each linked data group and its corresponding psychological link information is described. Please refer to [reference needed]. Figure 6 , Figure 6 This is a flowchart illustrating a process for constructing training data based on various linked data groups and their corresponding psychological link information, as provided in an embodiment of this application. Figure 6 As shown, the specific implementation steps for constructing training data based on each linked data group and its corresponding psychological link information are as follows:
[0185] Step S601: Construct multiple triplet data based on each linked data group and its corresponding psychological link information.
[0186] The data structure of triplet data can be [stimulus data fragment, psychological link information, response data fragment].
[0187] Step S602: Calculate and integrate the scores of each triplet data according to multiple preset evaluation dimensions to obtain the quality score corresponding to each triplet data.
[0188] The pre-defined evaluation dimensions can include structural integrity, causal coherence, anchoring consistency, emotional rationality, and information increment, aiming to comprehensively measure the overall quality of triplet data.
[0189] Structural integrity can be determined by checking whether the output mental activity chain includes all necessary stages (such as perceptual encoding, cognitive assessment, emotional arousal, memory association, and decision formation listed in the previous embodiments) and whether the fields of each stage are complete. The specific calculation formula is as follows:
[0190]
[0191] in, The structural integrity score. The number of required stages to be included (which can be set to 5 in conjunction with the stages listed in the foregoing embodiments).
[0192] Among them, causal coherence can be used to assess the degree of logical coherence between adjacent stages. Specifically, the content text of every two adjacent stages is encoded into vectors, the semantic relevance is calculated, and the average value is taken. The specific calculation formula is as follows:
[0193]
[0194] in, For causal coherence scores, This represents the actual number of stages. For text encoding functions, To calculate the cosine similarity of vectors, For the first Content text for each stage, For the first The content text for each stage.
[0195] Anchoring consistency can be used to assess the degree of semantic alignment between the two ends of the mental activity chain and the original stimulus and response. The specific calculation formula is as follows:
[0196]
[0197] in, To anchor the consistency score, To calculate the cosine similarity of vectors, For text encoding functions, This refers to the content text of the first stage (perceptual encoding stage). To stimulate data segments, This is the content text for the final stage (decision-making stage). In response to a data fragment.
[0198] Emotional rationality can be assessed using a pre-trained sentiment analysis model to examine the consistency between the emotion label and valence-arousal parameters in the third stage (emotion arousal stage) and the context (emotional tone of the stimulus and response data segments). The specific calculation formula is as follows:
[0199]
[0200] in, For emotional rationality score, To utilize sentiment analysis models for measuring similarity at the emotional level, This is the text for the third stage (emotion arousal stage). To stimulate data segments, In response to a data fragment.
[0201] The incremental information content can be used to assess whether the mental activity link provides additional information beyond simply piecing together stimulus and response data fragments. Specifically, it can be measured by calculating the information difference between the content text of the mental activity link and the piecing together text of stimulus and response data fragments. The specific calculation formula is as follows:
[0202]
[0203] in, For incremental information scores, The set of lexical units after removing stop words. The text containing the content of the psychological activity chain. To stimulate data segments, In response to data fragments, This is for splicing operations.
[0204] Optionally, after calculating the dimension score for each preset evaluation dimension, the dimension scores for each preset evaluation dimension can be weighted and summed to obtain the quality score. The specific calculation formula is as follows:
[0205]
[0206] in, For quality fraction, , , , and These are the weight values for each preset evaluation dimension, and , The structural integrity score. For causal coherence scores, To anchor the consistency score, For emotional rationality score, This is the score for information increment.
[0207] Step S603: Select target triplet data with quality scores exceeding a preset threshold from multiple triplet data, and determine the target triplet data as training data.
[0208] Among them, target triples with quality scores exceeding a preset threshold can be considered high-quality triples and directly selected as training data.
[0209] Optionally, a first score threshold and a second score threshold are set, where the first score threshold is greater than the second score threshold. If the quality score of a triplet is greater than or equal to the first score threshold, the triplet is directly added to the training dataset. If the quality score of a triplet is less than the second score threshold, the triplet is discarded, and the features of the sample are fed back to the training data pool for subsequent iterative optimization training of various models. If the quality score of a triplet is greater than or equal to the second score threshold but less than the first score threshold, a targeted repair process is triggered. Specifically, this can involve locating the problem stage based on the scores of each preset evaluation dimension and returning to the model corresponding to that problem stage for reprocessing. Specifically, if the structural integrity score is low, the causal language model can be used to regenerate the psychological link information; if the causal coherence score is low, the causal language model can be guided to perform local re-inference for parts with insufficient coherence between adjacent stages; if the anchoring consistency score is low, the accuracy of the segment splitting results of the sequence labeling model can be checked, and the sequence labeling model can be reverted to re-splitting; if the emotional rationality score is low, the causal language model can be guided to regenerate the emotional inference part. Of course, other correction and adjustment strategies are possible, which are not limited here. Thus, through a tiered feedback mechanism, the quality of data generation is continuously improved.
[0210] As can be seen from the above, by calculating the quality score corresponding to each triplet data and filtering out target triplet data with quality scores exceeding a preset threshold, the generated triplets can be objectively screened for quality, ensuring the overall quality of the final training data.
[0211] The following is a specific example of applying the training data generation method based on psychological process modeling provided in the embodiments of this application to a news report text scenario.
[0212] Input text:
[0213] During the morning rush hour, on a certain road, car A, after starting and turning, accidentally collided with car B, which was traveling straight. The woman riding car B immediately fell to the ground, and she and her bicycle were tightly pinned under car A. An auxiliary police officer on duty nearby heard the collision and rushed to the scene. He found the driver of car B with her legs firmly trapped, screaming in pain. In this emergency, several passersby volunteered to help, and together they tried to lift car A to free the trapped woman. However, the vehicle was too heavy, and a few people couldn't lift it. "Help! Save her!" With the auxiliary police officer's shouts, more and more passersby rushed over from all directions, including drivers and pedestrians, and joined the effort to lift the car and rescue the woman. This makeshift rescue team grew from three or five people initially to more than ten, forming a powerful force. Working together seamlessly, they lifted the car in about 20 minutes. The woman was rescued from the crush in seconds. After the story spread online, many netizens left comments such as: "Thank you to the kind-hearted man who lifted the car to help." and "There are no heroes in the world, but we applaud these ordinary heroes!"
[0214] 1. Data preprocessing:
[0215] After text cleaning, the original text is preserved. The semantic segmentation module determines that the text revolves around the same event and that the internal roles and behaviors are closely related. It is then treated as a complete semantic segment and numbered t1.
[0216] 2. Binary classification model processing:
[0217] Input t1 into the binary classification model, and the binary classification model outputs the classification result. Preset probability threshold The text segment was determined to contain cognitive linkage information.
[0218] 3. Sequence labeling model processing:
[0219] The sequence labeling model performs sequence labeling and fragment extraction on t1, identifying three sets of linked data groups containing stimulus and response data fragments from different subjects:
[0220] Group 1 (Auxiliary Police Officer's Perspective):
[0221] Stimulus data fragment S1: "After hearing the sound of a collision, it was discovered that car A and car B had collided. The female cyclist was trapped under the car with her legs stuck and was screaming in pain. Only a few passersby came to the rescue, but the car was too heavy to lift."
[0222] Response data fragment R1: "Immediately rush to the car to check, shout loudly to gather more passersby to help lift the car, and organize everyone to work together to lift the car body and rescue the trapped woman in about 20 seconds."
[0223] The second group (from the perspective of passersby who rushed in from all directions to join in lifting the car):
[0224] Stimulating data fragment S2: "Hearing the auxiliary police officer shouting loudly, 'Everyone come quickly to help, saving lives is the priority,' and discovering that someone at the intersection is trapped under a car and urgently needs joint rescue";
[0225] Response data fragment R2: "They rushed in from all directions to join the car-lifting team, working together with other passersby to lift the car body."
[0226] Third group (from the perspective of the female rider who was pinned down):
[0227] Stimulating data fragment S3: "I and my car were crushed under car A." "His leg was stuck and he was in excruciating pain. Many strangers rushed to his aid and helped lift the car to rescue him."
[0228] Response data fragment R3: "She cried out in pain and was rescued from under the car after a group of people worked together to lift it."
[0229] 4. Causal language model processing:
[0230] The causal language model performs psychological activity link inference on the aforementioned three sets of linked data and outputs the following:
[0231] Triad ①: Psychological Link Information of Auxiliary Police Officers
[0232] {
[0233] "stimulus": "After hearing a collision, it was discovered that car A and car B had collided. The female cyclist was trapped under the two vehicles, her legs pinned and screaming in pain. Only a few passersby arrived, but the vehicles were too heavy to lift."
[0234] Response: "Immediately rush to the car, shout loudly to gather more passersby to help lift the car, and organize everyone to work together to lift the car and rescue the trapped woman within about 20 seconds."
[0235] "Subject": "Auxiliary police officers on duty in the surrounding area, with public safety maintenance responsibilities and on-site handling experience."
[0236] “cognitive_chain”: [
[0237] {
[0238] "phase": "P1_Perception",
[0239] "content": "During my duty, I heard a clear sound of a vehicle collision. Upon arriving at the scene, I saw that car A and car B had collided, and the female cyclist was trapped under one of the vehicles." Legs were firmly stuck "It hurt so much that I cried out in pain."
[0240] "intensity": 0.95
[0241] },
[0242] {
[0243] "phase": "P2_Appraisal",
[0244] "content": "Immediately determine that this is an emergency rescue incident requiring immediate attention; every second the injured person remains trapped under the vehicle could worsen their condition; assess that several passersby are already attempting to lift the vehicle but lack the manpower, necessitating an immediate expansion of the rescue team; as the only on-duty personnel at the scene, I bear the responsibility of organizing and coordinating."
[0245] “appraisal_dimensions”: {
[0246] “relevance”: 0.95,
[0247] "urgency": 0.98,
[0248] “controllability”: 0.7
[0249] }
[0250] },
[0251] {
[0252] "phase": "P3_Emotion",
[0253] "content": "A strong sense of urgency and responsibility to save lives welled up within me, along with deep sympathy for the injured, and an urgent need to act immediately as required by my professional role."
[0254] “emotion_labels”: [“urgency”, “sympathy”, “responsibility”, “eagerness”],
[0255] "valence": -0.3,
[0256] "arousal": 0.95
[0257] },
[0258] {
[0259] “phase”: “P4_Memory”,
[0260] "content": "Drawing upon experience and emergency response procedures in handling traffic accidents during duty, recalling successful precedents of collaborative efforts to lift and rescue vehicles trapped under rubble, and realizing that teamwork is currently the most feasible solution."
[0261] "association_type": "Knowledge Invocation"
[0262] },
[0263] {
[0264] "phase": "P5_Decision",
[0265] "content": "Decided to immediately shout loudly to gather more passersby to join the car-lifting team, leveraging the influence of his auxiliary police officer status to quickly assemble manpower, prioritizing the rescue of the person under the car before proceeding with further actions."
[0266] "decision_factors": ["Principle of prioritizing life-saving efforts", "Driven by professional responsibilities", "Judgment on the allocation of on-site human resources", "Assessment of the feasibility of multi-person collaborative efforts"]
[0267] },
[0268] {
[0269] "phase": "P6_Preparation",
[0270] "content": "First, get to the car and stabilize the situation." After checking the injured person's condition, he shouted loudly to the surroundings, "Everyone come quickly to help! Saving lives is the priority!" He then gathered passersby and organized those already present to stand on either side of the car to prepare to lift it.
[0271] "expected_outcome": "To gather enough people in the shortest possible time to lift the car body, rescue the woman trapped underneath, and send her to the hospital as soon as possible."
[0272] } ]
[0274] }
[0275] Triad ②: Adding psychological link information from passersby who lifted the car
[0276] {
[0277] "stimulus": "Hearing the auxiliary police officer shouting loudly, 'Everyone come quickly to help, saving lives is the priority,' they discovered someone trapped under a car at the intersection and urgently needed rescue."
[0278] "response": "People rushed in from all directions to join the car-lifting team, working together seamlessly with other passersby to lift the vehicle."
[0279] “subject”: “ordinary passersby who were at the scene or nearby, including passing drivers” The passersby were all busy with their own affairs.
[0280] “cognitive_chain”: [
[0281] {
[0282] "phase": "P1_Perception",
[0283] "content": "Upon hearing the auxiliary police officer's urgent shouts, 'Everyone, come quickly and help! Saving lives is the priority,' looking in the direction of the sound, I saw a vehicle accident at the intersection, with someone trapped under the car, and several passersby were already trying to lift it."
[0284] "intensity": 0.85
[0285] },
[0286] {
[0287] "phase": "P2_Appraisal",
[0288] "content": "Judging from this to be an emergency rescue, one person obviously cannot lift the car; multiple people must work together to succeed; assessing that even with limited strength, I can still contribute, and every second counts in saving lives."
[0289] “appraisal_dimensions”: {
[0290] “relevance”: 0.8,
[0291] "urgency": 0.95,
[0292] “controllability”: 0.7
[0293] }
[0294] },
[0295] {
[0296] "phase": "P3_Emotion",
[0297] "content": "Feeling a strong sense of sympathy and urgency, inspired by the auxiliary police officer's shouts and the actions of those who went ahead, I felt an urge to help, but also a slight worry (fearing there wouldn't be enough manpower to lift it or that the rescue would be delayed)."
[0298] “emotion_labels”: [“sympathy”, “urgency”, “being moved”, “concern”],
[0299] "valence": -0.2,
[0300] "arousal": 0.85
[0301] },
[0302] {
[0303] “phase”: “P4_Memory”,
[0304] "content": "This reminds me of the simple moral concept of 'saving a life,' and the thought I would have done the same if I were in the scene when I see similar reports."
[0305] "association_type": "analogy"
[0306] },
[0307] {
[0308] "phase": "P5_Decision",
[0309] "content": "I decided to drop everything and rush to the scene immediately to join the team lifting the car and rescuing people, even though I'm not very strong, I still wanted to contribute my share."
[0310] “decision_factors”: [“Moral judgment prioritizing saving lives”, “Inspiration and organization from auxiliary police officers and pioneers”, “Assessment of feasibility of multi-person collaboration”, “Driven by a sense of urgency”]
[0311] } ]
[0313] }
[0314] Triad ③: Psychological Link Information of the Subdued Female Rider
[0315] {
[0316] “stimulus”: “The person and their car were crushed under the vehicle” My leg is stuck and I'm in excruciating pain. Many strangers rushed to the scene and worked together to lift the car and rescue it.
[0317] "response": "She screamed in pain and cried for help; after a group of people worked together to lift the car, she was successfully rescued from underneath."
[0318] "subject": "The woman who was trapped under a bicycle after an accident while cycling to work".
[0319] “cognitive_chain”: [
[0320] {
[0321] "phase": "P1_Perception",
[0322] "content": "While riding my bike straight, I was hit by a turning vehicle. Instantly, I fell to the ground with my bike and was trapped under the vehicle. I felt intense pain as my legs were heavily trapped and realized that I was completely unable to move."
[0323] "intensity": 1.0
[0324] },
[0325] {
[0326] "phase": "P2_Appraisal",
[0327] "content": "Realizing that he was in an extremely dangerous situation, with his legs potentially suffering serious injury from being trapped; assessing that he could not escape on his own and that his life and safety depended entirely on external rescue; upon hearing the auxiliary police officer's shouts and seeing more and more passersby arriving, he judged that his chances of being rescued were increasing."
[0328] “appraisal_dimensions”: {
[0329] “relevance”: 1.0,
[0330] "urgency": 1.0,
[0331] “controllability”: 0.1
[0332] }
[0333] },
[0334] {
[0335] "phase": "P3_Emotion",
[0336] “content”: “intertwined with intense physical pain” Fear of the consequences of injury The despair of being crushed and helpless transformed into intense hope and gratitude upon sensing the auxiliary police's rescue efforts and the collective help of others.
[0337] “emotion_labels”: [“pain”, “fear”, “despair”, “hope”, “gratitude”],
[0338] "valence": -0.85,
[0339] "arousal": 0.98
[0340] },
[0341] {
[0342] “phase”: “P4_Memory”,
[0343] "content": "Flash to daily life" The family's concern and reluctance, coupled with the simple feeling of "there are still more good people than bad" when hearing that strangers were coming to help, all stemmed from past news reports of similar incidents.
[0344] "association_type": "Knowledge Invocation"
[0345] },
[0346] {
[0347] "phase": "P5_Decision",
[0348] "content": "While in excruciating pain, she tried her best to call for help to let rescuers know her location and condition, while also cooperating with the rescue efforts; after being rescued, she was filled with deep gratitude for the kind strangers she had met."
[0349] "decision_factors": ["Survival instinct and self-protection instinct", "reliance on the kindness of rescuers", "concern about future health", "intense gratitude after being rescued"]
[0350] } ]
[0352] }
[0353] 5. Quality Assessment:
[0354] Scoring is performed on the aforementioned three triples:
[0355] Triplet ① (Auxiliary Police): SC=1.0, CC=0.93, AC=0.90, EP=0.88, IG=0.85, Q_score=0.91, Grade A, i.e., high-quality triplet.
[0356] Triplet ② (with the pedestrians lifting the car): SC=1.0, CC=0.88, AC=0.86, EP=0.85, IG=0.82, Q_score=0.88, Grade A, i.e., high-quality triplet.
[0357] Triplet ③ (Pressed Female Rider): SC=0.83 (P6 stage is missing, which is a reasonable omission because the subject is in a passive and trapped state and cannot prepare for action), CC=0.89, AC=0.91, EP=0.90, IG=0.78, Q_score=0.86, Grade A, i.e., high-quality triplet.
[0358] Therefore, all three triplets mentioned above were selected as training data.
[0359] Of course, the training data generation method based on psychological process modeling provided in this application can also be applied to scenarios such as sociological survey simulation, role-playing, and emotional companionship, and this application does not limit it.
[0360] Figure 7 This application provides a structural block diagram of a training data generation device based on psychological process modeling, configured to execute the training data generation method based on psychological process modeling provided in the above embodiments, and possessing corresponding functional modules and beneficial effects for executing the method. Figure 7 As shown, the device specifically includes:
[0361] Module 701 is configured to acquire a set of target text segments;
[0362] The first model processing module 702 is configured to input the target text segment set into the trained binary classification model to obtain the classification result corresponding to each text segment in the target text segment set, wherein the classification result is used to indicate whether the text segment contains cognitive linkage information;
[0363] The filtering module 703 is configured to filter out at least one target text segment from the target text segment set whose classification result indicates that it contains cognitive linkage information;
[0364] The second model processing module 704 is configured to input at least one target text segment into the trained sequence labeling model to obtain at least one linked data group corresponding to each target text segment;
[0365] The third model processing module 705 is configured to input at least one linked data group and preset constraint rule information into the trained causal language model to obtain the psychological link information corresponding to each linked data group.
[0366] Module 706 is configured to construct training data based on each linked data group and its corresponding psychological link information.
[0367] As described above, the process involves first using a binary classification model to filter irrelevant text, then using a sequence labeling model to accurately locate linked data groups, and finally using a causal language model to infer and generate psychological link information. Combining multiple models for collaborative processing ensures processing accuracy and improves efficiency. Simultaneously, it fills in the missing intermediate layer of psychological motivation in the existing training data, ensuring the integrity of the training data. This approach, through the entire process of cognitive linkage information filtering, linked data group extraction, and psychological link information generation, achieves explicit modeling of the psychological motivations behind human interaction behavior, improves training data quality, and provides training corpora with deep psychological mapping for the use of large language models in various application scenarios.
[0368] In one possible embodiment, the training process of the binary classification model is as follows:
[0369] Multiple raw text segments are obtained from the original corpus. The multiple raw text segments and the set prompt word information are input into the pre-trained large language model for the first annotation process to obtain the label value and label confidence of each raw text segment.
[0370] Based on the label confidence scores of each original text segment, multiple original text segments are subjected to hierarchical filtering to obtain multiple target text segments, and a training dataset is constructed based on the multiple target text segments and their corresponding label values.
[0371] Based on the training dataset, a large language model, and a set first loss function, the pre-built initial binary classification model is trained by knowledge distillation to obtain the trained binary classification model.
[0372] In one possible embodiment, the second model processing module 704 is specifically configured as follows:
[0373] For each target text segment, stimulus data fragments and response data fragments are labeled. For target text segments containing multiple stimulus data fragments and / or multiple response data fragments, stimulus data fragment sets and response data fragment sets are extracted.
[0374] The association score for each group of data fragments is calculated by grouping and associating each stimulus data fragment in the stimulus data fragment set with each response data fragment in the response data fragment set.
[0375] Multiple linked data groups are identified from the stimulus data segment set and the response data segment set based on the association scores of each data segment.
[0376] In one possible embodiment, the training process of the sequence labeling model is as follows:
[0377] Multiple sample text segments are obtained, each of which contains cognitive linkage information;
[0378] Multiple sample text segments are input into a pre-trained large language model for secondary annotation processing to obtain the location information of the linkage data group corresponding to the cognitive linkage information in each sample text segment.
[0379] The pre-built initial sequence labeling model is trained based on the location information of each sample text segment, the corresponding linked data group, and the set second loss function, to obtain the trained sequence labeling model.
[0380] In one possible implementation, the training process for the causal language model is as follows:
[0381] Obtain multiple linked sample data sets;
[0382] Multiple sample linked data groups and preset constraint rule information are input into a pre-trained large language model for third-party annotation processing to obtain the psychological link information corresponding to each sample linked data group.
[0383] Based on the linked data groups of each sample and their corresponding psychological link information, and the set third loss function, the pre-constructed initial causal language model is trained to obtain the trained causal language model.
[0384] In one possible embodiment, the construction module 706 is specifically configured as follows:
[0385] Multiple triplet data sets are constructed based on each linked data set and its corresponding psychological link information;
[0386] For each triplet data set, scores are calculated and integrated across multiple preset evaluation dimensions to obtain the quality score corresponding to each triplet data set.
[0387] Select target triplet data with quality scores exceeding a preset threshold from multiple triplet data sets, and use the target triplet data as training data.
[0388] In one possible embodiment, a preprocessing module is also included, configured to:
[0389] Obtain the raw text data;
[0390] The original text data is cleaned to obtain the first text data;
[0391] The first text data is semantically segmented to obtain the original text segment set;
[0392] The original text segment set is formatted and standardized to obtain the target text segment set.
[0393] In one possible embodiment, the preprocessing module is specifically configured as follows:
[0394] The first text data is split based on a preset sliding window and a preset step size to obtain window text data corresponding to multiple windows respectively;
[0395] Based on the semantic similarity of the text data of adjacent windows in multiple windows, the first text data is segmented to obtain the original text segment set.
[0396] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 8 As shown, the device includes a processor 801, a memory 802, an input device 803, and an output device 804; the number of processors 801 in the device can be one or more. Figure 8 Taking a processor 801 as an example; the processor 801, memory 802, input device 803, and output device 804 in the device can be connected via a bus or other means. Figure 8 Taking a bus connection as an example, the memory 802, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the training data generation method based on psychological process modeling in this embodiment. The processor 801 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 802, thereby realizing the aforementioned training data generation method based on psychological process modeling. The input device 803 can be configured to receive input digital or character information and generate key signal inputs related to user settings and function control of the device. The output device 804 may include a display screen or other display device.
[0397] The aforementioned electronic device includes a training data generation device based on psychological process modeling, which can be used to execute any training data generation method based on psychological process modeling, and has corresponding functions and beneficial effects.
[0398] This application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program performs relevant operations in the training data generation method based on psychological process modeling provided in any embodiment of this application, and has corresponding functions and beneficial effects.
[0399] Those skilled in the art will understand that embodiments of this application may be provided as methods, systems, or computer program products.
[0400] Therefore, this application may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, produce implementations of the flowchart... Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0401] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory. Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0402] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0403] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0404] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for generating training data based on psychological process modeling, characterized in that, include: Obtain a set of target text segments, input the set of target text segments into a trained binary classification model, and obtain the classification result corresponding to each text segment in the set of target text segments. The classification result is used to indicate whether the text segment contains cognitive linkage information. From the set of target text segments, at least one target text segment whose classification result indicates that it contains cognitive linkage information is selected, and the at least one target text segment is input into the trained sequence labeling model to obtain at least one linkage data group corresponding to each target text segment; The at least one linked data group and the preset constraint rule information are input into the trained causal language model to obtain the psychological link information corresponding to each linked data group. Training data is constructed based on each of the aforementioned linked data groups and their corresponding psychological link information; The step of inputting the at least one target text segment into the trained sequence labeling model to obtain at least one linked data set corresponding to each target text segment includes: Each target text segment is labeled with stimulus data fragments and response data fragments. For target text segments containing multiple stimulus data fragments and / or multiple response data fragments, a set of stimulus data fragments and a set of response data fragments are extracted. The association score of each group of data segments is obtained by grouping and calculating the association between each stimulus data segment in the stimulus data segment set and each response data segment in the response data segment set. Multiple linked data groups are determined from the stimulus data segment set and the response data segment set based on the association scores of each data segment.
2. The training data generation method based on psychological process modeling according to claim 1, characterized in that, The training process of the binary classification model is as follows: Multiple raw text segments are obtained from the original corpus. The multiple raw text segments and the set prompt word information are input into the pre-trained large language model for the first annotation process to obtain the label value and label confidence of each raw text segment. Based on the label confidence scores corresponding to each of the original text segments, the original text segments are subjected to hierarchical filtering to obtain multiple target text segments, and a training dataset is constructed based on the multiple target text segments and their corresponding label values. Based on the training dataset, the large language model, and the set first loss function, the pre-constructed initial binary classification model is trained by knowledge distillation to obtain the trained binary classification model.
3. The training data generation method based on psychological process modeling according to claim 1, characterized in that, The training process of the sequence labeling model is as follows: Multiple sample text segments are acquired, wherein each sample text segment contains cognitive linkage information; The multiple sample text segments are input into a pre-trained large language model for second annotation processing to obtain the location information of the linkage data group corresponding to the cognitive linkage information in each sample text segment. The pre-constructed initial sequence labeling model is trained based on the location information of each sample text segment, the corresponding linked data group, and the set second loss function to obtain the trained sequence labeling model.
4. The training data generation method based on psychological process modeling according to claim 1, characterized in that, The training process of the causal language model is as follows: Obtain multiple linked sample data sets; The multiple sample linkage data groups and preset constraint rule information are input into the pre-trained large language model for third annotation processing to obtain the psychological link information corresponding to each sample linkage data group. Based on the sample linkage data groups and their corresponding psychological link information, and the set third loss function, the pre-constructed initial causal language model is trained to obtain the trained causal language model.
5. The training data generation method based on psychological process modeling according to claim 1, characterized in that, The construction of training data based on each of the linked data groups and their corresponding psychological link information includes: Multiple triplet data are constructed based on each of the aforementioned linked data groups and their corresponding psychological link information; For each triplet data point, scores are calculated and integrated across multiple preset evaluation dimensions to obtain a quality score corresponding to each triplet data point. Select target triplet data with quality scores exceeding a preset threshold from the multiple triplet data, and determine the target triplet data as training data.
6. The training data generation method based on psychological process modeling according to claim 1, characterized in that, Before obtaining the target text segment set, the following is also included: Obtain the raw text data; The original text data is cleaned to obtain the first text data; The first text data is semantically segmented to obtain the original text segment set; The original text segment set is formatted and standardized to obtain the target text segment set.
7. The training data generation method based on psychological process modeling according to claim 6, characterized in that, The step of performing semantic segmentation on the first text data to obtain the original text segment set includes: The first text data is split based on a preset sliding window and a preset step size to obtain window text data corresponding to multiple windows respectively; Based on the semantic similarity of the text data of adjacent windows in the multiple windows, the first text data is segmented to obtain the original text segment set.
8. A training data generation device based on psychological process modeling, characterized in that, include: The acquisition module is configured to acquire a set of target text segments; The first model processing module is configured to input the target text segment set into a trained binary classification model to obtain a classification result for each text segment in the target text segment set. The classification result is used to indicate whether the text segment contains cognitive linkage information. The filtering module is configured to filter out at least one target text segment from the target text segment set, indicating that the classification result contains cognitive linkage information; The second model processing module is configured to input the at least one target text segment into the trained sequence labeling model to obtain at least one linked data group corresponding to each target text segment; The third model processing module is configured to input the at least one linked data group and preset constraint rule information into the trained causal language model to obtain the psychological link information corresponding to each linked data group. The construction module is configured to construct training data based on each of the linked data groups and their corresponding psychological link information; The second model processing module is specifically configured as follows: Each target text segment is labeled with stimulus data fragments and response data fragments. For target text segments containing multiple stimulus data fragments and / or multiple response data fragments, a set of stimulus data fragments and a set of response data fragments are extracted. The association score of each group of data segments is obtained by grouping and calculating the association between each stimulus data segment in the stimulus data segment set and each response data segment in the response data segment set. Multiple linked data groups are determined from the stimulus data segment set and the response data segment set based on the association scores of each data segment.
9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more computer programs; When the one or more computer programs are executed by the one or more processors, the electronic device implements the training data generation method based on psychological process modeling as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the training data generation method based on psychological process modeling as described in any one of claims 1-7.