A method, product, and electronic device for generating training data
By constructing a structured seed dataset and using an instruction generation model and a multi-round debate agent for data augmentation and cleaning, the problem of high cost and poor quality of training data acquisition in the field of psychological counseling was solved, achieving high-quality and low-cost data expansion.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DIGITAL NINGXIA CONSTRUCTION & OPERATION CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-06-05
AI Technical Summary
In the existing technology, the training data acquisition cost in the field of psychological counseling is high, the data is sensitive and has large procurement barriers, and the data quality control is not perfect, resulting in poor data diversity and logical coherence, which cannot meet the needs of rapid iteration.
By constructing a structured seed dataset, an initial data pool is generated. The data is then expanded using instruction generation and response generation models. Multiple agents are combined to conduct multi-round debates and two-layer cleaning and filtering to ensure the logicality and domain adaptability of the data.
It significantly improved the quantity and quality of training data in the field of psychological counseling, met the needs of rapid iteration, ensured the logical coherence and professional accuracy of the data, and reduced costs.
Smart Images

Figure CN122152968A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of mental health applications, and more specifically, embodiments of this application relate to a method, product, and electronic device for generating training data. Background Technology
[0002] Synthetic data technology, as a core means to address the scarcity, privacy, and diversity issues of real-world data, has been widely applied in large-scale language model (LLM) training. In the field of psychological counseling, high-quality psychological dialogue corpora are a crucial prerequisite for training AI counseling models, conducting related research, and developing applications. However, existing technical solutions suffer from the following technical shortcomings:
[0003] The current acquisition of psychological dialogue data mainly relies on procurement from external vendors, which presents three major problems: First, the cost is high, with clinical-grade, finely annotated psychological dialogue datasets priced at 200-300 yuan per record, making large-scale acquisition prohibitively expensive; second, the data is sensitive and faces significant procurement barriers, with a lack of compliant, commercially viable real-world psychological dialogue datasets on the market, making it difficult for commercial vendors to legally authorize and completely anonymize the data, and the existing data has a low match between scenario coverage and project requirements; third, the project cycle is lengthy, with vendor selection, business negotiations, legal review, and data cleaning and secondary annotation processes taking a long time, making it difficult to meet the needs of rapid iteration.
[0004] Existing synthetic data generation technologies also have shortcomings: some methods lack targeted scenario design, resulting in low matching degree between generated data and the needs of the target professional field (e.g., psychological counseling); the data quality control mechanism is imperfect, leading to poor data diversity and logical coherence.
[0005] In summary, the training data such as dialogue corpora provided by existing technologies cannot meet the needs of the target domain (e.g., the field of psychological counseling), resulting in models trained based on these training data failing to meet the needs of the target domain. Therefore, there is an urgent need for a method to synthesize psychological dialogue corpora. Summary of the Invention
[0006] The purpose of this application is to provide a method, product, and electronic device for generating training data. The embodiments of the present invention solve the problem of insufficient quantity by using synthetic corpora, solve the quality problem of synthetic data by using DU intelligent agent interaction, and ensure the logic and domain adaptability of the final output training corpus by using double-layer cleaning, effectively solving the technical problems of insufficient corpus and low corpus quality in the field of psychological counseling.
[0007] In a first aspect, embodiments of this application provide a method for generating training data, the method comprising: acquiring a structured seed dataset, wherein the seed dataset includes multiple dialogue samples and / or report samples, the dialogue samples having role labels adapted to a target domain, and the report samples having multiple different modules adapted to the target domain; constructing an initial data pool based on the seed dataset, wherein the initial data pool includes multiple sets of instruction-response pairs, each instruction describing a task requirement adapted to the target domain, and each response being a task output matching the task requirement; generating synthetic instructions through an instruction generation model and the initial data pool, and generating synthetic responses corresponding to the synthetic instructions through a response generation model and each response in the initial data pool; and obtaining target synthetic sample data based on the synthetic instructions and the synthetic responses.
[0008] The embodiments of this application construct an initial data pool by pre-constructing a seed dataset with role labels or different modules, which can improve the relevance of instructions in the obtained initial data pool to the target domain. Furthermore, some embodiments of this application generate new instructions and responses based on the data in the initial data pool through instruction generation and response generation models, which can significantly increase the amount of training data in the target domain.
[0009] In some embodiments, constructing an initial data pool based on the seed data includes: generating an i-th instruction for the i-th dialogue sample or the i-th report sample in the seed dataset, and constructing a mapping relationship between the i-th instruction and the i-th dialogue sample or the i-th report sample to obtain a set of instruction-response pairs, wherein each instruction is constructed based on the meta-information of the seed data, the meta-information including: counseling style, symptom type or population characteristics, each response being the content of the corresponding dialogue or report, the i-th dialogue sample or the i-th report being any seed data, and i being an integer greater than or equal to 1; cleaning and deduplicating each set of instruction-response pairs, and using the cleaned instruction-response pairs as data in the initial data pool.
[0010] The embodiments of this application can transform unstructured, raw seed data into a high-quality set of task examples that can be directly used by subsequent standard processes or deep learning network models by constructing an initial data pool. By constructing the data in the seed dataset into an initial data pool, the process of data standardization and task definition can be completed. Its output, the initial data pool, is an interface connecting seed data and AI automated augmentation (Self-Instruct).
[0011] In some embodiments, generating a synthesized instruction using an instruction generation model and instructions in the initial data pool includes: determining variables in a predefined structured instruction template using the instruction generation model and at least one instruction in the initial data pool, wherein the predefined structured instruction template includes: a scene description template, a role setting template, and a dialogue target template adapted to the target domain; and dynamically filling in the values of the corresponding variables to generate a synthesized instruction.
[0012] Some embodiments of this application can ensure that the generated tasks are adapted to target domains such as psychological dialogue or diagnostic reports by using the fixed structure of predefined structured instruction templates. The variable values corresponding to the slots in the templates are controlled diversity quantities, avoiding the generation of synthetic instructions that are irrelevant to the target domain.
[0013] In some embodiments, obtaining the target synthetic sample data based on the synthesis instruction and the synthesis response further includes: using the synthesis instruction and the synthesis response as initial synthetic sample data; and employing at least one agent to perform multi-round debate processing on the initial synthetic sample data to obtain the target synthetic sample data.
[0014] The embodiments of this application can improve the quality of the synthesized data by introducing multiple intelligent agents to debate the initial synthesized sample data.
[0015] In some embodiments, the step of processing the initial synthesized sample data with at least one intelligent agent to obtain target synthesized sample data includes: inputting a single data sample corresponding to the first synthesized sample into a first intelligent agent, and generating a first processing result through the first intelligent agent, wherein the single data sample is an initial synthesized dialogue or an initial synthesized report corresponding to any synthesized response, the first processing structure includes an inference part and a first corrected dialogue or a first corrected report, the first corrected dialogue is obtained by adjusting the initial synthesized dialogue based on the inference part, and the first corrected report is obtained by adjusting the initial synthesized report based on the inference part; inputting the first processing structure and the single data sample into a second intelligent agent. The system obtains a second processing result, which includes critical metadata for the reasoning part and a second corrective dialogue or a second corrective report. The second corrective dialogue is obtained by adjusting the first corrective dialogue based on the critical metadata, and the second corrective report is obtained by adjusting the first corrective report based on the critical metadata. The critical metadata includes: logical flaws, insufficient emotional adaptability, and domain terminology errors. The second processing result and the first processing result are input into a third intelligent agent, and the target synthetic sample data is determined by the evaluation criteria of the third intelligent agent. The evaluation dimensions of the evaluation criteria include: logical coherence, emotional adaptability, and domain accuracy.
[0016] Some embodiments of this application can improve the logical depth and professional accuracy of individual data in the initial synthetic sample data at the semantic level through the collaborative processing of three intelligent agents, and solve hidden and complex professional problems in the generated data by simulating expert consultation.
[0017] In some embodiments, the method further includes: cleaning the target synthetic sample data according to preset rules to obtain cleaned sample data; and filtering the cleaned sample data according to a target screening model to obtain target sample data, wherein the target screening model is obtained by training the screening model based on sample data with labeled logical coherence, sentiment adaptability, and domain accuracy.
[0018] The embodiments of this application, through a two-layer data cleaning and screening process of format cleaning and quality screening, can ensure the format standardization and quality consistency of the dataset from an overall perspective. By combining rules and models, all data, including refined data, is finally screened, ensuring that the final synthetic psychological corpus is professional and sophisticated on an individual level and pure and reliable overall, thus meeting the stringent requirements of AI models for training data quality.
[0019] Secondly, some embodiments of this application provide a method for model training, the method comprising: obtaining target synthetic sample data according to the method described in any one of the embodiments included in the first aspect; using the target synthetic sample data as training data, and training a psychological counseling model according to the training data to obtain a target psychological counseling model.
[0020] Thirdly, some embodiments of this application provide a method for generating dialogue and report data, the method comprising: designing target input prompts based on the generation target; and obtaining output results based on the target input prompts and the target psychological counseling model as described in the second aspect, wherein the output results include dialogues or reports.
[0021] Thirdly, some embodiments of this application provide an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the methods involved in the foregoing aspects.
[0022] Fourthly, some embodiments of this application provide a computer program product, including computer program instructions, which, when read and executed by a processor, can implement the methods involved in the above-mentioned aspects.
[0023] Fifthly, some embodiments of this application provide an apparatus for generating training data, the apparatus comprising: a structured seed dataset acquisition module configured to acquire a structured seed dataset, wherein the seed dataset includes multiple dialogue samples and / or report samples, the dialogue samples having role labels adapted to a target domain, and the report samples having multiple different modules adapted to the target domain; an initial data pool construction module configured to construct an initial data pool based on the seed dataset, wherein the initial data pool includes multiple sets of instruction-response pairs, each instruction describing a task requirement adapted to the target domain, and each response being a task output matching the task requirement; a synthesis module configured to generate synthesis instructions through an instruction generation model and the initial data pool, and generate synthesis responses corresponding to the synthesis instructions through a response generation model and each response in the initial data pool; and a target synthesis sample data providing module configured to obtain target synthesis sample data based on the synthesis instructions and the synthesis responses.
[0024] Sixthly, some embodiments of this application provide a computer program product, including computer program instructions, which, when read and executed by a processor, can implement the methods described in the above embodiments. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is an architecture diagram of the system for generating training data provided in the embodiments of this application;
[0027] Figure 2 One of the flowcharts for a method of generating training data provided in the embodiments of this application;
[0028] Figure 3 A second flowchart illustrating the method for generating training data provided in this application embodiment;
[0029] Figure 4 A block diagram illustrating the components of the apparatus for generating training data provided in the embodiments of this application;
[0030] Figure 5 This is a schematic diagram illustrating the composition of an electronic device provided in an embodiment of this application. Detailed Implementation
[0031] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0032] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0033] At least to address the technical problems pointed out in the background section, embodiments of this application provide a method for generating training data (e.g., this method can be used to generate training corpus or reports in the field of psychological counseling). This method generates an initial data pool based on data in a structured seed dataset, and generates synthetic data (which can be used as initial corpus) based on the initial data pool. Then, multiple agents improve the quality of the synthetic data, and finally, a two-layer screening mechanism is used to filter the improved data to obtain the optimal synthetic data as training data.
[0034] Compared with related technical solutions, the synthetic data obtained by the embodiments of this application is highly relevant to the field of psychological counseling, and expands the scale of training data in the field of psychological counseling at a lower cost.
[0035] Please refer to Figure 1 , Figure 1 The following is an architecture diagram of a system for generating training data provided in some embodiments of this application. The architecture includes: a user interface module 101, a task scheduling server 102, a seed database 103, an instruction generation model 104, a response generation model 105, a data storage module 106, a first intelligent agent 107, a second intelligent agent 108, a third intelligent agent 109, a basic cleaning module 111, and a high-level discrimination module 112.
[0036] The system for generating training data according to some embodiments of this application can be used to synthesize dialogue corpora in the field of psychological counseling. This system can be used to perform the following multiple steps: seed data construction (the constructed data is stored in…) Figure 1 In the seed database 103), Self-Instruct data augmentation (via Figure 1 The instruction generation model 104 and response generation model 105 are implemented, and the amplified data, i.e., the initial synthetic sample data, is stored in... Figure 1 In the data storage module 106), Multi-AgentDebate data refining (based on Figure 1 The implementation of the first intelligent agent 107, the second intelligent agent 108, and the third intelligent agent 109), and two-layer data cleaning and filtering (based on Figure 1 The basic cleaning module 111 and the high-level discrimination model 112 are used together to implement this.
[0037] Understandably, this is to further demonstrate the hardware architecture and data flow of the system generating the training data, such as Figure 1 As shown, some embodiments of this application divide the system into several parts: a user interaction part, a task scheduling part, a data processing part (including multiple models and intelligent agents), and a data storage part.
[0038] Users access the web interface (as...) Figure 1 A specific example of the user interface 101) or API is used to submit task requests. The task scheduling server 102 receives the request and assigns the task to the appropriate computing node. The data flow begins in the structured seed dataset building block ( Figure 1 (This module is not shown), through which a structured seed dataset can be obtained, and these data can then be stored in... Figure 1 Seed database 103. Then, data augmentation can be performed based on the data in seed database 103 (e.g., through...). Figure 1The instruction generation model and response generation model synthesize data based on the initial data pool data. These models can generate initial synthetic sample data in parallel by calling multiple state-of-the-art (SOTA) model APIs (such as DeepSeek-R1, GPT-4o, and Qwen-Max). The generated initial synthetic sample data then enters the data refining module (examples include...). Figure 1 The three intelligent agents (inference chain generator, rebuttal optimizer, and voting arbitrator) process the data sequentially, conducting multiple rounds of debate. The refined data then enters a two-layer data cleaning and filtering module (including...). Figure 1 The system consists of a basic cleaning module and a high-level discrimination module. The basic cleaning (rule cleaning, deduplication) is followed by a high-level filtering and discrimination model (i.e., target filtering model) to obtain the final target synthetic sample data. The target synthetic sample data is stored in a corpus, and the data in this corpus is used to train AI consultation models (e.g., AI models in the field of psychological counseling).
[0039] In other words, Figure 1 The data flow of the system is exemplified as follows: users submit tasks through the user interface layer; the application service layer receives and schedules the tasks; seed data is read from the data storage layer; the augmentation module of the data processing layer calls multiple SOTA model APIs of the model resource layer to generate initial synthetic sample data corresponding to the synthetic instructions and synthetic responses, which is stored in the basic data storage; the refining module calls three intelligent agents to conduct multiple rounds of debate on the synthetic responses in the initial synthetic sample data, and stores the refined data in temporary storage; the two-layer data cleaning module first performs basic cleaning and then advanced screening, and stores the final high-quality corpus in the final corpus. The corpus in the final corpus can be used for training AI consultation models.
[0040] The following is combined with Figure 2 This application provides an exemplary method for generating training data according to some embodiments, which includes, for example:
[0041] S110, Obtain the structured seed dataset.
[0042] It should be noted that the seed dataset of some embodiments of this application includes multiple dialogue samples, the seed dataset of some embodiments of this application includes multiple report samples, or the seed dataset of some embodiments of this application includes multiple dialogue samples and multiple report samples, wherein the dialogue samples have role labels matching the target domain, and the report samples have multiple different modules matching the target domain.
[0043] For example, if the target field is psychological counseling, the role labels may include: client and counselor, and the different modules may include: basic information description, core problem description module, counseling goal description module, intervention process record module, etc.
[0044] S120, construct an initial data pool based on the seed dataset, wherein the initial data pool includes multiple sets of instruction-response pairs, each instruction describing task requirements adapted to the target domain, and each response being a task output matching the task requirements.
[0045] For example, in some embodiments of this application, S120 includes:
[0046] The first step is to extract instruction-response pairs from the seed data.
[0047] For each dialogue sample, design an instruction. For example: "Simulate a psychological counseling dialogue about [topic], where the counselor uses the [school of thought] approach." The response is the dialogue content.
[0048] For each report sample, design an instruction, such as: "Generate a diagnostic report for the following dialogue." The response is the report content.
[0049] The second step is to clean and format the command-response pairs to ensure they meet the requirements (e.g., the commands are clear and the responses are complete).
[0050] The third step is to store the instruction-response pairs into the initial data pool.
[0051] The fourth step is to analyze the distribution of the initial data pool to ensure that it covers different counseling styles, symptom types, and population characteristics.
[0052] Fifth, if there are insufficient samples in certain categories, some instruction-response pairs can be manually added to balance the initial data pool.
[0053] It should be noted that the quality of the initial data pool in this application embodiment directly affects the quality of the subsequently generated data. Therefore, it is necessary to ensure that the samples in the initial data pool are of high quality and conform to the specifications.
[0054] S130, generate a synthetic instruction through the instruction generation model and the initial data pool, and generate a synthetic response corresponding to the synthetic instruction through the response generation model and each response in the initial data pool.
[0055] It should be noted that some embodiments of this application provide a data generation method based on iterative expansion of an initial data pool. This stage aims to expand small-scale seed data into large-scale, diverse initial synthetic sample data through a self-iteratory instruction guidance mechanism. The purpose is to construct a dynamically evolving instruction pool, thereby driving the automated generation and optimization of data. A specific implementation process includes data pool initialization, where dialogue and report samples generated in the seed data construction step, conforming to data specifications, are directly used as the initial set of "instruction-response pairs," which constitutes the initial data pool. It is understood that this initial data pool contains high-quality task paradigms defined by expert knowledge, providing learning examples and quality benchmarks for subsequent automated generation. For example, in some embodiments of this application, S130 typically includes: based on the constructed initial data pool, the system automatically executes the following steps to generate new instructions (i.e., synthetic instructions): sampling, randomly selecting a certain number of instruction-response pairs from the current initial data pool as examples; using a large language model (i.e., an instruction generation model) as the generation engine, allowing it to learn the task style and complexity of the examples, generating a batch of new, diverse task instructions (i.e., synthetic instructions). It should be noted that in some other embodiments of this application, in order to better guide the process of generating synthetic instructions from the large language model, the system adopts a predefined structured instruction template. By dynamically filling and combining variables in the template (such as counseling schools, symptom types, and population characteristics), new instructions covering the target scenario are systematically generated, ensuring the diversity and controllability of the data.
[0056] It should be noted that the instruction generation model and response generation model in some embodiments of this application may physically refer to the same model pool (such as DeepSeek-R1, GPT-4o, etc.), but logically they are assigned different tasks and their functional roles are distinguished by different prompt words.
[0057] S140, Target synthetic sample data is obtained according to the synthesis instruction and the synthesis response.
[0058] It should be noted that the target synthetic sample data can be used as training data for training the AI model. In some embodiments of this application, the synthetic instructions and synthetic responses can be directly used as training data. In other embodiments of this application, to further improve the instructions for training data, at least one agent can be used to further optimize the synthetic responses. In still other embodiments of this application, to further improve the instructions for training data, at least one agent can be used to further optimize the synthetic responses, and the data optimized by the agent can be subjected to a two-layer screening to obtain higher quality training data.
[0059] The embodiments of this application construct an initial data pool by pre-constructing a seed dataset with role labels or different modules, which can improve the relevance of instructions in the obtained initial data pool to the target domain. Furthermore, some embodiments of this application generate new instructions and responses based on the data in the initial data pool through instruction generation and response generation models, which can significantly increase the amount of training data in the target domain.
[0060] The implementation process of the relevant steps is illustrated below.
[0061] In some embodiments of this application, the process of constructing an initial data pool based on the seed data in step S120 includes:
[0062] The first step is to generate the i-th instruction for the i-th dialogue sample or the i-th report sample in the seed dataset, and to construct a mapping relationship between the i-th instruction and the i-th dialogue sample or the i-th report sample to obtain a set of instruction-response pairs.
[0063] It should be noted that each instruction is constructed based on the metadata of the seed data. The metadata includes: consultation school, symptom type or population characteristics. Each response is the content of the corresponding dialogue or report. The i-th dialogue sample or the i-th report is any seed data, where i is an integer greater than or equal to 1.
[0064] In other words, some embodiments of this application require that an instruction be constructed for each dialogue sample and each report sample.
[0065] For example, some embodiments of this application require instruction generation for each piece of seed data. This instruction generation is based on the metadata and content of the original data, and is either manually written or automatically generated according to rules to create a clear task instruction. This instruction summarizes the task objective represented by the data. Example: Original data: A dialogue record about "intervening in adolescent social anxiety using CBT". Generated instruction: "Please simulate a dialogue between a counselor and an adolescent suffering from social anxiety using cognitive behavioral therapy methods. The dialogue must include an automatic thought recognition component."
[0066] The second step is to clean and deduplicate each set of instruction-response pairs, and use the cleaned instruction-response pairs as data in the initial data pool.
[0067] For example, some embodiments of this application require cleaning and formatting the raw data according to preset data specifications to make it a standard response corresponding to the instruction. Examples: Dialogue data: Organizing the transcribed text into a strict role-playing format (e.g., Client: ... Counselor: ...). Report data: Filling the analysis content into a standardized report template (e.g., Core issues: ... Intervention process: ...).
[0068] The embodiments of this application can transform unstructured, raw seed data into a high-quality set of task examples that can be directly used by subsequent standard processes or deep learning network models by constructing an initial data pool. By constructing the data in the seed dataset into an initial data pool, the process of data standardization and task definition can be completed. Its output, the initial data pool, is an interface connecting seed data and AI automated augmentation (Self-Instruct).
[0069] In some embodiments, generating a synthesized instruction using an instruction generation model and instructions in the initial data pool includes: determining variables in a predefined structured instruction template using the instruction generation model and at least one instruction in the initial data pool, wherein the predefined structured instruction template includes: a scene description template, a role setting template, and a dialogue target template adapted to the target domain; and dynamically filling in the values of the corresponding variables to generate a synthesized instruction.
[0070] It's important to note that the structured instruction template, through its fixed structure, ensures that all generated tasks remain focused on the target domain (e.g., psychological dialogue or mental health diagnostic reports), and do not deviate to irrelevant tasks such as literary creation or coding. The variable slots in the template (such as [counseling style], [group]) are essentially a controlled list of diversity, instructing the system to vary and combine across these dimensions. This effectively prevents the model from introducing irrelevant or erroneous diversity during instruction generation (e.g., generating a "psychological counseling" dialogue involving divination).
[0071] It's easy to understand that the instruction generation model provides semantic understanding and instantiation capabilities. The model understands the meaning of each variable in the template. When the model recognizes a "[counseling style]", it associates it with specific content such as CBT and humanistic psychology; when it recognizes a "[psychological problem]", it associates it with anxiety, depression, etc. The model can perform natural language combination and generation. The model's task is to fill in variables and learn the fixed text of the structured instruction template to ultimately obtain a complete and fluent instruction. For example, it instantiates the following structured instruction module "Simulate a dialogue of [counseling style] for [psychological problems] in [age group]" into "Simulate a cognitive behavioral therapy dialogue for depressive mood in adolescent working professionals" (i.e., obtain a synthesized instruction).
[0072] It is easy to understand that some embodiments of this application achieve controllable generation of psycholinguistic corpora, such as synthetic instructions, through the synergistic effect of predefined structured instruction templates and instruction generation models. The structured instruction templates are responsible for defining the professional scope and key variables of the generated data, while the instruction generation model is responsible for natural and diverse language instantiation. This design avoids the professional inaccuracies caused by the unrestrained development of general-purpose language models, and overcomes the rigidity and lack of linguistic flexibility of data generated by purely rule-based templates. Thus, while ensuring domain accuracy, it achieves large-scale and diversified data expansion.
[0073] For example, in some embodiments of this application, the predefined structured instruction template includes:
[0074] Scenario description template: For example, “Simulate a cognitive behavioral therapy dialogue for adolescent academic anxiety.”
[0075] Role setting template: Clearly define the background of the counselor and the client (such as age, occupation, counseling goals).
[0076] Dialogue Goal Template: Specify the intervention goals to be achieved in the dialogue (such as "identifying irrational beliefs" or "developing a behavioral activation plan").
[0077] Some embodiments of this application dynamically populate template variables to ensure the diversity and controllability of the generated data. Model invocation and generation: Multiple state-of-the-art model APIs (such as DeepSeek-R1, GPT-4o, Qwen-Max) are invoked to generate initial question-answer data and analysis reports in parallel (as examples of initial synthetic sample data).
[0078] Some embodiments of this application can ensure that the generated tasks are adapted to target domains such as psychological dialogue or diagnostic reports by using the fixed structure of predefined structured instruction templates. The variable values corresponding to the slots in the templates are controlled diversity quantities, avoiding the generation of synthetic instructions that are irrelevant to the target domain.
[0079] It should be noted that some embodiments of this application introduce multiple intelligent agents to improve the logical depth and professional accuracy of a single piece of data from a semantic level, and to solve the problem of hidden and complex professional properties in the generated data, thereby improving the data quality of the synthesized response.
[0080] For example, such as Figure 3 As shown, in some embodiments of this application, obtaining the target synthetic sample data according to the synthesis instruction and the synthesis response further includes:
[0081] S141, the synthesis command and the synthesis response are used as initial synthesis sample data.
[0082] S142, at least one agent performs multiple rounds of debate on the initial synthetic sample data to obtain the target synthetic sample data.
[0083] For example, in some embodiments of this application, the second step includes:
[0084] The single data sample corresponding to the first synthesized sample is input into the first agent, and the first agent generates the first processing result. The single data sample is an initial synthesis dialogue or initial synthesis report corresponding to any synthesis response. The first processing structure includes an inference part and a first correction dialogue or first correction report. The first correction dialogue is obtained by adjusting the initial synthesis dialogue based on the inference part, and the first correction report is obtained by adjusting the initial synthesis report based on the inference part.
[0085] The first processing structure and the single data sample are input into the second agent to obtain a second processing result. The second processing result includes critical metadata for the reasoning part and a second corrective dialogue or a second corrective report. The second corrective dialogue is obtained by adjusting the first corrective dialogue based on the critical metadata, and the second corrective report is obtained by adjusting the first corrective report based on the critical metadata. The critical metadata includes: logical flaws, insufficient emotional adaptability, and domain terminology errors.
[0086] The second processing result and the first processing result are input into a third intelligent agent, and the target synthetic sample number is determined by the evaluation criteria of the third intelligent agent. The evaluation dimensions of the evaluation criteria include: logical coherence, emotional adaptability, and domain accuracy.
[0087] It is easy to understand that some embodiments of this application, through the collaborative processing of three intelligent agents, can improve the logical depth and professional accuracy of individual data in the initial synthetic sample data at the semantic level, and solve hidden and complex professional issues in the generated data by simulating expert consultation. Embodiments of this application can improve the quality of the obtained synthetic data by introducing multiple intelligent agents to debate the initial synthetic sample data.
[0088] To further improve the quality of training data, some embodiments of this application provide a two-layer screening mechanism. This mechanism ensures data format standardization through basic cleaning and achieves accurate evaluation of professional dimensions through advanced screening using a discriminative model trained by manual and LLM labeling.
[0089] For example, such as Figure 3As shown, in some embodiments of this application, the method further includes: S143, cleaning the target synthetic sample data according to preset rules to obtain cleaned sample data; S144, filtering the cleaned sample data according to a target screening model to obtain target sample data, wherein the target screening model is obtained by training the screening model based on sample data with labeled logical coherence, sentiment adaptability and domain accuracy.
[0090] The embodiments of this application, through a two-layer data cleaning and screening process of format cleaning and quality screening, can ensure the format standardization and quality consistency of the dataset from an overall perspective. By combining rules and models, all data, including refined data, is finally screened, ensuring that the final synthetic psychological corpus is professional and sophisticated on an individual level and pure and reliable overall, thus meeting the stringent requirements of AI models for training data quality.
[0091] The following uses the field of psychological counseling as an example to illustrate the method for generating training data provided in the embodiments of this application.
[0092] Some embodiments of this application provide a method for generating training data in the field of psychological counseling. This method can synthesize psychological dialogue corpora, specifically including the following steps:
[0093] Step 1: Seed Data Construction
[0094] 1) Data source: Through interviews with experts in psychological counseling, we collected real psychological counseling dialogues and analysis reports, covering core scenarios such as anxiety disorders and depressive disorders.
[0095] 2) Data Standardization: Clearly define the data format and labeling standards for real psychological counseling dialogue content and analysis reports. Dialogues must include interactions between the counselor and the client. Reports must cover modules such as basic situation description, core problem description, counseling goals, and intervention process (as examples of different modules) to obtain a structured seed dataset that meets the requirements for use in a production environment.
[0096] 3) Data scale: Construct a seed dataset, including dialogue samples and report samples, to provide a basic template and professional basis for subsequent expansion.
[0097] Step 2: Data Augmentation
[0098] 1) Technical Principles:
[0099] Instruction-response pairs are generated based on the seed dataset (i.e., the initial data pool is constructed; the specific processing procedure can be referred to above). Data diversity is controlled through structured instruction templates, covering different counseling approaches (such as Cognitive Behavioral Therapy (CBT) and Humanistic Therapy), symptom types (such as specific manifestations of anxiety and depression), and population characteristics (such as adolescents and working professionals). The data augmentation mechanism generates diverse instructions through model self-iteration, avoiding the limitations of manually written instructions and ensuring broad data coverage and scenario adaptability.
[0100] 2) Generation process:
[0101] Structured instruction templates, including:
[0102] Scenario description template: For example, “Simulate a cognitive behavioral therapy dialogue for adolescent academic anxiety.”
[0103] Role setting template: Clearly define the background of the counselor and the client (such as age, occupation, counseling goals).
[0104] Dialogue Goal Template: Specify the intervention goals to be achieved in the dialogue (such as "identifying irrational beliefs" or "developing a behavioral activation plan").
[0105] Template variables are dynamically populated to ensure the diversity and controllability of the generated data.
[0106] Model Invocation and Generation: Invoke multiple state-of-the-art model APIs (such as DeepSeek-R1, GPT-4o, Qwen-Max) to generate initial question-answer data (as an example of synthetic response) and analysis reports (as an example of synthetic response) in parallel.
[0107] Generation strategy:
[0108] Diversity enhancement: By randomly sampling template variables and model temperature parameters (temperature=0.7~1.0), changes in dialogue style and terminology are introduced.
[0109] Quality control: Initial filtering of generated content for grammatical errors, logical contradictions, and expressions that do not comply with the ethics of psychological counseling.
[0110] Post-processing and deduplication: Locality Sensitive Hash (LSH) and semantic deduplication techniques are used to remove duplicate or highly similar samples. After hybrid deduplication, 5.0B tokens of basic data are retained from the initial 8.0B tokens, of which 2 / 3 of the data is concentrated in the two core scenarios of anxiety disorders and depressive disorders.
[0111] 3) Data scale and distribution:
[0112] Total amount of initial screening data generated: 8.0B tokens (approximately 800,000 dialogue and report samples).
[0113] The effective data after deduplication is 5.0B tokens (approximately 500,000 samples), covering 10+ sub-scenarios of mental disorders (see Appendix Table 1 for details).
[0114] Step 4: Two-layer data cleaning and filtering
[0115] 1) Basic cleaning: Remove data with too many special characters or abnormal formatting by using rules, and perform strict data deduplication to ensure that the data format is standardized.
[0116] 2) Advanced Filtering:
[0117] Construct a discriminative model (i.e., a screening model) training dataset: Use a combination of manual and LLM methods to label the samples for quality, with labeling dimensions including logical coherence, sentiment fit, and domain accuracy;
[0118] Training and evaluating the model: Train a binary classification discriminant model or reward model based on the labeled dataset, and establish quality evaluation criteria;
[0119] Full data evaluation: The trained evaluation model is used to evaluate the mixed data (7.0 B tokens) from steps two and three one by one, and high-quality data is selected.
[0120] 3) Final output: After cleaning and screening, 5.0B tokens of valid data are retained, corresponding to 500,000-1,000,000 qualified synthetic psychological dialogue and report samples.
[0121] Step 5: Validation of Results
[0122] 1) Validation dimensions: Focus on two core scenarios: psychological counseling dialogue generation (question and answer interaction ability) and report summary (logic and language ability).
[0123] 2) Evaluation method: Referring to existing research results and combining the baseline data of model performance, the effectiveness of the synthetic data is verified by comparing the performance of the model before and after fine-tuning in dimensions such as creativity, chat, logical reasoning, and question answering.
[0124] 3) Expected Indicators: Based on the 72B scale benchmark model, the average performance improvement in core scenarios is estimated to be about 5%, of which the improvement in dialogue quality translates to a reduction of more than 10% in the error rate of key suggestions, and the improvement in report summary translates to a reduction of more than 20% in the omission rate of important information.
[0125] 3.2 System Architecture
[0126] The system of the present invention includes the following modules:
[0127] 1) Seed Data Construction Module: Responsible for interviewing business experts, collecting and standardizing real data, and outputting a standard-compliant seed dataset; 2) Synthetic Data Generation Module: Based on seed data and instruction templates, it calls multi-model APIs to generate initial augmented data to obtain initial synthetic sample data, ensuring data diversity; 3) Synthetic Data Refinement Module: Through debate and optimization by three collaborative agents, it improves data professionalism, logical coherence, and sentiment relevance; 4) Data Cleaning and Screening Module: Integrates basic rule cleaning and advanced discriminative model screening functions to output high-quality and effective data; 5) Evaluation and Verification Module: Constructs a performance evaluation system to compare and analyze the optimization effect of synthetic data on AI models, providing a basis for data quality iteration; 6) Resource Support Module: Integrates hardware and software resources to ensure efficient system operation.
[0128] Some embodiments of this application provide a method for model training, the method comprising: obtaining target synthetic sample data according to the method described in any of the above embodiments; using the target synthetic sample data as training data, and training a psychological counseling model according to the training data to obtain a target psychological counseling model.
[0129] Some embodiments of this application provide a method for generating dialogue and report data, the method comprising: designing target input prompts based on the generation target; obtaining output results based on the target input prompts and the target psychological counseling model as described above, wherein the output results include dialogues or reports.
[0130] like Figure 4 As shown, some embodiments of this application provide an apparatus for generating training data. It should be understood that this apparatus is similar to the one described above. Figure 2 Corresponding to the method embodiments, it can execute the various steps involved in the above method embodiments. The specific functions of the device can be found in the description above. To avoid repetition, detailed descriptions are appropriately omitted here. The device includes at least one software function module that can be stored in a memory or embedded in the device's operating system in the form of software or firmware. The device for generating training data includes: a structured seed dataset acquisition module 310, an initial data pool construction module 320, a synthesis module 330, and a target synthetic sample data provision module 340.
[0131] The structured seed dataset acquisition module is configured to acquire a structured seed dataset, wherein the seed dataset includes multiple dialogue samples and / or report samples, the dialogue samples having role labels, and the report samples having multiple different modules.
[0132] An initial data pool construction module is configured to construct an initial data pool based on the seed dataset, wherein the initial data pool includes multiple sets of instruction-response pairs, each instruction describing a task requirement adapted to the target domain, and each response being a task output matching the task requirement.
[0133] The synthesis module is configured to generate synthesis instructions through the instruction generation model and the initial data pool, and to generate synthesis responses corresponding to the synthesis instructions through the response generation model and each response in the initial data pool.
[0134] The target synthetic sample data providing module is configured to obtain target synthetic sample data according to the synthesis instruction and the synthesis response.
[0135] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the aforementioned method, and will not be elaborated further here.
[0136] like Figure 5 As shown, some embodiments of this application provide an electronic device 400, which includes a memory 410, a processor 420, and a computer program stored in the memory 410 and executable on the processor 420. When the processor 420 reads and executes the program via a bus 430, it can implement the methods involved in the above-mentioned aspects.
[0137] Processor 420 can process digital signals and may include various computing architectures. For example, it may be a complex instruction set computer architecture, a reduced instruction set computer architecture, or an architecture that implements multiple instruction set combinations. In some examples, processor 420 may be a microprocessor.
[0138] Memory 410 can be used to store instructions executed by processor 420 or data related to the execution of instructions. These instructions and / or data may include code used to implement some or all of the functions of one or more modules described in the embodiments of this application. The processor 420 of the embodiments of this disclosure can be used to execute the instructions in memory 410 to implement… Figure 2 The method shown. Memory 410 includes dynamic random access memory, static random access memory, flash memory, optical memory, or other memory well known to those skilled in the art.
[0139] Some embodiments of this application provide a computer program product, including computer program instructions, which, when read and executed by a processor, can implement the methods described in the above-mentioned aspects.
[0140] Some embodiments of this application provide a computer program product, including computer program instructions, which, when read and executed by a processor, can implement the methods described in the embodiments above.
[0141] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0142] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0143] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0144] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0145] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0146] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 a process, method, article, or apparatus. Without further limitations, 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 said element.
Claims
1. A method for generating training data, characterized in that, The method includes: Obtain a structured seed dataset, wherein the seed dataset includes multiple dialogue samples and / or report samples, the dialogue samples having role labels adapted to the target domain, and the report samples having multiple different modules adapted to the target domain; An initial data pool is constructed based on the seed dataset, wherein the initial data pool includes multiple sets of instruction-response pairs, each instruction describing a task requirement adapted to the target domain, and each response being a task output matching the task requirement; A synthetic instruction is generated using the instruction generation model and the initial data pool, and a synthetic response corresponding to the synthetic instruction is generated using the response generation model and each response in the initial data pool. The target synthetic sample data is obtained according to the synthesis instruction and the synthesis response.
2. The method as described in claim 1, characterized in that, The step of constructing an initial data pool based on the seed data includes: Generate an i-th instruction for the i-th dialogue sample or the i-th report sample in the seed dataset, and construct a mapping relationship between the i-th instruction and the i-th dialogue sample or the i-th report sample to obtain a set of instruction-response pairs. Each instruction is constructed based on the meta-information of the seed data, which includes: counseling style, symptom type or population characteristics. Each response is the content of the corresponding dialogue or report. The i-th dialogue sample or the i-th report is any seed data, and i is an integer greater than or equal to 1. Each set of instruction-response pairs is cleaned and deduplicated, and the cleaned instruction-response pairs are used as data in the initial data pool.
3. The method as described in claim 1, characterized in that, The process of generating synthetic instructions using the instruction generation model and the instructions in the initial data pool includes: The variables in the predefined structured instruction template are determined by the instruction generation model and at least one instruction in the initial data pool, wherein the predefined structured instruction template includes: a scene description template, a role setting template, and a dialogue target template adapted to the target domain; A synthesis instruction is generated by dynamically filling in the values of the corresponding variables.
4. The method according to any one of claims 1-3, characterized in that, The step of obtaining the target synthetic sample data according to the synthesis instruction and the synthesis response further includes: The synthesis instructions and the synthesis response are used as initial synthesis sample data; The target synthetic sample data is obtained by using at least one intelligent agent to perform multiple rounds of debate on the initial synthetic sample data.
5. The method as described in claim 4, characterized in that, The step of processing the initial synthetic sample data with at least one intelligent agent to obtain the target synthetic sample data includes: The first synthetic sample is input into the first agent, and the first agent generates the first processing result. The single data sample is an initial synthetic dialogue or an initial synthetic report corresponding to any synthetic response. The first processing structure includes an inference part and a first correction dialogue or a first correction report. The first correction dialogue is obtained by adjusting the initial synthetic dialogue based on the inference part, and the first correction report is obtained by adjusting the initial synthetic report based on the inference part. The first processing structure and the single data sample are input into the second agent to obtain a second processing result. The second processing result includes critical metadata for the reasoning part and a second corrective dialogue or a second corrective report. The second corrective dialogue is obtained by adjusting the first corrective dialogue based on the critical metadata, and the second corrective report is obtained by adjusting the first corrective report based on the critical metadata. The critical metadata includes: logical flaws, insufficient emotional adaptability, and domain terminology errors. The second processing result and the first processing result are input into a third intelligent agent, and the target synthetic sample data is determined by the evaluation criteria of the third intelligent agent. The evaluation dimensions of the evaluation criteria include: logical coherence, emotional adaptability, and domain accuracy.
6. The method as described in claim 1 or 4, characterized in that, The method further includes: The target synthetic sample data is cleaned according to preset rules to obtain cleaned sample data. The cleaned sample data is filtered according to the target screening model to obtain target sample data. The target screening model is trained on the sample data with labeled logical coherence, sentiment adaptability and domain accuracy.
7. A method for training a model, characterized in that, The method includes: The target synthetic sample data is obtained according to the method described in any one of claims 1-6; The target synthetic sample data is used as training data, and the psychological counseling model is trained based on the training data to obtain the target psychological counseling model.
8. A method for generating dialogue and report data, characterized in that, The method includes: Design target input prompts based on the generated targets; The output results are obtained based on the target input prompts and the target psychological counseling model as described in claim 7, wherein the output results include dialogues or reports.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the program, it can implement the method described in any one of claims 1-8.
10. A computer program product, characterized in that, It includes computer program instructions, which, when read and executed by a processor, can implement the method as described in any one of claims 1-8.