Method and device for constructing five-question generation model based on context

Through the knowledge graph sub-graph splitting and graph comparison learning technology, high-performance five-way question questions are generated in a small sample scenario, which solves the problem of question generation in the existing technology and promotes the intelligent development of international Chinese education.

CN119168029APending Publication Date: 2024-12-20HUAQIAO UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410933069.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

The prior art is difficult to generate questions with high performance in scenarios with few samples, and requires a large amount of high-quality labeling data.

Method used

By splitting the knowledge graphs in sub-graphs, calculating the similarity of the relationship paths, performing graph comparison learning, obtaining semantic representations, and finding similar sub-graphs through a similarity algorithm, and generating questions based on a large language model.

Benefits of technology

Generate five questions with high performance in a small sample scenario to assist in the intelligent generation of international Chinese teaching question bank resources and promote the digital development of international Chinese education.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119168029A_ABST
    Figure CN119168029A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for constructing a context-based five-question generation model, and the method comprises the following steps: S1, carrying out the sub-graph splitting of a knowledge graph, and obtaining the sub-graphs of the knowledge graph; s2, calculating the knowledge graph sub-graphs in the S1 according to the similarity of relation paths to obtain a plurality of groups of positive sample sub-graphs; s3, performing graph comparison learning on the positive sample sub-graphs in the S2 to obtain semantic representation of each sub-graph; s4, searching similar sub-graphs of the input sub-graphs in the example graph question set through a similarity algorithm based on the semantic representation in the S3, and obtaining a self-adaptive demonstration example; and S5, substituting the input sub-graph and the demonstration example in the step S4 into an instruction template to obtain an instruction text, and sending the instruction text into a large language model to generate a question sentence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of information processing, and in particular to a method and device for constructing a context-based five-question generation model. Background Art

[0002] One of the designs of question sentences in the prior art is the design of the five-what question sentence, which refers to the design method of five types of questions, namely: 1. What is it: refers to some questions that express factual content; 2. Why: refers to some questions that express purpose, reason, principle, rule, law and logical reasoning, and its solution usually corresponds to the acquisition of principle knowledge. 3. How: refers to some questions that express methods, ways and states, and its solution usually corresponds to the acquisition of strategic knowledge. 4. If: refers to some role transfer and situational questions that express that changes in conditions may produce new results. 5. By what: questions about "caused by..."

[0003] At present, the research on intelligent algorithms or models for question generation at home and abroad mainly focuses on end-to-end training and fine-tuning through pre-trained language models. These studies require a large amount of high-quality annotated data. Therefore, generating questions requires a large number of samples, and the demand for data and information is huge. Summary of the invention

[0004] The technical problem to be solved by the present invention is how to generate questions with high performance in a small number of sample scenarios.

[0005] The present invention adopts the following technical solution: a method for constructing a context-based five-question generation model, comprising the following steps:

[0006] S1. First, split the knowledge graph into subgraphs to obtain knowledge graph subgraphs;

[0007] S2, calculating the knowledge graph subgraphs described in S1 according to the similarity of the relationship paths to obtain multiple groups of positive sample subgraphs;

[0008] S3, performing graph contrast learning on the positive sample subgraphs described in S2 to obtain the semantic representation of each subgraph;

[0009] S4. Based on the semantic representation described in S3, similar subgraphs of the input knowledge graph subgraph in the example graph question set are searched through a similarity algorithm and adaptive demonstration examples are obtained;

[0010] S5. Substitute the input subgraph and the demonstration example described in S4 into the instruction template to obtain the instruction text, and send it to the large language model to generate a question sentence.

[0011] Preferably, S1 comprises the following steps:

[0012] S11: Let the knowledge graph G = {E, R, F}, where E represents the entity set, R represents the relationship set, F represents the fact set, e represents the entity, r represents the relationship, and f represents the fact;

[0013] S12: Split the knowledge graph G into subgraphs according to the one-hop, two-hop, divergent or convergent topological structure to obtain a knowledge graph subgraph set SUG_topo, where any knowledge graph subgraph sug_topo i ={E i , R i , F i}, i=1, 2…TP, where TP is the number of subgraph sets SUG_topo.

[0014] Preferably, S2 comprises the following steps:

[0015] S21: Let any subgraph sug in the knowledge graph subgraph set SUG_topo i The relationship path set is RP i ;

[0016] S22: Calculate the similarity S of the subgraph relationship path set for the knowledge graph subgraph set SUG_topo RP (sug i , sug j ), any two groups of sug i and sug j The relationship path set is RP i and RP j , the calculation process is shown in formula (1):

[0017]

[0018] Select the topk similarity knowledge graph subgraph pairs to enter the positive sample subgraph set Where k is km% of the number of times formula (1) is calculated, km is the ratio threshold, topk is the relationship path set and of any two groups calculated in S22, and the more similar ones are selected as a group according to the number, the top k groups, k is km% of the number of times formula (1) is calculated, km is the ratio threshold, M is the number of knowledge graph subgraphs of SUG_sample, and thus by traversing all knowledge graph subgraphs, N positive sample subgraph sets can be obtained to form the graph contrast learning training set COM.

[0019] Preferably, S3 comprises the following steps:

[0020] S31: for any knowledge graph subgraph sug in the graph contrast learning training set COM described in step S22 m ={E m , R m, F m}, r∈R m Send it to the pre-trained BERT model for word embedding to get the relation embedding vector v r ;

[0021] S32: Initialize any sug m Every node e∈E m Vector Take the mean of the relationship vectors connected to it, and the calculation process is shown in formula (2):

[0022]

[0023] Where Re is the set of relations connected to e, and sug m The initial features of the graph nodes are Where C is sug m The number of nodes;

[0024] S33: Assume any sug m The adjacency matrix A m For any two different sets of positive sample subgraphs in the graph contrast learning training set COM, each knowledge graph subgraph sug m of With the adjacency matrix A m Send it to the Gin graph neural network for encoding, average the node vectors and perform pooling to obtain the graph node features and will The sigmoid activation function is used to obtain the semantic representation z m , to calculate the graph contrast learning loss L gcl , the calculation formula is shown in (3):

[0025]

[0026] Among them, Pos(n) represents the nth group of positive sample sub-graphs, τ represents the temperature parameter, z n Represents another subgraph sug n The semantic representation of gcl Through iterative optimization, the graph semantic representation model G_gcl is obtained.

[0027] Preferably, S4 comprises the following steps:

[0028] S41: Construct an example graph question set D from the graph contrast learning training set COM Where K is the number of knowledge graph subgraphs in the example graph question set D. Any knowledge graph subgraph sug_example k Equipped with question set Q k ,and Where T is the number of questions, Q is the question set, q is the five-question sentence, and wh is the five-question parameter.

[0029] S42: Assume that the input knowledge graph subgraph sug ts , call graph semantic representation model G_gcl for sug ts Perform semantic representation and obtain the semantic representation vector z ts , traverse the graph representation set in the example graph question set D z k With z ts The cosine similarity is calculated as shown in (4):

[0030]

[0031] S43: Select k with the largest semantic representation similarity to obtain demonstration example dem={(sug_example1, Q1), ..., (sug_example dm , Q dm )}, where k is the kd% of the number of calculations in formula (4), kd is the ratio threshold, and dm is the number of graph-question pairs in the demonstration example. Preferably, S5 comprises the following steps:

[0032] S51: Set I tempalte As the instruction template, the knowledge graph subgraph sug ts , Demonstration example dem and five parameters wh are substituted into template I tempalte , get the instruction text IC.

[0033] S52: Send IC to the large language model, which converts IC into an input vector sequence V input =(v wt1 , v wt2 , ..., v wtLT ), where LT is the sequence length, and then calculate the probability P(y|V input ), the calculation formula is shown in (5):

[0034]

[0035] Where X is the five-question sentence generated by the five-question sentence generation model.

[0036] A device for constructing a context-based five-question generation model can generate five-question sentences by using the method for constructing a context-based five-question generation model as described above.

[0037] The present invention has the following beneficial effects: The present invention proposes a method and device for constructing a context-based five-question generation model, which generates five-question sentences with high performance in a small sample scenario through context learning technology and instruction prompt technology, assists in the intelligent generation of international Chinese teaching question bank resources, and promotes the digital development of international Chinese education. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 A framework diagram of a model generated for the present invention.

[0040] Figure 2 Flowchart for generating the model for the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments 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 making creative work belong to the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0042] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.

[0043] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0044] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0045] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may include that the first and second features are in direct contact, or may include that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, a first feature being "above", "above" and "above" a second feature includes that the first feature is directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being "below", "below" and "below" a second feature includes that the first feature is directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.

[0046] Example

[0047] The following are only preferred implementations of the present invention. The protection scope of the present invention is not limited to the following embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention.

[0048] Reference Manual Attached Figure 1-2 The present invention provides a method for generating an electronic medical record with factual consistency, comprising the following steps:

[0049] S1. First, split the knowledge graph into subgraphs to obtain knowledge graph subgraphs;

[0050] S1 is further specified as:

[0051] S11: Assume that the knowledge graph G = {E, R, F}, E = {Zhuge Liang, Battle of Red Cliffs, ...} represents an entity set of size 1587, R = {monarch, promote, ...} represents a relationship set of size 139, F = {Zhuge Liang-monarch->Liu Bei, Cao Cao-participate->Battle of Red Cliffs, ...} represents a triple set of size 2610, e represents entity, r represents relationship, and f represents fact.

[0052] S12: Split the knowledge graph G into subgraphs according to one-hop, two-hop, divergent, and convergent topological structures to obtain a subgraph set SUG_topo = {Monarch (Zhuge Liang, Liu Bei) -> Minister (Liu Bei, Zhuge Liang), Monarch (Zhang Liang, Liu Bang) -> Minister (Liu Bang, Zhang Liang), ...}.

[0053] S2, calculating the knowledge graph subgraphs described in S1 according to the similarity of the relationship paths to obtain multiple groups of positive sample subgraphs;

[0054] S2 is further specified as:

[0055] S21: Let any subgraph sug of the subgraph set SUG_topo i The relationship path set is RP i .

[0056] S22: Calculate the subgraph relationship path set similarity S for SUG_topo RP (sug i , sug j ), any two groups of sug i and sug j The relationship path set is RP i and RP j , the calculation process is shown in formula (1).

[0057]

[0058] Select the subgraph pairs with topk similarities to enter the positive sample subgraph set SUG_sample. Topk refers to 5% of the number of times calculated in formula (1). By traversing all subgraphs, N = 20 positive sample subgraph sets can be obtained, forming a graph contrast learning training set COM = {{Monarch (Zhuge Liang, Liu Bei) -> Minister (Liu Bei, Zhuge Liang), Monarch (Zhang Liang, Liu Bang) -> Minister (Liu Bang, Zhang Liang), ...}, {Honorary title (Du Fu, Poet Saint), Friend (Du Fu, Li Bai), ...}, ...}.

[0059] S3, performing graph contrast learning on the positive sample subgraphs described in S2 to obtain the semantic representation of each subgraph;

[0060] S3 is further specified as follows:

[0061] S31: For any subgraph sug in the graph contrast learning training set COM m ={E m , R m , F m}, r∈R m Send it to the pre-trained BERT model for word embedding to get the relation embedding vector v r . .

[0062] S32: Initialize any sug m Every node e∈E m Vector Take the mean of the relationship vectors connected to it, as shown in formula (2), where Re is the set of relationships connected to e. m The initial features of the graph nodes are Where C is sug m The number of nodes.

[0063]

[0064] S33: Assume any sug m The adjacency matrix A m For any two different sets of positive sample subgraphs in the graph contrast learning training set COM, each sug m of With the adjacency matrix A m Send it to the Gin graph neural network for encoding, average the node vectors and perform pooling to obtain the graph node features and will The sigmoid activation function is used to obtain the semantic representation z m , to calculate the graph contrast learning loss L gcl , the calculation formula is shown in (3).

[0065]

[0066] Among them, Pos(n) represents the nth group of positive sample sub-graphs, τ represents the temperature parameter, z n Represents another subgraph sug n The semantic representation of the graph is obtained by comparing the learning loss L gcl Through iterative optimization, the graph semantic representation model G_gcl is obtained.

[0067] S4. Based on the semantic representation described in S3, similar subgraphs of the input knowledge graph subgraph in the example graph question set are searched through a similarity algorithm and adaptive demonstration examples are obtained;

[0068] S4 is further specified as follows:

[0069] S41: Construct an example graph question set D from the graph contrast learning training set COM = {{(input subgraph: Du Fu-honorific title->Poet Sage; Du Fu-friend->Li Bai;), (Question 1: What is the honorific title of Li Bai's friend Du Fu?; Five What types: What), (Question 2: Why is Li Bai's friend Du Fu honored as the "Poet Sage"?; Five What types: Why)}, {(input subgraph: Westernization Movement-influence->Sino-Japanese War of 1894-1895;)}, (Question 1: What was the historical background of the Sino-Japanese War of 1894-1895?; Five What types: From what), (Question 2: How did the Westernization Movement affect the Sino-Japanese War of 1894-1895?; Five What types: How)}, ...}, the scale of D is 35 subgraphs and 112 questions.

[0070] S42: Assume input subgraph sug ts ={Li-friend->Hu;} call graph semantic representation model G_gcl for sug ts Perform semantic representation and obtain the semantic representation vector z ts =[1.23, 0.23, 0.44, ...]. Traverse the graph representation set in the example graph question set D z k With z ts The cosine similarity is calculated using the formula shown in (4).

[0071]

[0072] S43: According to the semantic representation similarity topk, the demonstration example dem={(input subgraph: Du Fu-honorific title->Poet Sage; Du Fu-friend->Li Bai; output question: Why is Li Bai's friend Du Fu honored as "Poet Sage"?), (input subgraph: Li-belief->A-ism; someone-belief->A-ism; output question: Why do Zhou and Li both believe in A-ism?), ...}, where k is 2% of the number of times formula (4) is calculated.

[0073] S5. Substitute the input subgraph and the demonstration example described in S4 into the instruction template to obtain the instruction text, and send it to the large language model to generate a question sentence.

[0074] There are two instruction templates, the first one is:

[0075] You are an education master who can output a question of a specified type based on the input knowledge graph triple. The requirements are as follows:

[0076] 1. The triplet form is: head entity-relationship->tail entity, including: person-person relationship->person, person-attribute->attribute value, event-event relationship->event, event-argument->argument value, person / event-relationship->event / person, etc.

[0077] 2. Output one question at a time, ending with "?"

[0078] 3. Please ask questions according to the specified question types, including what, why, how, how, and by what

[0079] 4. The content of the question and the answer to the question should cover the given knowledge graph triples as much as possible

[0080] 5. Try to restore the meaning of the knowledge graph triples

[0081] 6. We will give a set of demonstration examples, you can refer to these examples

[0082] 7. Questions should be as educational, well-worded, and coherent as possible.

[0083] 8. If the input knowledge graph triple contains the inference source and inference result, try to grasp the given inference relationship and generate questions. The specific forms include

[0084] (1) Why: Why is the inference valid? The answer is because there is a source of inference;

[0085] (2) How: Based on the source of reasoning, how do we draw some conclusions? The answer is the result of reasoning;

[0086] (3) How: If some factors in the inference source change, will some factors in the inference result change? The answer is generally open.

[0087] The question type specified for this generation is: {0}

[0088] The demonstration example is:

[0089] {1}

[0090] The input subgraph this time is: {2}, the inference source is: {3}, and the inference result is: {4}; the output question is: "'.

[0091] The second directive template is:

[0092] You are an education master who can output a question of a specified type based on the input knowledge graph triple.

[0093] The requirements are as follows:

[0094] 1. The triplet form is: head entity-relationship->tail entity, including: person-person relationship->person, person-attribute->attribute value, event-event relationship->event, event-argument->argument value, person / event-relationship->event / person, etc.

[0095] 2. Output one question at a time, ending with "?"

[0096] 3. Please ask questions according to the specified question types, including what, why, how, how, and by what

[0097] 4. The content of the question and the answer to the question should cover the given knowledge graph triples as much as possible

[0098] 5. Try to restore the meaning of the knowledge graph triples

[0099] 6. We will give a set of demonstration examples, you can refer to these examples

[0100] 7. Questions should be as educational, well-worded, and coherent as possible.

[0101] The question type specified for this generation is: {0}

[0102] The demonstration example is:

[0103] {1}

[0104] The input subgraph this time is: {2}; the output question is:

[0105] ”'

[0106] S5 is further specified as follows:

[0107] S51: Set instruction template I tempalte For {You are an education master, and you can output a question of a specified type based on the input knowledge graph triple. The requirements are as follows: 1. The triple form is: head entity-relationship->tail entity, including: person-person relationship->person, person-attribute->attribute value, event-event relationship->event, event-argument->argument value, person / event-relationship->event / person, etc. 2. Output one question at a time, ending with "?" 3. Please ask questions according to the specified question type, including what, why, how, how, and why 4. The content of the question and the answer to the question is required to cover the given knowledge graph triple as much as possible 5. Try to restore the meaning of the knowledge graph triple 6. We will give a set of demonstration examples, you can refer to these examples 7. The question should be as educational as possible, with appropriate wording and coherence. The specified question type generated this time is [x1], the demonstration example is: [x2], the input subgraph is: [x3], then the output question is:}. Input subgraph sug ts , the demonstration example dem and the five parameters wh (please refer to the "Research on Teaching Problem Design: Effectiveness and Scaffolding", 2005.10, China Audio-visual Education, No. 225) are substituted into the template I tempalte, get the instruction text IC = {You are an education master, and you can output a specified type of question sentence based on the input knowledge graph triple. The requirements are as follows: 1. The triple form is: head entity-relationship->tail entity, including: person-person relationship->person, person-attribute->attribute value, event-event relationship->event, event-argument->argument value, person / event-relationship->event / person, etc. 2. Output one question sentence at a time, ending with "?" 3. Please ask questions according to the specified question type, including what, why, how, how, and by what 4. The content of the question sentence and the answer to the question sentence should cover the given knowledge graph triple as much as possible 5. Try to restore the meaning of the knowledge graph triple 6. We will give a set of demonstration examples, you can refer to these examples 7. The question sentence should be as educational as possible, with appropriate words and coherence. The specified question type for this generation is: why, input subgraph: Du Fu-Honorary Title->Poet Saint; Du Fu-Friend->Li Bai;; Output question: Why is Li Bai's friend Du Fu honored as "Poet Saint"?, input subgraph: Li-Belief->Aism; Li-Friend->Hu;, then the output question is:}.

[0108] S52: Send IC to the large language model, which converts IC into an input vector sequence V input =(v wt1 , v wt2 , ..., v wtLT ), where LT is the sequence length, and then calculate the probability P(y|V input ), the calculation formula is shown in (5).

[0109]

[0110] Where X = {Why do Li and Hu both have faith, and what do they believe in?}, which is a question of the type "why" generated by the knowledge graph five-question generation model based on large model context learning.

[0111] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for constructing a context-based five-question generation model, It is characterized in that The steps include: S1. First, split the knowledge graph into subgraphs to obtain knowledge graph subgraphs; S2, calculating the knowledge graph subgraphs described in S1 according to the similarity of the relationship paths to obtain multiple groups of positive sample subgraphs; S3, performing graph contrast learning on the positive sample subgraphs described in S2 to obtain the semantic representation of each subgraph; S4, based on the semantic representation described in S3, searching for similar subgraphs of the input knowledge graph subgraph in the example graph question set through a similarity algorithm and obtaining an adaptive demonstration example; S5. Substitute the input subgraph and demonstration example described in S4 into the instruction template to obtain the instruction text, and send it to the large language model to generate a question. The instruction template is a template that can output a question of a specified type based on the input knowledge graph subgraph.

2. The method for constructing a context-based five-question generation model according to claim 1, It is characterized in that The S1 comprises the following steps: S11: Let the knowledge graph G = {E, R, F}, where E represents the entity set, R represents the relationship set, F represents the fact set, e represents the entity, r represents the relationship, and f represents the fact; S12: Split the knowledge graph G into subgraphs according to the one-hop, two-hop, divergent or convergent topological structure to obtain a knowledge graph subgraph set SUG_topo, where any knowledge graph subgraph sug_topo i ={E i ,R i ,F i }, i = 1, 2…TP, where TP is the number of subgraph sets SUG_topo.

3. The method for constructing a context-based five-question generation model according to claim 2, It is characterized in that The S2 comprises the following steps: S21: Let any subgraph sug in the knowledge graph subgraph set SUG_topo i The relationship path set is RP i ; S22: Calculate the similarity S of the subgraph relationship path set for the knowledge graph subgraph set SUG_topo RP (sug i ,sug j ), any two groups of sug i and sug j The relationship path set is RP i and RP j , the calculation process is shown in formula (1): Select the topk similarity knowledge graph subgraph pairs to enter the positive sample subgraph set Where k is km% of the number of times formula (1) is calculated, km is the ratio threshold, topk is the relationship path set and of any two groups calculated in S22, and the more similar ones are selected as a group according to the number, the top k groups, k is km% of the number of times formula (1) is calculated, km is the ratio threshold, M is the number of knowledge graph subgraphs of SUG_sample, and thus by traversing all knowledge graph subgraphs, N positive sample subgraph sets can be obtained to form the graph contrast learning training set COM.

4. The method for constructing a context-based five-question generation model according to claim 3, It is characterized in that The S3 comprises the following steps: S31: for any knowledge graph subgraph sug in the graph contrast learning training set COM described in step S22 m ={E m ,R m ,F m }, r∈R m Send it to the pre-trained BERT model for word embedding to get the relation embedding vector v r ; S32: Initialize any sug m Every node e∈E m Vector Take the mean of the relationship vectors connected to it, and the calculation process is shown in formula (2): Where Re is the set of relations connected to e, and sug m The initial features of the graph nodes are Where C is sug m The number of nodes; S33: Assume any sug m The adjacency matrix A m For any two different sets of positive sample subgraphs in the graph contrast learning training set COM, each knowledge graph subgraph sug m of With the adjacency matrix A m Send it to the Gin graph neural network for encoding, average the node vectors and perform pooling to obtain the graph node features and will The sigmoid activation function is used to obtain the semantic representation z m , to calculate the graph contrast learning loss L gcl , the calculation formula is shown in (3): Among them, Pos(n) represents the nth group of positive sample sub-graphs, τ represents the temperature parameter, z n Represents another subgraph sug n The semantic representation of gcl Through iterative optimization, the graph semantic representation model G_gcl is obtained.

5. The method for constructing a context-based five-question generation model according to claim 4, It is characterized in that The S4 comprises the following steps: S41: Constructing a sample graph question set from the graph contrast learning training set COM Where K is the number of knowledge graph subgraphs in the example graph question set D. Any knowledge graph subgraph sug_example k Equipped with question set Q k ,and Where T is the number of questions, Q is the question set, q is the five-question sentence, and wh is the five-question parameter. S42: Assume that the input knowledge graph subgraph sug ts , call graph semantic representation model G_gcl for sug ts Perform semantic representation and obtain the semantic representation vector z ts , traverse the graph representation set in the example graph question set D z k With z ts The cosine similarity is calculated as shown in (4): S43: Select k with the largest semantic representation similarity to obtain demonstration example dem={(sug_example 1 ,Q 1 ),…,(sug_example dm ,Q dm )}, where k is the kd% of the number of calculations in formula (4), kd is the ratio threshold, and dm is the number of graph-question pairs in the demonstration example.

6. The method for constructing a context-based five-question generation model according to claim 5, It is characterized in that The S5 comprises the following steps: S51: Set I tempalte As the instruction template, the knowledge graph subgraph sug ts , Demonstration example dem and five parameters wh are substituted into template I tempalte , get the instruction text IC. S52: Send IC to the large language model, which converts IC into an input vector sequence V input =(v wt1 ,v wt2 ,…,v wtLT ), where LT is the sequence length, and then calculate the probability P(y|V input ), the calculation formula is shown in (5): Where X is the five-question sentence generated by the five-question sentence generation model.

7. A device for constructing a context-based five-question generation model, It is characterized in that It can generate five-question questions by the method for constructing a context-based five-question question generation model as described in any one of claims 1-6.