A method, device, electronic device and storage medium for generating instruction data
By mapping agents to generate similar instruction data, the evolved agent performs logical evolution, and evaluates it by the evaluation agent, the problem of insufficient logical reasoning capabilities of large language models in the existing technology is solved, and efficient and diversified instruction data generation is achieved.
Patent Information
- Application Number
- CN202411336445.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-09-25
AI Technical Summary
When dealing with relatively strong logic problems, existing large language models have problems with limited logical reasoning capabilities and insufficient generalization capabilities, and obtaining instruction data through human experts' annotation is expensive and time-consuming.
The initial instruction data is type analyzed by mapping agents, similar instruction data is generated, and candidate instruction data is generated through the evolution agent's execution of preset evolution strategies. Finally, the evaluation agent is evaluated to determine the candidate instruction data that meets the preset conditions. As target instruction data.
It realizes the efficiency of instruction data generation while reducing labor costs, improves the diversity and quality of instruction data, and reduces the repetition rate in data evolution processing.
Smart Images

Figure CN118862864B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for generating instruction data. Background Art
[0002] Large Language Model (LLM) refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. Large language model can handle a variety of natural language tasks, such as text classification, question answering, dialogue, etc., and is an important path to artificial intelligence (AI).
[0003] At present, large language models trained with instruction data have demonstrated excellent performance in multiple downstream tasks of natural language processing (NLP), such as information extraction, text generation, question and answer, etc. The purpose of training large language models with instruction data is to enable the trained large language models to better follow instructions to complete vertical downstream tasks. However, the existing large language models have limited logical reasoning ability and insufficient generalization ability when dealing with problems with strong logic. To address this problem, in related technologies, instruction data with logical reasoning ability is obtained by labeling by human experts. However, this method not only has high labeling costs, but is also relatively time-consuming. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a method, device, electronic device and storage medium for generating instruction data, so as to improve the efficiency of generating instruction data while reducing labor costs. The specific technical solution is as follows:
[0005] In a first aspect, an embodiment of the present invention provides a method for generating instruction data, the method comprising:
[0006] Obtaining preset initial instruction data;
[0007] Using a mapping agent to perform type analysis on the initial instruction data, and generate instruction data of the same type as the initial instruction data, to obtain similar instruction data;
[0008] Utilizing an evolutionary agent to execute a preset evolutionary strategy on the similar instruction data to obtain a plurality of candidate instruction data;
[0009] Utilizing an evaluation agent to execute a preset evaluation strategy on each of the candidate instruction data to obtain an evaluation result corresponding to each of the candidate instruction data;
[0010] The candidate instruction data whose evaluation results meet the preset conditions are determined as target instruction data; the target instruction data is used to train the large language model.
[0011] Optionally, the using a mapping agent to perform type analysis on the initial instruction data and generate instruction data of the same type as the initial instruction data to obtain similar instruction data includes:
[0012] The initial instruction data is input into the mapping agent for type analysis and data generation to obtain similar instruction data of the same type as the initial instruction data.
[0013] Optionally, the preset evolution strategy includes at least one of the following: a logic depth generation strategy, a logic scope generation strategy, a logic precision generation strategy, a logic restriction generation strategy, a logic reasoning generation strategy, and a logic adversarial generation strategy.
[0014] Optionally, the using the evolutionary agent to execute a preset evolutionary strategy on the similar instruction data to obtain a plurality of candidate instruction data includes at least one of the following:
[0015] When the preset evolution strategy includes a logic depth generation strategy, the similar instruction data is input into the evolution agent to execute the logic depth generation strategy, thereby increasing the depth and complexity of the similar instruction data to obtain candidate instruction data;
[0016] When the preset evolution strategy includes a logical range generation strategy, the similar instruction data is input into the evolution agent to execute the logical range generation strategy, and the data range of the similar instruction data is expanded to obtain candidate instruction data;
[0017] When the preset evolution strategy includes a logic precision generation strategy, the similar instruction data is input into the evolution agent to execute the logic precision generation strategy, thereby enhancing the accuracy of the similar instruction data and obtaining candidate instruction data;
[0018] When the preset evolution strategy includes a logic-restricted generation strategy, the similar instruction data is input into the evolution agent to execute the logic-restricted generation strategy, and restriction conditions are introduced for the similar instruction data to obtain candidate instruction data;
[0019] When the preset evolution strategy includes a logical reasoning generation strategy, the similar instruction data is input into the evolution agent to execute the logical reasoning generation strategy, thereby enhancing the logical reasoning of the similar instruction data and obtaining candidate instruction data;
[0020] When the preset evolution strategy includes a logic adversarial generation strategy, the similar instruction data is input into the evolution agent to execute the logic adversarial generation strategy, generate adversarial data of the similar instruction data, and obtain candidate instruction data.
[0021] Optionally, the preset evaluation strategy includes at least one of the following: a consistency evaluation strategy, a rationality evaluation strategy, a coherence evaluation strategy, a causal relationship evaluation strategy, a reasoning ability evaluation strategy, and a professional knowledge evaluation strategy.
[0022] Optionally, the utilizing evaluation agent executes a preset evaluation strategy on each of the candidate instruction data to obtain an evaluation result corresponding to each of the candidate instruction data, including at least one of the following:
[0023] When the preset evaluation strategy includes a consistency evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the consistency evaluation strategy, the consistency between the question and the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0024] When the preset evaluation strategy includes a rationality evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the rationality evaluation strategy, the rationality of the question and answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0025] When the preset evaluation strategy includes a coherence evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the coherence evaluation strategy, the coherence of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0026] When the preset evaluation strategy includes a causal relationship evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the causal relationship evaluation strategy, the causal relationship of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0027] When the preset evaluation strategy includes a reasoning ability evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the reasoning ability evaluation strategy, the logical clarity of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0028] When the preset evaluation strategy includes a professional knowledge evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the professional knowledge evaluation strategy, the accuracy of the response content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained.
[0029] Optionally, the method further comprises:
[0030] Obtaining a marking result corresponding to the target instruction data;
[0031] Inputting the target instruction data into a pre-trained large language model to obtain a prediction result corresponding to the target instruction data;
[0032] The loss between the prediction result and the annotation result is calculated, and the parameters of the pre-trained large language model are adjusted according to the loss to obtain a trained large language model.
[0033] In a second aspect, an embodiment of the present invention provides a device for generating instruction data, the device comprising:
[0034] A data acquisition module, used to acquire preset initial instruction data;
[0035] A data mapping module, used to perform type analysis on the initial instruction data using a mapping agent, and generate instruction data of the same type as the initial instruction data to obtain similar instruction data;
[0036] A data evolution module, used for executing a preset evolution strategy on the similar instruction data using an evolutionary agent to obtain a plurality of candidate instruction data;
[0037] A data evaluation module, used to use an evaluation agent to execute a preset evaluation strategy on each candidate instruction data to obtain an evaluation result corresponding to each candidate instruction data;
[0038] The data screening module is used to determine the candidate instruction data whose evaluation results meet the preset conditions as the target instruction data; the target instruction data is used to train the large language model.
[0039] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0040] Memory, used to store computer programs;
[0041] The processor is used to implement any of the above methods when executing the program stored in the memory.
[0042] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned methods is implemented.
[0043] In a fifth aspect, an embodiment of the present invention further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-described methods.
[0044] Beneficial effects of the embodiments of the present invention:
[0045] An instruction data generation method, device, electronic device and storage medium provided by an embodiment of the present invention can use a mapping agent to perform type analysis on initial instruction data and generate similar instruction data of the same type as the initial instruction data, which can reduce the repetition rate of evolved data in subsequent data evolution processing. An evolution agent is used to execute a preset evolution strategy on similar instruction data to obtain multiple candidate instruction data, thereby realizing the automatic generation of a large amount of instruction data and improving the diversity of generated instruction data. Furthermore, an evaluation agent is used to execute a preset evaluation strategy on each candidate instruction data, and the candidate instruction data whose evaluation results meet preset conditions is determined as the target instruction data, which ensures the data quality of the generated instruction data to a certain extent, thereby improving the efficiency of instruction data generation while reducing labor costs.
[0046] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] 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 in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0048] Figure 1 A schematic diagram of a flow chart of a method for generating instruction data provided by an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of a method for generating instruction data provided by an embodiment of the present invention;
[0050] Figure 3 A schematic diagram of a flow chart of a model training method provided by an embodiment of the present invention;
[0051] Figure 4 A schematic diagram of the structure of a device for generating instruction data provided by an embodiment of the present invention;
[0052] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0053] 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 in the present invention, all other embodiments obtained by ordinary technicians in this field based on this application belong to the scope of protection of the present invention.
[0054] Existing large language models have limited logical reasoning ability and insufficient generalization ability when dealing with problems with strong logic. To address this problem, in related technologies, human experts use Chain of Thought (CoT) technology to manually annotate instruction data with logical reasoning ability. However, this method is not only costly to annotate, but also time-consuming.
[0055] To solve the above problems, the embodiments of the present invention provide a method, device, electronic device and storage medium for generating instruction data. The method for generating instruction data provided by the embodiments of the present invention can be applied to the generation of instruction data in reasoning scenarios that require large models for reasoning, such as common sense reasoning, logical reasoning, mathematical reasoning, symbolic reasoning and multimodal reasoning, and the generated instruction data can be applied to large language model training and fine-tuning scenarios in the field of artificial intelligence. The method for generating instruction data provided by the embodiments of the present invention can be executed by a device for generating instruction data, which can be deployed in an electronic device, such as a client device or a server device.
[0056] like Figure 1 As shown, the method for generating instruction data provided by the embodiment of the present invention may include the following steps:
[0057] S101, obtaining preset initial instruction data;
[0058] S102, using a mapping agent to perform type analysis on the initial instruction data, and generate instruction data of the same type as the initial instruction data, to obtain similar instruction data;
[0059] S103, using an evolutionary agent to execute a preset evolutionary strategy on similar instruction data to obtain a plurality of candidate instruction data;
[0060] S104, using the evaluation agent to execute a preset evaluation strategy on each candidate instruction data to obtain an evaluation result corresponding to each candidate instruction data;
[0061] S105, determining the candidate instruction data whose evaluation results meet the preset conditions as the target instruction data;
[0062] The target instruction data is used to train a large language model.
[0063] In an embodiment of the present invention, a mapping agent can be used to perform type analysis on initial instruction data and generate similar instruction data of the same type as the initial instruction data, which can reduce the repetition rate of the evolved data in the subsequent data evolution processing process. An evolution agent is used to execute a preset evolution strategy on similar instruction data to obtain multiple candidate instruction data, thereby realizing the automatic generation of a large amount of instruction data and improving the diversity of generated instruction data. Furthermore, an evaluation agent is used to execute a preset evaluation strategy on each candidate instruction data, and the candidate instruction data whose evaluation results meet preset conditions is determined as the target instruction data, which ensures the data quality of the generated instruction data to a certain extent, thereby reducing labor costs while improving the efficiency of instruction data generation.
[0064] In S101, the preset initial instruction data may be, for example, a small amount of logical instruction data with strong logic annotated by an expert, or instruction data obtained from other devices, and the part of instruction data is used as metadata for generating instruction data. In the embodiment of the present invention, instruction data is also a prompt word, which may be a question, a text description, etc. The preset initial instruction data is logical instruction data with strong logic annotated, which can ensure the logical reasoning ability and data quality of the subsequently generated instruction data, and the data quality here may represent the accuracy of the data, etc.
[0065] In one example, the initial instruction data may be logic instruction data in reasoning scenarios such as common sense reasoning, logical reasoning, mathematical reasoning, symbolic reasoning, and multimodal reasoning. For example, the initial instruction data may be a prompt word in a mathematical reasoning scenario: "There are three people A, B, and C, and they said the following: A said "B is a thief", B said: "C is a thief", and C said: "A is lying". It is known that only one of the three people told the truth, and the other two were lying. Who is the thief?", etc., and the initial instruction data is represented as .
[0066] Intelligent agent is a very important concept in the field of artificial intelligence. Any independent entity that can think and interact with the environment can be abstracted as an intelligent agent. An intelligent agent can specifically refer to a software or hardware entity that can act autonomously.
[0067] In S102, the mapping agent is an agent that is pre-designed based on the prompt word engineering and is used to perform type analysis on the initial instruction data and generate instruction data of the same type as the initial instruction data. Specifically, the mapping agent can be obtained based on the first preset prompt word, which is a prompt word used to perform type analysis on the initial instruction data and generate instruction data of the same type as the initial instruction data. The first preset prompt word is assigned to a pre-trained large model to obtain the mapping agent, and the pre-trained large model can be, for example, GPT-4o.
[0068] Exemplarily, the first preset prompt word corresponding to the mapping agent may be:
[0069] "You are a professional prompt word mapping agent
[0070] Analyze the type of prompt words given
[0071] Give me an example of this type
[0072] The answer should only include the question, not the result or analysis. Do not include "Question:" or "Example:" in the output. ”.
[0073] In a possible implementation, this step may be specifically implemented by: inputting the initial instruction data into a mapping agent for type analysis and data generation to obtain similar instruction data of the same type as the initial instruction data.
[0074] The mapping agent can perform type analysis on the initial instruction data input therein, and then generate one or more example instruction data of the same type as the initial instruction data, i.e., similar instruction data. For example, taking a mathematical problem in a mathematical reasoning scenario as an example, the type of the initial instruction data can be, for example, a statistical data analysis type, an optimization type, an equation solving type, and the like.
[0075] In one example, the embodiment of the present invention can realize data interaction through an application programming interface (API) to generate instruction data. Specifically, the initial instruction data can be input into the mapping agent through the API corresponding to the mapping agent to perform type analysis and data generation, and obtain the corresponding output, that is, similar instruction data of the same type as the initial instruction data.
[0076] Exemplarily, corresponding to the above initial instruction data ,Will Input the mapping agent designed using the first preset prompt word to obtain similar instruction data , It can be: "One of A, B and C is a thief. A said: "B is a thief", B said: "C is a thief", C said: "B is lying". It is known that only one person told the truth, who is the thief?".
[0077] In the embodiment of the present invention, a mapping agent is used to perform type analysis on initial instruction data and generate similar instruction data of the same type as the initial instruction data, which can reduce the repetition rate of the evolved data in the subsequent instruction data evolution process.
[0078] In S103, the evolutionary agent is an agent that is pre-designed based on prompt word engineering and is used to execute a preset evolutionary strategy on similar instruction data to evolve similar instruction data. Specifically, the evolutionary agent can be obtained based on a second preset prompt word, which is a prompt word used to execute a preset evolutionary strategy on similar instruction data to evolve similar instruction data, and the second preset prompt word is assigned to a pre-trained large model to obtain an evolutionary agent, and the pre-trained large model can be, for example, GPT-4o. Among them, the preset evolutionary strategy can be one or more, which will be described in detail below.
[0079] Exemplarily, the second preset prompt word corresponding to the evolving agent may be:
[0080] “You are a professional cue-word engineer.
[0081] Your goal is to rewrite the given prompt into a more complex version so that the AI system can respond more logically.
[0082] The rewritten prompt words must be reasonable and can be understood and answered by humans.
[0083] You should override a given prompt by:
[0084] If a #given prompt# can be solved in a few concise steps of thinking, you can rewrite it to explicitly ask for a step-by-step logical response.
[0085] You should try to avoid having redundant content in your #rewritten tips#. #rewritten tips# can only add a small number of words to the #given tips#.
[0086] Please remember to rewrite the prompt in Chinese.
[0087] '#given hint#', '#overridden hint#', 'given hint' and 'overridden hint' cannot appear in #overridden hint#.
[0088] #Given Tips#:
[0089] Among A, B, and C, one is a thief. A says, "B is a thief," B says, "C is a thief," and C says, "B is lying." It is known that only one person is telling the truth, so who is the thief?
[0090] #Rewrite tips#:".
[0091] The embodiment of the present invention can input similar instruction data into the evolving agent through the API corresponding to the evolving agent, so as to execute the preset evolution strategy on the similar instruction data and obtain candidate instruction data. In one example, n rounds of evolution processing can be performed, that is, an evolution is first performed on the similar instruction data, and then the instruction data generated by the evolution is evolved, so as to perform multiple rounds of iterative evolution to obtain more candidate instruction data, and n represents a positive integer greater than 1. Among them, the "given prompt" in the second preset prompt word of the above example is the similar instruction data input into the evolving agent, and "if the #given prompt# can be solved by a few concise thinking steps, it can be rewritten to explicitly require a reply of step-by-step logical reasoning." corresponds to a preset evolution strategy, and the "rewritten prompt" is the candidate instruction data generated by the evolution of the evolving agent.
[0092] Exemplarily, corresponding to the above similar instruction data ,Will Input the evolved intelligent agent designed using the second preset prompt word to obtain candidate instruction data , represents the candidate instruction data obtained by executing n rounds of evolutionary processing, A candidate instruction data may be:
[0093] "topic:
[0094] Among A, B, and C, one is a thief. A, B, and C made the following statements: A said, "B is a thief," B said, "C is a thief," and C said, "B is lying." Now please consider the following questions in turn and give your reasoning process:
[0095] 1. If A is telling the truth, then B is a thief. Is this consistent with the known conditions? If not, explain the reason.
[0096] 2. If what B said is true, then C is a thief. Is this consistent with the known conditions? If not, explain the reason.
[0097] 3. If C is telling the truth, then B is lying. Is this consistent with the known conditions? If not, explain the reason.
[0098] 4. Based on the above three situations and the known conditions, who is most likely to be the thief? Please explain your reasoning process in detail.
[0099] answer:
[0100] Let's analyze what each person said and their possible truth or falsehood in turn to determine who the thief is.
[0101] 1. If A is telling the truth:
[0102] - Person A said, "Person B is a thief."
[0103] - If A is telling the truth, then B is a thief.
[0104] - Now we want to verify what B and C say:
[0105] - If B is a thief, then B’s statement (“C is a thief”) is false.
[0106] - If B is a thief, C's statement ("B is lying") should be true, because B is indeed lying.
[0107] - In this case, B is lying and C is telling the truth, which is consistent with logic.
[0108] 2. If B is telling the truth:
[0109] - Person B said: "C is a thief."
[0110] - If B is telling the truth, then C is a thief.
[0111] - Now we want to verify what A and C say:
[0112] - If C is a thief, then what C said ("B is lying") is false, because C is indeed lying.
[0113] - If C is a thief, then A’s statement (“B is a thief”) should be false, because B is not a thief, but C is the thief.
[0114] - In this case, A is lying and C is lying, which is illogical because only one person is the thief, and it is illogical for both of them to lie.
[0115] 3. If C is telling the truth:
[0116] - C said: "B is lying."
[0117] - If C is telling the truth, then B is lying, that is, what B said, "C is a thief", is false.
[0118] - Now we want to verify A's statement:
[0119] - B is lying which means B is not a thief, which means C is not a thief.
[0120] - If B is lying, then A's statement ("B is a thief") is correct.
[0121] - In this case, B is lying and A is telling the truth, which is consistent with logic.
[0122] Comprehensive analysis of the above three situations:
[0123] - If A is telling the truth, then B is a thief, B is lying, and C is telling the truth.
[0124] - If Person B is telling the truth, then Person C is a thief, but this situation is illogical because both persons are lying.
[0125] - If C is telling the truth, then B is lying and A is telling the truth, which means B is a thief.
[0126] Through analysis, only the two cases of A telling the truth and C telling the truth are logically self-consistent. And these two cases have one thing in common - B is a thief. Therefore, B is most likely to be a thief. "
[0127] The evolutionary agent can execute a preset evolution strategy on similar instruction data to evolve similar instruction data from different aspects, so that the generated candidate instruction data has diversity. It can also execute multiple rounds of evolution processing to generate a large number of candidate instruction data, realizing the automatic generation of a large number of instruction data.
[0128] In S104, the evaluation agent is an agent that is pre-designed based on the prompt word engineering to execute a preset evaluation strategy on the candidate instruction data generated by evolution to evaluate the candidate instruction data. Specifically, the evaluation agent can be obtained based on the third preset prompt word, which is a prompt word used to execute a preset evaluation strategy on the candidate instruction data generated by evolution to evaluate the candidate instruction data. The third preset prompt word is assigned to a pre-trained large model to obtain the evaluation agent, and the pre-trained large model can be, for example, GPT-4o. Among them, the preset evaluation strategy can be one or more, and the specific description is similarly given below.
[0129] Exemplarily, the third preset prompt word corresponding to the evaluation agent may be:
[0130] “You are a professional instruction dataset evaluator.
[0131] Now I will give you a question and the corresponding answer. Please rate this data. The score is evaluated based on the following criteria, with the weights from largest to smallest:
[0132] The answer's problem-solving steps are coherent, logically clear, and have cause-effect relationships—50%.
[0133] The answer is correct from a calculation point of view and is consistent with the mathematical description in the question - 30%.
[0134] The answer is consistent with the question: 10%.
[0135] Both the questions and the answers are based on common sense and are reasonable, with emphasis on whether the results can represent decimals or negative numbers, etc.----10%.
[0136] Your answer must contain only 4 scores and the total score. Each score should be more detailed to improve the discrimination of the question. Put the 5 scores in brackets and output them. Do not output anything other than the brackets. ”.
[0137] The embodiment of the present invention can input candidate instruction data into the evaluation agent one by one or in batches through the API corresponding to the evaluation agent, so as to execute the preset evaluation strategy on the candidate instruction data and obtain the evaluation results corresponding to each candidate instruction data. Among them, the third preset prompt word "the answering steps are coherent, logically clear, and causally related" ---- 50%. The answer is correct from a calculation point of view and is consistent with the mathematical description in the question - 30%. The answer is consistent with the question: 10%. Both the questions and the answers are based on common sense and are reasonable, with emphasis on whether the results can represent decimals or negative numbers, etc.----10%. ", represents different evaluation strategies and the weight of the evaluation strategy.
[0138] For example, corresponding to the above A candidate instruction data is input into the evaluation agent designed using the third preset prompt word, and the obtained evaluation result can be expressed as: "Evaluation result: [50, 30, 10, 10, 100]". The last number in the evaluation result represents the total score of each evaluation strategy, and each of the remaining numbers represents the evaluation score of the corresponding evaluation strategy.
[0139] In one example, in S105, the candidate instruction data may be sorted in descending order according to the total score in the evaluation result, and then a preset number of candidate instruction data with a high ranking are determined as target instruction data, or the candidate instruction data with a total score greater than a preset threshold in the evaluation result are determined as target instruction data, etc. The candidate instruction data may also be sorted in descending order according to the evaluation score corresponding to the specified evaluation strategy in the evaluation result, and then a preset number of candidate instruction data with a high ranking are determined as target instruction data, or the candidate instruction data with an evaluation score corresponding to the specified evaluation strategy in the evaluation result greater than a set threshold are determined as target instruction data, etc. Among them, the preset number, preset threshold, set threshold and specified evaluation strategy can be set according to actual needs, and the embodiments of the present invention do not limit this.
[0140] The evaluation agent can perform detailed analysis and evaluation on each candidate instruction data generated by the evolution, so as to screen out better instruction data based on the evaluation results, eliminate data that does not meet the requirements or is duplicated, and improve the data quality of the target instruction data finally generated.
[0141] In a possible implementation, the above-mentioned preset evolution strategy may include at least one of the following: a logic depth generation strategy, a logic scope generation strategy, a logic precision generation strategy, a logic restriction generation strategy, a logic reasoning generation strategy, and a logic adversarial generation strategy.
[0142] Among them, the logical deepening generation strategy is a prompt word for increasing the depth and complexity of similar instruction data, the logical scoping generation strategy is a prompt word for expanding the data scope of similar instruction data, the logical precision generation strategy is a prompt word for enhancing the accuracy of similar instruction data, the logical restriction generation strategy is a prompt word for introducing restriction conditions for similar instruction data, the logical reasoning generation strategy is a prompt word for enhancing the logical reasoning of similar instruction data, and the logical adversarial generation strategy is a prompt word for generating adversarial data for similar instruction data.
[0143] Accordingly, the above step S103 uses the evolutionary agent to execute a preset evolutionary strategy on similar instruction data to obtain multiple candidate instruction data, which may include at least one of the following:
[0144] When the preset evolution strategy includes a logic depth generation strategy, similar instruction data is input into the evolution agent to execute the logic depth generation strategy, thereby increasing the depth and complexity of the similar instruction data and obtaining candidate instruction data;
[0145] When the preset evolution strategy includes a logical range generation strategy, similar instruction data is input into the evolution agent to execute the logical range generation strategy, so as to expand the data range of the similar instruction data and obtain candidate instruction data;
[0146] When the preset evolution strategy includes a logic precision generation strategy, similar instruction data is input into the evolution agent to execute the logic precision generation strategy, thereby enhancing the accuracy of the similar instruction data and obtaining candidate instruction data;
[0147] When the preset evolution strategy includes a logic-restricted generation strategy, similar instruction data is input into the evolution agent to execute the logic-restricted generation strategy, and restriction conditions are introduced for the similar instruction data to obtain candidate instruction data;
[0148] When the preset evolution strategy includes a logical reasoning generation strategy, similar instruction data is input into the evolution agent to execute the logical reasoning generation strategy, the logical reasoning of the similar instruction data is enhanced, and candidate instruction data is obtained;
[0149] When the preset evolution strategy includes a logical adversarial generation strategy, similar instruction data is input into the evolutionary agent to execute the logical adversarial generation strategy, to generate adversarial data of similar instruction data, and to obtain candidate instruction data.
[0150] Exemplarily, the logic depth generation strategy can be expressed as , Specifically used to increase the depth and complexity of similar instruction data, the corresponding prompt words can be: = "If the #given prompt# contains inquiries about certain questions, you can improve the logical depth of the response by increasing the depth of the inquiry." Then, using the instruction data generated by the strategy evolution to train the model can improve the model's ability to handle complex tasks.
[0151] The logical scope generation strategy can be expressed as , Specifically used to expand the data coverage of similar instruction data, the corresponding prompt words can be: = "If the #given prompt# contains inquiries about certain issues, the logical depth of the response can be improved by increasing the scope of the inquiry." Then, the model is trained using the instruction data generated by the strategy evolution, which can enhance the generalization ability of the model.
[0152] The logic precision generation strategy can be expressed as , Specifically used to enhance the accuracy of similar instruction data, the corresponding prompt words can be: ="Replace the general description in the #given prompt# with more specific and precise concepts to enhance the clarity and operability of the response." Then, using the instruction data generated by the strategy evolution to train the model can make the model more accurate and reliable when executing instructions.
[0153] The logical restriction generation strategy can be expressed as , It is specifically used to introduce restriction conditions for similar instruction data, so that the instruction data is more in line with the requirements of actual application scenarios and improves the practicality of the instruction data. The corresponding prompt words can be: = "Introduce more specific restrictions or requirements in the #given prompt# to enhance the logic and execution of the response.".
[0154] The logical reasoning generation strategy can be expressed as , Specifically used to enhance the logical reasoning of similar instruction data, so as to enhance the logical reasoning components in similar instruction data, the corresponding prompt words can be: = "If the #given prompt# can be solved by a few concise thinking steps, it can be rewritten to explicitly require a reply with step-by-step logical reasoning." Then, the model can be trained using the instruction data generated by the strategy evolution to improve the intelligence and reliability of the model.
[0155] The logical adversarial generation strategy can be expressed as , Specifically used to generate adversarial data with similar instruction data, the corresponding prompt words can be: ="Please consider some boundary cases or extreme examples that may lead to errors, and rewrite the #given prompt# to include ambiguous, contradictory or misleading elements to test the robustness of the response.", and then use the instruction data generated by the strategy evolution to train the model, which can improve the model's robustness and anti-interference ability.
[0156] Among them, the "given prompt" in the above example refers to the similar instruction data input into the evolving intelligent agent.
[0157] The evolutionary agent may contain one evolutionary strategy or multiple evolutionary strategies at the same time. When one evolutionary strategy is contained, the prompt word corresponding to the evolutionary agent includes the prompt word corresponding to the evolutionary strategy; when multiple evolutionary strategies are contained at the same time, the prompt word corresponding to the evolutionary agent includes the prompt words corresponding to multiple evolutionary strategies. When performing evolutionary processing on similar instruction data, multiple rounds of iterations may be performed to generate candidate instruction data to generate candidate instruction data with a larger amount of data. For example, the initial instruction data annotated by the expert is 15 data. After the mapping agent performs type analysis and data generation, 15 similar instruction data of the same type as the initial instruction data are obtained. For each similar instruction data, the above 6 evolutionary strategies are executed respectively, and 5 rounds of evolutionary processing are iteratively performed to obtain That is, more than 100,000 candidate instruction data, with strong instruction data automatic generation capabilities, significantly reducing labor costs and time consumption, and based on different evolution strategies, can generate instruction data with a certain degree of logical complexity and diversity.
[0158] In a possible implementation, the above-mentioned preset evaluation strategy includes at least one of the following: a consistency evaluation strategy, a rationality evaluation strategy, a coherence evaluation strategy, a causal relationship evaluation strategy, a reasoning ability evaluation strategy, and a professional knowledge evaluation strategy.
[0159] Among them, the consistency evaluation strategy is a prompt word used to evaluate the consistency of the questions and answer contents contained in the candidate instruction data, the rationality evaluation strategy is a prompt word used to evaluate the rationality of the questions and answer contents contained in the candidate instruction data, the coherence evaluation strategy is a prompt word used to evaluate the coherence of the problem-solving steps of the answer contents contained in the candidate instruction data, the causal relationship evaluation strategy is a prompt word used to evaluate the causal relationship of the problem-solving steps of the answer contents contained in the candidate instruction data, the reasoning ability evaluation strategy is a prompt word used to evaluate the logical clarity of the problem-solving steps of the answer contents contained in the candidate instruction data, and the professional knowledge evaluation strategy is a prompt word used to evaluate the accuracy of the answer contents contained in the candidate instruction data.
[0160] Accordingly, the above step S104 uses the evaluation agent to execute a preset evaluation strategy on each candidate instruction data to obtain an evaluation result corresponding to each candidate instruction data, which may include at least one of the following:
[0161] When the preset evaluation strategy includes a consistency evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the consistency evaluation strategy, the consistency between the question and the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0162] When the preset evaluation strategy includes a rationality evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the rationality evaluation strategy, the rationality of the question and answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0163] When the preset evaluation strategy includes a coherence evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the coherence evaluation strategy, the coherence of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0164] When the preset evaluation strategy includes a causal relationship evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the causal relationship evaluation strategy, the causal relationship of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0165] When the preset evaluation strategy includes a reasoning ability evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the reasoning ability evaluation strategy, the logical clarity of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0166] When the preset evaluation strategy includes a professional knowledge evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the professional knowledge evaluation strategy, the accuracy of the response content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained.
[0167] The evaluation agent may include one evaluation strategy or multiple evaluation strategies at the same time. When multiple evaluation strategies are included at the same time, the prompt word corresponding to the evaluation agent includes prompt words corresponding to multiple evaluation strategies, and may also include weights corresponding to multiple evaluation strategies, or may combine multiple evaluation strategies in one prompt word.
[0168] The third preset prompt word corresponding to the above-mentioned evaluation agent is used as an example. In this example, six evaluation strategies are included: consistency evaluation strategy, rationality evaluation strategy, coherence evaluation strategy, causality evaluation strategy, reasoning ability evaluation strategy, and professional knowledge evaluation strategy. Among them, the coherence evaluation strategy, reasoning ability evaluation strategy, and causality evaluation strategy are used in one prompt word, with a weight of 50%. The corresponding prompt word is: "The answer is consistent, logically clear, and has a causal relationship----50%. "; The weight of professional knowledge assessment strategy is 30%, and the corresponding prompt is: "The answer is correct from a calculation point of view and conforms to the mathematical description in the question----30%. "; The weight of the consistency assessment strategy is 10%, and the corresponding prompt is: "The answer content is consistent with the question----10%. "; The weight of the rationality evaluation strategy is 10%, and the corresponding prompt words are: "Both the questions and the answers are common sense and reasonable, and focus on whether the meaning represented by the results can be decimals or negative numbers, etc.----10%. ”.
[0169] For example, Figure 2 As shown, the generation of instruction data in the embodiment of the present invention can be divided into two stages, one stage is data evolution, and the other stage is data enhancement. In the data evolution stage, the preset initial instruction data (i.e., metadata) is generated. ,Will Input mapping agent to perform type analysis and data generation, and obtain Similar instruction data of the same type , and then Input the evolving agent to execute at least one of the following strategies: logic depth generation strategy, logic scope generation strategy, logic precision generation strategy, logic restriction generation strategy, logic reasoning generation strategy, and logic confrontation generation strategy. Perform at least one of the following evolutionary processes: deepening, scoping, refining, restricting, reasoning, and adversarial, to obtain candidate instruction data. . It's okay Generate similar instructions , directly It is also possible to input the evolutionary agent for evolution processing. Furthermore, in the data enhancement stage, the candidate instruction data generated by the evolution , each Input the evaluation agent to execute the preset evaluation strategy and obtain the The corresponding evaluation results ( Figure 2 The candidate instruction data that meets the preset conditions is determined as the target instruction data, that is, the final logical instruction data is obtained by screening. .
[0170] In an embodiment of the present invention, a mapping agent is first used to perform type analysis on initial instruction data, and instruction data of the same type as the initial instruction data is generated to obtain similar instruction data, thereby reducing the repetition rate of the evolved data in subsequent data evolution processing. Then, an evolution agent is used to execute different evolution strategies on the similar instruction data to obtain multiple candidate instruction data, thereby realizing the automatic generation of a large amount of instruction data, improving the logic and diversity of the generated instruction data, and enabling the generated instruction data to adapt to the needs of different downstream tasks, thereby enhancing the performance of the model trained using the generated instruction data in different tasks. Furthermore, an evaluation agent is used to execute a preset evaluation strategy on each candidate instruction data, and the candidate instruction data whose evaluation results meet the preset conditions is determined as the target instruction data, thereby ensuring the data quality of the generated instruction data to a certain extent, thereby reducing labor costs while improving the efficiency of instruction data generation.
[0171] In a possible implementation manner, based on the above embodiment, as Figure 3 As shown, the following model training steps can also be performed:
[0172] S301, obtaining the marking result corresponding to the target instruction data.
[0173] After the target instruction data is generated in the manner of the above embodiment, part or all of the target instruction data may be labeled to obtain a labeling result corresponding to the target instruction data, where the labeling result is the true value result corresponding to the target instruction data.
[0174] S302, input the target instruction data into the pre-trained large language model to obtain a prediction result corresponding to the target instruction data.
[0175] Use the pre-trained large language model and fine-tune the training using the target instruction data and its corresponding annotation results to improve the cost and efficiency of model training. The pre-trained large language model can be, for example, GPT-4o, chat language model deepseek-llm-7b-chat, etc. Exemplarily, the LORA method can be used to fine-tune the pre-trained large language model to reduce the cost of model training and improve the efficiency of model training.
[0176] S303, calculating the loss between the prediction result and the annotation result, and adjusting the parameters of the pre-trained large language model according to the loss to obtain a trained large language model.
[0177] The loss function used to calculate the loss between the prediction result and the labeling result may be, for example, a cross entropy loss function, and then the parameters of the pre-trained large language model are adjusted according to the loss until a preset end condition is met to obtain a trained large language model. The preset end condition may be a preset number of iterations, or the loss reaches a preset loss threshold, etc.
[0178] This is because a mapping agent is first used to perform type analysis on the initial instruction data, and instruction data of the same type as the initial instruction data is generated to obtain similar instruction data. Then, an evolutionary agent is used to execute different evolutionary strategies on the similar instruction data to obtain multiple candidate instruction data. Compared with similar instruction data and initial instruction data, the candidate instruction data has improved logic and diversity, and can better adapt to the needs of different downstream tasks. Furthermore, an evaluation agent is used to execute a preset evaluation strategy on each candidate instruction data, and the candidate instruction data whose evaluation results meet the preset conditions is determined as the target instruction data. This ensures the data quality of the generated target instruction data to a certain extent, so that the target instruction data is used to fine-tune the training of the large language model, and the trained large language model has stronger logical expression ability, which can effectively improve the generalization ability and task processing ability of the large language model when processing complex logical tasks.
[0179] For example, the pre-trained large language model is deepseek-llm-7b-chat, and the trained large language model obtained after fine-tuning training using the target instruction data and its corresponding annotation results is AntLM-7b-chat. Four example instruction data are used to compare the processing capabilities of deepseek-llm-7b-chat and AntLM-7b-chat. The results are as follows:
[0180] Example command data 1:
[0181] Ms. Zhang is currently three times her daughter's age. Six years later, Ms. Zhang's age will be twice her daughter's age. Based on these conditions, calculate the current ages of Ms. Zhang and her daughter, and explain the calculation steps in detail.
[0182] The processing results of the deepseek-llm-7b-chat model are:
[0183] Suppose Ms. Zhang is X years old and her daughter is Y years old. According to the question, we have two conditions: 1. Ms. Zhang's current age is three times her daughter's age: X=3Y. 2. Six years later, Ms. Zhang's age will become twice her daughter's age: X+6=2(Y+6). We can find the values of X and Y by solving these two equations. First, substitute the first equation into the second equation: 3Y+6=2(Y+6), which can be simplified to: 3Y=2Y+12, and by simplifying, we get: Y=12. Then, substitute Y=12 into the first equation X=3Y: X=3×12, so Ms. Zhang's age is: X=36 years old. Therefore, Ms. Zhang's current age is 36 years old and her daughter's age is 12 years old.
[0184] The processing results of the AntLM-7b-chat model are:
[0185] We can solve this problem by setting up equations. Let Ms. Zhang be x years old now and her daughter be y years old now. According to the question, we have the following two conditions: 1. Ms. Zhang is three times her daughter's age: x=3y. 2. Six years later, Ms. Zhang will be twice her daughter's age: x+6=2(y+6). Now, we have two equations: x=3y, x+6=2(y+6). We can simplify it by substituting the first equation x=3y into the second equation. Substitute x into the second equation: 3y+6=2(y+6), expand the second equation: 3y+6=2y+12, move 2y to the left of the equal sign and the constant to the right: 3y-2y=12-6, simplify to: y=6, now we know that the daughter is now y=6 years old. Next, use the first equation x=3y to calculate Ms. Zhang's current age x. Substitute y=6 into x=3y, x=3(6), calculate: x=18. Therefore, Ms. Zhang is now 18 years old and her daughter is now 6 years old. Summary: Ms. Zhang is now 18 years old and her daughter is now 6 years old.
[0186] The annotation result of example instruction data 1 is:
[0187] Ms. Zhang is now 18 years old. Her daughter is now 6 years old.
[0188] Example command data 2:
[0189] Two cars start from A and B, 300 kilometers apart, at the same time and drive towards each other. The speed of car A is 60 kilometers per hour, and the speed of car B is 40 kilometers per hour. Please answer the following questions in detail:
[0190] When the two cars met for the first time, how many kilometers had Car A and Car B traveled respectively?
[0191] When the two cars met for the first time, Car B immediately turned around and returned to B, while Car A continued to drive towards B. When Car A arrived at B, how many kilometers had Car B traveled in total?
[0192] Suppose the two cars turn around at the first meeting point, return to their respective starting points, and meet again at a certain point. How many kilometers did Car A and Car B travel respectively when they met for the second time? Please calculate the mileage of each car in detail and explain the total time between the two encounters.
[0193] The processing results of the deepseek-llm-7b-chat model are:
[0194] When they first met, the relative speed of the two cars was 100 km / h and the total distance was 300 km, so the meeting time was 3 hours. Car A traveled 180 km and Car B traveled 120 km.
[0195] It takes another 2 hours for car A to reach B. Car B turns around and drives 80 kilometers in 2 hours, so B drives a total of 120+80=200 kilometers.
[0196] The total distance traveled for the second encounter is 300 km, and the relative speed is still 100 km / h, so the encounter time is 3 hours. Car A has traveled 180 km and Car B has traveled 120 km.
[0197] The processing results of the AntLM-7b-chat model are:
[0198] The first question: How many kilometers had Car A and Car B traveled respectively when they met for the first time?
[0199] Car A and Car B start from places A and B, 300 kilometers apart, at the same time and drive towards each other.
[0200] Car A is going 60 kilometers per hour, and Car B is going 40 kilometers per hour. Because they are traveling in opposite directions, the speed at which the two cars approach each other is the sum of their speeds, which is nearly 100 kilometers per hour.
[0201] Because the distance between the two cars is 300 kilometers, and they are approaching 100 kilometers per hour together, they will meet in 3 hours.
[0202] During these 3 hours, Car A traveled at a speed of 60 kilometers per hour, so it traveled a total of 180 kilometers in 3 hours.
[0203] At the same time, car B travels at a speed of 40 kilometers per hour. After 3 hours, it travels 120 kilometers.
[0204] Therefore, when they first met, Car A had traveled 180 kilometers and Car B had traveled 120 kilometers.
[0205] The second question: Car B returns to place B, and car A continues to go to place B. When car A arrives at place B, how many kilometers has car B traveled in total?
[0206] After the first encounter, Car A still has 120 kilometers left to go to B. This is because it has already traveled 180 kilometers, and the remaining distance is 300 kilometers minus 180 kilometers.
[0207] Car A continues to travel to B at a speed of 60 kilometers per hour, so it will take another 2 hours to reach B.
[0208] Car B immediately turned around and returned to B after the encounter, continuing to drive at a speed of 40 kilometers per hour. In these 2 hours, Car B drove 80 kilometers to B.
[0209] Previously, car B had traveled 120 kilometers before the first encounter, plus the 80 kilometers it traveled when it turned around and returned, B traveled a total of 200 kilometers.
[0210] Therefore, when Car A arrives at Point B, Car B has traveled a total of 200 kilometers.
[0211] The third question: The two cars turned around after their first encounter. How many kilometers had car A and car B traveled respectively when they met for the second time?
[0212] Suppose that car A and car B turn around after their first encounter, with car A returning to place A and car B returning to place B. They are driving towards each other again.
[0213] The total distance between them is still 300 kilometers, and their total speed in the opposite directions is still 100 kilometers per hour.
[0214] Because the total distance remains the same and their speeds have not changed, the time it takes for them to meet again is still 3 hours.
[0215] During these 3 hours, Car A traveled at a speed of 60 kilometers per hour and traveled 180 kilometers in 3 hours.
[0216] Car B travels at a speed of 40 kilometers per hour and travels 120 kilometers in these 3 hours.
[0217] Therefore, when they meet for the second time, Car A has travelled 180 km and Car B has travelled 120 km, and the total time between the two encounters is 3 hours.
[0218] The annotation result of example instruction data 2 is:
[0219] When they first met, Car A had traveled 180 kilometers and Car B had traveled 120 kilometers.
[0220] When Car A arrives at Point B, Car B has traveled a total of 200 kilometers.
[0221] The two vehicles met for about 3 hours.
[0222] Example command data 3:
[0223] There are two types of facilities in the playground: slides and swings, with a total of 25 pieces of equipment.
[0224] Some of these equipment may have been removed or turned off, and each slide can accommodate 3 children at a time, while each swing can accommodate 2 children at a time.
[0225] Assume that the total capacity of all facilities is 60 children, including some equipment that may be under maintenance or temporarily out of service. How many slides and swings are there in the playground? Please explain the equipment status or other potential factors that may exist.
[0226] The processing results of the deepseek-llm-7b-chat model are:
[0227] Assuming that there are P slides and Q swings in the playground, then: 3P+2Q=60. Since there are a total of 25 equipment in the playground, then: P+Q=25. By solving the equations, we get: P=18, Q=7. Therefore, there are 18 slides and 7 swings in the playground. In addition, there are the following possible equipment conditions or potential factors: 1. The number of slides and swings may not be exactly equal because there are differences in the condition of the equipment in the playground. 2. Some facilities may be temporarily closed or overhauled, resulting in a decrease in the total passenger capacity. 3. The actual number of children may not be exactly equal to the facility capacity because the number of children actually using the facilities may be biased. 4. The facilities may be damaged or under repair, resulting in a decrease in the actual passenger capacity. 5. The equipment in the playground may have seasonal changes, resulting in changes in the number of equipment and usage.
[0228] The processing results of the AntLM-7b-chat model are:
[0229] To solve this problem, we can solve it by setting variables and establishing equations. Assume: There are p slides in the playground. There are q swings in the playground. According to the question, we can get the following two equations: 1. Total number of equipment: p+q=25, 2. Total passenger capacity: 3p+2q=60, we can solve this system of equations by substitution or elimination. Here I choose to use the substitution method. First, solve q from the first equation: q=25-p, then substitute q into the second equation: 3p+2(25-p)=60, simplify and solve the equation: 3p+50-2p=60, p+50=60, p=10, and get p=10 slides. Substitute p into the q equation again: q=25-p, q=25-10, q=15. Therefore, there are currently 10 slides and 15 swings in the playground. However, the question prompts that "some equipment may be under maintenance or temporarily out of service", so these 10 slides and 15 swings are only part of the currently available equipment, and the specific number of available equipment needs to take into account the maintenance and outage conditions. If there is more information, such as the number and time of maintenance and outage equipment, the specific number of available equipment can be further calculated.
[0230] The annotation result of example instruction data 3 is:
[0231] The playground has 10 slides and 15 swings.
[0232] Example instruction data 4:
[0233] It takes Xiao Wang 8 hours to complete a project alone, and it takes Xiao Li 10 hours to complete the same project alone.
[0234] If they all start working at the same time and each works together at a constant pace to complete the project, how many hours will it take them to complete it?
[0235] Calculate the sum of the work they each do per hour and use the total work to figure out how long it will take them to complete the project together.
[0236] The processing results of the deepseek-llm-7b-chat model are:
[0237] First, calculate the amount of work that John and Bob each complete per hour. John needs 8 hours to complete the entire project, so the amount of work he completes per hour is 1 / 8. Similarly, Bob needs 10 hours to complete the entire project, so the amount of work he completes per hour is 1 / 10. The sum of the work they complete per hour is 1 / 8 + 1 / 10. We can find their sum by finding the common denominator of these two fractions: 1 / 8 = 2 / 16, 1 / 10 = 2 / 20. So, the sum of the work they complete per hour is 2 / 16 + 2 / 20 = 2 / 10 + 2 / 10 = 4 / 10 = 2 / 5. Now that we know the amount of work they complete together per hour, we can calculate the time it takes them to complete the project together. The total amount of work on the project is 1 (assumed), and they complete 2 / 5 of the work per hour, so it takes them 1 / (2 / 5) = 5 / 2 hours to complete the entire project. So, it takes them 3 hours to complete the project together.
[0238] The processing results of the AntLM-7b-chat model are:
[0239] To calculate the time it takes for Xiao Wang and Xiao Li to complete the project together, we can solve this problem in several steps. 1. Calculate the amount of work Xiao Wang and Xiao Li each complete per hour: Xiao Wang needs 8 hours to complete the project alone, so the amount of work he completes per hour is: 1 / 8. Xiao Li needs 10 hours to complete the project alone, so the amount of work he completes per hour is: 1 / 10. 2. Calculate the sum of the amount of work they complete together per hour: The amount of work they complete together per hour is: 1 / 8+1 / 10, we need to find a common denominator to calculate the sum of these two fractions. The least common multiple of 8 and 10 is 40, so: 1 / 8=5 / 40, 1 / 10=4 / 40, 1 / 8+1 / 10=5 / 40+4 / 40=9 / 40. 3. Calculate the time it takes them to complete the project together: The amount of work they complete together per hour is: 9 / 40. The amount of work required for the project is 1 (the project itself is completed once), so the time they need is: 1 / (9 / 40)=1×40 / 9=40 / 9≈4.44 hours. In summary, Xiao Wang and Xiao Li start working at the same time and work together at a constant speed to complete the project, and they need about 4.44 hours.
[0240] The annotation result of example instruction data 4 is:
[0241] It takes about 4.44 hours for Xiao Wang and Xiao Li to start working at the same time.
[0242] From the above, it can be seen that the trained large language model AntLM-7b-chat obtained after fine-tuning training using the target instruction data and its corresponding annotation results has better reasoning ability when performing logical reasoning tasks and has a higher accuracy in answering questions than the large language model deepseek-llm-7b-chat before fine-tuning training.
[0243] Corresponding to the above method embodiments, the embodiments of the present invention also provide corresponding device embodiments.
[0244] like Figure 4 As shown, an embodiment of the present invention further provides a device for generating instruction data, the device comprising:
[0245] The data acquisition module 401 is used to acquire preset initial instruction data;
[0246] The data mapping module 402 is used to perform type analysis on the initial instruction data using a mapping agent, and generate instruction data of the same type as the initial instruction data to obtain similar instruction data;
[0247] The data evolution module 403 is used to use the evolution agent to execute a preset evolution strategy on similar instruction data to obtain multiple candidate instruction data;
[0248] The data evaluation module 404 is used to use the evaluation agent to execute a preset evaluation strategy on each candidate instruction data to obtain an evaluation result corresponding to each candidate instruction data;
[0249] The data screening module 405 is used to determine the candidate instruction data whose evaluation results meet the preset conditions as the target instruction data; the target instruction data is used to train the large language model.
[0250] Optionally, the data mapping module 402 is specifically used to input the initial instruction data into the mapping agent for type analysis and data generation to obtain similar instruction data of the same type as the initial instruction data.
[0251] Optionally, the above-mentioned preset evolution strategy includes at least one of the following: a logic depth generation strategy, a logic scope generation strategy, a logic precision generation strategy, a logic restriction generation strategy, a logic reasoning generation strategy and a logic adversarial generation strategy.
[0252] Optionally, the data evolution module 403 is specifically configured to perform at least one of the following:
[0253] When the preset evolution strategy includes a logic depth generation strategy, similar instruction data is input into the evolution agent to execute the logic depth generation strategy, thereby increasing the depth and complexity of the similar instruction data and obtaining candidate instruction data;
[0254] When the preset evolution strategy includes a logical range generation strategy, similar instruction data is input into the evolution agent to execute the logical range generation strategy, so as to expand the data range of the similar instruction data and obtain candidate instruction data;
[0255] When the preset evolution strategy includes a logic precision generation strategy, similar instruction data is input into the evolution agent to execute the logic precision generation strategy, thereby enhancing the accuracy of the similar instruction data and obtaining candidate instruction data;
[0256] When the preset evolution strategy includes a logic-restricted generation strategy, similar instruction data is input into the evolution agent to execute the logic-restricted generation strategy, and restriction conditions are introduced for the similar instruction data to obtain candidate instruction data;
[0257] When the preset evolution strategy includes a logical reasoning generation strategy, similar instruction data is input into the evolution agent to execute the logical reasoning generation strategy, the logical reasoning of the similar instruction data is enhanced, and candidate instruction data is obtained;
[0258] When the preset evolution strategy includes a logical adversarial generation strategy, similar instruction data is input into the evolutionary agent to execute the logical adversarial generation strategy, to generate adversarial data of similar instruction data, and to obtain candidate instruction data.
[0259] Optionally, the above-mentioned preset evaluation strategy includes at least one of the following: a consistency evaluation strategy, a rationality evaluation strategy, a coherence evaluation strategy, a causal relationship evaluation strategy, a reasoning ability evaluation strategy and a professional knowledge evaluation strategy.
[0260] Optionally, the data evaluation module 404 is specifically configured to perform at least one of the following:
[0261] When the preset evaluation strategy includes a consistency evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the consistency evaluation strategy, the consistency between the question and the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0262] When the preset evaluation strategy includes a rationality evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the rationality evaluation strategy, the rationality of the question and answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0263] When the preset evaluation strategy includes a coherence evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the coherence evaluation strategy, the coherence of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0264] When the preset evaluation strategy includes a causal relationship evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the causal relationship evaluation strategy, the causal relationship of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0265] When the preset evaluation strategy includes a reasoning ability evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the reasoning ability evaluation strategy, the logical clarity of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained;
[0266] When the preset evaluation strategy includes a professional knowledge evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the professional knowledge evaluation strategy, the accuracy of the response content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained.
[0267] Optionally, the above device further includes:
[0268] A labeling acquisition module is used to obtain labeling results corresponding to target instruction data;
[0269] A result prediction module is used to input the target instruction data into the pre-trained large language model to obtain the prediction result corresponding to the target instruction data;
[0270] The model training module is used to calculate the loss between the prediction results and the annotation results, and adjust the parameters of the pre-trained large language model according to the loss to obtain a trained large language model.
[0271] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501 , a communication interface 502 , a memory 503 and a communication bus 504 , wherein the processor 501 , the communication interface 502 , and the memory 503 communicate with each other via the communication bus 504 .
[0272] Memory 503, used for storing computer programs;
[0273] The processor 501 is used to implement the steps of any of the above-mentioned instruction data generation methods when executing the program stored in the memory 503 to achieve the same technical effect.
[0274] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0275] The communication interface is used for communication between the above electronic device and other devices.
[0276] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0277] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0278] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned instruction data generation methods are implemented to achieve the same technical effect.
[0279] In another embodiment provided by the present invention, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer executes the steps of the method for generating instruction data in any of the above embodiments to achieve the same technical effect.
[0280] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0281] 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 existence of other identical elements in the process, method, article or device including the elements.
[0282] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0283] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A method for generating instruction data, characterized in that: The method comprises: Obtaining preset initial instruction data; Using a mapping agent to perform type analysis on the initial instruction data, and generate instruction data of the same type as the initial instruction data, to obtain similar instruction data; Utilizing an evolutionary agent to execute a preset evolutionary strategy on the similar instruction data to obtain a plurality of candidate instruction data; Utilizing an evaluation agent to execute a preset evaluation strategy on each candidate instruction data to obtain an evaluation result corresponding to each candidate instruction data; the evaluation strategy is a prompt word used to evaluate the data in the candidate instruction data; Determine the candidate instruction data whose evaluation results meet the preset conditions as target instruction data; the target instruction data is used to train the large language model; The method of using the evolutionary agent to execute a preset evolutionary strategy on the similar instruction data to obtain a plurality of candidate instruction data includes: The similar instruction data is input into the evolutionary agent through the API corresponding to the evolutionary agent, and the preset evolutionary strategy is executed on the similar instruction data in multiple rounds to obtain multiple candidate instruction data; wherein the preset evolutionary strategy includes at least one of the following: a logic depth generation strategy, a logic scope generation strategy, a logic precision generation strategy, a logic restriction generation strategy, a logic reasoning generation strategy and a logic adversarial generation strategy; the logic depth generation strategy is a prompt word for increasing the depth and complexity of the similar instruction data, the logic scope generation strategy is a prompt word for expanding the data coverage of the similar instruction data, the logic precision generation strategy is a prompt word for enhancing the accuracy of the similar instruction data, the logic restriction generation strategy is a prompt word for introducing restriction conditions for the similar instruction data, the logic reasoning generation strategy is a prompt word for enhancing the logical reasoning of the similar instruction data, and the logic adversarial generation strategy is a prompt word for generating adversarial data for the similar instruction data.
2. The method according to claim 1, characterized in that The utilizing a mapping agent to perform type analysis on the initial instruction data and generate instruction data of the same type as the initial instruction data to obtain similar instruction data includes: The initial instruction data is input into the mapping agent for type analysis and data generation to obtain similar instruction data of the same type as the initial instruction data.
3. The method according to claim 1, characterized in that The using the evolutionary agent to execute a preset evolutionary strategy on the similar instruction data to obtain a plurality of candidate instruction data includes at least one of the following: When the preset evolution strategy includes a logic depth generation strategy, the similar instruction data is input into the evolution agent to execute the logic depth generation strategy, thereby increasing the depth and complexity of the similar instruction data to obtain candidate instruction data; When the preset evolution strategy includes a logical scope generation strategy, the similar instruction data is input into the evolution agent to execute the logical scope generation strategy, so as to expand the data coverage of the similar instruction data and obtain candidate instruction data; When the preset evolution strategy includes a logic precision generation strategy, the similar instruction data is input into the evolution agent to execute the logic precision generation strategy, thereby enhancing the accuracy of the similar instruction data and obtaining candidate instruction data; When the preset evolution strategy includes a logic-restricted generation strategy, the similar instruction data is input into the evolution agent to execute the logic-restricted generation strategy, and restriction conditions are introduced for the similar instruction data to obtain candidate instruction data; When the preset evolution strategy includes a logical reasoning generation strategy, the similar instruction data is input into the evolution agent to execute the logical reasoning generation strategy, thereby enhancing the logical reasoning of the similar instruction data and obtaining candidate instruction data; When the preset evolution strategy includes a logic adversarial generation strategy, the similar instruction data is input into the evolution agent to execute the logic adversarial generation strategy, generate adversarial data of the similar instruction data, and obtain candidate instruction data.
4. The method according to claim 1, characterized in that: The preset evaluation strategy includes at least one of the following: a consistency evaluation strategy, a rationality evaluation strategy, a coherence evaluation strategy, a causal relationship evaluation strategy, a reasoning ability evaluation strategy and a professional knowledge evaluation strategy; wherein the consistency evaluation strategy is a prompt word for evaluating the consistency between the question and the answer content contained in the candidate instruction data, the rationality evaluation strategy is a prompt word for evaluating the rationality of the question and the answer content contained in the candidate instruction data, the coherence evaluation strategy is a prompt word for evaluating the consistency of the problem-solving steps of the answer content contained in the candidate instruction data, the causal relationship evaluation strategy is a prompt word for evaluating the causal relationship of the problem-solving steps of the answer content contained in the candidate instruction data, the reasoning ability evaluation strategy is a prompt word for evaluating the logical clarity of the problem-solving steps of the answer content contained in the candidate instruction data, and the professional knowledge evaluation strategy is a prompt word for evaluating the accuracy of the answer content contained in the candidate instruction data.
5. The method according to claim 4, characterized in that The evaluation agent is used to execute a preset evaluation strategy on each candidate instruction data to obtain an evaluation result corresponding to each candidate instruction data, including at least one of the following: When the preset evaluation strategy includes a consistency evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the consistency evaluation strategy, the consistency between the question and the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained; When the preset evaluation strategy includes a rationality evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the rationality evaluation strategy, the rationality of the question and answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained; When the preset evaluation strategy includes a coherence evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the coherence evaluation strategy, the coherence of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained; When the preset evaluation strategy includes a causal relationship evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the causal relationship evaluation strategy, the causal relationship of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained; When the preset evaluation strategy includes a reasoning ability evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the reasoning ability evaluation strategy, the logical clarity of the problem-solving steps of the answer content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained; When the preset evaluation strategy includes a professional knowledge evaluation strategy, the candidate instruction data is input into the evaluation agent to execute the professional knowledge evaluation strategy, the accuracy of the response content contained in the candidate instruction data is evaluated, and the evaluation result corresponding to the candidate instruction data is obtained.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Obtaining a marking result corresponding to the target instruction data; Inputting the target instruction data into a pre-trained large language model to obtain a prediction result corresponding to the target instruction data; The loss between the prediction result and the annotation result is calculated, and the parameters of the pre-trained large language model are adjusted according to the loss to obtain a trained large language model.
7. A device for generating instruction data, characterized in that: The device comprises: A data acquisition module, used to acquire preset initial instruction data; A data mapping module, used to perform type analysis on the initial instruction data using a mapping agent, and generate instruction data of the same type as the initial instruction data to obtain similar instruction data; A data evolution module, used for executing a preset evolution strategy on the similar instruction data using an evolutionary agent to obtain a plurality of candidate instruction data; A data evaluation module, used to use an evaluation agent to execute a preset evaluation strategy on each candidate instruction data to obtain an evaluation result corresponding to each candidate instruction data; the evaluation strategy is a prompt word used to evaluate the data in the candidate instruction data; A data screening module, used to determine candidate instruction data whose evaluation results meet preset conditions as target instruction data; the target instruction data is used to train the large language model; Among them, the data evolution module is specifically used to input the similar instruction data into the evolutionary agent through the API corresponding to the evolutionary agent, and execute the preset evolution strategy on the similar instruction data for multiple rounds to obtain multiple candidate instruction data; the preset evolution strategy includes at least one of the following: a logic depth generation strategy, a logic scope generation strategy, a logic precision generation strategy, a logic restriction generation strategy, a logic reasoning generation strategy and a logic adversarial generation strategy; the logic depth generation strategy is a prompt word for increasing the depth and complexity of the similar instruction data, the logic scope generation strategy is a prompt word for expanding the data coverage of the similar instruction data, the logic precision generation strategy is a prompt word for enhancing the accuracy of the similar instruction data, the logic restriction generation strategy is a prompt word for introducing restriction conditions for the similar instruction data, the logic reasoning generation strategy is a prompt word for enhancing the logical reasoning of the similar instruction data, and the logic adversarial generation strategy is a prompt word for generating adversarial data for the similar instruction data.
8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method according to any one of claims 1 to 6 when executing a program stored in a memory.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Method for optimizing cue word and electronic equipment
CN117272988A
Prompt word evaluation method and device, electronic equipment and storage medium
CN118410141A