Medical instruction data generation method and device, storage medium and equipment

By dividing basic medical tasks and processing multiple iterations, high-quality medical instruction data is generated, which solves the problem of insufficient quality generation of traditional Chinese medicine instruction data in the existing technology, and achieves wider coverage and higher user consultation experience.

CN120048556APending Publication Date: 2025-05-27ANHUI IFLYHEALTH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510137420.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-07
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

Existing methods for generating medical instruction data are insufficient in generating high-quality medical instruction data, especially in capturing the complexity of complex problems in the medical field and meeting the specific needs of large-scale medical models in compliance with instructions.

Method used

Generate multiple levels of task seed sets by taking and dividing basic tasks related to medicine. Then, preset constraints are added to the instruction data in these seed sets, and multiple iterations are used to process them using the large language model to generate medical instruction data with different preset constraints.

Benefits of technology

It improves the generation quality and coverage of medical instruction data, meets the training needs of high-performance medical big models, and thus improves the user's consultation experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120048556A_ABST
    Figure CN120048556A_ABST
Patent Text Reader

Abstract

The invention discloses a medical instruction data generation method and device, a storage medium and equipment. The method comprises the steps that firstly, basic tasks related to medicine are acquired; dividing the basic task to obtain M levels of tasks; wherein M is a positive integer greater than 0; then generating a seed set corresponding to each type of task in the task data of the M levels; a preset constraint condition is added to the instruction data in the seed set, a prompt instruction prompt is combined, the instruction data are input into a preset large language model, N times of iteration processing is carried out on the instruction data, N pieces of medical instruction data which are generated based on the instruction data and have different preset constraint conditions are obtained, and N is a positive integer larger than 1. Therefore, the generation efficiency and accuracy (quality) of the medical instruction data can be improved, a high-quality medical large model is trained, and then the inquiry experience of a user can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of natural language processing, and in particular, to a method, device, storage medium and equipment for generating medical instruction data. Background Art

[0002] In the field of medical large model consultations, generating high-quality synthetic medical instruction data is crucial for training large machine learning models. This is because instruction data can unify tasks and endow the model with the ability to converse. Training and optimizing a medical consultation large model using high-quality medical instruction data can make the model's conversation performance stronger, thereby improving the model's performance in the case of user online consultations.

[0003] Currently, existing instruction data generation methods generally include two ways: one is to generate instruction data through the SELF-INSTRUCT framework. Although this method can generate diverse tasks, for complex problems in the medical field, this method may not be able to fully capture all the complexities of the instructions and is not applicable in the context of the high standards and solemnity of professional medical large models. The second is to construct instruction data through the instruction backtranslation method. However, the enhanced data of this method comes from publicly available network resources, which may pose challenges in instruction quality control and may have insufficient coverage for specific fields such as medical tasks, and cannot fully meet the specific requirements of professional medical large models in following instructions. It can be seen that both of these existing methods for generating instruction data have significant problems, which will affect the generation quality of medical instruction data. Summary of the Invention

[0004] The main purpose of the embodiments of the present application is to provide a method, device, storage medium and equipment for generating medical instruction data, which can improve the generation quality of medical instruction data, be used to train a high-performance medical large model, and thus can improve the user's consultation experience.

[0005] The embodiments of the present application provide a method for generating medical instruction data, including:

[0006] Obtaining medical-related basic tasks; and dividing the basic tasks to obtain tasks of M levels; M is a positive integer greater than 0;

[0007] Generating a seed set corresponding to each type of task among the M-level tasks;

[0008] Adding preset constraint conditions to the instruction data in the seed set, and combining with a prompt instruction prompt, inputting it into a preset large language model, and performing N iterative processes on the instruction data to obtain N medical instruction data with different preset constraint conditions generated based on the instruction data; N is a positive integer greater than 0.

[0009] In one possible implementation, dividing the basic task to obtain tasks of M levels includes:

[0010] Dividing the basic task according to the patient's inquiry record from the doctor to obtain tasks of M levels; wherein, the task is used to indicate at least one of an operation target, a specific operation scope, a specific execution method, and an application scenario.

[0011] In one possible implementation, the preset constraint condition belongs to at least one constraint dimension among the content dimension, the format dimension, the scenario dimension, and the logic dimension.

[0012] In one possible implementation, the constraint conditions in the content dimension include at least one of a word count limit, a quantity item limit, generating detailed subtasks, must start or end with a preset content, restricted to start or end with a preset content, a limit on the included content, restricted from including a specified content, generating background information; the constraint conditions in the format dimension include at least one of a limit on the output content format, a limit on the output content style, a limit on the output content including a preset symbol; the constraint conditions in the scenario dimension include at least one of a limit on a specific scenario, generating a role; the constraint conditions in the logic dimension include at least one of reasoning of medical values, reasoning of dates, construction of a thought chain.

[0013] In one possible implementation, the N pieces of medical instruction data with different preset constraint conditions include simple medical instruction data, intermediate instruction data, and complex medical instruction data.

[0014] In one possible implementation, the method further includes:

[0015] During the process of using the large language model to perform N iterations of processing to generate medical instruction data, for each generated medical instruction data, using the large language model to perform a rationality check on the generated medical instruction data and its added preset constraint conditions to obtain a check result.

[0016] In one possible implementation, the seed set includes instruction data and additional input data; the instruction data is used to represent the specific operations necessary for performing the corresponding category of tasks; the additional input data is used to represent the additional information or data required when executing the instructions in the instruction data.

[0017] The embodiment of the present application also provides a medical instruction data generation device, including:

[0018] A division unit, configured to obtain a basic task related to medicine; and divide the basic task to obtain tasks of M levels; M is a positive integer greater than 0;

[0019] A generation unit for generating a seed set corresponding to each type of task in the M-level task data.

[0020] An input unit for adding preset constraint conditions to the instruction data in the seed set, combining with a prompt instruction prompt, and inputting it into a preset large language model to perform N iterative processes on the instruction data to obtain N medical instruction data with different preset constraint conditions generated based on the instruction data; N is a positive integer greater than 0.

[0021] In a possible implementation, the partitioning unit is specifically configured to:

[0022] According to the patient's inquiry record about the doctor, partition the basic task to obtain M-level tasks; where the task is used to indicate at least one of the operation target, the specific operation scope, the specific execution method, and the application scenario.

[0023] In a possible implementation, the preset constraint conditions belong to at least one constraint dimension among the content dimension, the format dimension, the scenario dimension, and the logic dimension.

[0024] In a possible implementation, the constraint conditions in the content dimension include at least one of the word count length limit, the quantity item limit, generating detailed subtasks, must start or end with a preset content, restricted to start or end with a preset content, the limit of the included content, restricted not to include specified content, generating background information; the constraint conditions in the format dimension include at least one of the limit of the output content format, the limit of the output content style, the limit of the output content containing preset symbols; the constraint conditions in the scenario dimension include at least one of the limit of the specific scenario, generating roles; the constraint conditions in the logic dimension include at least one of the reasoning of medical values, the reasoning of dates, the construction of the thinking chain.

[0025] In a possible implementation, the N medical instruction data with different preset constraint conditions include simple medical instruction data, intermediate instruction data, and complex medical instruction data.

[0026] In a possible implementation, the device further includes:

[0027] A verification unit for, during the process of generating medical instruction data by performing N iterative processes using the large language model, for each generated medical instruction data, using the large language model to perform a rationality verification on the generated medical instruction data and its added preset constraint conditions to obtain a verification result.

[0028] In one possible implementation, the seed set includes instruction data and additional input data; the instruction data is used to represent the specific operations necessary for performing corresponding category tasks; the additional input data is used to represent additional information or data required when executing the instructions in the instruction data.

[0029] An embodiment of the present application also provides a medical instruction data generation device, including: a processor, a memory, and a system bus;

[0030] The processor and the memory are connected through the system bus;

[0031] The memory is used to store one or more programs, and the one or more programs include instructions that, when executed by the processor, cause the processor to execute any one of the implementation manners of the above-mentioned medical instruction data generation method.

[0032] An embodiment of the present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are run on a terminal device, the terminal device is caused to execute any one of the implementation manners of the above-mentioned medical instruction data generation method.

[0033] An embodiment of the present application also provides a computer program product. When the computer program product is run on a terminal device, the terminal device is caused to execute any one of the implementation manners of the above-mentioned medical instruction data generation method.

[0034] A medical instruction data generation method, device, storage medium, and device provided by an embodiment of the present application first obtain basic tasks related to medicine; and divide the basic tasks to obtain tasks of M levels, where M is a positive integer greater than 0; then generate a seed set corresponding to each type of task in the task data of M levels; then, add preset constraint conditions to the instruction data in the seed set, and combine with the prompt instruction prompt, and input it into a preset large language model to perform N iterative processes on the instruction data to obtain N medical instruction data with different preset constraint conditions generated based on the instruction data; where N is a positive integer greater than 1.

[0035] It can be seen that since the present application first obtains basic tasks related to medicine, it ensures the coverage of medical tasks, so that the coverage of the instruction data generated based on each type of task is wider. Then, using multi-dimensional preset constraint conditions, N medical instruction data are generated through N iterative processes by the large language model, thereby improving the generation efficiency and accuracy (quality) of the medical instruction data, for training a high-quality medical large model, and further improving the user's consultation experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0037] Figure 1 A flowchart of a method for generating medical instruction data provided by an embodiment of the present application;

[0038] Figure 2 A content schematic diagram of the constraint dimension provided by an embodiment of the present application;

[0039] Figure 3 A process schematic diagram of using a large language model for 4 iterative processes to obtain 4 pieces of medical instruction data with different preset constraint conditions provided by an embodiment of the present application;

[0040] Figure 4 An example diagram of using a multi - Agent interaction method to perform rationality verification on medical instruction data of a large language model and its added preset constraint conditions provided by an embodiment of the present application;

[0041] Figure 5 A composition schematic diagram of a medical instruction data generation device provided by an embodiment of the present application. Detailed implementation manners

[0042] Artificial intelligence, especially the application of Natural Language Processing (NLP) technology in medical consultations, is becoming increasingly widespread. For example, a medical large model composed of a large language model (LLM) can provide strong support for medical consultation services by automatically understanding and executing medical - related instructions. These models can automatically process medical record summaries, generate medical reports, interpret clinical instructions, etc., greatly improving the work efficiency of medical staff.

[0043] In the field of medical large model consultations, generating high - quality synthetic medical instruction data is crucial for training large - scale machine learning models. This is because instruction data can unify tasks and endow the model with the ability to converse. Training and optimizing a medical consultation large model with high - quality medical instruction data can make the model's conversation performance stronger, thereby improving the model's performance in the case of user online consultations and enhancing the user's consultation experience.

[0044] Currently, the existing methods for generating instruction data usually include the following two methods:

[0045] (1)Generate instruction data through the SELF-INSTRUCT framework.

[0046] Among them, the SELF-INSTRUCT framework first clarifies the definition of instruction data, that is, each task clearly states its instructions in natural language and is equipped with at least one set of input-output examples. Based on these basic tasks, the framework uses a bootstrap method to generate diverse new task instructions with the help of a pre-trained language model like GPT-3. Subsequently, the model judges the task type for each newly generated instruction - determining whether it is a classification task that requires a finite set of class labels as output or a task that requires other forms of output. For classification tasks, the SELF-INSTRUCT framework first generates possible class labels and then creates corresponding input samples according to these preset classes; for non-classification tasks, the model directly generates inputs and outputs closely related to the task description. In this process, the model uses existing task examples as context to guide the generation of new tasks, ensuring the relevance and diversity of the content.

[0047] After the generation stage, SELF-INSTRUCT performs a data cleaning and filtering process to remove those instructions with too high similarity to existing tasks or insufficient quality, ensuring that the dataset used for model fine-tuning has a high degree of originality and accuracy. Through this mechanism, the framework can continuously expand the task types and enhance the language model's understanding and execution ability for diverse instructions.

[0048] (2)Construct instruction data through the instruction back-translation method.

[0049] Specifically, by automatically assigning corresponding instruction labels to existing human-written texts, it opens up an extensible path to construct a high-quality instruction-following language model. This method starts with a language model fine-tuned with a small amount of seed data and a preset web corpus. Using the seed model for self-enhancement, it creates instructional prompts for web documents, and then through a self-screening process, selects high-quality examples from these candidates. This method mainly includes two key steps: first, generate instructions for unlabeled instruction data to form candidate instruction-answer (QA) pairs; second, perform self-screening through deduplication and filtering techniques to select high-quality instruction-answer pairs to form a selected dataset for training, and then iteratively generate higher-quality instruction data.

[0050] It can be seen that there are significant problems in the existing methods for generating instruction data, which will affect the generation quality of medical instruction data, specifically manifested in the following two points:

[0051] (1) There are relatively large limitations. For example, the enhanced data of the instruction back-translation method is sourced from publicly available network resources, which may pose challenges in instruction quality control and may not cover specific fields such as medical tasks sufficiently. This may not fully meet the specific requirements of professional medical large models in following instructions.

[0052] (2) The existing methods for implementing instruction data generation are not customized for specific tasks and are somewhat general, which is not applicable in the context of the high standards and seriousness of professional medical large models. For example, the SELF-INSTRUCT framework is used to generate brand-new task definitions. Although it can generate diverse tasks, for complex problems in the medical field, this method may not fully capture all the complexities of the instructions.

[0053] To address the above deficiencies, the present application provides a method for generating medical instruction data. First, obtain basic tasks related to medicine; then divide the basic tasks to obtain M levels of tasks, where M is a positive integer greater than 0; then generate a seed set corresponding to each type of task in the M levels of task data; next, add preset constraint conditions to the instruction data in the seed set, and combine with the prompt instruction prompt, and input it into a preset large language model to perform N iterative processes on the instruction data to obtain N medical instruction data with different preset constraint conditions generated based on the instruction data, where N is a positive integer greater than 1.

[0054] It can be seen that since the present application first obtains basic tasks related to medicine, it ensures the coverage of medical tasks, so that the instruction data generated based on each type of task has a wider coverage range. Then, by using multi-dimensional preset constraint conditions and performing N iterative processes through the large language model, multiple medical instruction data are generated, thereby improving the generation efficiency and accuracy (quality) of medical instruction data for training high-quality medical large models, and further improving the user's consultation experience.

[0055] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0056] First Embodiment

[0057] See Figure 1 , which is a schematic flowchart of a method for generating medical instruction data provided in this embodiment. The method includes the following steps:

[0058] S101: Obtain basic tasks related to medicine; and divide the basic tasks into M levels of tasks; wherein M is a positive integer greater than 0.

[0059] In this embodiment, in order to generate medical instruction data specifically for various medical professional tasks of the medical large model to improve the coverage of the medical instruction data, this embodiment first obtains all basic tasks related to medicine as much as possible. For example, 153 basic tasks related to medicine written by professionals (such as doctors) can be obtained, so as to ensure that the generated medical instruction data can involve every medical task.

[0060] Furthermore, all medical-related basic tasks acquired can be divided according to the patient's consultation record with the doctor by professionals (such as doctors) or machines to obtain M levels of tasks for executing the subsequent step S102, wherein each level of tasks can be used to indicate at least one of the operation target, the specific operation scope, and the specific execution method and application scenario. In addition, the present application does not limit the value of M, which can be set according to actual conditions and experience values. For example, an optional implementation method is to set M to 3. At this time, the basic tasks can be divided according to the patient's consultation record with the doctor to obtain three levels of tasks; wherein the first-level task can be used to indicate the operation target, the second-level task can be used to indicate the specific operation scope, and the third-level task can be used to indicate the specific execution method and application scenario, etc.

[0061] Specifically, in this implementation, the tasks (such as first-level tasks) used to indicate the operation objectives can be understood as top-level designs, indicating the main operation objectives and expected functional modules, such as but not limited to the following three types:

[0062] (1) Medical text generation: The goal is to automatically generate text with medical knowledge to meet the needs of specific medical information dissemination or recording, such as "Please generate a medical text for me (without specifying the medical text in which aspect)".

[0063] (2) Medical complex language understanding: Aims to deeply understand the semantics and structure of medical texts and support higher-level information extraction and content analysis.

[0064] (3) Complex logical reasoning in medicine: Use logical reasoning to deal with medical problems and solve logical challenges in the diagnosis or treatment process.

[0065] The tasks used to indicate specific operation scopes (such as secondary tasks) can be understood as goals based on the indicated operation objectives and the expected tasks (such as primary tasks), further refining the specific operation scope, such as but not limited to the following three types:

[0066] (1) Medical text generation - Popular science article generation: Generate articles aimed at popularizing medical knowledge, such as explaining common diseases or treatment methods. For example, "Please generate a medical popular science article for me (without specifying a particular direction of popular science article)".

[0067] (2) Medical text generation - Medical record document generation: Automatically generate medical record reports and other medical records to ensure the professionalism and accuracy of the records.

[0068] (3) Medical complex language understanding - Medical literature analysis: Deeply analyze the medical research literature provided by the user, extract key information, and support research and clinical decision-making.

[0069] Tasks used to indicate specific execution methods and application scenarios (such as third-level tasks) can be understood as further refining tasks used to indicate specific operation scopes (such as second-level tasks), specifying specific execution methods and application scenarios, and can include but are not limited to the following three types:

[0070] (1) Medical text generation - Sports health related - Weight loss plan generation: Generate a personalized weight loss plan based on the data provided by the user and the user's input requirements. Or, Medical text generation - Popular science article - Scams of health products for the elderly, such as "Please generate a popular science article for me, mainly introducing the scams of health products for the elderly".

[0071] (2) Medical complex language understanding - Medical text summary - Meeting minutes: Understand and summarize the text content with medical knowledge according to the relevant discussion content of the medical meeting input by the user, and output a structured meeting minutes.

[0072] (3) Medical complex logical reasoning - Treatment plan - Drug treatment plan: Analyze the patient's medical record provided by the user, and combine with the medical knowledge research within the medical large model itself to reason and give the most suitable drug treatment plan for the user.

[0073] It can be seen that tasks used to indicate operation objectives, specific operation scopes, specific execution methods and application scenarios (such as first-level tasks, second-level tasks, third-level tasks) gradually narrow the task scope.

[0074] S102: Generate a seed set corresponding to each type of task in the M-level tasks.

[0075] In this embodiment, after obtaining M levels of tasks (such as tasks at three levels: primary tasks, secondary tasks, and tertiary tasks) through step S101, the seed sets corresponding to each type of task among the M levels of tasks can be further generated by doctors or machines specifically for subsequent execution of step S103. Among them, the content included in the seed set is determined by the task category to which it belongs, mainly including two parts: instruction data and additional input data. The instruction data is used to represent the specific operations necessary to execute the corresponding category of tasks, and the additional input data is used to represent the additional information or data required when executing the instructions in the instruction data.

[0076] For example, for the primary task "Medical text generation: Please generate a medical text for me (without specifying which aspect of the medical text)", the instruction data in the generated seed set can be "Please generate a medical text for me", and the additional input data can be "related to the elderly".

[0077] Or, for the secondary task "Medical text generation - Popular science article generation: Please generate a medical popular science article for me (without specifying the specific direction of the popular science article)", the instruction data in the generated seed set can be "Please generate a medical popular science article for me", and the additional input data can be "related to the elderly".

[0078] Or, for the tertiary task "Medical text generation - Popular science article - Elderly health product scams: Please generate a popular science article for me to mainly introduce the current situation of elderly health product scams.", the instruction data in the generated seed set can be "Please generate a popular science article for me to mainly introduce the current situation of elderly health product scams", and the additional input data can be "To enable the elderly to anticipate scams in advance, it is necessary to first understand what the common methods of deception are, so that when encountering scammers, they can immediately think that it is a deception and thus stop losses in a timely manner".

[0079] S103: Add preset constraint conditions to the instruction data in the seed set, combine with the prompt instruction prompt, and input it into the preset large language model to perform N iterative processes on the instruction data to obtain N medical instruction data with different preset constraint conditions generated based on the instruction data; where N is a positive integer greater than 0.

[0080] It should be noted that, in order to improve the diversity and coverage of the generated medical instruction data, after generating the seed set through step S102, preset constraint conditions (the specific content is not limited and can be set according to the actual situation and empirical values) can be added to the instruction data it contains. Based on the instruction data in the seed set, multiple medical instruction data with different preset constraint conditions can be generated through multiple iterations. That is, based on one instruction data in a seed set, multiple new medical instruction data with different preset conditions can be correspondingly generated by gradually adding preset constraint conditions multiple times.

[0081] Specifically, after generating the seed set corresponding to each type of task, further, first, the instruction data in the seed set and the first preset constraint condition can be incorporated into the first prompt instruction prompt and input into the preset large language model LLM to utilize the large language model LLM to output updated instruction data containing the first preset constraint condition.

[0082] Among them, an optional implementation method is that the preset constraint conditions (including the first preset constraint condition mentioned in the above paragraph and the second preset constraint condition mentioned in the subsequent paragraphs, etc.) can belong to at least one of the four constraint dimensions of the content dimension, format dimension, scenario dimension, and logic dimension. Each of these four constraint dimensions contains multiple constraint conditions, such as Figure 2 shown.

[0083] Specifically, in this implementation method, on the one hand, the content dimension mainly includes constraint conditions for adding content to the instruction data in the seed set, which can specifically include but are not limited to word count length limits, quantity item limits, generating detailed subtasks, must start or end with a preset content, restricted to start or end with a preset content, content inclusion restrictions, restricted from including specified content, generating background information, etc. The specific introduction is as follows:

[0084] (1) Word count length limit: This constraint condition is mainly responsible for requiring the word count length of the response content to meet a certain limit, or not to exceed a certain word count, or not to be lower than a certain word count.

[0085] Example: For instance, for the third-level task "Medical Text Generation - Popular Science Articles - Health Care Product Scams for the Elderly: Please generate a popular science article for me, mainly introducing the current situation of health care product scams for the elderly.", the instruction data in the generated seed set is "Please generate a popular science article for me, mainly introducing the current situation of health care product scams for the elderly", and the additional input data is "To enable the elderly to anticipate scams in advance, it is necessary to first understand the common methods of deception, so that when encountering scammers, they can immediately recognize it as a deception and thus stop losses in a timely manner." The first preset constraint condition is "Add a word count constraint", then the instruction data in the seed set and the first preset constraint condition are combined into the first prompt instruction prompt and input into the large language model. The updated instruction data with this first preset constraint condition output by the model can be "Please generate a popular science article for me, mainly introducing the fraud means of health care products for the elderly. Your output length must not be less than 300 words.", and the additional input data remains "To enable the elderly to anticipate scams in advance, it is necessary to first understand the common methods of deception, so that when encountering scammers, they can immediately recognize it as a deception and thus stop losses in a timely manner."

[0086] (2) Quantity item limit: This constraint condition is mainly responsible for requiring that the content items of the answer must meet a certain quantity, such as the key points of the answer must not be less than 3 or not more than 5.

[0087] (3) Generate detailed subtasks: This constraint condition will combine the specific context of the instruction data in the seed set and randomly generate a related subtask, requiring that the content of the answer must answer this subtask again on the basis of the original semantic environment.

[0088] Example: Suppose the original instruction (i.e., the instruction data in the seed set) is: "Please generate an exam paper for the standardized training students in the hematology department, focusing on [Common Disease Diagnosis and Treatment in Hematology Department], [Key Points of Routine Operations], and [Highlights]." Then the updated instruction data with the subtask (i.e., the underlined content below) generated by the model can be: "Please generate an exam paper for the standardized training students in the hematology department, focusing on [Common Disease Diagnosis and Treatment in Hematology Department], [Key Points of Routine Operations], and [Highlights], And please include Some questions about [Case Analysis] . " It can be understood that the subtask extends further on the basis of the original task.

[0089] (4) Must start or end with a preset content: This constraint condition will combine the specific context of the instruction data in the seed set and randomly generate a preset content (such as a sentence), and require that the content of the answer must use this preset content (such as this sentence) as the opening sentence or use this sentence as the ending sentence.

[0090] Example: Suppose the original instruction (i.e., the instruction data in the seed set) is: "Please draft a quality of life questionnaire for the oncology department in combination with the following aspects: xxxx." Then the updated instruction data generated by the model can be: "Please draft a quality of life questionnaire for the oncology department in combination with the following aspects: xxxx. Note that in the last sentence or the last paragraph, it is strictly prohibited to end with the specific phrase 'the problem of patients' fatigue'."

[0091] (5) Restrictions on starting or ending with preset content: This constraint condition will randomly generate preset content (such as a sentence) in combination with the specific semantic context of the instruction data in the seed set, and requires that the content of the answer is prohibited from using this preset content (such as this sentence) as the opening or closing statement.

[0092] Example: The updated instruction data generated by the model can be: "As a medical postgraduate, please generate an experimental report based on the following situation, and note that in the last sentence or the last paragraph, avoid ending with 'the effect of lifestyle intervention'."

[0093] (6) Restrictions on included content: This constraint condition is mainly responsible for generating keywords and key phrases based on the semantic context according to the specific semantic context and theme of the instruction data in the seed set; and requires that the content of the answer must include these generated "keywords" and "key phrases".

[0094] Example: Suppose the original instruction (i.e., the instruction data in the seed set) is: "Please write a health popular science article for the official account, focusing on daily eye protection, and require that the key content points in the reply content be presented in tabular form." Then the updated instruction data generated by the model can be: "Please write a health popular science article for the WeChat official account, focusing on daily eye protection, and require that the key content points in the reply content be presented in tabular form. The content should include 'tips for preventing myopia and eye fatigue'."

[0095] (7) Restrictions on not including specified content: This constraint condition is mainly responsible for generating keywords and key phrases based on the semantic context according to the specific semantic context and theme of the instruction data in the seed set; and requires that the content of the answer is prohibited from including these generated "keywords" and "key phrases".

[0096] (8) Generating background information: This constraint condition is mainly responsible for generating a background information that conforms to the seed set in combination with the semantic context of the instruction data in the seed set, and requires that the answer must be based on this background information.

[0097] Example: Suppose the original instruction (i.e., the instruction data in the seed set) is: "As a medical graduate student, please generate an experimental report based on the following situation. The report should cover the experimental purpose, specific methods, result presentation, and final conclusion." Then the updated instruction data with background information (i.e., the underlined content below) added by the model can be: "As a medical graduate student, please generate an experimental report based on the following situation. You are studying the effects of lifestyle interventions in hypertensive patients, The report should cover the experimental purpose, specific methods, result presentation, and final conclusion." Among them, the background information is to generate some specific and more detailed scenarios based on the original instruction (i.e., the instruction data in the seed set) to make the reply more detailed.

[0098] Secondly, in the format dimension, it mainly includes restrictive conditions on the added format of the seed set, which can specifically include but are not limited to restrictions on the output content format, restrictions on the output content style, restrictions on the output content containing preset symbols, etc. The specific introduction is as follows:

[0099] (1) Restrictions on the output content format: This restrictive condition requires that the answer content must be in a common JSON, MarkDown, or table format in the medical scenario.

[0100] (2) Restrictions on the output content style: This restrictive condition requires that the answer content must be formatted and regularized for a certain content point. For example, for a certain content point, it is required to reply in an ordered list format similar to A.1, A.2...B.1, B.2...D.1, D.2, D.3.

[0101] (3) Restrictions on the output content containing preset symbols: This restrictive condition requires that the answer content must use preset symbols such as '{}', '[]', or '【】' to highlight certain keywords or key phrases in the answer content.

[0102] Thirdly, the scenario dimension can include but is not limited to restrictions on specific scenarios, generated roles, etc. The specific introduction is as follows:

[0103] (1) Restrictions on specific scenarios: This restrictive condition will randomly generate an environment based on the theme of the seed set and require the answer content to be replied in combination with this environmental information. For example: "Suppose you are about to popularize medical knowledge for the community residents, and the community residents don't have much professional medical knowledge. In this case, generate a medical popularization speech manuscript..."

[0104] (2) Generated role: This restrictive condition mainly randomly generates a role positioning that conforms to the identity based on the specific semantic environment of the seed set and requires the answer content to be replied based on this role positioning; for example: "Suppose you are a family member of a patient, and you are now asking the doctor about the condition of your family member...."

[0105] Fourthly, the logical dimension may include, but is not limited to, constraints such as reasoning of medical values, reasoning of dates, construction of thought chains, etc., which are introduced in detail as follows:

[0106] (1) Reasoning of medical values: This constraint combines a certain information point in the seed set and requires that the answer content must carry out reasoning and calculation of medical values in combination with this information point. For example: "Please generate a weight loss diet plan for me and give my daily calorie intake based on this diet plan, and give the specific calorie intake calculation process." The reply content should involve the calorie calculation formula of the diet plan.

[0107] (2) Reasoning of dates: This constraint combines a certain information point in the seed set and requires that the answer content must carry out date calculation for the information point. For example: "I am just 10 weeks pregnant and I have been feeling a bit unwell recently. Please calculate my expected due date for me and give the precautions for each date stage."

[0108] (3) Construction of thought chains: This constraint requires that the answer content must first construct its own thought chain and then answer according to the thought chain. For example: "Please explain this medical examination report for me. You should first construct your own thought chain and then give a careful reply based on this thought chain."

[0109] It can be seen that the above-mentioned 4 constraint dimensions and various constraint condition types are more in line with the personalized requirements of the medical large model, facilitating the subsequent generation of higher-quality medical instruction data.

[0110] Then, after generating the updated instruction data with the first preset constraint condition, further, the updated instruction data and the second preset constraint condition can be incorporated into the second prompt instruction prompt and input into the preset large language model LLM, so as to use the large language model LLM to output the updated instruction data containing the second preset constraint condition. By analogy, after N iterative processes, N medical instruction data with different preset constraint conditions generated based on the instruction data included in the seed set can be obtained, where N is a positive integer greater than 0.

[0111] An optional implementation method is that the N pieces of medical instruction data generated by performing N - times iterative processing on instruction data using a large - language model (LLM) and having different preset constraint conditions may include, but are not limited to, simple medical instruction data, intermediate instruction data, complex medical instruction data, etc. For example, when the value of N is 4, after performing 4 - times iterative processing using the large - language model (LLM) and gradually adding preset constraint conditions, among the 4 pieces of medical instruction data with different preset constraint conditions generated, the first piece of medical instruction data generated in the first iteration can be first - level instruction data, serving as simple medical instruction data; the second piece of medical instruction data and the third piece of medical instruction data generated in the second and third iterations can be second - level instruction data and third - level instruction data respectively, and the second - level instruction data and the third - level instruction data constitute intermediate instruction data; the fourth piece of medical instruction data generated in the fourth iteration can be fourth - level instruction data, serving as complex medical instruction data.

[0112] For example, as Figure 3 shown, in the initial stage, first, an initial seed set (including instruction data and additional input data) can be generated according to each task type. Then, the first constraint information can be added to the instruction data it contains. Assuming it is a format constraint as Figure 3 shown, then the first - level instruction data with format constraint can be generated, serving as simple medical instruction data. Next, a logical constraint (assumed to be randomly selected) can be randomly chosen and incorporated into the first - level instruction data to generate second - level instruction data. Subsequently, a context constraint is further added and integrated into the second - level instruction data to form third - level instruction data. At this time, the second - level instruction data and the third - level instruction data together constitute intermediate instruction data. Finally, based on the third - level instruction data, a content constraint is added to generate fourth - level instruction data, serving as complex medical instruction data.

[0113] For example: Assume that the instruction data in the initial seed set is "As a medical researcher in a hospital, please write a research report speech based on the following content." Then, the simple instruction data with format constraint can be "As a medical researcher in a hospital, please write a research report speech based on the following content, and ensure that the reply content must be in tabular format."

[0114] Furthermore, on this basis, the intermediate instruction data with context constraint can be:

[0115] "As a medical researcher in a hospital engaged in the research of new anti - cancer drugs, please write a research report speech based on the following content, and ensure that the reply content must be in tabular format."

[0116] Even further, on this basis, the intermediate instruction data with logical constraint can be:

[0117] "As a hospital medical researcher engaged in the research of new anti-cancer drugs, please write a scientific research report speech based on the following content, and ensure that the reply content must be in tabular format.

[0118] Perform different treatments under the following circumstances:

[0119] If your audience is medical professionals, please describe the experimental methods and data analysis in detail.

[0120] If the audience is the general public, please use plain language and highlight the main findings and future research directions. ".

[0121] Furthermore, on this basis, the complex instruction data with content constraints can be:

[0122] "As a hospital medical researcher engaged in the research of new anti-cancer drugs, please write a scientific research report speech based on the following content, and ensure that the reply content must be in tabular format.

[0123] Perform different treatments under the following circumstances:

[0124] If your audience is medical professionals, please describe the experimental methods and data analysis in detail.

[0125] If the audience is the general public, please use plain language and highlight the main findings and future research directions.

[0126] And, please include some specific plans and expected schedules for future research. ".

[0127] In this way, by gradually adding constraint information in this manner, the instruction data in the initial unconstrained seed set can be gradually evolved into four-level medical instruction data containing different constraint information, completing the constraint evolution of the seed set and improving the quantity and diversity of the generated medical instruction data.

[0128] In addition, to further improve the quality of the generated medical instruction data set, an optional implementation method is that during the process of using the large language model to perform N iterations to generate medical instruction data, for each generated medical instruction data, use the large language model to perform a rationality check on the generated medical instruction data and its added preset constraint conditions, etc., to obtain the verification result.

[0129] In this implementation, when adding constraint conditions in each iteration, to ensure the rationality of the added constraint conditions and the rationality of the rewritten (i.e., regenerated by the large language model) medical instruction data, the Multi-Agent Interaction Inquiry method can be adopted. The large language model itself is successively used as the "rewriter", "critic", and "modifier" of these three roles to verify the rationality of the medical instruction data generated after each iteration process and the preset constraint conditions added thereto, and perform targeted processing according to the verification results, such as Figure 4 as shown. Next, this application will introduce in detail the three roles of "rewriter", "critic", and "modifier" mentioned in the multi-agent interaction method:

[0130] (1) Rewriter

[0131] ① The rewriter is mainly responsible for fusing the randomly selected constraint type and the instruction data in the original seed set to form a new instruction data with constraint information. At the same time, after the rewriter finishes rewriting, it must give its own "added content" and "rewriting idea" after rewriting.

[0132] ② The rewriter must polish and rewrite the description of the instruction data in the seed set to ensure the overall description is smooth.

[0133] ③ The "added content" given by the rewriter is the specific content added when adding constraint information.

[0134] ④ The "rewriting idea" is the thinking chain of the rewriter when adding constraint information.

[0135] (2) Critic

[0136] ① The critic receives the "original seed set", "added constraint type", "added content", and "rewriting idea" given by the rewriter.

[0137] ② The critic, based on the received information and the specific semantic environment of the "original seed set", checks from the perspective of active criticism and strictness whether the "added content" given by the rewriter is reasonable and whether there are unreasonable points in the "rewriting idea". Among them, if the "added constraint type" is unreasonable, the critic will select a suitable constraint type from the preset constraint conditions and send it to the modifier. And, if the "added content" is unreasonable, a suitable "constraint content information" will be regenerated according to this "constraint type" and sent to the modifier. And, if the "rewriting idea" is unreasonable, the critic is responsible for giving a specific rewriting idea for the unreasonable points of the "rewriting idea".

[0138] (3) Modifier

[0139] ① The modifier is mainly responsible for adding constraint information to the instruction information of the seed set according to the "irrationalities" and "correction information" given by the critic, as well as the rewriting results of the rewriter.

[0140] ② If the modifier does not agree with the "correction information" of the critic, a "reject modification" mark is given, and this seed set is temporarily rejected, waiting for manual review of the relevant description of the seed set.

[0141] For example: For the rewriter, please add [Format Constraint] to [Given Instruction].

[0142] Input data: [Given Instruction]

[0143] Constraint type: [Format Constraint]

[0144] [Given Instruction]: As a medical researcher in a hospital, please write a scientific research report speech based on the following content.

[0145] Output data:

[0146] [Rewriting result]: As a medical researcher in a hospital, please write a scientific research report speech based on the following content, and ensure that the reply content must be in tabular format.

[0147] [Added content]: And ensure that the reply content must be in JSON format.

[0148] [Rewriting idea]: I added a restriction condition on the reply format, that is, the reply content must be in tabular format. This makes the key information clearer and easier to read, facilitating you to organize and use the content of the speech.

[0149] On this basis, for the critic, the input data is: [Rewriting result], [Added content], [Rewriting idea] (see the above description)

[0150] Then the output data can be:

[0151] [Recommended constraint type]: Markdown format

[0152] [Recommended added content]: The reply content must be in Markdown format.

[0153] [Suggestion for rewriting idea]: JSON format is not suitable for the speech scenario, and Markdown format should be used.

[0154] Furthermore, for the modifier, the input data is as described above, and the output data is:

[0155] Whether to reject modification: No

[0156] Modification result: As a medical researcher in a hospital, please write a scientific research report speech based on the following content, and ensure that the reply content must be in Markdown format.

[0157] In this way, by having the large language model act as 3 interactive roles in the multi-Agent interaction method and using the interactive interrogation method to verify when adding each level of constraints, the accuracy of each level of added constraints can be fully guaranteed, thereby improving the accuracy of the finally generated medical instruction data.

[0158] On this basis, after generating high-quality medical instruction data with higher accuracy, using these data to train the medical large model can significantly improve the model's understanding ability of complex medical problems. This is because the medical instruction data generated by the method provided in this application can cover a wider range of cases and scenarios, including those that are relatively rare in the real world. In addition, by continuously adjusting the generated instruction data and optimizing the instruction data generation process, the training data set can be further refined to more accurately reflect the complexity of medical Q&A in the real world, thereby improving the accuracy and reliability of the medical large model in actual applications, and then being able to provide users with better consultation services.

[0159] In summary, a method for generating medical instruction data provided in this embodiment first obtains basic tasks related to medicine; divides the basic tasks to obtain M levels of tasks, where M is a positive integer greater than 0; then generates a seed set corresponding to each type of task in the M levels of task data; next, adds preset constraint conditions to the instruction data in the seed set, combines it with the prompt instruction prompt, and inputs it into the preset large language model to perform N iterative processes on the instruction data to obtain N medical instruction data with different preset constraint conditions generated based on the instruction data, where N is a positive integer greater than 1.

[0160] It can be seen that since this application first obtains basic tasks related to medicine, it ensures the coverage of medical tasks, so that the instruction data generated based on each type of task has a wider coverage range. Then, using multi-dimensional preset constraint conditions, N medical instruction data are generated through N iterative processes by the large language model, thereby improving the generation efficiency and accuracy (quality) of medical instruction data, training a high-quality medical large model, and then improving the user's consultation experience.

[0161] Second Embodiment

[0162] This embodiment will introduce a medical instruction data generation device. For related content, please refer to the above method embodiment.

[0163] See Figure 5, which is a schematic diagram of the composition of a medical instruction data generation device provided in this embodiment. The device 500 includes:

[0164] A division unit 501, configured to obtain basic tasks related to medicine; and divide the basic tasks to obtain tasks of M levels; M is a positive integer greater than 0;

[0165] A generation unit 502, configured to generate a seed set corresponding to each type of task in the task data of the M levels;

[0166] An input unit 503, configured to add a preset constraint condition to the instruction data in the seed set, combine it with a prompt instruction prompt, and input it into a preset large language model to perform N iterative processes on the instruction data to obtain N medical instruction data with different preset constraint conditions generated based on the instruction data; N is a positive integer greater than 0.

[0167] In an implementation manner of this embodiment, the division unit 501 is specifically configured to:

[0168] According to the patient's inquiry record of the doctor, divide the basic tasks to obtain tasks of M levels; wherein, the tasks are used to indicate at least one of an operation target, a specific operation scope, a specific execution method, and an application scenario.

[0169] In an implementation manner of this embodiment, the preset constraint condition belongs to at least one constraint dimension among a content dimension, a format dimension, a scenario dimension, and a logic dimension.

[0170] In an implementation manner of this embodiment, the constraint conditions in the content dimension include at least one of a word count length limit, a quantity item limit, generating detailed subtasks, must start or end with a preset content, restricting starting or ending with a preset content, a limit on the included content, restricting not to include a specified content, generating background information; the constraint conditions in the format dimension include at least one of a limit on the output content format, a limit on the output content style, a limit on the output content including a preset symbol; the constraint conditions in the scenario dimension include at least one of a limit on a specific scenario, generating a role; the constraint conditions in the logic dimension include at least one of reasoning of medical values, reasoning of dates, construction of a thinking chain.

[0171] In an implementation manner of this embodiment, the N medical instruction data with different preset constraint conditions include simple medical instruction data, intermediate instruction data, and complex medical instruction data.

[0172] In an implementation manner of this embodiment, the device further includes:

[0173] A verification unit is configured to, during the process of generating medical instruction data through N - time iterative processing using a large - language model, for each generated medical instruction data, use the large - language model to perform a rationality verification on the generated medical instruction data and the added preset constraint conditions to obtain a verification result.

[0174] In one implementation manner of this embodiment, the seed set includes instruction data and additional input data; the instruction data is used to represent the specific operations necessary for performing corresponding category tasks; the additional input data is used to represent the additional information or data required when executing the instructions in the instruction data.

[0175] Furthermore, an embodiment of the present application also provides a medical instruction data generation device, including: a processor, a memory, and a system bus;

[0176] The processor and the memory are connected through the system bus;

[0177] The memory is used to store one or more programs, and the one or more programs include instructions that, when executed by the processor, cause the processor to execute any one of the implementation methods of the above - mentioned medical instruction data generation method.

[0178] Furthermore, an embodiment of the present application also provides a computer - readable storage medium, in which instructions are stored. When the instructions are run on a terminal device, the terminal device is caused to execute any one of the implementation methods of the above - mentioned medical instruction data generation method.

[0179] Furthermore, an embodiment of the present application also provides a computer program product. When the computer program product is run on a terminal device, the terminal device is caused to execute any one of the implementation methods of the above - mentioned medical instruction data generation method.

[0180] From the description of the above - mentioned implementation manners, those skilled in the art can clearly understand that all or part of the steps in the above - mentioned embodiment methods can be implemented by means of software plus a necessary general - purpose hardware platform. Based on such an understanding, the technical solution of the present application, in essence, or the part that makes a contribution to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in each embodiment or some parts of the embodiments of the present application.

[0181] It should be noted that the various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method section.

[0182] It should also be noted that in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0183] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating medical instruction data, characterized in that: include: Obtaining basic tasks related to medicine; and dividing the basic tasks to obtain M levels of tasks; The M is a positive integer greater than 0; Generate a seed set corresponding to each type of task in the M levels of tasks; Adding preset constraints to the instruction data in the seed set, combining with prompt instructions, inputting into a preset large language model, performing N iterative processing on the instruction data, and obtaining N pieces of medical instruction data with different preset constraints generated based on the instruction data; The N is a positive integer greater than 0.

2. The method according to claim 1, characterized in that The basic tasks are divided into M levels of tasks, including: According to the patient's consultation record with the doctor, the basic tasks are divided to obtain M levels of tasks; wherein the tasks are used to indicate at least one of an operation target, a specific operation scope, a specific execution method and an application scenario.

3. The method according to claim 1, characterized in that The preset constraint condition belongs to at least one constraint dimension among content dimension, format dimension, scenario dimension and logic dimension.

4. The method according to claim 3, characterized in that The constraints in the content dimension include at least one of word length limit, number of item limit, generation of detailed subtasks, must start or end with preset content, limit to start or end with preset content, limit to included content, limit not to include specified content, and generation of background information; the constraints in the format dimension include at least one of output content format limit, output content style limit, and output content containing preset symbols limit; the constraints in the scenario dimension include at least one of specific scenario limit and generation of roles; the constraints in the logic dimension include at least one of medical numerical reasoning, date reasoning, and construction of thought chains.

5. The method according to claim 1, characterized in that The N pieces of medical instruction data with different preset constraints include simple medical instruction data, intermediate instruction data and complex medical instruction data.

6. The method according to claim 1, characterized in that The method further comprises: In the process of using the large language model to perform N iterative processes to generate medical instruction data, for each generated medical instruction data, the large language model is used to perform rationality verification on the generated medical instruction data and the preset constraints added thereto to obtain a verification result.

7. The method according to any one of claims 1 to 6, characterized in that: The seed set includes instruction data and additional input data; the instruction data is used to represent the specific operations required to execute the corresponding category of tasks; the additional input data is used to represent additional information or data required when executing the instructions in the instruction data.

8. A medical instruction data generating device, characterized in that: include: Division units for acquiring basic tasks related to medicine; And the basic tasks are divided into M levels of tasks; The M is a positive integer greater than 0; A generating unit, configured to generate a seed set corresponding to each type of task in the M levels of task data; An input unit, used to add preset constraints to the instruction data in the seed set, combine with a prompt instruction prompt, input the result to a preset large language model, perform N iterative processing on the instruction data, and obtain N pieces of medical instruction data with different preset constraints generated based on the instruction data; The N is a positive integer greater than 0.

9. A medical instruction data generating device, characterized in that: include: Processor, memory, system bus; The processor and the memory are connected via the system bus; The memory is used to store one or more programs, wherein the one or more programs include instructions, and when the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the method according to any one of claims 1 to 7.