Instruction fine tuning data generation method and device, equipment and medium

By generating target table building statements and database data corresponding to the preset vertical field, and calculating the instruction follow-up difficulty value, the problem of insufficient adaptability of existing data sets is solved, high-quality instruction fine-tuning data is obtained, and the performance of the database model is improved. Reduced costs.

CN119127923APending Publication Date: 2024-12-13SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411240266.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing instruction fine-tuning data set lacks adaptability to the landing scenario, especially in terms of irrelevant rejection, unauthorized rejection, field authentication and Chinese alias, which makes it difficult to obtain high-quality instruction fine-tuning data for landing scenarios.

Method used

By creating target table building statements corresponding to preset vertical fields, target problems are generated, database data is generated based on these problems, and the commands are calculated to filter target data with difficulty values, adjust the data type proportion, and generate high-quality command fine-tuning data.

Benefits of technology

It has achieved the acquisition of a large number of high-quality instruction fine-tuning data, which improves the experience and response speed of the database model, and reduces the deployment requirements and implementation costs of multi-models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127923A_ABST
    Figure CN119127923A_ABST
Patent Text Reader

Abstract

The invention discloses an instruction fine tuning data generation method and device, equipment and a medium, and relates to the technical field of natural language processing, and the method comprises the steps: creating a target table establishment statement corresponding to a preset vertical field, and generating a plurality of target problems corresponding to a plurality of preset conditions according to the target table establishment statement; generating database data corresponding to the plurality of target problems, and generating instruction fine tuning data corresponding to the preset vertical field according to the plurality of target problems and the database data; circulating the steps until a plurality of instruction fine tuning data corresponding to all the preset vertical fields are generated; calculating a plurality of instruction following difficulty values corresponding to the instruction fine tuning data, and determining a plurality of target instruction fine tuning data based on the instruction following difficulty values; and based on a preset problem type proportion, adjusting a data type proportion of the plurality of target instruction fine adjustment data to obtain adjusted target instruction fine adjustment data. In this way, a large amount of high-quality instruction fine tuning data for the landing scene can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a method, device, equipment and medium for generating instruction fine-tuning data. Background Art

[0002] Instruction Fine-Tuning (IFT) is a representative capability of the new language big model. It can help humans give commands to the big model in natural language and communicate with each other. This makes it easier for people and machines to interact. In order to fine-tune instructions, it is necessary to collect or build data sets. The existing NL2SQL (Natural Language to SQL, a language conversion technology) data sets lack adaptability to landing scenarios: they are powerless in irrelevant rejection, unauthorized rejection, field authentication, Chinese aliases, etc.

[0003] From the above, it can be seen that how to obtain a large amount of high-quality instruction fine-tuning data for landing scenarios is an urgent problem to be solved. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a method, device, equipment and medium for generating instruction fine-tuning data, which can obtain a large amount of high-quality instruction fine-tuning data for landing scenarios. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a method for generating instruction fine-tuning data, comprising:

[0006] Create a target table building statement corresponding to the current preset vertical field, and generate a number of target questions corresponding to a number of preset conditions according to the target table building statement;

[0007] Generate database data corresponding to the plurality of target problems, and generate instruction fine-tuning data corresponding to the current preset vertical field according to the plurality of target problems and the database data;

[0008] The next preset vertical field is used as the current preset vertical field, and the process jumps to the step of creating a target table building statement corresponding to the current preset vertical field, and generating a plurality of target questions corresponding to a plurality of preset conditions according to the target table building statement, so as to generate instruction fine-tuning data corresponding to the next preset vertical field, until a plurality of instruction fine-tuning data corresponding to all preset vertical fields are generated;

[0009] Calculating a number of instruction follow-up difficulty values ​​corresponding to the number of instruction fine-tuning data, and extracting a number of target instruction fine-tuning data from the number of instruction fine-tuning data based on the number of instruction follow-up difficulty values;

[0010] The data type ratios of the plurality of target instruction fine-tuning data are adjusted based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data.

[0011] Optionally, the step of creating a target table building statement corresponding to the current preset vertical field, and generating a number of target questions corresponding to a number of preset conditions according to the target table building statement, includes:

[0012] Create a target table creation statement corresponding to the current preset vertical field, and generate a number of first-category target questions corresponding to the first-category preset conditions and / or a number of second-category target questions corresponding to the second-category preset conditions based on the target table creation statement; the first-category preset conditions are preset conditions that are unrelated to the current preset vertical field; the second-category preset conditions are preset conditions that are related to the current preset vertical field.

[0013] Optionally, the step of creating a target table building statement corresponding to the current preset vertical field, and generating a number of target questions corresponding to a number of preset conditions according to the target table building statement, includes:

[0014] Create a target table building statement corresponding to the current preset vertical field, and generate several conditional control statements based on the target table building statement to determine the control authority;

[0015] Based on the control authority and the current preset vertical field, a number of third-category target questions corresponding to the third-category preset conditions and / or a number of fourth-category target questions corresponding to the fourth-category preset conditions, and / or a number of fifth-category target questions corresponding to the fifth-category preset conditions are generated; the third-category preset conditions are preset conditions related to the current preset vertical field and do not match the control authority; the fourth-category preset conditions are preset conditions that are unrelated to the current preset vertical field and match the control authority; the fifth-category preset conditions are preset conditions that are related to the current preset vertical field and match the control authority.

[0016] Optionally, the generating of database data corresponding to the plurality of target problems, and generating instruction fine-tuning data corresponding to the current preset vertical field according to the plurality of target problems and the database data, includes:

[0017] Based on the target table creation statement, database data corresponding to the plurality of second-category target problems and the plurality of fifth-category target problems are generated, and instruction fine-tuning data corresponding to the preset vertical field is generated according to all the target problems and the database data.

[0018] Optionally, the calculating a plurality of instruction following difficulty values ​​corresponding to the plurality of instruction fine-tuning data, and extracting a plurality of target instruction fine-tuning data from the plurality of instruction fine-tuning data based on the plurality of instruction following difficulty values, includes:

[0019] Calculate a number of instruction following difficulty values ​​corresponding to the number of instruction fine-tuning data using a preset instruction following difficulty calculation formula;

[0020] Determine whether a current instruction following difficulty value corresponding to current instruction fine-tuning data among the plurality of instruction fine-tuning data is greater than a preset instruction following difficulty value threshold;

[0021] If the current instruction following difficulty value is greater than a preset instruction following difficulty value threshold, the current instruction fine-tuning data is determined as the target instruction fine-tuning data;

[0022] If the instruction following difficulty value corresponding to the current instruction fine-tuning data is not greater than the preset instruction following difficulty value threshold, the next instruction fine-tuning data is used as the current instruction fine-tuning data, and the process jumps to the step of determining whether the current instruction following difficulty value corresponding to the current instruction fine-tuning data among the several instruction fine-tuning data is greater than the preset instruction following difficulty value threshold, so as to determine whether the instruction following difficulty value corresponding to the next instruction fine-tuning data is greater than the preset instruction following difficulty value threshold.

[0023] Optionally, before adjusting the data type ratios of the plurality of target instruction fine-tuning data based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data, the method further includes:

[0024] The number of the target questions is expanded by presetting target question expansion instructions.

[0025] Optionally, adjusting the data type ratio of the plurality of target instruction fine-tuning data based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data includes:

[0026] Adjusting the target question type ratio corresponding to the target instruction fine-tuning data based on the preset question type ratio to obtain an adjusted target question type ratio;

[0027] The data type ratios of the plurality of target instruction fine-tuning data are adjusted based on the adjusted target problem type ratios to obtain adjusted target instruction fine-tuning data.

[0028] In a second aspect, the present application provides an instruction fine-tuning data generating device, comprising:

[0029] A target question generation module is used to create a target table building statement corresponding to the current preset vertical field, and generate a number of target questions corresponding to a number of preset conditions according to the target table building statement;

[0030] An instruction fine-tuning data generating module, used to generate database data corresponding to the plurality of target problems, and to generate instruction fine-tuning data corresponding to the current preset vertical field according to the plurality of target problems and the database data;

[0031] A vertical field switching module, used to take the next preset vertical field as the current preset vertical field, and jump to the step of creating a target table building statement corresponding to the current preset vertical field, and generating a plurality of target questions corresponding to a plurality of preset conditions according to the target table building statement, so as to generate instruction fine-tuning data corresponding to the next preset vertical field, until a plurality of instruction fine-tuning data corresponding to all preset vertical fields are generated;

[0032] a target instruction fine-tuning data determining module, configured to calculate a plurality of instruction following difficulty values ​​corresponding to the plurality of instruction fine-tuning data, and extract a plurality of target instruction fine-tuning data from the plurality of instruction fine-tuning data based on the plurality of instruction following difficulty values;

[0033] The target instruction fine-tuning data adjustment module is used to adjust the data type ratio of the target instruction fine-tuning data based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data.

[0034] In a third aspect, the present application provides an electronic device, including:

[0035] Memory, used to store computer programs;

[0036] The processor is used to execute the computer program to implement the aforementioned instruction fine-tuning data generation method.

[0037] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned instruction fine-tuning data generation method when executed by a processor.

[0038] The present application creates a target table building statement corresponding to the current preset vertical field, and generates a number of target problems corresponding to a number of preset conditions according to the target table building statement; generates database data corresponding to the several target problems, and generates instruction fine-tuning data corresponding to the current preset vertical field according to the several target problems and the database data; takes the next preset vertical field as the current preset vertical field, and jumps to the step of creating a target table building statement corresponding to the current preset vertical field, and generating a number of target problems corresponding to a number of preset conditions according to the target table building statement, so as to generate instruction fine-tuning data corresponding to the next preset vertical field, until a number of instruction fine-tuning data corresponding to all preset vertical fields are generated; calculates a number of instruction following difficulty values ​​corresponding to the several instruction fine-tuning data, and extracts a number of target instruction fine-tuning data from the several instruction fine-tuning data based on the several instruction following difficulty values; adjusts the data type ratio of the several target instruction fine-tuning data based on the preset problem type ratio to obtain adjusted target instruction fine-tuning data.

[0039] As can be seen from the above, this application creates a target table creation statement, generates target problems for different application scenarios, determines the corresponding instruction fine-tuning data based on the target problems, and finally screens the qualified target instruction fine-tuning data by calculating the instruction following difficulty value. It can obtain a large amount of high-quality instruction fine-tuning data for landing scenarios, improve the database model experience and response speed, while also reducing the need for multi-model deployment and reducing landing costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0041] Figure 1 A flow chart for generating instruction fine-tuning data disclosed in this application;

[0042] Figure 2 A specific instruction fine-tuning data generation flow chart disclosed in this application;

[0043] Figure 3 A timing diagram of a process of generating instruction fine-tuning data disclosed in the present application;

[0044] Figure 4 This is a schematic diagram of the structure of an instruction fine-tuning data generating device disclosed in this application;

[0045] Figure 5This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] Instruction fine-tuning is a representative capability of the recent language large model, which can help humans give commands to the large model in natural language and communicate. This enables more convenient interaction between people and machines. In order to perform instruction fine-tuning, it is inevitable to collect or construct data sets. The existing relevant data sets lack adaptability such as landing scenarios: they are powerless in terms of irrelevant refusal to answer, unauthorized refusal to answer, field authentication, Chinese aliases, etc. To this end, the present application provides an instruction fine-tuning data generation scheme that can obtain a large amount of high-quality instruction fine-tuning data for landing scenarios.

[0048] See also Figure 1 As shown, an embodiment of the present invention discloses a method for generating instruction fine-tuning data, comprising:

[0049] Step S11: Create a target table building statement corresponding to the current preset vertical field, and generate a number of target questions corresponding to a number of preset conditions according to the target table building statement.

[0050] In this embodiment, a target table building statement of a preset database type is generated according to the current vertical field based on the preset multi-field table building statement generation instruction, and several target questions corresponding to several preset conditions are generated according to the target table building statement. Among them, the current vertical field is any one of several vertical fields, and the content of the vertical field can be specifically determined according to the actual application scenario, which is not specifically limited here; the preset database type can be specifically determined according to the actual application scenario, including but not limited to PostgreSQL (an open source relational database), MySQL (an open source relational database), SQLite (a lightweight open source relational database) and other database types. Specifically, the creation of a target table building statement corresponding to the current preset vertical field, and the generation of several target questions corresponding to several preset conditions according to the target table building statement, may include: creating a target table building statement corresponding to the current preset vertical field, and generating several target-independent questions corresponding to preset conditions unrelated to the current preset vertical field and / or several target-related questions corresponding to preset conditions related to the current preset vertical field according to the target table building statement. That is, by generating several target questions related to and unrelated to the vertical field, different instruction fine-tuning data can be generated for target questions of different field types in subsequent steps.

[0051] Further, several conditional control statements are generated according to the target table building statement, and several target questions corresponding to several preset conditions are generated based on the several conditional control statements and the target table building statement. Specifically, the creation of a target table building statement corresponding to the current preset vertical field, and the generation of several target questions corresponding to several preset conditions according to the target table building statement, may include: creating a target table building statement corresponding to the current preset vertical field, and generating several conditional control statements according to the target table building statement to determine the control authority; based on the control authority and the current preset vertical field, generating several target unauthorized related questions corresponding to preset conditions related to the current preset vertical field and not matching the control authority, and / or several target authorized unrelated questions corresponding to preset conditions unrelated to the current preset vertical field and matching the control authority, and / or several target authorized related questions corresponding to preset conditions related to the current preset vertical field and matching the control authority. That is, by setting the control authority and generating several target questions matching the authority, different instruction fine-tuning data can be generated for target questions of different authority types in subsequent steps.

[0052] It should be noted that after generating a number of target problems corresponding to a number of preset conditions according to the target table creation statement, it is also necessary to correct the number of target problems through instructions for correcting format errors to ensure the stability of the results and facilitate analysis.

[0053] Step S12: Generate database data corresponding to the target problems, and generate instruction fine-tuning data corresponding to the current preset vertical field based on the target problems and the database data.

[0054] In this embodiment, database data corresponding to the target problems is generated based on the target table creation statement. The database data includes but is not limited to Chinese alias SQL (Structured Query Language) and SQL fields. Specifically, the generation of database data corresponding to the target problems and the generation of instruction fine-tuning data corresponding to the current preset vertical field according to the target problems and the database data may include: generating Chinese alias SQL and SQL fields corresponding to the target-related problems and the target-authority-related problems based on the target table creation statement, and generating instruction fine-tuning data corresponding to the preset vertical field according to the Chinese alias SQL and SQL fields corresponding to all the target problems and the target-related problems and the target-authority-related problems based on the preset fine-tuning instructions. It should be noted that when generating data based on the preset fine-tuning instructions, it is first necessary to determine the vertical field corresponding to the target problem and determine whether it is related to the current vertical instruction, then determine whether there is a preset control authority in the current vertical field, and determine whether the target problem has the preset control authority according to the preset control authority, and finally determine the target problem type of the target problem based on the above judgment results, and generate different types of instruction fine-tuning data for different target problem types. Specifically, for target-irrelevant questions, target-unauthorized questions, and target-authorized irrelevant questions, according to the target question type of the target question, result information indicating that the query is not possible is returned. The result information includes the reason why the question is not possible to query; for target-related questions and target-authorized questions, according to the target question type of the target question, result information indicating that the query is allowed is returned. The result information includes the Chinese alias SQL and the SQL field used corresponding to the target question.

[0055] Step S13, taking the next preset vertical field as the current preset vertical field, and jumping to the step of creating a target table building statement corresponding to the current preset vertical field, and generating a number of target problems corresponding to a number of preset conditions according to the target table building statement, so as to generate instruction fine-tuning data corresponding to the next preset vertical field, until a number of instruction fine-tuning data corresponding to all preset vertical fields are generated.

[0056] In this embodiment, the current preset vertical field is switched and steps S11 and S12 are repeated to obtain instruction fine-tuning data corresponding to different preset vertical fields. By generating a number of instruction fine-tuning data, the data types in the database can be enriched, the database model experience and response speed can be improved, and the need for multi-model deployment and the implementation cost can be reduced.

[0057] Step S14: Calculate a number of instruction following difficulty values ​​corresponding to the number of instruction fine-tuning data, and extract a number of target instruction fine-tuning data from the number of instruction fine-tuning data based on the number of instruction following difficulty values.

[0058] In this embodiment, a plurality of instruction following difficulty values ​​corresponding to the plurality of instruction fine-tuning data are calculated by a preset instruction following difficulty formula, and a plurality of target instruction fine-tuning data are extracted from the plurality of instruction fine-tuning data by judging whether the plurality of instruction following difficulty values ​​are greater than a preset plurality of instruction following difficulty thresholds. The instruction following difficulty threshold can be specifically determined according to actual application conditions, for example, the first quartile can be determined from the plurality of instruction following difficulty values, and the corresponding first quartile is determined as the instruction following difficulty threshold. Specifically, the step of calculating the instruction following difficulty values ​​corresponding to the instruction fine-tuning data, and extracting the target instruction fine-tuning data from the instruction fine-tuning data based on the instruction following difficulty values ​​may include: calculating the instruction following difficulty values ​​corresponding to the instruction fine-tuning data by a preset instruction following difficulty calculation formula; determining the first quartile of the instruction following difficulty values, and determining the corresponding first quartile value as a preset instruction following difficulty threshold; judging whether the current instruction following difficulty value corresponding to the current instruction fine-tuning data in the instruction fine-tuning data is greater than the preset instruction following difficulty threshold; if the current instruction following difficulty value is greater than the preset instruction following difficulty threshold, determining the current instruction fine-tuning data as the target instruction fine-tuning data; if the instruction following difficulty value corresponding to the current instruction fine-tuning data is not greater than the preset instruction following difficulty threshold, taking the next instruction fine-tuning data as the current instruction fine-tuning data, and jumping to the step of judging whether the current instruction following difficulty value corresponding to the current instruction fine-tuning data in the instruction fine-tuning data is greater than the preset instruction following difficulty threshold, so as to judge whether the instruction following difficulty value corresponding to the next instruction fine-tuning data is greater than the preset instruction following difficulty threshold. The preset instruction following difficulty formula is:

[0059] ;

[0060] Among them, IFD (y i |x i ) is for a given sample (x i ,y i)’s instruction following difficulty value, PPL (y i |x i ) is for a given sample (x i ,y i ) in the presence of fine-tuning instructions, PPL (y i ) is for a given sample (x i ,y i ) The perplexity in the absence of fine-tuning instructions. The perplexity is an indicator to measure the difficulty of following instructions. The formula for calculating the perplexity is:

[0061] ;

[0062] Among them, PPL (y i |x i ) is for a given sample (x i ,y i ) is the perplexity in the presence of fine-tuning instructions, N is the number of samples, and p is the sample probability distribution.

[0063] It can be understood that by calculating the several instruction following difficulty values ​​corresponding to the several instruction fine-tuning data, and extracting several target instruction fine-tuning data from the several instruction fine-tuning data based on the several instruction following difficulty values, the generated target instruction fine-tuning data can be more easily learned and mastered by the model that needs fine-tuning.

[0064] Step S15: adjusting the data type ratio of the plurality of target instruction fine-tuning data based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data.

[0065] In this embodiment, by adjusting the problem ratio to reduce unnecessary operations, the subsequent operation cost can be reduced. Specifically, the data type ratio of the target instruction fine-tuning data is adjusted based on the preset problem type ratio to obtain the adjusted target instruction fine-tuning data, which may include: adjusting the target problem type ratio corresponding to the target instruction fine-tuning data based on the preset problem type ratio to obtain the adjusted target problem type ratio; adjusting the data type ratio of the target instruction fine-tuning data based on the adjusted target problem type ratio to obtain the adjusted target instruction fine-tuning data. Among them, the preset target problem expansion instruction can expand the target problem. Among them, the preset problem type ratio can be determined according to the actual application scenario, and is not specifically limited here.

[0066] As can be seen from the above, the embodiment of the present application creates a target table creation statement to generate target questions for irrelevant refusal to answer, unauthorized refusal to answer, field authentication, and Chinese alias scenarios, and determines the corresponding instruction fine-tuning data based on the target question. Finally, the qualified target instruction fine-tuning data is filtered by calculating the instruction following difficulty value, so that a large amount of high-quality instruction fine-tuning data for landing scenarios can be obtained, thereby improving the database model experience and response speed. At the same time, unnecessary calculations are reduced by adjusting the problem ratio, thereby reducing the need for multi-model deployment and reducing landing costs.

[0067] See also Figure 2 As shown, in order to quickly enrich the data set of instruction fine-tuning data, the present application provides a specific instruction fine-tuning data generation method, including:

[0068] Step S21: Create a target table creation statement corresponding to a preset vertical field, and generate instruction fine-tuning data corresponding to the preset vertical field according to the target table creation statement.

[0069] Step S22: Expand the number of target questions by using preset target question expansion instructions.

[0070] In this embodiment, the number of the target questions is expanded by a preset target question expansion instruction, and the data type ratio of the several target instruction fine-tuning data is adjusted based on a preset question type ratio to obtain the adjusted target instruction fine-tuning data. Specifically, before the data type ratio of the several target instruction fine-tuning data is adjusted based on the preset question type ratio to obtain the adjusted target instruction fine-tuning data, it may also include: expanding the questioning method of the target question by a preset target question expansion instruction to obtain a new target question. That is, by expanding the questioning method similar to the target question, a target question similar to the target question can be obtained, the data in the database can be enriched, and the stability of the instruction adjustment data for complex application scenarios can be improved.

[0071] Step S23: adjusting the data type ratio of the instruction fine-tuning data based on a preset problem type ratio to obtain target instruction fine-tuning data.

[0072] Among them, the specific implementation process of the above steps S21 and S23 can refer to the corresponding content in the above embodiments, and will not be repeated here.

[0073] As can be seen from the above, the embodiment of the present application can obtain target questions similar to the target questions by expanding the questioning method similar to the target questions, enrich the data in the database, and improve the stability of the instruction adjustment data for complex application scenarios. At the same time, by adjusting the problem ratio, unnecessary operations are reduced, the need for multi-model deployment is reduced, and the implementation cost is reduced.

[0074] See also Figure 3 As shown, the present application provides a specific instruction fine-tuning data generation method, including:

[0075] This application generates NL2SQL instructions based on a large business model to fine-tune data. Specifically, instructions are generated based on multi-domain table creation statements to generate vertical domain table creation statements:

[0076] MULTI_DOMAIN_DDL_GEN_TEMPLATE = """# Task

[0077] Generate a table creation statement for the {db_type} database based on the domain [DOMAIN] {domain_name} [DOMAIN].

[0078] ## Note

[0079] - Select reasonable field data types based on business needs to improve data storage accuracy and query efficiency.

[0080] {note}- Do not include comments in the table creation statement.

[0081] - After the table creation statement, add Chinese comment statements for the fields and tables.

[0082] - If the field and table names are case sensitive, double quotes are required.

[0083] - Do not use Chinese characters in table creation statements.

[0084] ## Answer

[0085] Generate a table creation statement for a Postgres database based on the domain [DOMAIN]{domain_name}[DOMAIN].

[0086] The table creation statement and the Chinese comment statement are written together.

[0087] [DDL]

[0088] """

[0089] Among them, db_type is the database type, such as PostgresSQL; domain_name is the domain content, such as automobile manufacturing parts inventory; Note is other requirements for table creation statements, such as PostgreSQL table creation statements. Table names and field names use pinyin abbreviations, with the first letter capitalized and double quotes.

[0090] Generate a preset number of irrelevant questions according to the vertical field table creation statement, and the content of the instruction for generating irrelevant questions is as follows:

[0091] GEN_FREEQA_BASE_DDL_TEMPLATE = """

[0092] # Task

[0093] Based on the context, generate {freeqa_nums} unrelated questions, using Chinese.

[0094] ## Context

[0095] {ddl}

[0096] ## Answer

[0097] Based on the context, generate {freeqa_nums} unrelated questions and answer them in Chinese.

[0098] ```json [

[0100] ["1",[Unrelated question]] ... ]

[0103] ```

[0104] """

[0105] Wherein, freeqa_nums is the number of generated irrelevant questions; ddl is the table creation statement for the field.

[0106] Several conditional control statements are generated according to the vertical field table creation statement. The instructions for generating conditional control statements are as follows:

[0107] GEN_USER_PERMISSION_TEMPLATE = """

[0108] # Task

[0109] Generate {user_permission_nums} conditional control statements based on the relevant fields in the Database Schema

[0110] ### Note

[0111] - Add double quotes if field and table names in database schema have them.

[0112] - Do not use AND in conditional control statements.

[0113] - The content of the conditional control statement should be specific, clear and concise, without the words "certain" or "specific". For example: where "LB" = 'Humanities'.

[0114] ## Database Schema

[0115] {ddl}

[0116] ## For Example

[0117] ```json [

[0119] ["1","where ssqx_cn = 'Saihan District'"] ]

[0121] ```

[0122] ## Answer

[0123] Generate {user_permission_nums} conditional control statements based on the relevant fields in the Database Schema. Do not use AND in the conditional control statements.

[0124] ```json [

[0126] ["1",[Conditional control statement]] ... ]

[0129] ```

[0130] """

[0131] Among them, user_permission_nums is the number of generated conditional control statements; ddl is the domain table creation statement.

[0132] According to the vertical field table creation statement, all conditional control statements are traversed to generate no-authority related issues. The instructions for generating no-authority related issues are as follows:

[0133] GEN_NO_PERMISSION_QA_TEMPLATE = """

[0134] # Task

[0135] According to the Database Schema, generate {no_permission_qa_nums} Chinese natural language query problems that conflict with Data Permission.

[0136] # Note

[0137] - Use affirmative words in conflicting Chinese natural language query questions, and avoid words such as "not" and "non". For example:

[0138] Example 1

[0139] Data Permission: where "MC" = 'Bronze'

[0140] Conflict Question: List all artworks named ceramics.

[0141] Example 2

[0142] Data Permission: where health_status = 'Good'

[0143] Conflicting Question: Retrieving detailed information about elderly people whose health status is general.

[0144] ## Database Schema

[0145] {ddl}

[0146] ## Data Permission

[0147] {data_permission}

[0148] ## Answer

[0149] According to the Database Schema, the {no_permission_qa_nums} item is generated, which is inconsistent and conflicting with {data_permission}.

[0150] ```json [

[0152] ["1","Conflicting Chinese Natural Language Query Problem"] ... ]

[0155] ```

[0156] """

[0157] Among them, no_permission_qa_nums is the number of no-permission related questions generated; data_permission is a conditional control statement.

[0158] According to the vertical field table creation statement, all conditional control statements are traversed to generate permission-irrelevant questions. The instructions for generating permission-irrelevant questions are as follows:

[0159] GEN_PERMISSION_NO_MATCH_QA_TEMPLATE = """

[0160] # Task

[0161] According to the Context, {permission_no_match_qa_nums} entries are generated to match the Data Permission, which has nothing to do with the Context.

[0162] ## Context

[0163] {ddl}

[0164] ## Data Permission

[0165] {data_permission}

[0166] ## Note

[0167] - Do not use double quotes in the json string of the answer.

[0168] - Chinese natural language query questions should describe the problem from the perspective of the table user.

[0169] - Natural language query question expression should be in natural Chinese.

[0170] - The question should match the information reflected by the Data Permission, and the Data Permission should be naturally described in the question.

[0171] - Must be independent of the Context topic and related to other domain topics.

[0172] ## Example of Answer

[0173] ```json [

[0175] ["1", "In agricultural irrigation systems, which areas have \"WaterLevel\" exceeding 5.00 meters?"],

[0176] ["2", "In the urban drainage system, which monitoring points have a \"WaterLevel\" higher than 5.00 meters?"],

[0177] ["3", "In aquaculture farms, which ponds have \"WaterLevel\" above 5.00 meters?"] ]

[0179] ```

[0180] ## Answer

[0181] According to the Context, {permission_no_match_qa_nums} entries are generated to match the Data Permission, which has nothing to do with the Context.

[0182] ```json [

[0184] ["1",[matches Data Permission, not related to Context]] ... ]

[0187] ```

[0188] """

[0189] Among them, permission_no_match_qa_nums is the number of permission-irrelevant questions.

[0190] According to the vertical field table creation statement, all conditional control statements are traversed to generate permission-related questions. The instructions for generating permission-related questions are as follows:

[0191] GEN_PERMISSION_QA_TEMPLATE = """

[0192] # Task

[0193] According to the Database Schema, generate {permission_qa_nums} Chinese natural language query questions that match the Data Permission.

[0194] ## Database Schema

[0195] {ddl}

[0196] ## Data Permission

[0197] {data_permission}

[0198] ## Note

[0199] - Chinese natural language query questions should describe the problem from the perspective of the table user.

[0200] - Chinese natural language query question expression should be natural.

[0201] ## Answer

[0202] According to the Database Schema, generate {permission_qa_nums} Chinese natural language query questions that match the Data Permission.

[0203] ```json [

[0205] ["1",[matching natural language query question]] ... ]

[0208] ```

[0209] """

[0210] Among them, permission_qa_nums is the number of permission-related questions generated.

[0211] Generate a preset number of related questions based on the vertical field table creation statement, and the instructions for generating related questions are as follows:

[0212] GEN_RELATED_QA_TEMPLATE = """

[0213] # Task

[0214] According to the Database Schema, {related_qa_nums} Chinese natural language query questions are generated.

[0215] ## Note

[0216] - Query questions cover this table to common queries.

[0217] - If there are date related fields, please raise a question related to date processing.

[0218] - Proportional calculation problems If commonly used, please write a proportional calculation problem.

[0219] ## Database Schema

[0220] {ddl}

[0221] ## Answer

[0222] According to the Database Schema, {related_qa_nums} Chinese natural language query questions are generated.

[0223] ```json [

[0225] ["1",[Chinese natural language query problem]] ... ]

[0228] ```

[0229] """

[0230] Among them, related_qa_nums is the number of related questions generated.

[0231] According to the related questions and the authorized related questions, the corresponding Chinese alias SQL and SQL fields are generated through the vertical field table creation statement. The instructions for generating Chinese alias SQL and SQL fields are as follows:

[0232] GEN_SQL_FROM_QA_TEMPLATE = """

[0233] # Task

[0234] Generate SQL and SQL fields based on table creation statements and user questions.

[0235] ## Note

[0236] - If double quotes are used for the fields and table names in the table creation statement, the SQL statement should be consistent with the table creation statement.

[0237] - The SQL statement should be derived from the table creation statement fields and table names, and the select fields should use Chinese aliases.

[0238] - Do not use "select *" in the SQL statement. Instead, list the 3 to 4 most relevant fields.

[0239] ## Reply Example

[0240] User Question: What is the average age of all centenarians?

[0241] ```sql

[0242] SELECT AVG(EXTRACT(YEAR FROM AGE(CURRENT_DATE, "CSRQ"::DATE))::INTEGER) AS average age FROM "Ledger_BSLRTZ" WHERE "IsDeleted" = FALSE

[0243] ```

[0244] ```json

[0245] {{"SQL_USAGE_FIELDS":["CSRQ","IsDeleted"]}}

[0246] ```

[0247] ## User Questions

[0248] {user_query}

[0249] ## Answer

[0250] Generate SQL based on the table creation statement.

[0251] ```sql

[0252] [SQL]

[0253] ```

[0254] ```json

[0255] [SQL_USAGE_FIELDS]

[0256] ```

[0257] """

[0258] Among them, user_query is the user question.

[0259] Based on the above problems and the generation of corresponding Chinese alias SQL and the use of SQL fields to build NL2SQL instructions to fine-tune data, the NL2SQL fine-tuning instructions are as follows:

[0260] SQL_INSTRUCT_TEMPLATE = """### Task

[0261] Generate a SQL query to answer [QUESTION]{user_query}[ / QUESTION]

[0262] Instructions

[0263] - step1: Analyse the Database Schema, the Data Permission and theQuestion, check PERMISSION and RELEVANCE

[0264] - step2: Generate SQL Query

[0265] - step3: Add SQL usage fields after SQL

[0266] ### Note

[0267] - If database Schema fields and table names have double quotation,the sql statement is the same as the database Schema

[0268] - Fields of the SQL use Chinese aliases

[0269] - Aggregate data and don't forget group by

[0270] ### Data Permission

[0271] {data_permission}

[0272] ### Database Schema

[0273] The query will run on a database with the following schema:

[0274] {ddl_with_kg}

[0275] ### Example of the Answer

[0276] {example}

[0277] ### Answer

[0278] Given the database schema, here is the SQL query that [QUESTION]{user_query}[ / QUESTION]

[0279] -- CHECK_PERMISSION_AND_RELEVANCE: {{"reason":"Under {table_name}; data permission: {data_permission}, question: {user_query}==>[PLACEHOLDER]", "result":[PLACEHOLDER]}}

[0280] [SQL]

[0281] [SQL_USAGE_FIELDS]

[0282] When constructing training data according to the NL2SQL fine-tuning instructions, the generated data should be constructed differently according to different problems. The unified format is:

[0283] """-- CHECK_PERMISSION_AND_RELEVANCE: {{"reason":"{permission_reason}", "result":"{reply_permission}"}}{reply_sql}"""

[0284] The specific variables are as follows: if user_permission has no conditional control statement, user_permission="None" should be set; if reply_sql does not have, reply_sql="".

[0285] For example, for irrelevant issues, non-authorized issues, and authorized but irrelevant issues:

[0286] permission_reason="Under {table_name}; data permission: {user_permission}, problem: {query}==>cannot be queried"

[0287] reply_permission="REJECT"

[0288] For permission-related and related issues:

[0289] permission_reason="Under {table_name}; data permission: {user_permission}, question: {query}==>queryable"

[0290] reply_permission="ACCEPT"

[0291] Among them, reply_sql is the generated corresponding Chinese alias SQL and the used SQL field.

[0292] The final result is as follows:

[0293] -- CHECK_PERMISSION_AND_RELEVANCE: {{"reason":"Under TABLE bslrxx is 'Information of Centenarians'; Data Permission: None, Question: Average age of centenarians ==> can be queried", "result":"ACCEPT"}}

[0294] SELECT AVG(EXTRACT(YEAR FROM AGE(CURRENT_DATE, "CSRQ"::DATE))::INTEGER) AS average age FROM "Ledger_BSLRTZ" WHERE "IsDeleted" = FALSE

[0295] -- SQL_USAGE_FIELDS:["CSRQ","IsDeleted"]

[0296] Finally, the IFD scores corresponding to the NL2SQL instruction fine-tuning data in different vertical fields are calculated according to the IFD (Instruction Following Difficulty) score calculation method, and then the NL2SQL instruction fine-tuning data is filtered according to the fine-tuning function.

[0297] As can be seen from the above, the embodiment of the present application generates irrelevant issues, non-authorization-related issues, authorization-irrelevant issues, authorization-related issues and related issues for the vertical field through vertical field table creation statements, and determines corresponding instruction fine-tuning data based on the above issues. Finally, the NL2SQL instruction fine-tuning data is filtered according to the fine-tuning function through the IFD score, so that a large amount of high-quality instruction fine-tuning data for landing scenarios can be obtained, which improves the database model experience and response speed, while also reducing the need for multi-model deployment and reducing the landing cost.

[0298] See also Figure 4 As shown, the present application provides an instruction fine-tuning data generating device, comprising:

[0299] A target question generation module 11 is used to create a target table building statement corresponding to the current preset vertical field, and generate a number of target questions corresponding to a number of preset conditions according to the target table building statement;

[0300] An instruction fine-tuning data generating module 12 is used to generate database data corresponding to the target problems, and to generate instruction fine-tuning data corresponding to the current preset vertical field according to the target problems and the database data;

[0301] The vertical field switching module 13 is used to take the next preset vertical field as the current preset vertical field, and jump to the step of creating a target table building statement corresponding to the current preset vertical field, and generating a plurality of target questions corresponding to a plurality of preset conditions according to the target table building statement, so as to generate instruction fine-tuning data corresponding to the next preset vertical field, until a plurality of instruction fine-tuning data corresponding to all preset vertical fields are generated;

[0302] a target instruction fine-tuning data determining module 14, configured to calculate a plurality of instruction following difficulty values ​​corresponding to the plurality of instruction fine-tuning data, and extract a plurality of target instruction fine-tuning data from the plurality of instruction fine-tuning data based on the plurality of instruction following difficulty values;

[0303] The target instruction fine-tuning data adjustment module 15 is used to adjust the data type ratio of the target instruction fine-tuning data based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data.

[0304] As can be seen from the above, the embodiment of the present application creates a target table creation statement, generates target problems for different application scenarios, determines corresponding instruction fine-tuning data based on the target problems, and finally screens qualified target instruction fine-tuning data by calculating the instruction following difficulty value. It can obtain a large amount of high-quality instruction fine-tuning data for landing scenarios, improve the database model experience and response speed, while also reducing the need for multi-model deployment and reducing landing costs.

[0305] In some specific implementations, the target question generating module 11 may specifically include:

[0306] A first target question generating unit is used to create a target table building statement corresponding to the current preset vertical field, and generate a number of first-type target questions corresponding to the first-type preset conditions and / or a number of second-type target questions corresponding to the second-type preset conditions according to the target table building statement; the first-type preset conditions are preset conditions that are irrelevant to the current preset vertical field; the second-type preset conditions are preset conditions that are related to the current preset vertical field;

[0307] A conditional control statement generating unit, used to create a target table building statement corresponding to the current preset vertical field, and generate a number of conditional control statements according to the target table building statement to determine the control authority;

[0308] A second target question generating unit is used to generate a number of third-category target questions corresponding to the third-category preset conditions and / or a number of fourth-category target questions corresponding to the fourth-category preset conditions, and / or a number of fifth-category target questions corresponding to the fifth-category preset conditions based on the control authority and the current preset vertical field; the third-category preset conditions are preset conditions related to the current preset vertical field and do not match the control authority; the fourth-category preset conditions are preset conditions that are unrelated to the current preset vertical field and match the control authority; the fifth-category preset conditions are preset conditions that are related to the current preset vertical field and match the control authority.

[0309] In some specific implementations, the instruction fine-tuning data generating module 12 may specifically include:

[0310] An instruction fine-tuning data generating unit is used to generate database data corresponding to the plurality of second-category target problems and the plurality of fifth-category target problems based on the target table creation statement, and to generate instruction fine-tuning data corresponding to the preset vertical field based on all the target problems and the database data.

[0311] In some specific implementations, the target instruction fine-tuning data determination module 14 may specifically include:

[0312] An instruction following difficulty value calculation unit, used for calculating a plurality of instruction following difficulty values ​​corresponding to the plurality of instruction fine-tuning data by using a preset instruction following difficulty calculation formula;

[0313] The target instruction fine-tuning data determining unit is used to determine whether the current instruction following difficulty value corresponding to the current instruction fine-tuning data among the several instruction fine-tuning data is greater than the preset instruction following difficulty value threshold; if the current instruction following difficulty value is greater than the preset instruction following difficulty value threshold, the current instruction fine-tuning data is determined as the target instruction fine-tuning data; if the instruction following difficulty value corresponding to the current instruction fine-tuning data is not greater than the preset instruction following difficulty value threshold, the next instruction fine-tuning data is used as the current instruction fine-tuning data, and jumps to the step of determining whether the current instruction following difficulty value corresponding to the current instruction fine-tuning data among the several instruction fine-tuning data is greater than the preset instruction following difficulty value threshold, so as to determine whether the instruction following difficulty value corresponding to the next instruction fine-tuning data is greater than the preset instruction following difficulty value threshold.

[0314] In some specific implementations, the target instruction fine-tuning data adjustment module 15 may specifically include:

[0315] A target problem expansion unit, used to expand the number of the target problems by presetting target problem expansion instructions;

[0316] a target question type ratio adjustment unit, configured to adjust the target question type ratio corresponding to the plurality of target instruction fine-tuning data based on a preset question type ratio to obtain an adjusted target question type ratio;

[0317] The target instruction fine-tuning data adjustment unit is used to adjust the data type ratio of the plurality of target instruction fine-tuning data based on the adjusted target problem type ratio to obtain the adjusted target instruction fine-tuning data.

[0318] Furthermore, the present application also discloses an electronic device. Figure 5 : This is a structural diagram of an electronic device 20 shown according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the instruction fine-tuning data generation method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0319] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0320] In addition, the memory 22 as a carrier for storing resources may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0321] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the instruction fine-tuning data generation method executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0322] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed instruction fine-tuning data generation method is implemented. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.

[0323] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0324] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0325] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0326] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0327] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for generating instruction fine-tuning data, characterized in that: include: Create a target table building statement corresponding to the current preset vertical field, and generate a number of target questions corresponding to a number of preset conditions according to the target table building statement; Generate database data corresponding to the plurality of target problems, and generate instruction fine-tuning data corresponding to the current preset vertical field according to the plurality of target problems and the database data; The next preset vertical field is used as the current preset vertical field, and the process jumps to the step of creating a target table building statement corresponding to the current preset vertical field, and generating a plurality of target questions corresponding to a plurality of preset conditions according to the target table building statement, so as to generate instruction fine-tuning data corresponding to the next preset vertical field, until a plurality of instruction fine-tuning data corresponding to all preset vertical fields are generated; Calculating a number of instruction following difficulty values ​​corresponding to the number of instruction fine-tuning data, and extracting a number of target instruction fine-tuning data from the number of instruction fine-tuning data based on the number of instruction following difficulty values; The data type ratios of the plurality of target instruction fine-tuning data are adjusted based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data.

2. The method for generating instruction fine-tuning data according to claim 1, characterized in that: The target table building statement corresponding to the current preset vertical field is created, and a number of target questions corresponding to a number of preset conditions are generated according to the target table building statement, including: Create a target table creation statement corresponding to the current preset vertical field, and generate a number of first-category target questions corresponding to the first-category preset conditions and / or a number of second-category target questions corresponding to the second-category preset conditions based on the target table creation statement; the first-category preset conditions are preset conditions that are unrelated to the current preset vertical field; the second-category preset conditions are preset conditions that are related to the current preset vertical field.

3. The method for generating instruction fine-tuning data according to claim 2, characterized in that: The target table building statement corresponding to the current preset vertical field is created, and a number of target questions corresponding to a number of preset conditions are generated according to the target table building statement, including: Create a target table building statement corresponding to the current preset vertical field, and generate several conditional control statements based on the target table building statement to determine the control authority; Based on the control authority and the current preset vertical field, a number of third-category target questions corresponding to the third-category preset conditions and / or a number of fourth-category target questions corresponding to the fourth-category preset conditions, and / or a number of fifth-category target questions corresponding to the fifth-category preset conditions are generated; the third-category preset conditions are preset conditions related to the current preset vertical field and do not match the control authority; the fourth-category preset conditions are preset conditions that are unrelated to the current preset vertical field and match the control authority; the fifth-category preset conditions are preset conditions that are related to the current preset vertical field and match the control authority.

4. The method for generating instruction fine-tuning data according to claim 3, characterized in that: The generating of database data corresponding to the plurality of target problems, and generating instruction fine-tuning data corresponding to the current preset vertical field according to the plurality of target problems and the database data, includes: Based on the target table creation statement, database data corresponding to the plurality of second-category target problems and the plurality of fifth-category target problems are generated, and instruction fine-tuning data corresponding to the preset vertical field is generated according to all the target problems and the database data.

5. The method for generating instruction fine-tuning data according to claim 1, characterized in that: The calculating a plurality of instruction following difficulty values ​​corresponding to the plurality of instruction fine-tuning data, and extracting a plurality of target instruction fine-tuning data from the plurality of instruction fine-tuning data based on the plurality of instruction following difficulty values, comprises: Calculate a number of instruction following difficulty values ​​corresponding to the number of instruction fine-tuning data using a preset instruction following difficulty calculation formula; Determine whether a current instruction following difficulty value corresponding to current instruction fine-tuning data among the plurality of instruction fine-tuning data is greater than a preset instruction following difficulty value threshold; If the current instruction following difficulty value is greater than a preset instruction following difficulty value threshold, the current instruction fine-tuning data is determined as the target instruction fine-tuning data; If the instruction following difficulty value corresponding to the current instruction fine-tuning data is not greater than the preset instruction following difficulty value threshold, the next instruction fine-tuning data is used as the current instruction fine-tuning data, and the process jumps to the step of determining whether the current instruction following difficulty value corresponding to the current instruction fine-tuning data among the several instruction fine-tuning data is greater than the preset instruction following difficulty value threshold, so as to determine whether the instruction following difficulty value corresponding to the next instruction fine-tuning data is greater than the preset instruction following difficulty value threshold.

6. The method for generating instruction fine-tuning data according to claim 1, characterized in that: Before the data type ratio of the plurality of target instruction fine-tuning data is adjusted based on the preset problem type ratio to obtain adjusted target instruction fine-tuning data, the method further includes: The number of the target questions is expanded by presetting target question expansion instructions.

7. The method for generating instruction fine-tuning data according to any one of claims 1 to 6, characterized in that: The step of adjusting the data type ratio of the plurality of target instruction fine-tuning data based on the preset problem type ratio to obtain adjusted target instruction fine-tuning data includes: Adjusting the target question type ratio corresponding to the target instruction fine-tuning data based on the preset question type ratio to obtain an adjusted target question type ratio; The data type ratios of the plurality of target instruction fine-tuning data are adjusted based on the adjusted target problem type ratios to obtain adjusted target instruction fine-tuning data.

8. A device for generating instruction fine-tuning data, characterized in that: include: A target question generation module is used to create a target table building statement corresponding to the current preset vertical field, and generate a number of target questions corresponding to a number of preset conditions according to the target table building statement; An instruction fine-tuning data generation module, used to generate database data corresponding to the plurality of target problems, and generate instruction fine-tuning data corresponding to the current preset vertical field according to the plurality of target problems and the database data; A vertical field switching module, used to take the next preset vertical field as the current preset vertical field, and jump to the step of creating a target table building statement corresponding to the current preset vertical field, and generating a plurality of target questions corresponding to a plurality of preset conditions according to the target table building statement, so as to generate instruction fine-tuning data corresponding to the next preset vertical field, until a plurality of instruction fine-tuning data corresponding to all preset vertical fields are generated; a target instruction fine-tuning data determining module, configured to calculate a plurality of instruction following difficulty values ​​corresponding to the plurality of instruction fine-tuning data, and extract a plurality of target instruction fine-tuning data from the plurality of instruction fine-tuning data based on the plurality of instruction following difficulty values; The target instruction fine-tuning data adjustment module is used to adjust the data type ratio of the target instruction fine-tuning data based on a preset problem type ratio to obtain adjusted target instruction fine-tuning data.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the instruction fine-tuning data generation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the instruction fine-tuning data generating method according to any one of claims 1 to 7 is implemented.