Large language model test data set generation method, system, equipment and medium
Through the pre-trained large language model agent, a dialogue chain and judgment chain are generated, and a large language model test data set is automatically constructed, which solves the problem of inefficiency of traditional methods and realizes efficient data set generation and keyword extraction.
Patent Information
- Application Number
- CN202411104009.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-29
AI Technical Summary
The traditional large language model test dataset construction method is inefficient and requires a lot of manual labor, which cannot automatically and efficiently generate datasets.
Through multiple pre-trained large language model agents, dialogue chains and judgment chains are generated based on prompts, optimal answers and keyword collections are automatically generated, and stored in the database to test the question-and-answer capabilities of large language models.
The automated generation of large language model test data sets is realized, efficiency is improved, manual intervention is reduced, correct answers are automatically given and keyword extraction is extracted, and the efficiency of data set generation is improved.
Smart Images

Figure CN119046424A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing, and in particular to a method, system, device and medium for generating a large language model test data set. Background Art
[0002] With the rapid development of large language model technology, its application in the field of natural language processing has become more and more extensive, and has achieved remarkable results. Large language models can learn a large amount of text data and generate text similar to human writing. This feature enables large language models to be used in various natural language processing tasks, including machine translation, text summarization, question-answering systems, etc. Datasets used to test large language models are important resources in the field of large language models. High-quality datasets can help train more accurate and robust large language models. However, traditional dataset construction methods usually require a lot of manual labor and are inefficient. Summary of the invention
[0003] The purpose of this application is to provide a method, system, device and medium for generating a large language model test data set, which can improve the automation level and efficiency of data set generation.
[0004] To achieve the above objectives, this application provides the following solutions:
[0005] In a first aspect, the present application provides a method for generating a large language model test data set, comprising:
[0006] Get the prompt;
[0007] A dialogue chain is generated based on the prompt by multiple dialogue agents; in the dialogue chain, each dialogue agent generates an answer based on the prompt, and questions and scores the answers generated by other dialogue agents, and each dialogue agent regenerates an answer based on the questions and scores given by other agents, until a pre-set dialogue chain end condition is met, and the answer with the highest score is taken as the optimal answer;
[0008] A judgment chain is generated based on the prompt and the optimal answer through a keyword extraction agent and a keyword judgment agent; in the judgment chain, the keyword extraction agent extracts a keyword set from the optimal answer, the keyword judgment agent questions the keyword set extracted by the keyword extraction agent, and the keyword extraction agent re-extracts the keyword set according to the question given by the keyword judgment agent until the optimal keyword set is obtained when the pre-set judgment chain end condition is met; each dialogue agent, the keyword extraction agent and the keyword judgment agent are all pre-trained large language model agents;
[0009] The prompt, the optimal answer and the optimal keyword set are stored in a database to obtain a data set; the data set is used to test the question-answering capability of a large language model.
[0010] In a second aspect, the present application provides a system for generating a large language model test data set, comprising:
[0011] A prompt acquisition module, used to acquire prompts;
[0012] A dialogue module, for generating a dialogue chain based on the prompt through multiple dialogue agents; in the dialogue chain, each dialogue agent generates an answer according to the prompt, and questions and scores the answers generated by other dialogue agents, and each dialogue agent regenerates an answer according to the questions and scores given by other agents, until a preset dialogue chain end condition is met, and the answer with the highest score is taken as the optimal answer;
[0013] A judgment module, used to generate a judgment chain based on the prompt and the optimal answer through a keyword extraction agent and a keyword judgment agent; in the judgment chain, the keyword extraction agent extracts a keyword set from the optimal answer, the keyword judgment agent questions the keyword set extracted by the keyword extraction agent, and the keyword extraction agent re-extracts the keyword set according to the question given by the keyword judgment agent until the preset judgment chain end condition is met to obtain the optimal keyword set; each dialogue agent, the keyword extraction agent and the keyword judgment agent are pre-trained large language model agents;
[0014] The data set storage module is used to store the prompt, the optimal answer and the optimal keyword set into a database to obtain a data set; the data set is used to test the question-answering ability of the large language model.
[0015] In a third aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned method for generating a large language model test data set.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned method for generating a large language model test data set.
[0017] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0018] The present application provides a method, system, device and medium for generating a large language model test data set, wherein multiple dialogue agents generate a dialogue chain based on prompts, and multiple dialogue agents generate, question, score and update answers, and finally give the best answer, and a keyword extraction agent and a keyword judgment agent generate a judgment chain based on prompts and the best answer, and the keyword extraction agent and the keyword judgment agent extract, question and update keywords, and finally give the best keyword set. The present application can automatically give the correct answer to the prompt and extract keywords from the answer, without manually determining the answer or manually extracting keywords, thereby improving the generation efficiency of the large language model test data set. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 This is an application environment diagram of a method for generating a large language model test data set in one embodiment of the present application;
[0021] Figure 2 A schematic diagram of the overall process of a method for generating a large language model test data set provided in one embodiment of the present application;
[0022] Figure 3 A detailed flowchart of a method for generating a large language model test data set provided in one embodiment of the present application;
[0023] Figure 4 A schematic diagram of functional modules of a system for generating a large language model test data set provided in one embodiment of the present application;
[0024] Figure 5 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0027] The method for generating a large language model test data set provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send prompts to be processed to the server 104. The server 104 is deployed with multiple dialogue agents, a keyword extraction agent and a keyword judgment agent. After receiving the prompts to be processed, the server 104 generates the best answer through multiple dialogue agents, generates the best keyword set through the keyword extraction agent and the keyword judgment agent, and stores the prompts, the best answer and the best keyword set in the database. The database can be the above-mentioned data storage system or other storage devices. In addition, in some embodiments, the large language model test data set generation method can also be implemented by the server 104 or the terminal 102 alone.
[0028] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.
[0029] In an exemplary embodiment, Figure 2 and Figure 3 As shown, a method for generating a large language model test data set is provided. The method is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or can be executed by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used for explanation, and the steps include the following steps 200 to 205.
[0030] In this embodiment, each dialogue agent, the keyword extraction agent and the keyword judgment agent are all pre-trained large language model agents.
[0031] Step 200, obtain real question-answer dialogue data, and extract keywords from the answers in the real question-answer dialogue data to obtain a pre-trained data set; use pre-trained prompts, pre-trained answer questions, pre-trained answer scores, pre-trained correct answers and role information to pre-train the first language model agent to obtain a dialogue agent; use pre-trained prompts, pre-trained correct answers, pre-trained keywords and role information to pre-train the second language model agent to obtain a keyword extraction agent; use pre-trained prompts, pre-trained correct answers, pre-trained keywords, pre-trained keyword questions and role information to pre-train the third language model agent to obtain a keyword judgment agent.
[0032] The pre-training data set includes pre-training prompts, pre-training answer questions, pre-training answer scores, pre-training correct answers, pre-training keywords, pre-training keyword questions and role information.
[0033] The role information includes role name and role capabilities. Role names include: dialogue agent, keyword extraction agent, and keyword judgment agent. Role capabilities include: answer, review answer, score answer, extract keywords, and judge keywords.
[0034] That is, this application uses prompts, questions, ratings, correct answers, and role information pre-trained dialogue agents, uses prompts, correct answers, keywords, and role information pre-trained keyword extraction agents, and uses prompts, correct answers, keywords, questions, and role information pre-trained keyword judgment agents.
[0035] In order to better understand the technical solution of this application, the pre-training process of the large language model agent is specifically introduced below:
[0036] First, we organize some question-and-answer dialogue data, and manually extract keywords from the answers in the question-and-answer dialogue data, that is, organize a benchmark truth value, and then input the benchmark truth value into the large language model intelligent agent. After that, we manually input the entire process of answering, questioning, scoring, role information, etc. into the large language model intelligent agent, which is the process of communication between humans and the large language model.
[0037] After pre-training, the dialogue agent knows information such as the dialogue process and the format of the answer, similar to chatting with ChatGPT. The prompt refers to the content entered in the input box when chatting with ChatGPT, and the dialogue agent can automatically give an answer.
[0038] After setting the identity information of the keyword extraction agent, input the question and answer, and the keyword extraction agent can automatically provide a set of keywords.
[0039] After setting the identity information of the keyword judgment agent, the keyword judgment agent knows its task and can automatically give its own judgment after receiving the prompt, the correct answer and the keyword set.
[0040] Step 201, obtaining a prompt, wherein the prompt is a question of manual input or batch file reading.
[0041] Specifically, the prompts can be input manually one by one, or the json file can be edited manually and input in batches by reading the file.
[0042] Step 202: Generate a dialogue chain based on the prompt through multiple dialogue agents. In the dialogue chain, each dialogue agent generates an answer based on the prompt, and questions and scores the answers generated by other dialogue agents. Each dialogue agent regenerates an answer based on the questions and scores given by other agents until the preset dialogue chain end condition is met, and the answer with the highest score is taken as the optimal answer.
[0043] This application first inputs the prompt into the dialogue platform. The dialogue platform includes multiple dialogue agents and dialogue topics. The dialogue agent has three capabilities: answering, reviewing answers, and scoring answers. The dialogue topic includes dialogue tasks and dialogue chain end conditions. After receiving the prompt, multiple dialogue agents generate a dialogue chain.
[0044] In an exemplary embodiment, the dialogue chain includes: multiple dialogue agents give answers respectively; multiple dialogue agents question and score the answers of other dialogue agents respectively; if each answer has a corresponding question, the multiple dialogue agents give improved answers based on the question and the comment, and question and score the answers of other dialogue agents again respectively; if the dialogue chain termination condition is met, the best answer, the question and score corresponding to the best answer are given.
[0045] In an exemplary embodiment, the dialogue chain termination condition is: the dialogue time exceeds the dialogue chain time setting threshold or multiple dialogue agents have no doubts about a certain answer. No doubt means the score is the preset highest score. The score includes three aspects: relevance, accuracy and logic. Each aspect is scored from 0 to 10, with 10 being the full score, that is, no doubt.
[0046] Before the conversation, an identity is manually set for each dialogue agent. This identity can be filled in at will, for example:
[0047] assistant = AssistantAgent(name = "Dialogue Agent 01", llm_config = {"config_list": config_list}, human_input_mode = "NEVER", system_message = "You are a real human being, an expert in the field of data sets. Your task is to give a rigorous and comprehensive answer to each prompt given, to carefully review and severely question the answers of others, and to give your score (0 to 10 points, 10 points means complete agreement with the answer, no question)").
[0048] Among them, assistant represents identity information, AssistantAgent() represents the function of setting identity information, name represents name, llm_config represents configuration information, human_input_mode represents input mode, and system_message represents system parameters.
[0049] After setting the identity information at the code level, the dialogue agent knows its tasks, inputs prompts, and answers according to the preset answer order and procedures.
[0050] Here is a specific example of a dialogue chain:
[0051] There are three dialogue agents, namely dialogue agent 1, dialogue agent 2 and dialogue agent 3. The specific dialogue chain is:
[0052] (1) Enter the prompt.
[0053] (2) First round:
[0054] Dialogue Agent No. 1: Give Answer No. 1.
[0055] Dialogue agent number two: Give answer number two.
[0056] Dialogue agent number three: Give answer number three.
[0057] (3) Second round:
[0058] Dialogue Agent No. 1: raises questions and gives scores for the answer given by Agent No. 2; raises questions and gives scores for the answer given by Agent No. 3.
[0059] Dialogue agent No. 2: raises questions and gives scores for answer No. 1; raises questions and gives scores for answer No. 3.
[0060] Dialogue agent No. 3: raises questions and gives scores for answer No. 1; raises questions and gives scores for answer No. 2.
[0061] (4) Third round:
[0062] Dialogue Agent No. 1: Gives an improved No. 1 answer based on the questions and scores received.
[0063] Dialogue Agent No. 2: Gives an improved No. 2 answer based on the questions and scores received.
[0064] Dialogue Agent No. 3: Gives an improved No. 3 answer based on the questions and scores received.
[0065] (5) If the conditions for ending the dialogue chain are not met, proceed to the second round; otherwise, end the dialogue chain and give the best answer, its question, and score.
[0066] Step 203, a judgment chain is generated based on the prompt and the optimal answer by the keyword extraction agent and the keyword judgment agent. In the judgment chain, the keyword extraction agent extracts a keyword set from the optimal answer, the keyword judgment agent questions the keyword set extracted by the keyword extraction agent, and the keyword extraction agent re-extracts the keyword set according to the question given by the keyword judgment agent until the preset judgment chain end condition is met to obtain the optimal keyword set.
[0067] The application inputs the prompt and the best answer into the keyword extraction platform. The keyword extraction platform includes a keyword extraction agent, a keyword judgment agent and a keyword extraction theme. The keyword extraction theme includes a judgment task and a judgment chain end condition. After receiving the prompt and the best answer, the keyword extraction agent and the keyword judgment agent generate a judgment chain.
[0068] In an exemplary embodiment, the judgment chain includes: the keyword extraction agent extracts a keyword set that can represent the best answer from the best answer; the keyword judgment agent judges whether each keyword in the keyword set can represent each key point in the best answer; if it is judged that the keyword cannot represent the key point in the best answer, or there are key points that are not represented, a question is raised; the keyword extraction agent gives an improved keyword set based on the question; if the judgment chain end condition is met, the optimal keyword set and the corresponding question are given.
[0069] In an exemplary embodiment, the keyword set extracted by the keyword extraction agent from the optimal answer includes multiple keywords.
[0070] The process of the keyword judgment agent questioning the keyword set extracted by the keyword extraction agent includes: judging whether the keywords in the keyword set extracted by the keyword extraction agent can represent the key information in the optimal answer, and whether the key information in the optimal answer is all represented by the keywords in the keyword set extracted by the keyword extraction agent; if so, no question is raised; otherwise, a question is raised.
[0071] The end condition of the judgment chain is: the judgment time exceeds the judgment chain time setting threshold or the keyword judgment agent has no doubts about the keyword set.
[0072] Before keyword extraction, an identity information is manually set for the keyword extraction agent. This identity description can be filled in arbitrarily, for example:
[0073] assistant = AssistantAgent(name = "Keyword Extraction Agent", llm_config = {"config_list": config_list}, human_input_mode = "NEVER", system_message = "You are a real human being, an expert in the field of keyword extraction. Your task is: after receiving a pair of questions and answers, based on your understanding of the information contained in the questions and answers, extract from the answers several keywords that you think are most representative and can best answer the questions. For example, for the question and answer: {"Question": "What color is the skin of polar bears?", "Answer": "Polar bears' skin is black. Although their fur is white or transparent, their black skin helps absorb and retain heat to help them stay warm in the cold Arctic environment."}, the keyword you extracted should be {"black"}").
[0074] After setting the identity information at the code level, the keyword extraction intelligence receives the optimal question and answer and automatically gives a set of extracted keywords.
[0075] The following is a specific example of the judgment chain:
[0076] (1) Enter the prompt and the best answer.
[0077] (2) First round:
[0078] Keyword extraction agent: given a set of keywords.
[0079] (3) Second round:
[0080] Keyword judgment agent: Based on the obtained keyword set, it judges whether each keyword in the keyword set can express the optimal answer and raises questions.
[0081] (3) Third round:
[0082] Keyword extraction agent: gives an improved set of keywords based on the queries received.
[0083] (4) If the judgment chain end condition is not met, go to the second round; otherwise, end the judgment chain and give the optimal keyword set and its query.
[0084] In order to better understand the technical solution of the present application, an example of interaction between a keyword extraction agent and a keyword judgment agent is further given below:
[0085] The information that the keyword extraction agent gives to the keyword judgment agent:
[0086] {"Question":"What are the three elements of a map?","Answer":"The three elements of a map are:Scale: This indicates the proportional relationship between the distance on the map and the actual distance on the ground.Direction: This is usually used to show the direction of the map by indicating north, usually through a compass rose or a north arrow.Legend: Also known as annotation, it explains the meaning of the various symbols and colors used on the map so that readers can understand the content of the map.","Keyword Collection":{"scale","direction"}}.
[0087] The keyword judgment agent gives the keyword extraction agent information:
[0088] In the answer provided, the key words are {"scale", "direction"}. However, this set does not include the key element "legend". Figure 3 One of the elements must be included in the keyword set. Therefore, a keyword is missing from the current keyword set.
[0089] The doubts are as follows:
[0090] Missing keywords: The keyword set does not contain "Legend", which is the Figure 3 An important part of the element.
[0091] The modified keyword set should be: {"scale", "direction", "legend"}.
[0092] Step 204: store the prompt, the optimal answer and the optimal keyword set in a database to obtain a data set. The data set is used to test the question-answering capability of the large language model.
[0093] Currently, in order to obtain data for testing large prediction models, one can only manually collect conversations one by one and extract keywords manually, which is very inefficient. However, this application can automatically answer various questions, automatically extract keywords from the answers, automatically generate data sets and store them in a database. The data in the database can be directly used to test large language models, thereby improving the testing efficiency of large language models.
[0094] Step 205, storing the dialogue chain and the judgment chain in a memory warehouse.
[0095] The intelligent agent in this application is based on a large language model. By setting identities, pre-training, and adding memory warehouses, multiple large language model agents can communicate autonomously and give results.
[0096] In this embodiment, the large language model agent uses the API calls of the Gemini, ChatGPT, and ChatGLM models. The mobile application comes from the application market.
[0097] This application inputs prompts into a dialogue platform, and after multiple dialogue agents receive the prompts, they generate a dialogue chain and give the best answer. The prompts and the best answer are then input into a keyword extraction platform to generate a judgment chain and give the best keyword set. The application is able to give correct answers to the prompts like humans and extract keywords from the answers. It uses the text generation capabilities of a large language model to automatically generate database records, greatly improving the efficiency of data set generation.
[0098] In an exemplary embodiment, when the prompt is obtained by reading a file, the format of the file is: [{"Ability":"Basic Ability","Classification":"Multilingual Ability","Subcategory":"Language Translation Ability","Prompt":"What is Violence expressed in Chinese?"},{"Ability":"Basic Ability","Classification":"Knowledge and Common Sense","Subcategory":"Scientific Knowledge","Prompt":"When sunlight passes through the atmosphere, it is scattered, making the sky appear blue. What is this phenomenon called?"}].
[0099] After obtaining the best answer, the file format is: [{"Ability":"Basic Ability","Classification":"Multilingual Ability","Subcategory":"Language Translation Ability","Prompt":"What is the Chinese expression for Violence?","Answer":""Violence" is expressed as "Violence" in Chinese."},{"Ability":"Basic Ability","Classification":"Knowledge and Common Sense","Subcategory":"Scientific Knowledge","Prompt":"When sunlight passes through the atmosphere, it is scattered, making the sky appear blue. What is this phenomenon called?","Answer":"When sunlight passes through the atmosphere, it is scattered by gas molecules and tiny particles in the atmosphere, making the sky appear blue. This phenomenon is called Rayleigh scattering. Rayleigh scattering mainly affects short-wavelength blue and purple light, so the sky looks blue."}].
[0100] After obtaining the keyword set, the file format is: [{"Ability":"Basic Ability","Classification":"Multilingual Ability","Subcategory":"Language Translation Ability","Prompt":"What is the Chinese expression for Violence?","Answer":""Violence" is expressed in Chinese as violence, atrocities, and brutality.","Keyword Set":["Violence","Atrocities","Brutality"]},{"Ability":"Basic Ability","Classification":"Knowledge and Common Sense","Subcategory":"Scientific Knowledge","Prompt":"When sunlight passes through the atmosphere, it is scattered, making the sky appear blue. What is this phenomenon called?","Answer":"When sunlight passes through the atmosphere, it is scattered by gas molecules and tiny particles in the atmosphere, making the sky appear blue. This phenomenon is called Rayleigh scattering. Rayleigh scattering mainly affects short-wavelength blue and purple light, so the sky looks blue.","Keyword Set":["Rayleigh scattering"]}].
[0101] Among them, capability, category and subcategory are the classification of prompts. Capabilities are divided into basic capabilities, domain capabilities and intrinsic security.
[0102] (1) Basic competencies include: language comprehension, coding, knowledge and common sense, logical reasoning, and multilingual ability.
[0103] Subcategories under language understanding include: object reference and relationship extraction, semantic disambiguation, sentiment analysis, implicit causal relationships, event extraction, multi-sentence logical reasoning, spatial and temporal relationships, abstract and concrete concept understanding, and command and request understanding.
[0104] Subcategories under code include: code generation quality, application programming interface usage suggestions, code understanding and interpretation, code optimization suggestions, code comment generation, code reuse and modularization suggestions, defect and vulnerability identification, coding style and specifications, algorithmic problem solving, and multi-language code translation.
[0105] Subcategories under knowledge and common sense include: common sense reasoning, historical factual accuracy, scientific knowledge, culture and art, geographical knowledge, understanding of social phenomena, and literary and philosophical understanding.
[0106] Subcategories of logical reasoning include: basic logical reasoning, multi-sentence logical reasoning, probability and statistical reasoning, causal inference, pattern recognition and inductive reasoning, and fallacy and bias identification.
[0107] Subcategories under multilingual capabilities include: language translation capabilities, cross-language text summarization, multilingual entity recognition, cross-language information retrieval, cross-language sentiment analysis, and multilingual question and answer.
[0108] (2) Categories under domain capabilities include: expertise, traceability, and output formatting.
[0109] Subcategories under professional knowledge include: professional knowledge accuracy, use of professional terminology, professional compliance, identification of confusing knowledge, professional knowledge understanding, professional factual misperceptions, and professional competence humility.
[0110] Subcategories under traceability include: data source transparency, user feedback mechanism, timestamp and version control, reference basis, and thought chain.
[0111] Subcategories under output formatting include: output content formatting, formatting adjustments, multimedia and data presentation, and style consistency.
[0112] (3) Classifications under intrinsic security include: hallucination, contextual learning, fairness, robustness, compliance, and fault tolerance.
[0113] Subcategories under hallucinations include: false information generation, misattribution, misleading generalizations, and text generation irrelevance.
[0114] Subcategories under contextual learning include: few-shot learning, sentiment and context understanding, implicit meaning and implication, long text understanding, and reference and backtracking.
[0115] Subcategories under equity include: gender equity, socioeconomic equity, racial and cultural equity, religious equity, ability and disability equity, and regional and national equity.
[0116] Subcategories under robustness include: adversarial robustness and drift robustness.
[0117] Subcategories under Compliance include: ethical boundaries and detection of illegal issues.
[0118] Subcategories under fault tolerance include: input fault tolerance and outlier tolerance.
[0119] The present application also provides an application scenario, which applies the above-mentioned large language model test data set generation method. Specifically: the large language model test data set generation method provided in this embodiment can be applied to the task of natural language processing by the large language model. The task of natural language processing by the large language model includes a large language model training link, a large language model testing link and a natural language processing link; after training the large language model, a data set is generated by the large language model test data set generation method provided in this embodiment, and the question-answering ability of the trained large language model is tested before entering the natural language processing link.
[0120] Based on the same inventive concept, the embodiment of the present application also provides a test data set generation system for implementing the test data set generation method involved above. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more test data set generation system embodiments provided below can refer to the limitations of the test data set generation method above, and will not be repeated here.
[0121] In an exemplary embodiment, Figure 4 As shown, a large language model test data set generation system is provided, including: a prompt acquisition module 401, a dialogue module 402, a judgment module 404 and a data set storage module 406.
[0122] The prompt acquisition module 401 is used to acquire prompts.
[0123] The dialogue module 402 is used to generate a dialogue chain based on the prompt through multiple dialogue agents; in the dialogue chain, each dialogue agent generates an answer according to the prompt, and questions and scores the answers generated by other dialogue agents, and each dialogue agent regenerates an answer based on the questions and scores given by other agents until the pre-set dialogue chain end condition is met, and the answer with the highest score is used as the optimal answer.
[0124] The judgment module 404 is used to generate a judgment chain based on the prompt and the optimal answer through a keyword extraction agent and a keyword judgment agent; in the judgment chain, the keyword extraction agent extracts a keyword set from the optimal answer, the keyword judgment agent questions the keyword set extracted by the keyword extraction agent, and the keyword extraction agent re-extracts the keyword set according to the question given by the keyword judgment agent until the preset judgment chain end condition is met to obtain the optimal keyword set; each dialogue agent, the keyword extraction agent and the keyword judgment agent are all pre-trained large language model agents.
[0125] The data set storage module 406 is used to store the prompt, the optimal answer and the optimal keyword set into a database to obtain a data set. The data set is used to test the question-answering capability of the large language model.
[0126] Furthermore, the large language model test data set generation system further includes a dialogue chain storage module 403 and a judgment chain storage module 405. The dialogue chain storage module 403 is used to store the dialogue chain in a memory warehouse. The judgment chain storage module 405 is used to store the judgment chain in the memory warehouse.
[0127] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store prompts. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating a large language model test data set is implemented.
[0128] Those skilled in the art will understand that Figure 5The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0129] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0130] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0131] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0132] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0133] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0134] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0135] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A method for generating a large language model test data set, characterized in that: The method for generating a large language model test data set comprises: Get the prompt; A dialogue chain is generated based on the prompt by multiple dialogue agents; in the dialogue chain, each dialogue agent generates an answer based on the prompt, and questions and scores the answers generated by other dialogue agents, and each dialogue agent regenerates an answer based on the questions and scores given by other agents, until a pre-set dialogue chain end condition is met, and the answer with the highest score is taken as the optimal answer; A judgment chain is generated based on the prompt and the optimal answer through a keyword extraction agent and a keyword judgment agent; in the judgment chain, the keyword extraction agent extracts a keyword set from the optimal answer, the keyword judgment agent questions the keyword set extracted by the keyword extraction agent, and the keyword extraction agent re-extracts the keyword set according to the question given by the keyword judgment agent until the optimal keyword set is obtained when the pre-set judgment chain end condition is met; each dialogue agent, the keyword extraction agent and the keyword judgment agent are all pre-trained large language model agents; The prompt, the optimal answer and the optimal keyword set are stored in a database to obtain a data set; the data set is used to test the question-answering capability of the large language model.
2. The method for generating a large language model test data set according to claim 1, characterized in that: The prompt is a question of manual input or reading file batch input.
3. The method for generating a large language model test data set according to claim 1, characterized in that: The method for generating a large language model test data set also includes: Acquire real question-answer dialogue data, and extract keywords from answers in the real question-answer dialogue data to obtain a pre-training data set; the pre-training data set includes pre-training prompts, pre-training answer questions, pre-training answer scores, pre-training correct answers, pre-training keywords, pre-training keyword questions, and role information; Pre-training the first language model agent using pre-trained prompts, pre-trained answers to questions, pre-trained answer scores, pre-trained correct answers, and role information to obtain a dialogue agent; Pre-training the second language model agent using pre-trained prompts, pre-trained correct answers, pre-trained keywords and role information to obtain a keyword extraction agent; The third language model agent is pre-trained using pre-trained prompts, pre-trained correct answers, pre-trained keywords, pre-trained keyword questions and role information to obtain a keyword judgment agent.
4. The method for generating a large language model test data set according to claim 1, characterized in that: The dialogue chain termination condition is: the dialogue time exceeds the dialogue chain time setting threshold or multiple dialogue agents have no doubts about a certain answer; wherein no doubt means that the score is the preset highest score.
5. The method for generating a large language model test data set according to claim 1, characterized in that: The keyword extraction agent extracts a plurality of keywords from the optimal answer. The process of the keyword judgment agent questioning the keyword set extracted by the keyword extraction agent includes: Determine whether the keywords in the keyword set extracted by the keyword extraction agent can represent the key information in the optimal answer, and whether the key information in the optimal answer is all represented by the keywords in the keyword set extracted by the keyword extraction agent. If so, no question is raised; otherwise, a question is raised.
6. The method for generating a large language model test data set according to claim 1, characterized in that: The end condition of the judgment chain is: the judgment time exceeds the judgment chain time setting threshold or the keyword judgment agent has no doubts about the keyword set.
7. The method for generating a large language model test data set according to claim 1, characterized in that: The method for generating a large language model test data set also includes: The dialogue chain and the judgment chain are stored in a memory warehouse.
8. A system for generating a large language model test data set, characterized in that: The large language model test data set generation system comprises: A prompt acquisition module, used to acquire prompts; A dialogue module, for generating a dialogue chain based on the prompt through multiple dialogue agents; in the dialogue chain, each dialogue agent generates an answer according to the prompt, and questions and scores the answers generated by other dialogue agents, and each dialogue agent regenerates an answer according to the questions and scores given by other agents, until a preset dialogue chain end condition is met, and the answer with the highest score is taken as the optimal answer; A judgment module, used to generate a judgment chain based on the prompt and the optimal answer through a keyword extraction agent and a keyword judgment agent; in the judgment chain, the keyword extraction agent extracts a keyword set from the optimal answer, the keyword judgment agent questions the keyword set extracted by the keyword extraction agent, and the keyword extraction agent re-extracts the keyword set according to the question given by the keyword judgment agent until the preset judgment chain end condition is met to obtain the optimal keyword set; each dialogue agent, the keyword extraction agent and the keyword judgment agent are pre-trained large language model agents; The data set storage module is used to store the prompt, the optimal answer and the optimal keyword set into a database to obtain a data set; the data set is used to test the question-answering ability of the large language model.
9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for generating a large language model test data set according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a large language model test data set according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Question and answer method and system based on large model, computer equipment and storage medium
CN119474278A
Question answering method, system, computer device and storage medium based on large model
CN119474278B
Casting field question and answer data enhancement method based on large language model
CN121581224A
Evaluation set generation method and device for intelligent marketing agent
CN122364930A
