Question generation method, device, equipment and medium based on context information
By obtaining the initial problem and its context information, and using the extraction and evolutionary prompts in the prompt library to generate evolutionary problems, the problem of high construction cost and poor flexibility of problem data sets in the existing technology is solved, and the diversity and Generate data sets of adaptable problems.
Patent Information
- Application Number
- CN202410223392.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-28
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-02-28
AI Technical Summary
In the prior art, the data collection of artificially constructed problems is high, which limits the number and diversity of problems. The automatic generation method based on the original problem is poor in flexibility, making it difficult to adapt to a variety of application scenarios.
By obtaining the initial problem and its context information, selecting target information extraction and evolution prompts from the pre-constructed prompt library, input it to a large language model to generate evolutionary problems, and using multiple evolutionary directions and synonyms to extend the propt to improve the problem data diversity and adaptability of the set.
It has achieved the generation of highly diverse and large-scale problem data sets, which reduces costs, improves flexibility and adaptability, and is suitable for a variety of application scenarios.
Smart Images

Figure CN118152529B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a method, device, equipment and medium for generating questions based on context information. Background Art
[0002] Large language models have become the preferred method for many natural language processing tasks. In order to train large language models to better solve problems, a large number of problem samples need to be constructed. At present, the cost of constructing problem datasets manually is high, which limits the number and diversity of problems. The use of artificial intelligence methods to generate problem datasets based on original problems requires that the original problems contain rich information, which is inflexible and difficult to adapt to a variety of application scenarios. Summary of the invention
[0003] The present invention provides a context-based question generation method, device, equipment and medium to solve the defects of the prior art that a question data set is constructed manually, which is costly and limits the number and diversity of questions; an artificial intelligence method is used to construct a question data set based on the original question, which requires the original question to contain rich information, has poor flexibility and is difficult to adapt to a variety of application scenarios.
[0004] In a first aspect, the present invention provides a method for generating questions based on context information, comprising:
[0005] Obtaining an initial question and context information corresponding to the initial question;
[0006] Selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and the context information into a first language model, and obtaining key information of the context information output by the first language model;
[0007] A target question evolution prompt is selected from the prompt library, and the initial question, key information and the target question evolution prompt are input into the second largest language model to obtain the question evolved from the initial question output by the second largest language model.
[0008] In some embodiments, after obtaining the question evolved from the initial question output by the second largest language model, the method further includes:
[0009] A target question synonym expansion prompt is selected from the prompt library, and the evolved question and the target question synonym expansion prompt are input into a third language model to obtain a synonym expansion question of the evolved question output by the third language model.
[0010] In some embodiments, the step of selecting a target question from the prompt library to evolve a prompt includes:
[0011] Determining a target evolution direction corresponding to the initial problem from multiple evolution directions;
[0012] Based on the target evolution direction, the target question evolution prompt is selected from the prompt library.
[0013] In some embodiments, the multiple evolutionary directions include adding constraints, explicit reasoning, reification, increasing queries, and creating entirely new questions.
[0014] In some embodiments, determining the target evolution direction corresponding to the initial question from multiple evolution directions includes:
[0015] According to the preset selection probability distribution of the multiple evolutionary directions, a target evolutionary direction corresponding to the initial problem is determined from the multiple evolutionary directions.
[0016] In some embodiments, the method further includes: selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and the context information into a first large language model, and obtaining key information of the context information output by the first large language model.
[0017] Selecting an initial information extraction prompt that matches the context information from the prompt library;
[0018] Inputting the initial information extraction prompt and the context information into a first large language model to obtain initial key information of the context information output by the first large language model;
[0019] Evaluating the quality of the initial key information to obtain an evaluation result;
[0020] Based on the evaluation result, the initial information extraction prompt is adjusted to obtain the target information extraction prompt, and the target information extraction prompt is added to the prompt library.
[0021] In some embodiments, the key information includes entity information, relationship information, and task information.
[0022] In a second aspect, the present invention further provides a context information-based question generation device, comprising:
[0023] A first acquisition unit, configured to acquire an initial question and context information corresponding to the initial question;
[0024] A first information extraction unit is used to select a target information extraction prompt from a pre-built prompt library, input the target information extraction prompt and the context information into a first large language model, and obtain key information of the context information output by the first large language model;
[0025] The question evolution unit is used to select a target question evolution prompt from the prompt library, input the initial question, key information and the target question evolution prompt into the second largest language model, and obtain the question after the initial question is evolved, which is output by the second largest language model.
[0026] In a third aspect, the present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for generating questions based on context information as described above is implemented.
[0027] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for generating questions based on context information.
[0028] The present invention provides a context information-based question generation method, device, equipment and medium, which obtains an initial question and its corresponding context information, selects a target information extraction prompt from a prompt library, inputs the target information extraction prompt and the context information into a first language model to obtain key information of the context information, selects a target question evolution prompt from the prompt library, inputs the initial question, the key information and the target question evolution prompt into a second language model to obtain a question after the initial question evolves, and can more effectively generate a diverse and large-scale question data set with strong flexibility and adaptability, and is suitable for a variety of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0030] Figure 1 is a flowchart of a method for generating questions based on context information provided by an embodiment of the present invention;
[0031] Figure 2 is a schematic diagram of the structure of a context information-based question generation device provided by an embodiment of the present invention;
[0032] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] The terms "first", "second", etc. in the description of the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.
[0035] Large language models are trained by absorbing and analyzing massive amounts of text data. Large language models have the ability to interact with a variety of inputs and can generate logically rigorous and fluent texts. In the process of training large language models to better follow instructions, researchers carefully construct question datasets that include manually written questions, such as providing some customized questions for each task. However, this closed-ended question setting has two significant limitations: first, the lack of diversity, all examples revolve around only a few general questions, which severely limits the diversity of the questions; second, single task orientation: these questions usually only cover a single task type, such as translation or summarization, while the questions given by humans in reality often involve a variety of complex tasks and requirements.
[0036] In order to expand the diversity of questions and obtain an open domain question dataset, one way is to create an open domain question dataset manually. However, the cost of manual processing is high, and the difficulty level distribution of manually created questions tends to be simple or medium.
[0037] Recently, in a study on generating open-domain problems based on a large language model, a large language model was used to evolve the original problem, automatically generating open-domain problems of various difficulty levels on a large scale. However, the original problem before evolution was required to contain rich information so that information extraction or information processing could be performed based on this rich information, thereby achieving problem evolution. This method has poor flexibility and is difficult to adapt to a variety of application scenarios.
[0038] To this end, an embodiment of the present invention provides a question generation method, apparatus, device and medium based on context information, which obtains an initial question and its corresponding context information, selects a target information extraction prompt from a prompt library, inputs the target information extraction prompt and the context information into a first language model to obtain key information of the context information, selects a target question evolution prompt from the prompt library, inputs the initial question, the key information and the target question evolution prompt into a second language model to obtain a question after the initial question evolves, and can more effectively generate a diverse and large-scale question data set with strong flexibility and adaptability, and is suitable for a variety of application scenarios.
[0039] Figure 1 Schematic diagram of a process for generating questions based on context information provided by an embodiment of the present invention. Figure 1 As shown, a method for generating questions based on context information is provided, comprising the following steps: step 110, step 120, and step 130. The steps of the method flow are only a possible implementation of the present invention.
[0040] Step 110: Obtain an initial question and context information corresponding to the initial question.
[0041] Among them, the context information corresponding to the initial question refers to the overall context or environment in which the initial question is located; the context information includes the content of sentences, paragraphs or even the entire article related to the initial question before and after, as well as background information that may affect the understanding and answering of the initial question.
[0042] It should be noted that contextual information can provide additional clues and information and is crucial to correctly understand and answer the initial question.
[0043] Step 120: Select a target information extraction prompt from a pre-built prompt library, input the target information extraction prompt and context information into the first largest language model, and obtain key information of the context information output by the first largest language model.
[0044] Among them, the prompt library includes multiple information extraction prompts, question evolution prompts and question synonym expansion prompts.
[0045] Optionally, a question set and a corresponding answer set in the target field are obtained, a plurality of prompt texts are obtained according to the question set and the answer set, and a prompt library is constructed based on the plurality of prompt texts.
[0046] Optionally, the prompts in the prompt library are continuously optimized to adapt to new problems and needs.
[0047] Among them, the target information extraction prompt includes entity recognition prompt, keyword extraction prompt, event extraction prompt, concept extraction prompt, etc. Information extraction prompt is used to guide the large language model to focus on important content, which can help the large language model understand the problem more accurately, focus on key information, and improve the accuracy and effectiveness of the answer.
[0048] In some embodiments, the key information includes entity information, relationship information, and task information.
[0049] For example, the context information corresponding to the initial question includes the following:
[0050] In a scene from a science fiction movie, the main character, the shapeshifting creature "The Morphogen", is about to present a stunning camouflage and transformation show. This scene is set in a desolate area on Mars. The Morphogen will undergo a thrilling transformation and camouflage from a flying dragon to a mechanical behemoth. The production team must ensure that the transformation effect achieves the expected level of realism. First, they must ensure the smoothness of the transformation process. Secondly, considering that the Morphogen has complex biological and mechanical characteristics, the details and structures of the transformation and camouflage must be accurate to present a sense of reality. In addition, ray tracing technology is also crucial in the deformation and camouflage process, as it needs to ensure the continuity of lighting and shadows. Finally, time and resource constraints are also factors that the team needs to consider. They must complete the production of this visual effect in a limited time and within a limited budget.
[0051] The target information extraction prompt includes the following:
[0052] Extract entity information, relationship information and task information about the restrictions or environment on which the task implementer is subject from the context information; Note: The extracted information should not be too long, please list the entity information, relationship information and task information separately.
[0053] The key information of the context information output by the first language model includes the following:
[0054] 1) Entity information: shaper, Mars, production team;
[0055] 2) Relationship information: morpher and deformation, morpher and disguise, production team and the realism of deformation effect, ray tracing technology and the consistency of deformation and disguise process, and the impact of time and resource constraints on the production team;
[0056] 3) Mission information: Ensure that the Morphogen's deformation and camouflage effects achieve the desired level of realism; fully consider the Morphogen's complex biological and mechanical characteristics to present a sense of reality; use ray tracing technology to ensure the consistency of the deformation and camouflage process; complete the production of visual effects within a limited time and within a limited budget.
[0057] It can be understood that by using target information extraction prompts, the large language model can be guided to focus more on extracting key information of contextual information, improve the precision and accuracy of the output results, and improve the efficiency of key information extraction.
[0058] Step 130: Select a target question evolution prompt from the prompt library, input the initial question, key information and the target question evolution prompt into the second largest language model, and obtain the question after the initial question is evolved output by the second largest language model.
[0059] Among them, the target question evolution prompt is used to guide the large language model to evolve the initial question based on the initial question and key information; the target question evolution prompt includes prompts such as creating a new question, adding constraints, explicit reasoning, concretization, and adding queries.
[0060] In some embodiments, selecting a target question from a prompt library to evolve prompt includes:
[0061] Determine the target evolution direction corresponding to the initial problem from multiple evolution directions;
[0062] Based on the target evolution direction, the target question evolution prompt is selected from the prompt library.
[0063] Optionally, a target evolution direction corresponding to the initial problem may be determined from multiple evolution directions according to user needs, and the initial problem may be evolved multiple times according to user needs.
[0064] In some embodiments, multiple evolutionary directions include adding constraints, explicit reasoning, reification, increasing queries, and creating entirely new questions.
[0065] It should be noted that adding constraints means adding constraints to the initial problem; explicit reasoning means rewriting the initial problem so that the rewritten problem requires multiple steps of reasoning; concretization means replacing the general concepts in the initial problem with specific concepts; adding queries means increasing the depth and breadth of queries when the initial problem contains queries; creating a completely new problem means drawing inspiration from the initial problem to create a completely new problem.
[0066] In some embodiments, determining a target evolution direction corresponding to the initial question from a plurality of evolution directions includes:
[0067] According to the selection probability distribution of multiple pre-set evolutionary directions, a target evolutionary direction corresponding to the initial problem is determined from the multiple evolutionary directions.
[0068] Optionally, the selection probability distribution of a plurality of preset evolutionary directions may be obtained based on user input.
[0069] Optionally, the sampling probability of each evolutionary direction can be an equal probability. For example, when using the evolutionary directions of creating a new problem, adding constraints, explicit reasoning, concretization, and increasing queries, the sampling probability of each direction is 0.2; it can also be an artificially designed probability, for example, the probabilities of creating a new problem, adding constraints, explicit reasoning, concretization, and increasing queries are 0.4, 0.2, 0.1, 0.2, and 0.1 respectively.
[0070] For example, the initial question is: What are the basic principles for achieving transformation in camouflage?
[0071] The evolutionary direction is to create a completely new problem. The prompt for the target problem evolution includes "draw inspiration from the initial problem and create a completely new problem". The evolved problem is: In the field of visual effects, how to use ray tracing technology to achieve more realistic object deformation effects?
[0072] If the direction of evolution is to add constraints, the problem after evolution is: how to achieve more complex deformation in camouflage?
[0073] If the direction of evolution is explicit reasoning, then the problem after evolution is: How to use camouflage to achieve effective deformation?
[0074] If the direction of evolution is concretization, then the problem after evolution is: how to achieve effective morphological changes in camouflage?
[0075] If the evolutionary direction is to increase queries, the problem after evolution is: How to achieve more complex deformation in camouflage?
[0076] It can be understood that according to the selection probability distribution of multiple pre-set evolutionary directions, the target evolutionary direction corresponding to the initial problem is determined from multiple evolutionary directions. The evolutionary direction of the problem can be controlled with a certain probability according to user needs, thereby obtaining more diverse and personalized problems, which is highly flexible and can adapt to different application scenarios.
[0077] In an embodiment of the present invention, by obtaining an initial question and its corresponding context information, selecting a target information extraction prompt from a prompt library, inputting the target information extraction prompt and the context information into a first language model, obtaining key information of the context information, selecting a target question evolution prompt from the prompt library, inputting the initial question, key information and the target question evolution prompt into a second language model, obtaining a question after the initial question has evolved, thereby reducing costs, eliminating potential requirements for the original question, and being able to more accurately and effectively generate a large number of highly diverse and information-intensive question data sets, which can cover a wider range of contexts and needs, provide users with more flexible choices, and be suitable for a variety of fields and application scenarios.
[0078] It should be noted that each implementation of the present invention can be freely combined, the order can be changed, or it can be executed separately, and does not need to rely on or depend on a fixed execution order.
[0079] In some embodiments, after obtaining the question evolved from the initial question output by the second largest language model, the method further includes:
[0080] A target question synonym expansion prompt is selected from the prompt library, and the evolved question and the target question synonym expansion prompt are input into the third language model to obtain the synonym expansion question of the evolved question output by the third language model.
[0081] Among them, the target question synonym expansion prompt is used to guide the large language model to perform synonymous expansion on the evolved question to generate a new question with a similar meaning to the evolved question but a different expression form.
[0082] Optionally, the evolved questions can be synonymously expanded by synonym replacement, sentence conversion, etc.
[0083] For example, the evolved question is: How to achieve integration through artificial intelligence technology? The synonymous expansion of this question is: How can artificial intelligence technology help achieve integration?
[0084] For example, the evolved questions are: What are time-sensitive goals? How are time-sensitive goals defined?
[0085] It can be understood that by selecting the target question synonym expansion prompt from the prompt library, using the target question synonym expansion prompt and the third language model, the evolved question is synonymously expanded to obtain the synonym expansion question of the evolved question, which further increases the generation scale and diversity of the questions.
[0086] In some embodiments, before selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and context information into the first language model, and obtaining key information of the context information output by the first language model, the method further includes:
[0087] Selecting an initial information extraction prompt that matches the context information from the prompt library;
[0088] Inputting the initial information extraction prompt and the context information into the first language model to obtain the initial key information of the context information output by the first language model;
[0089] Evaluate the quality of initial key information and obtain evaluation results;
[0090] Based on the evaluation results, the initial information extraction prompt is adjusted to obtain the target information extraction prompt, and the target information extraction prompt is added to the prompt library.
[0091] Optionally, evaluation indicators, such as accuracy, completeness, etc., are determined in advance, and the quality of the initial key information is evaluated according to the evaluation indicators to obtain evaluation results.
[0092] It is understandable that by continuously adjusting the information extraction prompt, the extraction effect of key information can be gradually optimized and the accuracy and completeness of information extraction can be improved; adding the evaluated and adjusted target information extraction prompt to the prompt library can enrich the content of the prompt library and improve its adaptability and practicality; by continuously optimizing the information extraction process, the model's performance in processing complex information and context understanding can be improved, thereby providing more accurate and targeted information output and improving user experience.
[0093] The following describes a question generating device based on context information provided by an embodiment of the present invention. The question generating device based on context information described below and the method described above can refer to each other.
[0094] Figure 2 A schematic diagram of the structure of a context information-based question generation device provided by an embodiment of the present invention, such as Figure 2 As shown, the context information-based question generating device 200 includes:
[0095] A first acquisition unit 210 is used to acquire an initial question and context information corresponding to the initial question;
[0096] The first information extraction unit 220 is used to select a target information extraction prompt from a pre-built prompt library, input the target information extraction prompt and the context information into the first language model, and obtain key information of the context information output by the first language model;
[0097] The question evolution unit 230 is used to select a target question evolution prompt from the prompt library, input the initial question, key information and the target question evolution prompt into the second largest language model, and obtain the question after the initial question is evolved from the output of the second largest language model.
[0098] Optionally, the context information-based question generating device 200 further includes:
[0099] The question synonym expansion unit is used to select a target question synonym expansion prompt from the prompt library, input the evolved question and the target question synonym expansion prompt into the third language model, and obtain the synonym expansion question of the evolved question output by the third language model.
[0100] Optionally, select a target question from the prompt library to evolve the prompt, including:
[0101] Determine the target evolution direction corresponding to the initial problem from multiple evolution directions;
[0102] Based on the target evolution direction, the target question evolution prompt is selected from the prompt library.
[0103] Optionally, multiple evolutionary directions include adding constraints, explicit reasoning, reification, augmenting queries, and creating entirely new questions.
[0104] Optionally, a target evolution direction corresponding to the initial problem is determined from multiple evolution directions, including:
[0105] According to the selection probability distribution of multiple pre-set evolutionary directions, a target evolutionary direction corresponding to the initial problem is determined from the multiple evolutionary directions.
[0106] Optionally, the context information-based question generating device further includes:
[0107] A second acquisition unit is used to select an initial information extraction prompt that is adapted to the context information from the prompt library;
[0108] A second information extraction unit is used to input the initial information extraction prompt and the context information into the first large language model to obtain the initial key information of the context information output by the first large language model;
[0109] An information evaluation unit, used to evaluate the quality of the initial key information and obtain an evaluation result;
[0110] The adjustment unit is used to adjust the initial information extraction prompt based on the evaluation result to obtain the target information extraction prompt, and add the target information extraction prompt to the prompt library.
[0111] Optionally, the key information includes entity information, relationship information and task information.
[0112] It should be noted here that the context information-based question generation device provided in an embodiment of the present invention can implement all the method steps implemented in the above-mentioned context information-based question generation method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.
[0113] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Figure 3As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the question generation method based on context information, the method comprising: obtaining an initial question and context information corresponding to the initial question; selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and the context information into the first language model, and obtaining key information of the context information output by the first language model; selecting a target question evolution prompt from the prompt library, inputting the initial question, key information and the target question evolution prompt into the second language model, and obtaining the question after the initial question is evolved output by the second language model.
[0114] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0115] On the other hand, the present invention also provides a computer program product, which includes a computer program, and the computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the question generation method based on context information provided by the above methods, and the method includes: obtaining an initial question and context information corresponding to the initial question; selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and the context information into a first language model, and obtaining key information of the context information output by the first language model; selecting a target question evolution prompt from the prompt library, inputting the initial question, key information and the target question evolution prompt into a second language model, and obtaining the question after the initial question is evolved from the second language model.
[0116] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the context information-based question generation method provided by the above-mentioned methods, the method comprising: obtaining an initial question and context information corresponding to the initial question; selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and the context information into a first language model, and obtaining key information of the context information output by the first language model; selecting a target question evolution prompt from the prompt library, inputting the initial question, key information and the target question evolution prompt into a second language model, and obtaining the question after the initial question is evolved from the second language model.
[0117] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0118] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A question generation method based on context information, characterized in that: include: Obtaining an initial question and context information corresponding to the initial question; Selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and the context information into a first large language model, and obtaining key information of the context information output by the first large language model; Selecting a target question evolution prompt from the prompt library, inputting the initial question, key information and the target question evolution prompt into the second largest language model, and obtaining the question after the initial question is evolved output by the second largest language model; The target question evolution prompt is used to guide the second largest language model to evolve the initial question according to the initial question and key information; The target problem evolution prompt includes creating a new problem, adding constraints, explicit reasoning, visualization, and adding query prompts.
2. The method for generating questions based on context information according to claim 1, characterized in that: After obtaining the question evolved from the initial question output by the second largest language model, the method further includes: A target question synonym expansion prompt is selected from the prompt library, and the evolved question and the target question synonym expansion prompt are input into a third language model to obtain a synonym expansion question of the evolved question output by the third language model.
3. The method for generating questions based on context information according to claim 1, characterized in that: The step of selecting a target question evolution prompt from the prompt library includes: Determining a target evolution direction corresponding to the initial problem from multiple evolution directions; Based on the target evolution direction, the target problem evolution prompt is selected from the prompt library.
4. The method for generating questions based on context information according to claim 3, characterized in that: The multiple evolutionary directions include adding constraints, explicit reasoning, reification, increasing queries, and creating entirely new problems.
5. The method for generating questions based on context information according to claim 3, characterized in that: Determining the target evolution direction corresponding to the initial problem from multiple evolution directions includes: According to the preset selection probability distribution of the multiple evolutionary directions, a target evolutionary direction corresponding to the initial problem is determined from the multiple evolutionary directions.
6. The method for generating questions based on context information according to claim 1, characterized in that: The step of selecting a target information extraction prompt from a pre-built prompt library, inputting the target information extraction prompt and the context information into a first language model, and obtaining key information of the context information output by the first language model further includes: Selecting an initial information extraction prompt that matches the context information from the prompt library; Inputting the initial information extraction prompt and the context information into a first large language model to obtain initial key information of the context information output by the first large language model; Evaluating the quality of the initial key information to obtain an evaluation result; Based on the evaluation result, the initial information extraction prompt is adjusted to obtain the target information extraction prompt, and the target information extraction prompt is added to the prompt library.
7. The method for generating questions based on context information according to any one of claims 2 to 6, characterized in that: The key information includes entity information, relationship information and task information.
8. A question generation device based on context information, characterized in that: include: A first acquisition unit, configured to acquire an initial question and context information corresponding to the initial question; A first information extraction unit is used to select a target information extraction prompt from a pre-built prompt library, input the target information extraction prompt and the context information into a first large language model, and obtain key information of the context information output by the first large language model; A question evolution unit, used for selecting a target question evolution prompt from the prompt library, inputting the initial question, key information and the target question evolution prompt into the second largest language model, and obtaining the question after the initial question is evolved output by the second largest language model; The target question evolution prompt is used to guide the second largest language model to evolve the initial question according to the initial question and key information; The target problem evolution prompt includes creating a new problem, adding constraints, explicit reasoning, visualization, and adding query prompts.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for generating questions based on context information as described in any one of claims 1 to 7 is implemented.
10. A non-transitory 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 questions based on context information as claimed in any one of claims 1 to 7 is implemented.
