Diversified data generation method and system based on large language model and storage medium
By preprocessing and generating samples in multiple rounds on the large language model service node, and utilizing the prompt word template framework and asynchronous parallel processing, the problem of low data generation efficiency of large language models is solved, realizing efficient and low-cost diversified data generation, supporting multi-scenario applications and rapid commercialization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies for large language models suffer from low data generation efficiency, high costs, and strong sample dependence, leading to a dilemma for enterprises when building customized AI applications: "data hunger" and "high costs," which severely restricts the speed of commercialization and large-scale application.
By configuring local large language model service nodes, input samples are preprocessed, and multiple prompt word variations are generated for each sample using a predefined prompt word template framework. Combined with asynchronous parallel processing and multi-round generation mechanisms, large language generative data is generated, and data quality is ensured through an intelligent evaluation mechanism.
It enables efficient generation of high-quality large language generative data, reduces dependence on original samples, improves resource utilization and generation efficiency, and is suitable for scenarios such as intelligent customer service training and vertical domain model fine-tuning. It significantly reduces data acquisition costs and shortens model development cycles.
Smart Images

Figure CN121809469A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and natural language processing, and in particular to a method, system, and storage medium for generating diverse data based on a large language model. Background Technology
[0002] With the widespread application of Large Language Models (LLMs) across various industries, high-quality training data has become a key factor determining model performance. Whether it's the pre-training and fine-tuning of general dialogue models or the customized development of intelligent assistants in vertical domains, both heavily rely on massive, diverse, and high-quality training data. However, the core contradiction currently facing the industry lies in two aspects: on the one hand, the demand for data scale in model training is growing exponentially (often requiring tens of thousands to millions of high-quality large language generative datasets); on the other hand, traditional data acquisition methods—whether manual annotation, web scraping and cleaning, or simple rule generation—all suffer from serious bottlenecks such as low efficiency, high cost, difficulty in quality control, and strong sample dependence.
[0003] In existing technologies, the sample reuse capability of data generation is severely insufficient. 100 original samples can often only generate 100-300 data points, leading to the need to collect a large number of expensive original samples. These technological limitations cause enterprises to face a dilemma of "data hunger" and "high costs" when building customized AI applications, which seriously restricts the speed of commercialization and large-scale application of large language model technology. Summary of the Invention
[0004] In view of this, the purpose of this invention is to propose a method, system and storage medium for generating diverse data based on a large language model, so as to solve the problems of strong sample dependence, low efficiency and high cost in the prior art.
[0005] To achieve the above objectives, this invention provides a method for generating diverse data based on a large language model, comprising the following steps: S1. Configure the local large language model service node; S2. Preprocess the input samples, including data format validation, metadata extraction, and dialogue structure analysis. S3. The input samples are processed through the service node, and multiple generation parameters are configured for each sample according to the predefined prompt word template framework, thereby generating multiple prompt word variations for each sample; S4. Generate large language generative data based on the generated prompt word variants.
[0006] Preferably, the predefined prompt word template framework includes at least one of the following: task description placeholder, example dialogue placeholder, theme direction placeholder, special requirements placeholder, and number of variations placeholder; The task description placeholders are used to populate task type description information extracted from the metadata of the input sample; The example dialogue placeholders are used to fill in the normalized string representation obtained by converting the dialogue content of the input sample; The subject-specific placeholder is used to fill in the business scenario direction parameter; The special requirement placeholder is used to fill in dialog generation constraints or requirements; The variant quantity placeholder is used to fill in the number of data rows to be generated parameter.
[0007] Preferably, the step of configuring multiple generation parameters for each sample to generate multiple prompt word variants for each sample includes: generating different prompt word variants by randomly selecting different business scenario direction parameters and sampling parameters.
[0008] Preferably, the processing of input samples in step S3 includes adapting the corresponding processing mode according to the number of input samples, and the generation of large language generative data in step S4 is based on the processing mode of step S3 and adapted to the generation logic, including: using a sample-based mode when the number of samples is sufficient; extracting dialogue structure, content features and business logic from the sample data in step S3; filling the complete example dialogue into the prompt word variants; and generating large language generative data in step S4 by learning the expression, dialogue style and information organization structure of the example dialogue. When the number of samples is insufficient but there are structural requirements, a templated mode is used. Multiple dialogue template frames are predefined. In step S3, the business scenario direction parameters in the prompt word variants are combined to creatively fill the variable area of the dialogue template frame to generate large language generative data. When there are no samples, the zero-sample mode is used, skipping the processing of sample data in step S3. In step S4, only the set task type description information and business scenario direction parameters are used to create independently and generate large language generative data.
[0009] Preferably, in step S3, the generation of each prompt word variant goes through an independent generation process and is processed in parallel.
[0010] Preferably, this method further includes: If the generation of prompt word variants in step S3 fails or the quality is substandard, retry the generation until the expected number of prompt word variants is reached or the retry limit is exceeded.
[0011] Preferably, this method further includes training the large language model using the generated large language generative data, the training steps of which include: The generated large language generative data is stored in JSON format, with each data point containing complete dialogue turn information. The data is then converted into the format required by the model according to the training requirements of different models. The generated large language generative data is used to build a training dataset and input into the fine-tuning process of the large language model. The large language generative data is converted into a "instruction-input-output" triple format. Evaluate the model's performance, identify its weaknesses or error types based on the evaluation results, adjust the generation parameters or prompt word configuration, generate supplementary data accordingly, and retrain the model until the evaluated model performance meets the set requirements.
[0012] This invention also provides a diversified data generation system based on a large language model, including several local large language model service nodes, and further comprising: The preprocessing module is used to preprocess the input samples; The service node is used to process the preprocessed input samples, configure multiple generation parameters for each sample according to the predefined prompt word template framework, thereby generating multiple prompt word variants for each sample, and generating large language generative data based on the generated prompt word variants.
[0013] The present invention also provides a smart terminal, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the above method.
[0014] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0015] The beneficial effects of this invention are: 1. This invention supports multiple rounds of generation of the same batch of samples through parameter support. A single sample can generate multiple variants, reducing the dependence on a large number of original samples. Each sample can generate multiple different variants. Content diversification is achieved by randomly selecting parameters. Based on a small number of high-quality sample templates or even 0 samples, this invention can generate a large amount of similar but different data. Through parameter control, the same template can be applied in different business scenarios. A single sample can cover multiple business scenarios, improving scenario reuse rate. When the quality of generated data does not meet the standards, the system will automatically retry multiple times, improving the utilization rate of a single sample.
[0016] 2. This invention can effectively reduce the cost of manual participation, reduce the workload of manual review, improve resource utilization, reduce the unit data generation cost, and reduce resource waste through intelligent load balancing, while caching and deduplication mechanisms avoid duplicate calculations.
[0017] 3. This invention can efficiently generate high-quality generative data for large languages, breaking through the "data bottleneck" in large-scale model applications. It is suitable for scenarios such as intelligent customer service training, vertical domain model fine-tuning, multilingual data construction, long-tail scenario supplementation, test data generation, knowledge distillation, and continuous learning. It supports low sample dependence, multi-scenario parameterized control, and parallel generation. Combined with intelligent evaluation to ensure data quality, it significantly reduces data acquisition costs, improves production efficiency, and shortens model development cycles. It is adaptable to multiple industries such as finance, healthcare, and education, as well as resource-constrained scenarios, and has extremely high commercial value and promotion prospects. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only for this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart illustrating a method for generating diverse data based on a large language model, as provided in an embodiment of the present invention. Figure 2 A block diagram of a diversified data generation system based on a large language model provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a smart terminal provided in an embodiment of the present invention; Figure 4 A flowchart of an intelligent evaluation method based on a large language model provided in an embodiment of the present invention; Figure 5 This is a flowchart illustrating the use of generated large language generative data for training a large language model, as provided in an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0021] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0022] Example 1: like Figure 1 As shown in the embodiments of this specification, a method for generating diverse data based on a large language model is provided, including the following steps: S1. Establish a distributed data generation system, configuring several local large language model service nodes. In a scheme with multiple local large language model service nodes, the multi-threaded data generation capability of this method can be extended. A service discovery mechanism manages and coordinates the service nodes in the distributed data generation system, enabling them to communicate with each other, automatically detect available services, establish a service connection pool, and implement load balancing and failover mechanisms. The number of service nodes in the distributed data generation system can be dynamically adjusted and expanded later, thus giving the system linearly scalable data generation capabilities.
[0023] S2. Preprocess the input sample data, including data format validation, metadata extraction, and dialogue structure analysis.
[0024] In this embodiment, data format verification refers to determining whether the format of the input sample data meets the requirements. If it does not meet the requirements, the sample data format can be automatically adjusted, and sample data that cannot be adjusted to the required format is discarded. Metadata extraction refers to extracting metadata from sample data. Metadata is mainly used to describe task type information, data structure, attributes, and relationships. Dialogue structure analysis refers to deconstructing the organizational form, interaction logic, and element relationships of sample data. This includes identifying the participants, the order of speaking, and the number of rounds; sorting out the ways in which topics are initiated, continued, transitioned, and ended in the dialogue; and identifying the relationships between linguistic phenomena such as reference and omission. The results of the structure analysis are recorded or the sample data is marked to provide a basis for subsequent sample segmentation and processing.
[0025] S3. If there are multiple local large language model service nodes, the sample data will be intelligently sharded according to the number of service nodes to ensure that the amount of data processed by each service node is balanced. Based on the number of service nodes, the algorithm first calculates the theoretical average amount of data, and then dynamically adjusts it according to the differences in computing power of each node to avoid some nodes being overloaded and some nodes being idle. The sharding algorithm considers data characteristics and business scenarios to ensure that the sharded data maintains the original semantic integrity and business logic. For example, samples with similar semantics and consistent business types are preferentially assigned to the same node. At the same time, the correlation degree is used to ensure that strongly correlated data is not split.
[0026] S4. The preprocessed input samples are processed by the service node. Based on the predefined prompt word template framework, multiple generation parameters are configured for each sample, thereby generating multiple prompt word variations for each sample. Specifically, this includes the following steps: The system predefined prompt template framework (command_prompt) includes configurable areas such as task description placeholder {meta_description}, example dialogue placeholder {conversation_str}, topic direction placeholder {direction}, special requirements placeholder {special}, and number of variations placeholder {num_variants}.
[0027] Extract the task type description information (such as "entity extraction task", "question rewriting task", etc.) recorded in the metadata of the input sample and fill it into the {meta_description} placeholder. This provides the model with a clear and unambiguous guidance on the generation target and avoids the model from misjudging the task type. Example Dialogue Formatting: The dialogue content of the input sample is standardized, including removing redundant symbols and unifying the expression style, and is converted into a regular string format. If there are multiple rounds of dialogue, the interaction content of each round is concatenated in the format of "Human:[User Input]\nAssistant:[Assistant Reply]\n" to ensure the logical coherence of the context. The processed complete content is then filled into the {conversation_str} placeholder to provide the model with an intuitive and standardized generation style reference and ensure the consistency of the model's output style.
[0028] Direction parameter injection: Randomly select a specific business scenario direction (such as "credit card annual fee", "stock trading", "medical consultation" etc.) from the pre-configured directions parameter list. After verifying the suitability of the scenario with the current task, inject it into the {direction} placeholder to guide the model to focus on generating data for a specific business scenario, so that the output content is more in line with the context and needs of the actual business scenario.
[0029] Special constraint addition: Based on the rules pre-configured in the special_prompt parameter, additional generation constraints (such as format specifications, content boundaries, quality standards, etc.) are added to the prompt words and filled into the {special} placeholder to ensure that the data generated by the model meets the preset requirements in terms of format, content, quality, etc., thereby improving data validity.
[0030] Variant number setting: Accurately fill the {num_variants} placeholder with the specific value of the variants_per_sample parameter to clearly tell the model the number of data variants to be generated, so as to meet the data volume requirements in different scenarios.
[0031] Prompt assembly: Integrate the above components according to the predefined prompt template framework, replace all placeholder parameters through the string format (format()) method, and generate complete prompts that the model can directly accept after integrity verification, ensuring that the input information is complete and error-free, and finally generate complete prompts that the model can directly input.
[0032] Through this dynamic construction mechanism, the system can automatically complete the adaptive construction of prompt words based on the feature differences of input samples, changes in business requirements, and configuration of generation parameters. The entire process requires no manual intervention, which not only improves the efficiency of prompt word generation but also ensures its matching degree with actual needs.
[0033] S5. Generate large language generative data based on the generated prompts: Specifically, the deployed large language model is called via an HTTP API interface, and the constructed prompts and complete generation parameters are synchronously transmitted to the large language model. The generation results can be adjusted by configuring various model parameters, including but not limited to temperature parameters, maximum token count, and generation strategies. The temperature parameter is used to control the randomness of the generated content; for example, lower temperatures correspond to more deterministic outputs, while higher temperatures correspond to more diverse expressions. The maximum token count limits the length boundary of a single generated content item, and the generation strategy can be preset to specific modes such as continuation, rewriting, and summarization to ensure precise and controllable generation direction. To cope with high-concurrency scenarios, the call process adopts an asynchronous processing mechanism. Through non-blocking IO design and task queue buffering, a large number of requests are received and processed in parallel and in an orderly manner, avoiding efficiency losses caused by request congestion. The large language generative data in this invention refers to the data output by the large language model, which, in addition to dialogue data, also includes various model products such as generated text, code, summaries, and translation results.
[0034] As one implementation method, this approach creates a distributed asynchronous task queue, ensuring complete independence for each service node in task processing. Based on real-time status such as node computing power and current load, an independent generation task is dynamically allocated to each service node. The task scheduler employs an asynchronous concurrent scheduling mechanism, allowing multiple service nodes to execute tasks simultaneously while maintaining resource isolation. This effectively avoids resource contention between nodes, maximizes the utilization of system resources such as CPU and memory, and significantly improves overall data generation efficiency. Each task assigned to a node includes complete generation parameter configurations, including but not limited to preset generation directions (such as specific business scenarios), the required number of variants, and quality thresholds (such as semantic accuracy and format compliance requirements), ensuring that each node can independently complete the task loop without relying on intermediate results from other nodes.
[0035] As one implementation method, this approach supports multiple rounds of generation operations on the same batch of samples, and also supports using the high-quality large language generative data generated in step S5 as new sample data for multiple rounds of expansion. By configuring round parameters to control the number of generation iterations, each round of generation fine-tunes prompt words or model parameters based on previous results to generate data variants with new features, fully exploring the potential value of the samples and maximizing data utilization. To avoid data conflicts or quality fluctuations between rounds, the system maintains a balance between data consistency and diversity through preset rules. Consistency is reflected in the stable continuation of core semantics and business logic, while diversity is achieved by introducing synonym replacement, sentence structure transformation, and detail supplementation. Simultaneously, similarity checks prevent excessive repetition between variants.
[0036] After multiple rounds of data generation are completed, the results of all rounds need to be intelligently merged: First, data deduplication is performed by comparing text hashes and calculating semantic similarity to remove completely duplicate or highly similar content; then, the remaining data is sorted according to quality assessment indicators (such as relevance to the task objective, language fluency, compliance, etc.) to select high-quality samples; finally, the quantity is controlled according to the preset quantity requirements, which can be achieved by retaining the top-ranked samples or by proportional sampling. The final output dataset ensures that it is free of redundancy and has sufficient diversity and quality to meet the needs of subsequent applications.
[0037] As one implementation, the processing of input samples in step S4 includes adapting a corresponding processing mode according to the number of input samples, and the generation of large language generative data in step S5 is based on the processing mode of step S4 adapted to the generation logic, including: Determine the quantity and quality of the input samples and select a suitable generation mode, specifically including: When sufficient high-quality original samples are available, the sample-based generation mode is selected. In this mode, the method performs multi-dimensional analysis of the sample data, deeply extracting the structural features of the dialogue (such as the number of turns, the rhythm of role interaction, and topic transition nodes), content features (such as the usage habits of professional terms, sentence style, and information density distribution), and business logic (such as the process from problem statement to solution and the core logic of demand response). After analysis, complete and characteristic example dialogues are accurately filled into the {conversation_str} area of the prompt words. After receiving the prompt words, the model focuses on learning the details of expression, dialogue style, and information organization framework in the examples. Based on this, combined with task requirements and business direction, it generates new dialogues with a structure that highly matches the samples but without repeating the core content. The core advantage of this mode is the accurate replication of the sample style, which is suitable for scenarios with clear mature sample references, such as expanding customer service dialogues in mature business lines and generating professional dialogues in specific fields. It can ensure that the generated data and the original samples maintain a high degree of consistency in terms of terminology, response logic, and interaction style.
[0038] When the number of original samples is extremely small or non-existent, a zero-sample generation mode is activated. In this mode, the method does not rely on specific example dialogue inputs, but only uses the task description and business direction as the core basis for generation. The task description clearly defines the generation goal, such as "building a product consultation dialogue" or "generating a problem-solving dialogue"; the business direction locks in the scenario context, such as "smart home operation and maintenance" or "cross-border e-commerce after-sales service". At this time, the {conversation_str} area in the prompt is empty, or only the basic format description "Human:[user input]\nAssistant:[assistant reply]" is retained. The model will call on the general dialogue capabilities and scenario knowledge base accumulated during its own training process, and combine the core requirements of the task definition and the contextual norms of the business scenario to autonomously create and generate large language generative data that conforms to the task goal and scenario characteristics. The core value of this mode lies in the flexibility of scenario adaptation. It is suitable for scenarios that lack sample support, such as the initial dataset building of new business launches and the generation of dialogues in niche fields, and can build a dataset that meets basic usage needs from scratch.
[0039] When the number of original samples falls between the two scenarios mentioned above, the template-based generation mode is selected. As a hybrid generation solution bridging the first two modes, this mode balances structural standardization and content diversity. In this mode, the method pre-constructs multiple dialogue template frameworks tailored to different business scenarios. Each template not only clearly defines the overall structure of the dialogue but also defines required fields and variable areas. When constructing prompts, the template's structural definition, functional descriptions of each part, and filling rules are fully embedded, while business direction parameters are incorporated to clarify scenario boundaries. During the model generation process, it strictly adheres to the template's structural framework and required field requirements, ensuring a consistent dialogue format and complete core information. Simultaneously, it creatively fills in variable areas based on business direction, enriching the content by replacing different cases, adjusting the expression angle, and supplementing scenario-based details. This model is suitable for scenarios with clear requirements for dialogue structure, but which need to achieve data diversity through content changes. Taking customer service dialogue generation as an example, the template can define a fixed five-round structure of "greeting guidance - problem statement - information verification - solution provision - satisfaction confirmation". The model generates specific content in each round around different business directions such as "home appliance repair" and "mobile phone after-sales service", which ensures both format compliance and avoids content homogenization.
[0040] After generating large-scale language generative data, this method also includes structured parsing of the generated results returned by the model, extracting dialogue content, metadata information, business tags, etc. The parsing process includes steps such as JSON format validation, content integrity checks, and format standardization to ensure the structured nature of the generated data.
[0041] As one implementation method, in the generation of large language generative data, this approach generates multiple different data variants for a single original sample. The specific generation scale of the variants is precisely controlled by the `variants_per_sample` parameter, which can meet the needs of a small number of variants required for small-scale testing as well as adapt to the massive number of variants required for large-scale training. `variants_per_sample` is an integer parameter that defines the number of variants to be generated for each input sample. This parameter is set during system initialization and passed to the processing flow of each service node. For example, setting `variants_per_sample=3` will generate 3 different large language generative data for each sample.
[0042] To ensure the distinctiveness and diversity of each variant, each variant undergoes an independent generation process. This is achieved by randomly selecting different directions and adjusting model sampling parameters (such as temperature, seed, and top_p parameters controlling the model sampling token), ensuring significant differences between generated variants. Specifically, when calling the model, parameters such as temperature and business direction are specifically adjusted to prevent duplicate variant content from the outset. Simultaneously, variant generation employs an efficient parallel processing mechanism. The system allocates an independent processing thread or service node to each variant, allowing multiple variants to synchronously advance the generation process within the same timeframe. This significantly reduces overall generation time and substantially improves generation efficiency while maintaining variant quality and diversity.
[0043] At the code implementation level, the system uses a loop structure to handle the generation of multiple variants for each sample. It executes `variants_per_sample` LLM calls on a single sample, with each call returning a result as an independent variant. Quality assessment and filtering are then performed after all variants have been collected.
[0044] As one implementation method, this approach employs a dynamic adjustment mechanism. After each variant generation is completed, if any anomalies such as data generation failure, format errors, or content quality issues are detected, the system automatically triggers a retry generation process. The number of retries is pre-set by the `sample_retry_times` parameter. Specific detection mechanisms include API call failure detection, result parsing error detection, and content quality assessment. Content quality issues refer to generated content failing to meet core task requirements, such as semantic deviation from business direction, non-compliant formatting, or logical contradictions. When an unqualified situation is detected, to improve the retry success rate, the system optimizes the generation configuration for each retry, including exponential backoff, parameter adjustment, and prompt word optimization. For example, it might fine-tune the model's temperature parameters, adjust the details of prompt word descriptions, or switch to a more adaptable generation strategy to avoid recurring similar failures. If the number of retries reaches the parameter-set upper limit without generating a qualified variant, the system records the anomaly and terminates the retry, including error logging, failure cause analysis, and resource cleanup, then focuses on generating other samples or variants to ensure stable system operation even under abnormal conditions. If a valid variant is generated within the retry limit, the process continues until the final number of valid variants fully meets the preset requirements, ensuring that the overall data volume meets the standard.
[0045] As one implementation method, the final scale of generated large-scale language generative data can be defined by a clear formula, providing a clear quantitative basis for data generation planning. Specifically, the total generated data volume equals the number of samples multiplied by the number of variants per sample multiplied by the number of generation rounds. Here, the number of samples refers to the total number of valid samples initially input into the system, after which invalid or duplicate samples need to be removed through preliminary screening; the number of variants per sample (variants_per_sample) represents the number of different variants planned to be generated for each valid sample; and the number of generation rounds (data_rounds) represents the number of times the generation process is repeated for the same batch of samples. For example, if the initial input consists of 100 filtered valid samples, the number of variants per sample is set to 3, and the number of generation rounds is 10, then the theoretical total generated data volume can be calculated as 100 multiplied by 3 multiplied by 10, resulting in 3000 data entries. It should be noted that this value is a theoretical value without quality screening; the actual final output data volume will be reduced due to subsequent quality checks, deduplication, and other processes.
[0046] This method achieves precise control over the business scenario of the generated data through direction parameters, i.e., the {direction} placeholders in the prompt words, thereby supporting automated adaptation across multiple business domains. To improve the efficiency and accuracy of scenario adaptation, this method pre-builds a rich library of business scenario templates, covering multiple mainstream domains such as financial consulting, customer service, and product introduction. Each template contains core elements such as typical dialogue logic, professional terminology system, and interaction rhythm characteristics for the corresponding scenario. When specific scenario data needs to be generated, the most suitable scenario template in the template library is automatically matched based on the specific content of the direction parameters, while the key configurations in the template are integrated into the prompt word construction process. The direction parameters are carried by the string list, and each element in the list corresponds to a specific business scenario or topic direction, which can clearly define the subject scope of the generated content. For example, the direction list in the financial field can be set to ["credit card annual fee", "stock liquidation", "fund redemption", "loan interest rate", "account security"], providing a clear basis for scenario control.
[0047] When constructing prompts for each sample, the system uses a random sampling function (random.choice()) to select a direction from the list of directions. This randomness ensures that the generated data covers a variety of business scenarios, effectively avoiding the concentration of the generated dataset in a few popular scenarios. This allows the final generated dataset to evenly cover all scenarios in the list of directions, providing more comprehensive scenario adaptation capabilities for model training and reducing the problem of insufficient model generalization performance caused by a single scenario.
[0048] The selected direction string is injected into the {direction} area of the generated prompt, serving as a "topic direction" instruction passed to the model to accurately guide the scene direction. When generating dialogue, the model constructs content around this direction. For example, when direction="credit card annual fee", the generated dialogue will involve content related to annual fee inquiries, waiver policies, and billing rules.
[0049] By randomly selecting different directions during multiple generation processes, the same sample can be used to generate data for multiple business scenarios, achieving multi-scenario coverage. Even if the initial input is the same sample, after being guided by different scenario directions, diverse data variants corresponding to different business scenarios can be generated. Taking an original "consultation dialogue" sample as an example, its core dialogue structure (such as the turn logic of "user asks a question - assistant responds - user asks follow-up questions - assistant explains in detail") remains stable, but by combining different direction parameters, dialogue variants for various scenarios such as "credit card annual fee consultation," "loan interest rate consultation," and "financial product consultation" can be generated. This reuse mechanism greatly improves the utilization efficiency of the original sample, eliminating the need to prepare a large number of original samples for each business scenario; the scenario coverage of the dataset can be expanded simply by switching scenario directions.
[0050] As one implementation method, the `directions` parameter in this approach supports fine-grained, hierarchical definition of business scenarios. This multi-level description enables more precise scenario control, meeting the generation requirements of specific business processes. The definition can employ a hierarchical structure of "domain—category—sub-scenario," using clear separation logic to distinguish different levels. For example, in the personal loan scenario within the financial field, the `directions` list can be defined as ["personal loan - mortgage - interest rate adjustment", "personal loan - mortgage - early repayment", "personal loan - auto loan - approval process"], achieving three-level scenario control. When the system selects this type of fine-grained direction parameter, it guides the model to focus on generating content for the lowest-level sub-scenario, ensuring that the generated data accurately matches the actual needs of the business process.
[0051] Each business domain can define its own list of directions. The financial domain focuses on transactions, accounts, and products; the medical domain focuses on symptoms, diagnosis, and treatment; and the education domain focuses on courses, assignments, and exams. When switching business domains, simply load the corresponding domain's list in the configuration module, and the system will automatically generate data according to the new scenario direction, significantly reducing the cost and time required for cross-domain adaptation.
[0052] Through this parameterized control, the system can flexibly adjust the scale of data generation, expanding the dataset by increasing the number of variants when the sample size is limited.
[0053] Correspondingly, this embodiment also provides a diversified data generation system based on a large language model, such as Figure 2 As shown, it includes multiple local large language model service nodes 103, and also includes: Preprocessing module 101 is used to preprocess the input samples; The sharding module 102 is used to intelligently shard the preprocessed samples according to the number of service nodes, so that the amount of data processed by each service node is balanced. The service node 103 is used to process the input samples, configure multiple generation parameters for each sample according to the predefined prompt word template framework, thereby generating multiple prompt word variations for each sample, and generating large language generative data based on the generated prompt words.
[0054] Through the above methods and systems, the generation efficiency of large language generative data is greatly improved. A single A100 environment using the MOE235B-A22b parametric model can process 256+ inferences simultaneously, with an average generation speed of 10-200 high-quality data points per minute (depending on model complexity and the number of output tokens).
[0055] Furthermore, through variant generation and multi-round generation, the dependence on the original samples is reduced. Based on a small number of high-quality sample templates or even 0 samples, a large amount of similar but different data can be generated through prompt engineering. 100 original samples can generate 1000-3000 training data, with an expansion ratio of 10:1 to 30:1. Through parameters, a single sample can cover multiple business scenarios, improving the scenario reuse rate.
[0056] This method effectively reduces labor costs, significantly improves computing costs, enhances resource utilization, avoids redundant calculations, allows for rapid customization of prompt word templates, shortens adaptation time from days to hours, and supports multiple vertical sectors such as finance, healthcare, and education.
[0057] like Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a smart terminal provided in an embodiment of this application. The smart terminal 200 of this embodiment includes: a processor 220 ( Figure 3 Only one is shown in the diagram), memory 210, and computer program 211 stored in memory 210 and executable on at least one memory 210. Memory 210 executes computer program 211 to send a request to processor 220, and processor 220 returns a result to implement the steps in the above method embodiments.
[0058] The following are examples of automatic adaptation of this method and system in different business domains: Case 1: Financial Sector - Banking Business Scenario Directions Configuration: ["Credit Card Annual Fee Waiver", "Debit Card Loss Reporting and Replacement", "Wealth Management Product Return Inquiry", "Loan Limit Application", "Foreign Exchange Rate", "Account Transfer Limit", "Credit Score Inquiry"] Adaptation Effect: Based on general customer service dialogue samples, the system automatically generates dialogue data covering 7 financial business scenarios, including business-specific terminology, process steps, numerical calculations, etc., without the need for manual writing of financial knowledge. Generation Example: When inputting a three-round dialogue sample of "Consultation-Inquiry-Answer", with direction="Credit Card Annual Fee Waiver", the system generates a dialogue of "User inquires about annual fee → Customer service inquires about card type → Provides waiver conditions and application process".
[0059] Case 2: Healthcare - Symptom Consultation Scenario Directions Configuration: ["Headache Symptom Diagnosis", "Fever Medication Suggestions", "Skin Allergy Treatment", "Chronic Disease Follow-up Reminder", "Physical Examination Report Interpretation", "Vaccination Consultation", "Nutritional Recommendations"] Adaptation Effect: Generates doctor-patient dialogue data for different symptoms and health problems, including standard medical consultation processes such as symptom description, preliminary judgment, medical advice, and precautions. Example Generation: Based on the medical consultation template, when direction="Fever Medication Suggestions", a complete consultation dialogue is generated: "Temperature Inquiry → Symptom Verification → Medication Recommendation → Medication Contraindications → Follow-up Visit Reminder".
[0060] Case 3: E-commerce - After-sales Service Scenario Directions Configuration: ["Product Return and Exchange Process", "Logistics Information Inquiry", "Invoice Issuance Application", "Coupon Usage Rules", "Member Points Redemption", "Product Quality Complaint", "Promotional Activity Inquiry"] Adaptation Effect: Generates e-commerce customer service dialogues covering the entire pre-sales, sales, and after-sales process, automatically including e-commerce business elements such as order number, product information, and logistics status. Example: When the dialogue framework "Problem-Inquiry-Solution" is entered, and direction="Product Return and Exchange Process" is set, a dialogue of "Return Reason → Order Inquiry → Return Condition Judgment → Return Process Explanation → Logistics Arrangement" is generated.
[0061] Case 4: Education Sector - Online Learning Scenario Directions Configuration: ["Course Assignment Submission", "Exam Score Inquiry", "Learning Progress Tracking", "Course Content Q&A", "Learning Material Download", "Group Discussion Organization", "Certificate Application Process"] Adaptation Effect: Generates educational scenario dialogues such as teacher-student interaction and learning support, automatically including educational elements such as course name, assignment requirements, and grading criteria. Example Generation: When direction="Course Assignment Submission", it generates a teaching dialogue of "Student inquires about submission method → Teacher explains format requirements → Deadline reminder → Submission confirmation".
[0062] Case 5: Smart Home - Device Control Scene Directions Configuration: ["Air Conditioner Temperature Adjustment", "Lighting Brightness Control", "Curtain Opening / Closing Operation", "Security System Settings", "Home Appliance Scheduled Tasks", "Scene Mode Switching", "Device Troubleshooting"] Adaptation Effect: Generates a human-computer interaction control dialogue, including smart home-specific content such as device status, control commands, and feedback confirmation. Example: When direction="Air Conditioner Temperature Adjustment", a control dialogue is generated: "User issues temperature adjustment command → System confirms current temperature → Executes adjustment → Feedback of new temperature".
[0063] Case 6: Legal Consultation - Contract Review Scenario Directions Configuration: ["Employment Contract Clauses", "Lease Contract Disputes", "Breach of Contract in Sales Contracts", "Risks in Loan Agreements", "Validity of Confidentiality Agreements", "Scope of Power of Attorney", "Partnership Agreement Distribution"] Adaptation Effect: Generates a legal consultation dialogue, including legal terminology, clause analysis, risk warnings, and solution suggestions. Example: When direction="Employment Contract Clauses", a professional consultation dialogue is generated: "Consultation on the legality of contract clauses → Lawyer analyzes key clauses → Points out potential risks → Provides modification suggestions".
[0064] As demonstrated by the above examples, the system only needs to configure a list of directions parameters relevant to the business domain, without modifying the code or model, to automatically adapt to the data generation needs of different vertical domains. This parameterized business scenario control mechanism gives the system broad cross-domain applicability.
[0065] Example 2: This embodiment provides an intelligent evaluation method based on a large language model, such as... Figure 4 As shown, it includes: S100. First, establish a dual evaluation framework to achieve comprehensive quality control of generated data through the collaboration of rule-based evaluation and model evaluation. Rule-based evaluation verifies the data's format standardization (e.g., whether it conforms to the preset JSON structure and whether field naming is consistent), structural integrity (e.g., whether the dialogue rounds are complete and whether core information is missing), and business logic rationality (e.g., whether the dialogue content fits the specified business scenario and is free of logical contradictions), ensuring that the data meets the basic requirements for subsequent use. Model evaluation, on the other hand, relies on the deep understanding capabilities of the large language model to focus on evaluating content quality (e.g., language fluency, professionalism of expression, and absence of redundancy and repetition), semantic accuracy (e.g., core viewpoints are consistent with the business direction and there is no ambiguity or error information), and business value (e.g., whether it can meet the actual application needs such as model training and business simulation), thus making up for the shortcomings of rule-based evaluation in the flexible quality dimension.
[0066] S101. Building upon the dual evaluation mechanism, a comprehensive four-dimensional scoring system is further established, encompassing task compliance, format correctness, content quality, and data diversity, to ensure quantifiable and objective evaluation results. Clear scoring criteria are defined for each dimension. Furthermore, weights are allocated based on the priority requirements of the business scenario, and a weighted calculation is used to derive the comprehensive quality score for each sample, avoiding biases caused by single-dimensional evaluation.
[0067] S102. To adapt to different business needs and data characteristics, this evaluation method also introduces a dynamic threshold control mechanism to flexibly adjust quality admission standards and set quality requirements according to business needs and data characteristics. Threshold control includes minimum score requirements, pass rate control, and quality distribution management. The minimum score requirement sets the lowest overall score for a sample to pass; samples below this score are directly judged as unqualified and removed. Pass rate control ensures that the final amount of qualified data meets usage requirements based on the overall quality goals of the dataset. Quality distribution management uses threshold adjustment to ensure a reasonable distribution of quality scores for qualified samples, guaranteeing basic quality while maintaining a certain quality gradient to adapt to different application scenarios. The entire threshold adjustment process supports manual configuration or automatic optimization by the system based on historical data, achieving precise matching between quality requirements and business needs.
[0068] Through the aforementioned evaluation methods, a dual evaluation mechanism ensures data quality, raising the pass rate to over 85%, and achieving an LLM-as-Judge evaluation accuracy of over 90%, approaching the level of human evaluation. A multi-dimensional scoring system comprehensively covers data quality requirements. Rule-based evaluation ensures 100% format standardization, increases content diversity by 40%, effectively avoids data duplication, and improves domain-specific accuracy.
[0069] Example 3: The dialogue data generated by the above methods can be used for training large language models, such as... Figure 5 As shown, the specific steps include: S200: The generated dialogue data is stored in JSON format, with each data entry containing complete dialogue turn information. Depending on the training requirements of different models, the stored JSON data can be flexibly converted to various target formats. For example, for instruction fine-tuning tasks, it can be converted to a standard "instruction-input-output" instruction fine-tuning format; for training dialogue generation models, the original multi-turn dialogue structure can be preserved; and for training question-answering models, it can be converted to a concise question-answering format, ensuring that the data can directly meet the training input requirements of different models.
[0070] S201. After quality assessment and screening, the generated data can be directly used to construct the training dataset. Two data partitioning methods are available: one is to automatically split the data according to a preset ratio (e.g., 80% for training set, 10% for validation set, and 10% for test set); the other is to support stratified sampling according to dimensions such as business scenario, data source, and quality level to ensure that each partitioned dataset can evenly cover the core scenario and data features.
[0071] S202. Input the generated dataset into the fine-tuning process of the large language model. For instruction fine-tuning tasks, convert the dialogue data into "instruction-input-output" triplet format; if it is a dialogue model-specific training, fully preserve the turn structure, role interaction logic and contextual association of multi-turn dialogues to ensure that the model can learn real dialogue interaction patterns; if it is a task-specific model, extract input-output pairs directly related to the task from the dialogue data.
[0072] S203. After model training is complete, use a test set to evaluate model performance. Based on the evaluation results, identify the model's weaknesses or error types, adjust direction parameters or prompt word configurations, and generate supplementary data accordingly. After the supplementary data is generated, integrate it into the training set and restart model fine-tuning. Through a closed-loop iteration of "generation-training-evaluation-optimization," continuously improve model performance and data quality.
[0073] For scenarios with existing small-scale, high-quality data, the system-generated data can be used as a data augmentation technique to expand the training set size and improve the model's generalization ability and robustness. This augmentation method does not require additional collection of original samples and can quickly fill the scenario gaps and quantity deficiencies in the original dataset, effectively improving the model's generalization ability. This application is particularly suitable for supplementing data in long-tail business scenarios and low-frequency intents. By enriching the sample quantity in these scenarios, it solves the problem of low model response accuracy and poor adaptability in niche scenarios, allowing the model to maintain stable performance across all business scenarios.
[0074] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples; within the framework of the invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in the details for the sake of brevity.
[0075] This invention is intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for generating diverse data based on a large language model, characterized in that, Includes the following steps: S1. Configure the local large language model service node; S2. Preprocess the input samples; S3. The preprocessed input samples are processed by the local large language model service node. According to the predefined prompt word template framework, multiple generation parameters are configured for each sample, thereby generating multiple prompt word variants for each sample. S4. Generate large language generative data based on the generated prompt word variants.
2. The method for generating diverse data based on a large language model according to claim 1, characterized in that, The predefined prompt word template framework includes at least one of the following: task description placeholder, example dialogue placeholder, theme direction placeholder, special requirements placeholder, and number of variations placeholder; The task description placeholders are used to populate task type description information extracted from the metadata of the input sample; The example dialogue placeholders are used to fill in the normalized string representation obtained by converting the dialogue content of the input sample; The subject-specific placeholder is used to fill in the business scenario direction parameter; The special requirement placeholder is used to fill in dialog generation constraints or requirements; The variant quantity placeholder is used to fill in the number of data rows to be generated parameter.
3. The method for generating diverse data based on a large language model according to claim 2, characterized in that, The method involves configuring multiple generation parameters for each sample to generate multiple prompt word variants for each sample, including generating different prompt word variants by randomly selecting different business scenario direction parameters and sampling parameters.
4. The method for generating diverse data based on a large language model according to claim 1, characterized in that, The processing of input samples in step S3 includes adapting the processing mode according to the number of input samples, and the generation of large language generative data in step S4 is based on the processing mode adapted to the generation logic in step S3, including: When there are enough samples, a sample-based model is used. In step S3, the dialogue structure, content features and business logic are extracted from the sample data, and the complete example dialogue is filled into the prompt word variant. In step S4, large language generative data is generated by learning the expression, dialogue style and information organization structure of the example dialogue. When the number of samples is insufficient but there are structural requirements, a templated mode is used. Multiple dialogue template frames are predefined. In step S3, the business scenario direction parameters in the prompt word variants are combined to creatively fill the variable area of the dialogue template frame to generate large language generative data. When there are no samples, the zero-sample mode is used, skipping the processing of sample data in step S3. In step S4, only the set task type description information and business scenario direction parameters are used to create independently and generate large language generative data.
5. The method for generating diverse data based on a large language model according to claim 1, characterized in that, In step S3, the generation of each of the prompt word variants is carried out through an independent generation process and is processed in parallel.
6. The method for generating diverse data based on a large language model according to claim 1, characterized in that, The method further includes: If the generation of prompt word variants in step S3 fails or the quality is substandard, retry the generation until the expected number of prompt word variants is reached or the retry limit is exceeded.
7. The method for generating diverse data based on a large language model according to claim 1, characterized in that, The method further includes: after step S4, training the large language model using the generated large language generative data, the training steps including: The generated large language generative data is stored in JSON format, with each data point containing complete dialogue turn information. The data is then converted into the format required by the model according to the training requirements of different models. The generated large language generative data is used to build a training dataset and input into the fine-tuning process of the large language model. The large language generative data is converted into a "instruction-input-output" triple format. Evaluate the model's performance, identify its weaknesses or error types based on the evaluation results, adjust the generation parameters or prompt word configuration, generate supplementary data accordingly, and retrain the model until the evaluated model performance meets the set requirements.
8. A diversified data generation system based on a large language model, characterized in that, Including several local large language model service nodes, and also: The preprocessing module is used to preprocess the input samples; The service node is used to process the preprocessed input samples, configure multiple generation parameters for each sample according to the predefined prompt word template framework, thereby generating multiple prompt word variants for each sample, and generating large language generative data based on the generated prompt word variants.
9. A smart terminal, characterized in that, The smart terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 7.