A training data generation method, electronic equipment, storage medium and program product
By generating system-level prompts and automatically generating input instruction and response sets using a large language model, the problem of low efficiency and poor adaptability in training dataset construction in existing technologies is solved. This achieves efficient and automated generation of multi-turn dialogue training datasets, improving the semantic coherence and domain adaptability of the data.
Patent Information
- Application Number
- CN202511101859.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-08-07
AI Technical Summary
Existing technologies for constructing high-quality instruction-response pairs for training datasets suffer from low efficiency, poor domain adaptability, and a lack of coherence in dialogue semantics, making it difficult to meet the needs of large-scale data construction.
By acquiring domain identifier information of the target domain, system-level prompts are generated. Input instruction sets and response sets are automatically generated using a large language model that has completed alignment training. Multi-turn dialogue training data with semantic coherence is generated through multi-turn dialogue expansion, and instruction optimization training dataset for the large language model is constructed.
It significantly improves the automation of the instruction-response construction process, enhances the semantic diversity and domain adaptability of data, and has excellent versatility, portability and cross-domain scalability, enabling it to quickly adapt to the business needs of different domains.
Smart Images

Figure CN120632467B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a training data generation method, electronic device, storage medium, and program product. Background Technology
[0002] In recent years, large language models (LLMs) have made significant progress in the field of natural language processing, demonstrating powerful language understanding and generation capabilities in general tasks such as dialogue, question answering, and code generation. To further improve the model's adaptability to specific tasks, researchers commonly employ instruction tuning techniques. These techniques align model behavior with high-quality instruction-response data pairs, thereby enhancing its generalization ability and enabling it to handle new tasks not encountered during training.
[0003] Currently, although some open-source models such as GPT, Qwen, and LLaMA have released their parameter weights, providing developers with a model foundation, most of the high-quality aligned training datasets that accompany them are still private, which limits the progress of open research on artificial intelligence technology and the expansion of its practical application.
[0004] In existing technologies, the method of constructing instruction data still has the following problems:
[0005] 1. One type of method relies on experts manually writing instructions and annotating responses. Although the data quality is high, it suffers from problems such as high cost, low efficiency, and poor scalability, making it difficult to meet the needs of large-scale data construction.
[0006] 2. Another type of automation method (such as Self-Instruct) attempts to generate training samples by the model itself to reduce manual costs. Although it improves the efficiency of data generation, it still heavily relies on the design of the initial seed instruction or prompt template in practical applications, and its generation quality still requires a lot of manual intervention.
[0007] 3. As the scale of automatically synthesized data continues to expand, existing generation mechanisms tend to become homogenized in terms of language expression and task type, making it difficult to maintain language diversity and the breadth of task coverage.
[0008] Therefore, existing methods for constructing instruction datasets still suffer from problems such as strong reliance on manual intervention, weak professional adaptability, insufficient multi-round construction capabilities, and decreased data diversity. How to efficiently construct instruction datasets with broad coverage and stable quality has become an urgent problem to be solved in this field. Summary of the Invention
[0009] To address the shortcomings of existing technologies, this application provides a training data generation method, electronic device, storage medium, and program product, which at least solve the problems of low efficiency, poor domain adaptability, and lack of coherence in dialogue semantics in the construction of high-quality instruction-response pairs in existing technologies.
[0010] To achieve the above objectives and other advantages, some embodiments of this application provide the following aspects:
[0011] In a first aspect, some embodiments of this application provide a training data generation method, including:
[0012] Obtain the domain identifier information of the target domain, and generate system-level prompt information related to the target domain based on the domain identifier information;
[0013] The system-level prompt information is input into the large language model that has completed alignment training, driving the model to generate a set of input instructions related to the target domain;
[0014] The input instruction set is used as input prompts and is continued to be input into the large language model to generate a response set that is semantically related to the input instruction set, thereby forming a first training dataset that includes the input instruction set and the response set.
[0015] For each instruction-response pair in the first training dataset, multi-turn dialogue training data with semantic coherence and rich context is constructed using the multi-turn dialogue extension generation method of the large language model.
[0016] The training data from multiple multi-turn dialogues are aggregated to construct a second training dataset for instruction tuning training or supervised alignment tasks of large language models.
[0017] Secondly, some embodiments of this application also provide an electronic device, the electronic device comprising:
[0018] One or more processors; and a memory storing computer program instructions that, when executed, cause the processors to perform the training data generation method as described above.
[0019] Thirdly, some embodiments of this application also provide a computer-readable storage medium having a computer program and / or instructions stored thereon, which, when executed by a processor, implement the training data generation method as described above.
[0020] Fourthly, some embodiments of this application also provide a computer program product, including a computer program and / or instructions that, when executed by a processor, implement the training data generation method as described above.
[0021] Compared with related technologies, the solution provided in this application introduces system-level prompt information constructed based on domain identifier information of different target domains. This guides a large language model that has completed alignment training to automatically generate a set of user instructions with semantic diversity and consistent expression. Furthermore, it generates response content that highly matches the semantics of the instructions, thereby constructing a first training dataset with standardized structure and accurate semantics. This method does not rely on manual prompting engineering, expert writing, or preset seed instructions, significantly improving the automation level and task generalization ability of the instruction-response construction process. Furthermore, by performing multi-turn context expansion on the instruction-response pairs in the first training dataset, multi-turn dialogue training data with semantic coherence and logical progression is constructed, enhancing the data's adaptability to complex interaction scenarios and its contextual understanding ability. Therefore, the training data generated by this method has good domain adaptability, enabling the generated data content to quickly adapt to the business needs of different domains, possessing excellent versatility, transferability, and cross-domain scalability. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other implementation methods can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating a training data generation method provided in an embodiment of this application;
[0024] Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] First Embodiment
[0027] The first embodiment of this application relates to a training data generation method, referring to... Figure 1 As shown, the method may include the following steps:
[0028] Step S1: Obtain the domain identifier information of the target domain, and generate system-level prompt information related to the target domain based on the domain identifier information.
[0029] Specifically, regarding step S1, the target domain refers to the specific task or application scenario to which the training data generation method of this application is applicable. It represents a specific theme or professional scope in the data generation process. Examples include industries such as healthcare, law, finance, education, and automotive. In the healthcare field, tasks may involve disease diagnosis, treatment methods, and medical image analysis. In the legal field, tasks may include contract analysis, legal consultation, and case judgment analysis; they can also be specific professional knowledge areas such as computer science, physics, and chemistry, such as computer science tasks like programming code generation and technical document writing; or specific application or task requirements, such as technical support, customer service, and educational tutoring involving frequently asked questions and technical support.
[0030] Domain identification information refers to key information used to describe and define the characteristics of a target domain in a specific application scenario. It can identify the core attributes of a domain through specific tags, parameters, or metadata, thereby helping the system understand and generate data that meets the needs of that domain. Domain identification information is a core input in the automated data generation process, directly affecting the model's generation capabilities and the relevance of the generated data. For example, in the medical target domain, domain identification information can include "medicine," "disease type," "treatment method," and "prevention measures." After obtaining this information, it can help generate more system-level prompts focused on medical tasks, such as "Please describe common internal medicine diseases and their treatment methods." For the education target domain, the generated system-level prompts could be: "Please describe the key teaching methods and learning assessment strategies in this domain." Compared to other prompts that typically involve users directly inputting instructions to the model to complete a simple task, system-level prompts are designed to guide large language models by providing comprehensive task guidance and background, ensuring the structure and consistency of the generated content.
[0031] Step S2: Input system-level prompts into the large language model that has completed alignment training, driving the model to generate a set of input instructions related to the target domain.
[0032] Specifically, in step S2, alignment training refers to fine-tuning the model parameters using data from the target domain to enable it to better understand domain terminology and generate domain-specific content. Therefore, in many applications, especially domain-specific tasks such as healthcare, law, and education, manually designing and generating task instructions and responses is both time-consuming and complex. By using large language models (such as GPT and BERT) that have undergone alignment training, the system can automatically generate high-quality domain-specific data, reducing the need for manual design and annotation, and significantly improving the efficiency and scale of data generation.
[0033] After receiving system-level prompts, the model generates a set of input instructions relevant to the target domain. These instruction sets typically consist of a series of task requirements or questions that effectively guide the model to generate responses. For example, in the medical field, the generated input instructions might be: "Please describe the symptoms and treatments for diabetes" or "Please list common types of cancer and early warning signs."
[0034] To ensure the diversity and coverage of the generated instruction set, the instruction content can be continuously optimized through multiple rounds of generation or parameter tuning. For example, by adjusting the model's generation parameters, such as sampling temperature, maximum output length, and repetition penalty coefficient, the model can generate a more diverse instruction set, ensuring that each instruction has high semantic uniqueness and practicality. The generated instruction set should not be limited to common tasks or problems, but should cover different types of tasks and difficulty levels within the domain.
[0035] Step S3: Use the input instruction set as input prompts and continue to input it into the large language model to generate a response set that is semantically related to the input instruction set, thus forming the first training dataset that includes the input instruction set and the response set.
[0036] Specifically, regarding step S3, in step S2, a set of input instructions related to the target domain has been generated. These instructions contain descriptions of specific tasks or problems, guiding the model to generate domain-specific responses. These instructions, as input prompts, are fed one by one into the aligned and trained large language model. Each input instruction contains a clear task objective, domain context, and semantic requirements. Upon receiving the input instructions, the large language model first parses the semantic information of each instruction, including the task objective, contextual requirements, and response format requirements. Based on the task information and system-level prompts conveyed in the instructions, the model generates response content semantically related to the instructions. These responses should semantically match the instructions and conform to the language style, format, and task requirements specified in the system-level prompts. For example, if the input instruction is "Please describe the common symptoms and treatments for this disease," the generated response content could include a description of the disease's symptoms and corresponding treatment recommendations.
[0037] The generated response set undergoes quality checks to ensure semantic integrity and fluency, avoiding repetitive, irrelevant, or substandard responses. If the generated response content does not meet the expected quality standards or semantic alignment requirements, the system will make appropriate adjustments or generate new responses until the content satisfies the standards. Each input instruction and its corresponding generated response are bound together to form an instruction-response pair. All generated instruction-response pairs are then aggregated to form the first training dataset.
[0038] Step S4: For each instruction-response pair in the first training dataset, construct multi-turn dialogue training data with semantic coherence and rich context by using the multi-turn dialogue extension generation method of the large language model.
[0039] Specifically, in step S4, a first training dataset has been generated, containing a certain number of instruction-response pairs. For each instruction-response pair in the first training dataset, step S4 enhances the semantic coherence and contextual depth of the training data through a multi-turn dialogue extension generation method.
[0040] Multi-turn dialogue expansion here refers to the system expanding the breadth and depth of the dialogue by continuously generating new commands and responses based on a single command-response pair. When generating multi-turn dialogues, the system retains the content of the previous turn as historical context, allowing the new command-response pairs to semantically continue and evolve. In this way, the model can not only understand the current task but also semantically expand based on previously generated content, ensuring logical coherence in the dialogue.
[0041] During the multi-round generation process, the system evaluates the quality of each generated instruction-response pair to ensure consistency between the response and the instruction, clear semantics, and compliance with task requirements. If an instruction is irrelevant, semantically ambiguous, or of low quality, the system will adjust or regenerate it to ensure the quality of the generated data. If a response generated by the model deviates from the task topic in a particular round, the system will screen it based on semantic similarity and regenerate response content that is more relevant to the topic.
[0042] Step S5: Summarize multiple multi-turn dialogue training data to construct a second training dataset for instruction tuning training or supervised alignment tasks of large language models.
[0043] Specifically, for step S5, before aggregating the multi-turn dialogue data, a quality check is required to ensure that the instruction-response pairs in each dialogue dataset are semantically consistent, task-specific, and expressively coherent. If semantic errors, task deviations, or formatting issues occur during the generation of certain dialogues, the system will filter and correct them through a quality control mechanism.
[0044] Each multi-turn dialogue data sample is converted into a standardized format, typically including input instructions, responses, task labels, and dialogue turn information. All samples will be unified into structured data units, for example: {"Input Instruction": "Describe treatment methods for diabetes", "Response": "Diabetes treatment methods include medication and lifestyle modifications", "Turn": 1, "Task Type": "Disease Treatment"}. This structured data will ensure that the system can clearly understand the context and task objective of each training sample during subsequent model training.
[0045] Through multi-turn dialogue expansion, each generated instruction-response pair is constructed into a complete dialogue sequence. Finally, these multi-turn dialogue training data are aggregated to form a complete multi-turn dialogue dataset, which will serve as training data for different target domains.
[0046] Compared with related technologies, the solution provided in this application introduces system-level prompt information constructed based on domain identifier information of different target domains. This guides a large language model that has completed alignment training to automatically generate a set of user instructions with semantic diversity and consistent expression. Furthermore, it generates response content that highly matches the semantics of the instructions, thereby constructing a first training dataset with standardized structure and accurate semantics. This method does not rely on manual prompting engineering, expert writing, or preset seed instructions, significantly improving the automation level and task generalization ability of the instruction-response construction process. Furthermore, by performing multi-turn context expansion on the instruction-response pairs in the first training dataset, multi-turn dialogue training data with semantic coherence and logical progression is constructed, enhancing the data's adaptability to complex interaction scenarios and its contextual understanding ability. Therefore, the training data generated by this method has good domain adaptability, enabling the generated data content to quickly adapt to the business needs of different domains, possessing excellent versatility, transferability, and cross-domain scalability.
[0047] Second Embodiment
[0048] The second embodiment of this application relates to a training data generation method. The second embodiment is an improvement upon the first embodiment, specifically in that: in the second embodiment of this application, a specific implementation method for automatically generating system-level prompt information based on target domain identifier information is provided, namely, step S1 may further include the following steps:
[0049] Step S101: Based on the domain classification library or knowledge graph defined for different target domains, extract the domain identification information corresponding to different application scenarios. The domain identification information includes: industry name, business type, task category and knowledge subclass label.
[0050] Specifically, domain identification information can be key information extracted from a domain classification library or knowledge graph of the target domain, used to identify and describe a specific domain or application scenario. The domain classification library or knowledge graph includes the core knowledge of the domain, task types, common application scenarios, and industry-specific knowledge subclasses.
[0051] Domain identification information includes: industry name, business type, task category, and knowledge subcategory label. For example, in the medical field, domain identification information might include "medicine" as the industry name, "disease diagnosis" as the business type, "symptom recognition" as the task category, and "diabetes" as the knowledge subcategory label; while in the legal field, domain identification information might include "law" as the industry name, "contract review" as the business type, "intellectual property" as the task category, and "patent law" as the knowledge subcategory label.
[0052] Step S102: Based on at least one content in the domain identifier information, retrieve a matching prompt structure entry from the preset prompt template library, and combine the prompt structure entry with the domain identifier information through template filling and parameter binding to dynamically generate system-level prompt information optimized for different target domains.
[0053] A cue template library is a pre-designed and stored set of standardized templates that provide a structured framework for different tasks or domains. A cue structure entry is a specific template instance retrieved from the cue template library. For example, when dealing with a diabetes task in the medical field, relevant templates would be selected from the library and populated to form a cue structure entry suitable for the diabetes task.
[0054] In this embodiment, step S102 combines the prompt structure entries and domain identifier information through template filling and parameter binding to dynamically generate system-level prompt information optimized for different target domains, specifically including:
[0055] Step S1021: Identify multiple placeholder fields set in the prompt structure entry. The placeholder fields include the model role field, task objective field, answer format field, and style constraint field.
[0056] Step S1022: Semantically map and fill parameters of each semantic element in the domain identifier information with one or more of the placeholder fields, and semantically enhance and modify the answer format and style constraint fields according to different task scenarios;
[0057] Step S1023: Through content insertion and context constraint rules, generate system-level prompt information with complete structure and clear semantics from the filled prompt structure entries.
[0058] Specifically, based on the prompt structure entries retrieved from the prompt template library, a series of placeholder fields are identified. These placeholder fields are predefined template tags and can include the following categories:
[0059] Model Role Field: Used to specify the role the model should assume, helping the model understand its role in the generation task, such as "Please play the role of a [doctor]" or "As a [legal expert], please answer the following questions".
[0060] Task objective field: Clearly defines the specific task that the instruction requires the model to perform, such as "Please describe the common symptoms of [disease type]" or "Please explain the scope of application of [legal provision]".
[0061] Answer format field: Set the format requirements when generating answers, such as "Answers should include [symptoms], [treatment methods], [preventive measures]" or "Answers should be concise and to the point, with a maximum of 150 words".
[0062] Style Constraints field: Style constraints that must be followed when generating answers, such as "use concise and clear language" or "avoid using technical terms".
[0063] The system performs semantic mapping and parameter filling between the semantic elements in the domain identifier information and the placeholder fields in the prompt structure entries. Specifically, based on the domain identifier information (such as "medicine," "disease type," etc.), the system matches this information with relevant fields in the placeholder fields (such as model role, task objective, etc.) to determine which placeholder field should be filled with which information. For example, "diabetes" in the domain identifier information is mapped to the "[disease type]" placeholder field in the task objective field. Parameter filling involves filling the specific values or parameters from the domain identifier information into the placeholder fields in the template, replacing the placeholders determined by semantic mapping with actual content, and generating the final system-level prompt information.
[0064] Simultaneously, these placeholder fields will undergo semantic enhancement based on different task contexts. The specific type and objectives of the task determine the structured requirements of the generated content. For example, a disease diagnosis task might require descriptions based on dimensions such as symptoms, treatment plans, and preventative measures, while a legal task might require listing the key points of legal provisions one by one. If the task requires describing treatment methods for diabetes, the original prompt structure, "Please summarize the treatment methods for [disease type]," can be enhanced by the task context to "Please summarize the treatment methods for diabetes in the order of medication, lifestyle modifications, and surgical treatment." Through this enhancement, the answer format becomes more organized and aligned with the task objectives.
[0065] Different tasks require different language styles due to their context and language. For example, legal tasks may require formal and rigorous language, while educational tasks may favor a more concise and approachable style. If a task requires the model to generate interpretations of legal provisions, style constraints might require the generated content to "use formal legal terminology" and "avoid overly colloquial expressions." Therefore, the original prompt structure "Please explain the core content of [legal provision]" can be style-enhanced to "Please rigorously explain the core content of [legal provision], ensuring the use of accurate legal terminology."
[0066] During the content insertion phase, the system further supplements the task with more details based on domain knowledge and task requirements. For example, in a medical task, the system may not only insert the disease name, but also, depending on the complexity of the task, insert information such as treatment plans and symptom descriptions to ensure that the generated instructions are comprehensive and detailed.
[0067] Contextual constraint rules are rules that ensure logical consistency and semantic coherence when generating system-level prompts. This ensures that the generated prompts are not only semantically clear but also effectively guide the model in executing tasks. For example, for a medical problem, the system will ensure that the generated task instructions are presented in the correct order (e.g., describing symptoms first, then providing treatment methods, and finally explaining preventative measures). Contextual constraint rules also ensure the professionalism and applicability of the content. For instance, in legal tasks, the generated prompts must conform to the expression of legal provisions; in education, the generated instructions must meet the requirements of teaching objectives. Combining content insertion and contextual constraint rules, the system ultimately generates system-level prompts that are structurally complete and semantically clear task instructions. These instructions clearly guide the model to perform the corresponding tasks and ensure that the generated content has semantic accuracy and logical consistency.
[0068] It is easy to see that in this embodiment, by combining domain identifier information with a preset template library, system-level prompts related to the target domain are automatically generated, avoiding the reliance on manual design and annotation in traditional methods. This enables rapid generation of task instructions, significantly improving the efficiency and scalability of task instruction generation, and meeting the needs of large-scale data generation tasks.
[0069] Third Embodiment
[0070] The third embodiment of this application relates to a training data generation method. The third embodiment is an improvement upon the first embodiment, specifically in that: in the third embodiment of this application, a specific implementation method for automated batch generation of input instructions is provided, namely, step S2 may further include the following steps:
[0071] Step S201: Input the system-level prompt information as guidance content into the input interface of the large language model, so that the large language model can parse and obtain the comprehensive semantic expression for the target domain;
[0072] Step S202: Based on the comprehensive semantic expression and the configured generation parameters, guide the model to perform multiple rounds of batch generation process, automatically construct an input instruction set of a scale matching the set task requirements. The generation parameters include: sampling temperature, maximum output length, repetition penalty coefficient and diversity sampling strategy.
[0073] Step S203: The input instruction set can cover multiple sub-tasks and diverse application scenarios in the target domain, and has diversity in task semantic structure while maintaining consistency in expression style.
[0074] Specifically, an input interface is first designed for the large language model, enabling it to receive formatted system-level prompts. This interface needs to process not only text information but also parse and understand placeholder fields and template fields within the system-level prompts. The large language model then uses Natural Language Processing (NLP) techniques to parse the input system-level prompts, extracting domain information, task type, format requirements, and other relevant details. Using pre-trained parameters and language knowledge, the model generates task instructions relevant to the target domain, obtaining a comprehensive semantic expression suitable for that domain and ensuring that this comprehensive semantic expression is correctly transmitted to the large model.
[0075] Generation parameters are tools for controlling the instructions generated by the model, helping the system manage the diversity and consistency of the generated content. By adjusting parameters such as sampling temperature, output length, repetition penalty coefficient, and diversity sampling strategy, the system can generate an input instruction set of a certain scale that matches the task requirements, ensuring that the generated content is both rich and structurally sound.
[0076] The sampling temperature is used to control the randomness and diversity of the generated content. A higher temperature is set to generate diverse responses, while a lower temperature is set to generate more concise and standardized task instructions.
[0077] Output length controls the length of each generated instruction, preventing the generation of excessively long or short content. The system automatically adjusts the maximum output length based on the complexity of the task and the required level of detail. For example, the system increases the maximum output length for instructions requiring detailed descriptions, while limiting the maximum output length for shorter instructions.
[0078] The duplication penalty coefficient is used to control the model to avoid duplicate content during the generation process. When the similarity of generated content exceeds a set threshold, the system applies a penalty to the duplicate content, thereby avoiding redundancy. For example, for task instructions that require high diversity, the system will set a higher duplication penalty coefficient to increase the diversity of generated content.
[0079] A diversity sampling strategy is used to control the diversity in task instruction generation, ensuring semantic and formal diversity within the instruction set. This strategy adjusts based on the complexity and required breadth of the task. The system automatically adjusts the appropriate diversity sampling strategy according to the diversity requirements of the target task. For example, when generating multiple diabetes-related instructions, the system will generate different instructions based on the task scenario requirements, such as "describing the symptoms of diabetes," "treatment methods for diabetes," and "preventive measures for diabetes," while avoiding generating instructions with semantic repetition or overly similar content.
[0080] The system guides the large language model to generate instructions repeatedly in multiple batches based on comprehensive semantic expression and configured generation parameters. In each round, the system adjusts its generation strategy according to previously generated content or task context to ensure each instruction is highly relevant to the target task and meets the generation parameter requirements. The system controls the size of the output task instruction set by setting the batch size; that is, it dynamically adjusts the batch size based on the required number of task instructions, and generates instructions in batches to avoid excessive resource consumption from generating too much content at once. To handle large-scale task instruction generation (e.g., automatically generating tens of thousands, hundreds of thousands, or millions of batches), the system can utilize distributed computing frameworks (such as Apache Spark or Hadoop) to distribute the task instruction generation process across multiple computing nodes for parallel processing. Based on the current generation load, the system automatically assigns generation tasks to different computing nodes for processing. Since large-scale data generation consumes significant computing resources, especially memory and processing power, the system needs to monitor resource usage in real time and dynamically allocate computing resources. When resources are insufficient, priority scheduling is implemented to ensure the generation process is not interrupted due to resource constraints.
[0081] The generation of large-scale task instructions also requires ensuring the quality of the generated content. Quality control and filtering should be performed on each batch of generated data. This can be achieved using automated quality assessment tools based on criteria such as semantic consistency, task coverage, and generation diversity. Post-processing filtering mechanisms can also be used to filter out instructions that do not meet quality requirements. For example, task instructions with duplicate content, incorrect syntax, or unclear semantics can be removed.
[0082] Using specialized knowledge graphs or domain classification libraries helps analyze the core structure of the target task, understand its key components, and break it down into different sub-tasks. For example, the task of "health data management" can be broken down into multiple sub-tasks such as "health data collection," "health data storage," and "health data analysis." For larger and more complex tasks, a recursive approach can be used to decompose the task subclasses. This method ensures that the task subclasses can meet multi-level needs and provide a more granular task scope.
[0083] Application scenarios are typically closely related to the task's execution environment, user needs, or usage context. Identifying specific application scenarios within the target domain allows us to determine the unique requirements of the task within each scenario. For example, a "health management" scenario might emphasize long-term health tracking and personalized recommendations, while a "disease diagnosis" scenario focuses more on accurate symptom identification and clinical support. Different scenarios may require different knowledge, technologies, or solutions; therefore, different application scenarios usually lead to different task breakdown requirements.
[0084] During the generation process, the system utilizes semantic mapping and a diversity sampling strategy for configuration parameters to ensure the semantic diversity of the generated task instructions, thereby generating multiple instructions with different semantic expressions. Specifically, in each generation round, by modeling different levels and details of the task, each instruction will describe the target task from different angles or levels, ensuring that the generated content has breadth and can cover various sub-categories of tasks and application scenarios in the target domain. Simultaneously, by adjusting the sampling temperature and repetition penalty coefficient in the generation parameters, the system ensures that the generated content has appropriate randomness and variability.
[0085] It is evident that in this embodiment, combining comprehensive semantic expression with generation parameters effectively improves the efficiency and quality of instruction generation. Through multi-round batch generation, the system can flexibly generate task instructions covering different sub-tasks and application scenarios according to the specific needs of the target domain, avoiding the high cost and low efficiency of manually writing task instructions, while ensuring the quality and consistency of instruction content. This makes the generation of input instructions more automated, particularly suitable for large-scale data generation tasks, and can efficiently support the training data generation needs of multi-domain tasks, while improving the adaptability and diversity of tasks while ensuring data quality.
[0086] It should be noted that the third embodiment of this application may also be an improvement based on any one or more of the first to second embodiments.
[0087] Fourth embodiment
[0088] The fourth embodiment of this application relates to a training data generation method. The fourth embodiment is an improvement upon the first embodiment, specifically in that: in this fourth embodiment, a specific implementation method for instruction-response data generation and structured storage is provided, namely, step S3 may further include the following steps:
[0089] Step S301: Input each input instruction in the input instruction set as input content and input it into the large language model one by one. The large language model parses the semantic information in the input instructions and generates response content with structural norms and semantic fit based on the response format and language style requirements set in the system-level prompt information.
[0090] Step S302: Perform data binding processing on each input instruction and its generated response content, establish a unique key-value mapping relationship, and uniformly store it as a structured sample unit to form an instruction-response pair;
[0091] Step S303: Sequentially organize multiple structured sample units according to a preset format and summarize them to construct the first training dataset.
[0092] Specifically, the system inputs each instruction into the large language model and relies on the model's natural language understanding capabilities to parse out the semantic information and generate structured responses. This ensures that the responses not only meet the requirements of the instructions but also align with the task objectives. Simultaneously, the system provides formatting guidance to the large language model based on pre-defined response formatting and language style requirements in the system-level prompts (e.g., concise, clearly structured responses using formal language). When generating responses, the system adjusts the model's output based on preset generation parameters (such as sampling temperature, maximum output length, and repetition penalty coefficient). For example, a higher sampling temperature results in more diverse generated content, preventing overly simplistic and repetitive task instructions and ensuring that the generated instruction set covers a wider range of task requirements.
[0093] Each generated task instruction and its corresponding response are bound together as key-value pairs. For example, a unique identifier (ID) can be used to identify each instruction-response pair. Through this mapping, the system ensures that each input instruction and its response can be uniquely referenced. The system then stores the input instructions, response content, and task objectives, along with other relevant information, as a structured sample unit (e.g., JSON, CSV), enabling effective management and processing of the generated data.
[0094] Each structured sample unit is processed according to a preset format. For example, in JSON format, the system needs to ensure that each field conforms to a predefined standard type (string, integer, array, etc.) and is complete. During the processing, the system further sorts, filters, and groups the data according to the needs of different sub-tasks. For example, it may sort and group the data by task category, generation time, task difficulty, and other factors.
[0095] Data filtering includes: screening and filtering instruction-response pairs in the first training dataset based on a set of quality assessment metrics, including:
[0096] Set minimum and maximum length thresholds for input commands and responses, and prune or remove commands and responses that exceed the threshold range.
[0097] Assuming the input command length is limited to 10-100 characters, samples below this threshold may lack sufficient information and will be discarded, while samples exceeding this threshold will be truncated or discarded to avoid generating excessively long and redundant content. Similarly, the response content length is limited to 20-200 characters, and samples exceeding this threshold will be truncated or discarded.
[0098] Based on a pre-trained language model, semantic embedding is performed on the input instruction and the response content, and the semantic similarity between the two is calculated to evaluate whether the response content is aligned with the semantic intent of the input instruction as a whole.
[0099] The system captures semantic information by converting input commands and responses into high-dimensional vectors. Semantic similarity between commands and responses is calculated using methods such as cosine similarity or Euclidean distance. If the similarity is below a set threshold, it indicates that the response content is semantically inconsistent with the input command, and the system will discard these invalid samples.
[0100] Based on the semantic points extracted from the input instructions, the extent to which the response content covers the contextual information is evaluated to determine the semantic completeness of the response content.
[0101] Extract semantic key points from the input instructions and use them as criteria for evaluating the response. The following criteria can be set to determine the semantic completeness of the response: whether the response covers all the key elements mentioned in the input instructions, whether the response answers the core question of the instructions in detail and sufficiently, and whether the response content conforms to the nature and objectives of the task. If the coverage meets the predetermined criteria and the information is sufficient, the response is considered semantically complete.
[0102] Discretized statistical analysis is performed on the task objectives or semantic expressions in the input instruction set to measure their coverage breadth in terms of task categories and expression structures.
[0103] Discretize the task objectives. Task objectives typically refer to the core goals or requirements of input instructions. For example, in the medical field, task objectives might be "describe symptoms," "explain treatment methods," or "answer health questions." By statistically analyzing the frequency of each task objective, the system can identify biases in the data regarding certain task objectives, ensuring a balanced distribution of various task objectives. The semantic expression of the task also needs to be discretized to ensure diversity in expression structure and syntax. For example, analyze whether the generated input instructions use different sentence structures (such as "please describe," "please explain," "give examples," etc.), thereby ensuring that the generated data has grammatical and expressive diversity.
[0104] The similarity between adjacent instruction-response pairs is evaluated by calculating the minimum semantic distance or word-level difference between neighboring samples, and highly repetitive or redundant samples are eliminated.
[0105] Semantic distance measures the semantic similarity between two texts, that is, the degree of difference in the actual meaning expressed by the texts. Common methods for calculating semantic distance include cosine similarity, Euclidean distance, and Manhattan distance. Text can be converted into vector representations using models such as word embeddings or sentence embeddings, and then their similarity can be calculated. Word-level dissimilarity measures the similarity between texts by calculating the lexical differences. Methods such as Jaccard similarity and Levenshtein distance can be used to calculate the differences at the lexical level. A similarity threshold (e.g., 0.85) can be set; if the similarity between two instruction-response pairs exceeds the threshold, they are considered redundant samples and should be removed. To more efficiently remove redundant samples, the system can calculate the semantic dissimilarity between instruction-response pairs at the scale of data through batch processing. For example, parallel processing or distributed computing frameworks can be used to accelerate similarity calculation and data processing, improving the system's processing efficiency.
[0106] The trained reward model is used to evaluate the quality of the response content, and instruction-response pairs with scores higher than the set scoring threshold are retained as valid samples.
[0107] Reward models typically utilize large-scale pre-trained language models (such as GPT and BERT) for fine-tuning. During training, a large number of high-quality samples are used to annotate the generated responses, learning how to evaluate response quality. The annotated data during training may include human ratings or ratings automatically generated according to specific criteria. After generating instruction-response pairs, the system evaluates the quality of the responses using the pre-trained reward model. The model generates a score for each response based on multiple dimensions, including the syntax, content relevance, and semantic consistency of the instruction and response. As the amount of generated data increases, the accuracy of the reward model's scoring can be iteratively optimized by continuously collecting new generated data and human evaluation feedback, thereby further improving data quality.
[0108] It is evident that in this embodiment, by inputting commands one by one and parsing their semantic information, combined with the format and language style requirements in the system-level prompts, the response content is ensured to meet high standards in terms of semantic fit and structural regularity, thereby optimizing data quality. By binding commands and responses and storing them uniformly as structured sample units, the operability and flexibility of the dataset are enhanced, providing a high-quality and easily manageable data foundation for subsequent large-scale language model training. The batch generation and serialization of training datasets greatly improves the efficiency of data construction, reduces manual intervention, and promotes the rapid generation of large-scale, high-quality training data.
[0109] It should be noted that the fourth embodiment of this application may also be an improvement based on any one or more of the first to third embodiments.
[0110] Fifth Embodiment
[0111] The fifth embodiment of this application relates to a training data generation method. The fifth embodiment is an improvement upon the first embodiment, specifically in that: in the fourth embodiment of this application, a specific implementation method for multi-turn dialogue extension of instruction-response pair data is provided, namely, step S4 may further include the following steps:
[0112] Step S401: Input each instruction-response pair in the first training dataset as context for the start round of the dialogue into the large language model;
[0113] Step S402: Based on retaining the content of the previous round of dialogue as historical context, guide the model to generate a new round of instructions and corresponding response content that are semantically related to the previous round. The new round of user instructions semantically include question follow-up, task deepening, content reflection or knowledge generalization.
[0114] Step S403: Repeat the above generation process to continuously build a multi-turn instruction-response sequence until the preset number of dialogue turns is reached or the dialogue generation interruption condition is met;
[0115] Step S404: The multi-turn instruction-response pairs together constitute a multi-turn dialogue training data, which has contextual semantic coherence and logical progression structure, and is used to enhance the understanding and response capabilities of the large language model in complex dialogue tasks.
[0116] Specifically, the system extracts the initial context from each instruction-response pair in the first training dataset and uses it as input for the initial rounds of the dialogue, feeding it into the large language model one by one. Before inputting the data, the instructions and responses are preprocessed, such as removing redundant punctuation, irrelevant characters, and formatting issues to ensure the text contains only meaningful content. The input text is then broken down into words or subwords using a vocabulary. After the preprocessing step, the pre-trained language model generates semantic vector representations of the instructions and responses. The language model converts each word or phrase into a corresponding embedding vector, which captures the contextual information and semantic features of the word. The system then uses the generated semantic embeddings as input to the input interface of the large language model.
[0117] The system transforms the instructions and responses from the previous round into vector or embedding representations, concatenates them with the newly generated instructions and responses, and then inputs them into the model. In this way, the model can understand the context of the current task and the content of the previous dialogue. By retaining the content of the previous dialogue as historical context, the system guides the large language model to generate new instructions and responses that are semantically relevant to the previous round.
[0118] To achieve semantic progression in multi-turn dialogues, the system dynamically adjusts generation parameters such as temperature, maximum output length, content diversity, and repetition penalty coefficient based on task complexity and dialogue progress. In the previous round of dialogue, if the generated instructions and responses are already relatively basic, the system can appropriately increase the temperature (to improve diversity) while using Top-p sampling to ensure that the generated content is diverse but does not deviate from the task objective.
[0119] Building upon historical context, the system guides the large language model to generate instructions relevant to the current dialogue objective and generates corresponding responses based on the semantics of the generated instructions. The system ensures that new instructions and responses conform to semantic progression, avoiding overly simplistic or irrelevant content. Specifically, based on the previous round of dialogue, the system generates new instructions of various types, such as follow-up questions, task deepening, reflection, or knowledge generalization. Based on the generated instructions, the large language model generates semantically appropriate responses, ensuring that the responses provide detailed answers to the task objective or offer relevant information. In each round of dialogue, the generation of instructions and responses is accomplished using natural language generation technology. The system generates language expressions that conform to the task objective through contextual analysis of the dialogue content. By continuously accumulating historical dialogue content, the instructions and responses generated in each round are stored in a structured manner. With each round of dialogue, the historical context is updated and passed to the next round to ensure the coherence and logical progression of the dialogue.
[0120] To ensure that the generated multi-turn dialogues meet the needs of practical applications, the system sets conditions for the number of turns generated or the progression of dialogue content. During the multi-turn dialogue generation process, the system sets a maximum number of turns to ensure that the generated dialogues do not exceed the requirements of the actual application. For example, the system can be set to generate no more than 5 turns of dialogue content. If the generated instructions and responses have already covered the required task objectives, the system can also automatically stop generating based on the progression of the dialogue content. When the content reaches a certain depth or complexity, the model will stop generating to avoid meaningless expansion. In each round of generation, the system does not simply copy the content of the previous round, but rather semantically progresses based on historical dialogue content and context, increasing the depth of the dialogue.
[0121] When processing the data, the system verifies the semantic coherence of each round of command-response pairs. For example, it uses semantic embedding technology to calculate the similarity and relevance between the current response and the previous response. If the semantics of the response are found to be inconsistent with the previous round, or if there is a logical break, the system will regenerate or adjust the response. The system also analyzes whether each round of commands effectively expands or deepens the content of the previous round, ensuring that multi-round dialogues not only have semantic consistency but also logical progression, avoiding stagnation or repetition in the dialogue content.
[0122] The processed and validated data will be integrated into the final multi-turn dialogue training dataset and stored serially according to a preset format. This data will provide rich training samples for subsequent large language model training, enabling the model to understand and generate coherent and logically clear responses when handling complex dialogue tasks.
[0123] It is readily apparent that, in this embodiment, by introducing a multi-turn dialogue generation mechanism, the system can efficiently construct complex dialogue datasets. The generation of each instruction-response pair not only ensures semantic consistency and logical progression but also effectively enhances the model's responsiveness to complex tasks. By expanding each turn based on historical context, the system can generate dialogue content with progression and depth, avoiding simple copying or a single response method, thereby improving the richness and diversity of the dialogue. This method significantly improves the efficiency and quality of training data generation, providing more high-quality and diverse task data for training large language models, and significantly enhancing the model's understanding and response capabilities.
[0124] It should be noted that the fifth embodiment of this application may also be an improvement based on any one or more of the first to fourth embodiments.
[0125] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this application. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this application.
[0126] Furthermore, some embodiments of this application also provide an electronic device. The electronic device can be various forms of digital computer, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, etc. The electronic device can also be various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices.
[0127] The electronic device includes: one or more processors; and a memory storing computer program instructions, which, when executed, cause the processor to perform a training data generation method as provided in any one or more of the above embodiments. Figure 2An exemplary structural diagram of the electronic device is disclosed. The electronic device includes one or more processors 1101, a memory 1102, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components are interconnected via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some other embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple electronic devices can be connected, each providing some of the necessary operations. The components, their connections and relationships, and their functions shown herein are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0128] The electronic device may further include an input device 1103 and an output device 1104. The processor 1101, memory 1102, input device 1103, and output device 1104 may be connected via a bus or other means. Figure 2 Taking the example of a connection between China and Israel via a bus.
[0129] Input device 1103 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the electronic device, such as a touch screen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 1104 may include a display device, auxiliary lighting device (e.g., LED), and haptic feedback device (e.g., vibration motor). The display device may include, but is not limited to, a liquid crystal display, a light-emitting diode display, and a plasma display. In some embodiments, the display device may be a touch screen.
[0130] To provide interaction with the user, the electronic device can be a computer. The computer has: a display device (e.g., a cathode ray tube or LCD monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback); and input from the user can be received in any form (e.g., voice input or tactile input).
[0131] In this embodiment, a computer-readable medium stores a computer program / instructions, which, when executed by a processor, implement a training data generation method provided in any one or more of the above embodiments. The computer-readable medium may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into that device. The computer-readable medium carries one or more computer-readable instructions.
[0132] The memory 1102 can serve as a non-transitory computer-readable storage medium, used to store non-transitory software programs, non-transitory computer-executable programs, and modules. The processor 1101 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions, and modules stored in the memory 1102, thereby implementing the program instructions / modules corresponding to the methods provided in any one or more of the embodiments described above in this application.
[0133] The memory 1102 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 1102 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 1102 may optionally include memory remotely located relative to the processor 1101, and these remote memories can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0134] It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. Computer-readable media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections having one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, optical fibers, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0135] Computer-readable media include permanent and non-permanent, removable and non-removable media, which can store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory, static random access memory, dynamic random access memory, other types of random access memory, read-only memory, electrically erasable programmable read-only memory, flash memory or other memory technologies, read-only optical discs, digital versatile optical discs or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0136] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including local area networks (LANs) or wide area networks (WANs), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0137] In the above embodiments, all or part of the implementation can be achieved through software, hardware, firmware, or any combination thereof. For example, it can be implemented using an application-specific integrated circuit (ASIC), a general-purpose computer, or any other similar hardware device. In some embodiments, the software program of this application can be executed by a processor to implement the above steps or functions. Similarly, the software program of this application (including related data structures) can be stored in a computer-readable recording medium, such as RAM memory, magnetic or optical drives, floppy disks, and similar devices. In addition, some steps or functions of this application can be implemented in hardware, for example, as circuitry that cooperates with a processor to perform the various steps or functions.
[0138] The computer program product provided in this application includes one or more computer programs / instructions. When executed by a processor, these computer programs / instructions generate, in whole or in part, the processes or functions described in this application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0139] The flowcharts or block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of devices, 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 indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated 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 the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-specific system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0140] The scope of this application is defined by the appended claims rather than the foregoing description, and is therefore intended to encompass all variations falling within the meaning and scope of equivalents of the claims. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a device claim may also be implemented by a single unit or device in software or hardware. Terms such as "first," "second," etc., are used only for distinguishing descriptions and do not indicate any particular order, nor should they be construed as indicating or implying relative importance.
[0141] 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 made 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, and the above embodiments should be regarded as exemplary and non-limiting.
Claims
1. A method for generating training data, characterized in that, include: Based on domain classification libraries or knowledge graphs defined for different target domains, obtain domain identification information for the target domain; The system dynamically generates system-level prompts optimized for different target domains by combining the prompt structure entries with the domain identification information through template filling and parameter binding, including: Identify multiple placeholder fields set in the prompt structure entry, including model role field, task objective field, answer format field, and style constraint field; The semantic elements in the domain identifier information are semantically mapped and parameter-filled with one or more of the placeholder fields, and the answer format and style constraint fields are semantically enhanced and modified according to different task scenarios. By using content insertion and context constraint rules, the populated prompt structure entries are used to generate system-level prompt information that is structurally complete and semantically clear. The system-level prompt information is input into the large language model that has completed alignment training, driving the model to generate a set of input instructions related to the target domain; The input instruction set is used as input prompts and is continued to be input into the large language model to generate a response set that is semantically related to the input instruction set, thereby forming a first training dataset that includes the input instruction set and the response set. For each instruction-response pair in the first training dataset, multi-turn dialogue training data with semantic coherence and rich context is constructed using the multi-turn dialogue extension generation method of the large language model. The training data from multiple multi-turn dialogues are aggregated to construct a second training dataset for instruction tuning training or supervised alignment tasks of large language models. The second training dataset can adapt to the business needs of different domains and has good versatility, portability and cross-domain scalability.
2. The training data generation method according to claim 1, characterized in that, The domain identification information includes: industry name, business type, task category, and knowledge subclass label; Based on at least one of the contents of the domain identification information, a matching prompt structure entry is retrieved from a preset prompt template library.
3. The training data generation method according to claim 1, characterized in that, The step of inputting the system-level prompt information into a large language model that has completed alignment training, and driving the model to generate an input instruction set related to the target domain, includes: The system-level prompt information is input as guidance content into the input interface of the large language model, enabling the large language model to parse and obtain a comprehensive semantic expression oriented towards the target domain; Based on the comprehensive semantic expression and the configured generation parameters, the model is guided to perform multiple rounds of batch generation process, automatically constructing an input instruction set of a scale matching the set task requirements. The generation parameters include: sampling temperature, maximum output length, repetition penalty coefficient, and diversity sampling strategy. The input instruction set can cover multiple sub-categories of tasks and diverse application scenarios in the target domain, and it has diversity in task semantic structure while maintaining consistency in expression style.
4. The training data generation method according to claim 1, characterized in that, The step of using the input instruction set as input prompts and continuing to input it into the large language model to generate a response set semantically related to the input instruction set, thereby forming a first training dataset including the input instruction set and the response set, includes: Each input instruction in the input instruction set is used as input content and input into the large language model one by one. The large language model parses the semantic information in the input instructions and generates response content with structural standardization and semantic fit based on the response format and language style requirements set in the system-level prompt information. Each input command is data-bound to its generated response, establishing a unique key-value mapping relationship and storing them uniformly as structured sample units to form a command-response pair; The multiple structured sample units are serialized and organized according to a preset format, and then summarized to construct the first training dataset.
5. The training data generation method according to claim 1, characterized in that, Before the step of constructing multi-turn dialogue training data with semantic coherence and rich context for each instruction-response pair in the first training dataset using the multi-turn dialogue extension generation method of the large language model, the method further includes: screening and filtering the instruction-response pairs in the first training dataset based on a set of quality evaluation metrics, including: Set minimum and maximum length thresholds for input commands and responses, and trim or remove commands and responses that exceed the threshold range; Based on a pre-trained language model, semantic embedding is performed on the input instruction and the response content, and the semantic similarity between the two is calculated to evaluate whether the response content is aligned with the semantic intent of the input instruction as a whole. Based on the semantic points extracted from the input instructions, the degree of coverage of the response content in the context information is evaluated to determine the semantic completeness of the response content. Discretized statistical analysis is performed on the task objectives or semantic expressions in the input instruction set to measure its coverage breadth in terms of task categories and expression structures; By calculating the minimum semantic distance or word-level difference between neighboring samples, the similarity between adjacent instruction-response pairs is evaluated, and highly repetitive or redundant samples are eliminated. The trained reward model is used to evaluate the quality of the response content, and instruction-response pairs with scores higher than the set scoring threshold are retained as valid samples.
6. The training data generation method according to claim 1, characterized in that, The step of constructing multi-turn dialogue training data with semantic coherence and rich context for each instruction-response pair in the first training dataset using the multi-turn dialogue extension generation method of the large language model includes: Each instruction-response pair in the first training dataset is input into the large language model as the context of the dialogue start round; While retaining the content of the previous round of dialogue as historical context, the model is guided to generate a new round of instructions and corresponding responses that are semantically related to the previous round. The new round of instructions semantically include questioning, task deepening, content reflection, or knowledge generalization. Repeatedly execute the process of generating new instructions and corresponding responses related to the semantics of the previous round, continuously building multi-round instruction-response pairs until the preset number of dialogue rounds is reached or the dialogue generation is interrupted. The multi-turn instruction-response pairs together constitute a multi-turn dialogue training data, possessing contextual semantic coherence and a logically progressive structure, which is used to enhance the understanding and response capabilities of large language models in complex dialogue tasks.
7. An electronic device, characterized in that, The electronic device includes: One or more processors; and a memory storing computer program instructions that, when executed, cause the processors to perform the training data generation method as described in any one of claims 1-6.
8. A computer-readable storage medium having a computer program and / or instructions stored thereon, characterized in that, When the computer program and / or instructions are executed by the processor, they implement the training data generation method as described in any one of claims 1-6.
9. A computer program product, comprising a computer program and / or instructions, characterized in that, When the computer program and / or instructions are executed by the processor, they implement the training data generation method as described in any one of claims 1-6.
Citation Information
Patent Citations
Table information extraction method, system and equipment based on compressed pre-training language model
CN116701619A
Model training method and device, storage medium and electronic equipment
CN120181239A
Method for generating multi-round dialogue corpora and training and testing large language model
CN120216640A
Data enhancement method and related equipment
CN120216697A