A graphics generation method, a training method and a device for a topic analysis model

Through the training of the graph generation method and question analysis model, the geometric problem graph is generated using pre-trained models, which solves the problems of slow generation speed and poor accuracy in the existing technology, and achieves fast and accurate graph generation and improves the efficiency of question setting. .

CN118762104BActive Publication Date: 2025-01-07ANT CLOUD TECH GRP CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411245289.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2025-01-07
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

In the prior art, the generation speed of geometric problems is slow and prone to errors, and there is a lack of a fast and accurate generation method.

Method used

The graph generation method is used to obtain target questions and target prompt information, enter pre-trained problem analysis model, and generate graphs using the analysis results of categories, components, component attributes and component positions. The method includes the use of an encoder and a decoder, generating one-dimensional, two-dimensional or three-dimensional graphics, etc.

Benefits of technology

It realizes the rapid and accurate generation of geometric questions, improves the efficiency and accuracy of question setting, and has significant advantages over manual drawing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762104B_ABST
    Figure CN118762104B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method for generating a graph, a method for training a topic analysis model and a device, and relates to the field of computer application technology. The method for generating a graph includes: obtaining a target topic and target prompt information; the target prompt information includes: category prompt information, component prompt information, component attribute prompt information and component position prompt information; inputting the target topic and the target prompt information into a pre-trained topic analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information and a component position analysis result corresponding to the component position prompt information; and using the category analysis result, the component analysis result, the component attribute analysis result and the component position analysis result to generate a graph corresponding to the target topic. By applying the embodiment of the present invention, the rapid and accurate generation of the graph corresponding to the topic is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and in particular to a graph generation method, a training method and a device for a question analysis model. Background Art

[0002] In the field of education, geometry problems often have corresponding geometric figures. For example, when a math or geometry teacher assigns a geometry problem, they need to provide the corresponding figure. In related technologies, teachers manually draw the corresponding figures, but this method is not only slow but also prone to errors. Therefore, how to quickly and accurately generate the corresponding geometric figures for each problem has become a technical problem that needs to be solved urgently. Summary of the Invention

[0003] The purpose of the embodiments of the present invention is to provide a graph generation method, a training method and a device for a question analysis model to achieve rapid and accurate graph generation. The specific technical solution is as follows:

[0004] In a first aspect, an embodiment of the present invention provides a method for generating a graph, the method comprising:

[0005] Obtaining a target topic and target prompt information; the target prompt information includes: category prompt information, component prompt information, component attribute prompt information, and component location prompt information;

[0006] Inputting the target topic and the target prompt information into a pre-trained topic analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information;

[0007] A graphic corresponding to the target topic is generated using the category analysis result, the component analysis result, the component attribute analysis result, and the component position analysis result.

[0008] Optionally, the topic analysis model includes: an encoder and a decoder; inputting the target topic and the target prompt information into a pre-trained topic analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information, including:

[0009] Inputting the target question and the category prompt information into a pre-trained question analysis model, encoding the target question and the category prompt information using the encoder to obtain a first feature vector and a second feature vector, and decoding the first feature vector and the second feature vector using the decoder to obtain a category analysis result corresponding to the category prompt information;

[0010] Inputting the target question and the component prompt information into a pre-trained question analysis model, encoding the target question and the component prompt information using the encoder to obtain a first feature vector and a third feature vector, and decoding the first feature vector and the third feature vector using the decoder to obtain a component analysis result corresponding to the component prompt information;

[0011] Inputting the target question and the component attribute prompt information into a pre-trained question analysis model, encoding the target question and the component attribute prompt information using the encoder to obtain a first eigenvector and a fourth eigenvector, respectively, and decoding the first eigenvector and the fourth eigenvector using the decoder to obtain a component attribute analysis result corresponding to the component attribute prompt information;

[0012] The target question and the component position prompt information are input into a pre-trained question analysis model, the target question and the component position prompt information are respectively encoded by the encoder to obtain a first eigenvector and a fifth eigenvector, and the first eigenvector and the fifth eigenvector are decoded by the decoder to obtain a component position analysis result corresponding to the component position prompt information.

[0013] Optionally, the question analysis model includes: an encoder and four decoders; inputting the target question and the target prompt information into a pre-trained question analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information, including:

[0014] Inputting the target question and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information into a pre-trained question analysis model, and using the encoder to encode the target question and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information, respectively, to obtain a first eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector;

[0015] Decoding the first feature vector and the second feature vector using a first decoder to obtain a category analysis result corresponding to the category prompt information;

[0016] Decoding the first and third eigenvectors using a second decoder to obtain a component analysis result corresponding to the component prompt information;

[0017] Decoding the first and fourth eigenvectors using a third decoder to obtain a component attribute analysis result corresponding to the component attribute prompt information;

[0018] The first eigenvector and the fifth eigenvector are decoded by using a fourth decoder to obtain a component position analysis result corresponding to the component position prompt information.

[0019] Optionally, the category analysis result includes: one-dimensional graphics, two-dimensional graphics, three-dimensional graphics or other graphics; the component analysis result includes: at least one of arrow, shape, position, style, style, matrix, table, graph, tree, mind map, background and adaptation; the component attribute analysis result includes: at least one of basic shape attributes, style attributes, text attributes, node attributes, rectangle, circle, star, arrow attributes, line type, color, layer, coordinates and loop; the component position analysis result includes: at least one of coordinate representation, node representation and path representation;

[0020] Generating a graphic corresponding to the target topic by using the category analysis result, the component analysis result, the component attribute analysis result, and the component position analysis result includes:

[0021] Based on the category analysis result, the component analysis result, the component attribute analysis result, and the component position analysis result, a preset graphic generation tool is called to generate a graphic corresponding to the target topic.

[0022] In a second aspect, an embodiment of the present invention provides a method for training a question analysis model, the method comprising:

[0023] Obtain a pre-trained question analysis model and preset prompt information; the preset prompt information includes: category prompt information, component prompt information, component attribute prompt information, and component location prompt information;

[0024] Obtaining sample titles and their corresponding annotated attributes; the annotated attributes include: category, component, component attribute, and component position;

[0025] Inputting the sample question and the preset prompt information into the pre-trained question analysis model to obtain an attribute prediction result corresponding to the sample question, the attribute prediction result including: a category prediction result corresponding to the category prompt information, a component prediction result corresponding to the component prompt information, a component attribute prediction result corresponding to the component attribute prompt information, and a component position prediction result corresponding to the component position prompt information;

[0026] The loss between the attribute prediction result and the labeled attribute is calculated, and the parameters of the pre-trained question analysis model are adjusted according to the loss to obtain a trained question analysis model.

[0027] Optionally, the method further includes:

[0028] Adding a weight matrix to the pre-trained question analysis model and initializing the weight matrix;

[0029] The calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the pre-trained question analysis model according to the loss to obtain a trained question analysis model, includes:

[0030] The loss between the attribute prediction result and the labeled attribute is calculated, and the parameters of the weight matrix are adjusted according to the loss to obtain a trained question analysis model.

[0031] Optionally, adding a weight matrix to the pre-trained question analysis model and initializing the weight matrix includes:

[0032] Adding a weight matrix to a specified part of the pre-trained question analysis model and initializing the weight matrix;

[0033] The calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the weight matrix according to the loss to obtain a trained question analysis model, includes:

[0034] Keeping the parameters of the pre-trained question analysis model unchanged, calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the weight matrix according to the loss until the learning rate of the weight matrix meets the convergence condition;

[0035] The parameters of the pre-trained question analysis model are updated using the parameters of the weight matrix to obtain a trained question analysis model.

[0036] Optionally, the weight matrix includes a dimensionality reduction matrix and a dimensionality increase matrix; and adding the weight matrix to a designated portion of the pre-trained question analysis model and initializing the weight matrix includes:

[0037] According to the output dimension of the specified part of the pre-trained question analysis model, a dimensionality reduction and then dimensionality increase operation is performed to obtain the dimensionality reduction matrix and the dimensionality increase matrix;

[0038] Adding a bypass including the dimensionality reduction matrix and the dimensionality increase matrix at a designated location of the pre-trained question analysis model;

[0039] The reduced-dimensional matrix is ​​initialized using a random Gaussian distribution, and the increased-dimensional matrix is ​​initialized using a zero matrix.

[0040] In a third aspect, an embodiment of the present invention provides a graphics generation device, the device comprising:

[0041] The first acquisition module is used to acquire a target topic and target prompt information; the target prompt information includes: category prompt information, component prompt information, component attribute prompt information and component location prompt information;

[0042] a first topic analysis module, configured to input the target topic and the target prompt information into a pre-trained topic analysis model, and obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information;

[0043] A graphics generation module is used to generate a graphics corresponding to the target topic by using the category analysis result, the component analysis result, the component attribute analysis result and the component position analysis result.

[0044] In a fourth aspect, an embodiment of the present invention provides a training device for a question analysis model, the device comprising:

[0045] The second acquisition module is used to obtain a pre-trained question analysis model and preset prompt information; the preset prompt information includes: category prompt information, component prompt information, component attribute prompt information and component location prompt information;

[0046] A third acquisition module is used to obtain sample titles and their corresponding annotated attributes; the annotated attributes include: category, component, component attribute, and component position;

[0047] A second question analysis module is configured to input the sample question and the preset prompt information into the pre-trained question analysis model to obtain an attribute prediction result corresponding to the sample question, the attribute prediction result including: a category prediction result corresponding to the category prompt information, a component prediction result corresponding to the component prompt information, a component attribute prediction result corresponding to the component attribute prompt information, and a component position prediction result corresponding to the component position prompt information;

[0048] The model training module is used to calculate the loss between the attribute prediction result and the labeled attribute, and adjust the parameters of the pre-trained question analysis model according to the loss to obtain a trained question analysis model.

[0049] In a fifth aspect, an embodiment of the present invention further provides an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0050] Memory for storing computer programs;

[0051] The processor is configured to implement any of the above methods when executing a program stored in the memory.

[0052] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned methods is implemented.

[0053] In a seventh aspect, an embodiment of the present invention further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-described methods.

[0054] Beneficial effects of the embodiments of the present invention:

[0055] An embodiment of the present invention provides a graphics generation method, a training method and a device for a question analysis model, which use a pre-trained question analysis model in combination with target prompt information to analyze a target question, and obtain category analysis results, component analysis results, component attribute analysis results and component position analysis results corresponding to the target question, so as to accurately generate graphics corresponding to the target question using the category analysis results, component analysis results, component attribute analysis results and component position analysis results obtained by analysis. Compared with manual drawing, the method achieves rapid and accurate generation of graphics corresponding to the question, thereby improving the efficiency and accuracy of question setting.

[0056] Of course, it is not necessary to achieve all of the advantages described above simultaneously in order to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0058] Figure 1 A schematic diagram of a flow chart of a graphics generation method provided by an embodiment of the present invention;

[0059] Figure 2 A flowchart of a method for analyzing a question provided by an embodiment of the present invention;

[0060] Figure 3 Another flowchart of the question parsing method provided by an embodiment of the present invention;

[0061] Figure 4 A flowchart of a method for training a question analysis model provided by an embodiment of the present invention;

[0062] Figure 5 Another flowchart of a method for training a question analysis model provided by an embodiment of the present invention;

[0063] Figure 6 A schematic diagram of fine-tuning training for a question analysis model provided by an embodiment of the present invention;

[0064] Figure 7 A schematic structural diagram of a graphics generating device provided by an embodiment of the present invention;

[0065] Figure 8 A schematic diagram of the structure of a training device for a question analysis model provided by an embodiment of the present invention;

[0066] Figure 9 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0068] To enable rapid and accurate graphics generation, embodiments of the present invention provide a graphics generation method, a method for training a question analysis model, and an apparatus for doing so. These methods are applied to generating graphics based on questions and can be implemented using electronic devices, such as client devices or server devices.

[0069] like Figure 1 As shown, the graphics generation method provided by the embodiment of the present invention includes:

[0070] S101, obtaining target questions and target prompt information;

[0071] The target prompt information includes: category prompt information, component prompt information, component attribute prompt information and component location prompt information;

[0072] S102, inputting the target topic and target prompt information into a pre-trained topic analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information;

[0073] S103, generating a graphic corresponding to the target topic using the category analysis results, component analysis results, component attribute analysis results, and component position analysis results.

[0074] In an embodiment of the present invention, a pre-trained question analysis model is used in combination with target prompt information to analyze the target question, and category analysis results, component analysis results, component attribute analysis results, and component position analysis results corresponding to the target question are obtained, so that the category analysis results, component analysis results, component attribute analysis results, and component position analysis results obtained by analysis can be used to accurately generate graphics corresponding to the target question. Compared with manual drawing, the graphics corresponding to the question are quickly and accurately generated, thereby improving the efficiency and accuracy of question setting.

[0075] In an embodiment of the present invention, a question analysis model is pre-trained and deployed in an electronic device. This pre-trained question analysis model is used to parse questions for which graphics need to be generated, obtaining relevant attributes corresponding to the question, such as the category, component, component attributes, and component location, to facilitate the generation of corresponding graphics. The specific training process of the question analysis model is described in detail below.

[0076] In S101, the target question is any question that requires generating a graphic. The target prompt information can be task-related information and context, specifically used to indicate the relationship between the input and output of the question analysis model, so as to help the question analysis model better understand the task and generate the correct output. In one example, the target prompt information is a prompt word or instruction, which is input into a pre-trained question analysis model together with the target question to guide the question analysis model to output a response corresponding to the target prompt information.

[0077] In one embodiment, the target prompt information may include: category prompt information, component prompt information, component attribute prompt information, and component location prompt information. The category prompt information is used to indicate that the input of the question analysis model is the target question, and the output is the category analysis result; the component prompt information is used to indicate that the input of the question analysis model is the target question, and the output is the component analysis result; the component attribute prompt information is used to indicate that the input of the question analysis model is the target question, and the output is the component attribute analysis result; and the component location prompt information is used to indicate that the input of the question analysis model is the target question, and the output is the component location analysis result. For example, the category prompt information may be "generating the category of the question based on the question", or "what is the category of the question", etc.; the component prompt information may be "generating the component of the question based on the question", or "what are the components contained in the question", etc.; the component is used to represent the elements contained in the graph; the component attribute prompt information may be "generating the component attributes of the question based on the question", or "what are the attributes of the component in the question", etc.; the component location prompt information may be "generating the component position of the question based on the question", or "where is the component located in the question", etc.

[0078] Furthermore, in S102, the target topic and target prompt information are input into a pre-trained topic analysis model, so that the topic analysis model analyzes the target topic under the guidance of the target prompt information, and obtains the category analysis result corresponding to the category prompt information relative to the target topic, the component analysis result corresponding to the component prompt information, the component attribute analysis result corresponding to the component attribute prompt information, and the component position analysis result corresponding to the component position prompt information.

[0079] In one possible implementation, the category analysis results may include: one-dimensional graphics, two-dimensional graphics, three-dimensional graphics, or other graphics; here, other graphics refer to graphics other than one-dimensional graphics, two-dimensional graphics, and three-dimensional graphics. The component analysis results may include: at least one of arrows, shapes, positioning, patterns, decorations, matrices, tables (calc), graphs, trees (tress), mind maps (mindmaps), backgrounds, and fits. The component attribute analysis results may include: at least one of basic shape attributes, style attributes, text attributes, node attributes, rectangles, circles, stars, arrow attributes, line types, colors, layers, coordinates, and loops. The component position analysis results may include: at least one of coordinate representation, node representation, and path representation.

[0080] The category analysis results, component analysis results, component property analysis results, and component position analysis results contain rich content, making graphics generated based on the category analysis results, component analysis results, component property analysis results, and component position analysis results more accurate.

[0081] In an embodiment of the present invention, the target prompt information may further specify the format of the output content of the question analysis model. For example, the output of the question analysis model, including the category analysis results, component analysis results, component property analysis results, and component position analysis results, may be specified as text in the Tikz (a drawing tool) format. In Tikz format, circles are represented using \coordinate, lines using \path, and special shapes using \filldraw.

[0082] In a possible implementation, S103 may be to call a preset graphic generation tool to generate a graphic corresponding to the target topic based on the category analysis result, the component analysis result, the component attribute analysis result, and the component position analysis result.

[0083] For example, when a pre-trained question analysis model is used in combination with target prompt information to analyze and obtain the category analysis results, component analysis results, component property analysis results, and component position analysis results corresponding to the target question, a tikz component or plug-in can be called to directly generate graphics corresponding to the target question.

[0084] In an embodiment of the present invention, a pre-trained question analysis model is used in combination with target prompt information to analyze the target question, and the category analysis results, component analysis results, component attribute analysis results and component position analysis results corresponding to the target question are obtained. Then, the category analysis results, component analysis results, component attribute analysis results and component position analysis results obtained by analysis are used to call a preset graphic generation tool to accurately generate the graphics corresponding to the target question. Compared with manual drawing, the graphics corresponding to the question are quickly and accurately generated, thereby improving the efficiency and accuracy of question setting.

[0085] In one possible implementation, the pre-trained topic analysis model may include an encoder and a decoder, such as Figure 2 As shown, the implementation of the above S102 of parsing the target question using the pre-trained question analysis model combined with the target prompt information may include:

[0086] S201: Input the target question and category prompt information into a pre-trained question analysis model, use an encoder to encode the target question and category prompt information to obtain a first feature vector and a second feature vector, and use a decoder to decode the first feature vector and the second feature vector to obtain a category analysis result corresponding to the category prompt information;

[0087] S202: Input the target question and component prompt information into a pre-trained question analysis model, encode the target question and component prompt information using an encoder to obtain a first eigenvector and a third eigenvector, and decode the first eigenvector and the third eigenvector using a decoder to obtain a component analysis result corresponding to the component prompt information.

[0088] S203: Input the target question and component attribute prompt information into a pre-trained question analysis model, use an encoder to encode the target question and component attribute prompt information to obtain a first eigenvector and a fourth eigenvector, and use a decoder to decode the first eigenvector and the fourth eigenvector to obtain a component attribute analysis result corresponding to the component attribute prompt information.

[0089] S204, input the target question and component position prompt information into a pre-trained question analysis model, use the encoder to encode the target question and component position prompt information respectively to obtain the first eigenvector and the fifth eigenvector, use the decoder to decode the first eigenvector and the fifth eigenvector, and obtain the component position analysis result corresponding to the component position prompt information.

[0090] In an embodiment of the present invention, a question analysis model is trained by inputting questions and prompt words one by one. Accordingly, the question analysis model includes an encoder and a decoder, so that the question analysis model has a simple structure, low training complexity, and a more accurate model, thereby being able to more accurately parse the target question.

[0091] Among them, the encoder and decoder contained in the question analysis model can be implemented using a recurrent neural network, etc. The encoder encodes the question and prompt information input into the question analysis model, and converts the question and prompt information into context vectors of fixed length respectively. The decoder decodes the encoded context vector and generates the corresponding output based on the context vector.

[0092] The above steps S201 to S204 may be executed in parallel or one by one, which is not specifically limited in the embodiment of the present invention.

[0093] In one possible implementation, the pre-trained topic analysis model may include an encoder and four decoders, such as Figure 3 As shown, the implementation of the above S102 of parsing the target question using the pre-trained question analysis model combined with the target prompt information may include:

[0094] S301, inputting the target question and category prompt information, component prompt information, component attribute prompt information, and component location prompt information into a pre-trained question analysis model, and using an encoder to encode the target question and category prompt information, component prompt information, component attribute prompt information, and component location prompt information, respectively, to obtain a first eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector;

[0095] S302, using a first decoder to decode the first feature vector and the second feature vector to obtain a category analysis result corresponding to the category prompt information;

[0096] S303: Decode the first and third eigenvectors using a second decoder to obtain a component analysis result corresponding to the component prompt information.

[0097] S304, using a third decoder to decode the first eigenvector and the fourth eigenvector to obtain a component attribute analysis result corresponding to the component attribute prompt information;

[0098] S305 : Decode the first eigenvector and the fifth eigenvector using a fourth decoder to obtain a component position analysis result corresponding to the component position prompt information.

[0099] In this embodiment of the present invention, a question analysis model is trained by inputting a question and multiple prompt words at once. Accordingly, the question analysis model includes an encoder and four decoders. The four decoders can be understood as four branch networks of the question analysis model, respectively used to parse the category, components, component attributes, and component positions of the target question, thereby facilitating faster parsing of the target question. The structures of the four decoders can be the same or different.

[0100] In one embodiment, Figure 4 As shown, the training method of the question analysis model provided by the embodiment of the present invention includes:

[0101] S401, obtaining a pre-trained question analysis model and preset prompt information.

[0102] The preset prompt information may include: category prompt information, component prompt information, component attribute prompt information, and component location prompt information. Specifically, the preset prompt information may be the same as the target prompt information mentioned above, both of which are prompt words or instructions pre-set for the question analysis model.

[0103] The pre-trained question analysis model can be a pre-trained large model, such as the Tongyi Qianwen series model Qwen LLM (Large Language Models).

[0104] S402: Obtain sample titles and their corresponding annotation attributes.

[0105] The annotation attributes corresponding to the sample questions may include: category, component, component attribute, and component position. Among them, categories may include: one-dimensional graphics, two-dimensional graphics, three-dimensional graphics, or other graphics; components may include: arrows, shapes, positions, patterns, decorations, matrices, tables (calc), graphs, trees (tress), mind maps (mindmaps), backgrounds, and fits; component attributes may include: basic shape attributes, style attributes, text attributes, node attributes, rectangles, circles, stars, arrow attributes, line types, colors, layers, coordinates, and loops; component positions may include: coordinate representation, node representation, and path representation.

[0106] S403: Input the sample question and preset prompt information into the pre-trained question analysis model to obtain the attribute prediction result corresponding to the sample question.

[0107] The attribute prediction results may include: category prediction results corresponding to category prompt information, component prediction results corresponding to component prompt information, component attribute prediction results corresponding to component attribute prompt information, and component position prediction results corresponding to component position prompt information. The category prediction results may include: one-dimensional graphics, two-dimensional graphics, three-dimensional graphics, or other graphics; the component prediction results may include: at least one of arrows, shapes, positioning, patterns, decorations, matrices, tables (calc), graphs, trees (tress), mind maps (mindmaps), backgrounds, and fits; the component attribute prediction results may include: at least one of basic shape attributes, style attributes, text attributes, node attributes, rectangles, circles, stars, arrow attributes, line types, colors, layers, coordinates, and loops; the component position prediction results may include: at least one of coordinate representation, node representation, and path representation.

[0108] In an embodiment of the present invention, the above-mentioned step S402 can directly obtain pre-labeled sample questions and the labeled attributes corresponding to the sample questions. It can also first obtain the sample questions, and then input the sample questions and preset prompt information into a pre-trained question analysis model to obtain the attribute prediction results corresponding to the sample questions, and then correct the attribute prediction results to obtain the labeled attributes corresponding to the sample questions, thereby saving the time and cost of manual labeling.

[0109] In one possible implementation, the pre-trained question analysis model may include an encoder and a decoder. Accordingly, this step may be implemented as follows:

[0110] Input the sample question and category prompt information into the pre-trained question analysis model, use the encoder to encode the sample question and category prompt information to obtain the sixth eigenvector and the second eigenvector respectively, and use the decoder to decode the sixth eigenvector and the second eigenvector to obtain the category prediction result corresponding to the category prompt information;

[0111] Input the sample question and component prompt information into the pre-trained question analysis model, use the encoder to encode the sample question and component prompt information to obtain the sixth eigenvector and the third eigenvector respectively, and use the decoder to decode the sixth eigenvector and the third eigenvector to obtain the component prediction result corresponding to the component prompt information;

[0112] Input the sample question and component attribute prompt information into the pre-trained question analysis model, use the encoder to encode the sample question and component attribute prompt information to obtain the sixth eigenvector and the fourth eigenvector respectively, use the decoder to decode the sixth eigenvector and the fourth eigenvector to obtain the component attribute prediction result corresponding to the component attribute prompt information;

[0113] The sample question and component position prompt information are input into the pre-trained question analysis model, and the sample question and component position prompt information are respectively encoded by the encoder to obtain the sixth eigenvector and the fifth eigenvector. The sixth eigenvector and the fifth eigenvector are decoded by the decoder to obtain the component position prediction result corresponding to the component position prompt information.

[0114] In another possible implementation, the pre-trained topic analysis model may include an encoder and four decoders. Accordingly, this step may be implemented as follows:

[0115] Inputting the sample question and category prompt information, component prompt information, component attribute prompt information, and component position prompt information into the pre-trained question analysis model, and using an encoder to encode the sample question and category prompt information, component prompt information, component attribute prompt information, and component position prompt information, respectively, to obtain a sixth eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector;

[0116] Decoding the sixth eigenvector and the second eigenvector using the first decoder to obtain a category prediction result corresponding to the category prompt information;

[0117] Decoding the sixth eigenvector and the third eigenvector using the second decoder to obtain a component prediction result corresponding to the component prompt information;

[0118] Decoding the sixth eigenvector and the fourth eigenvector using a third decoder to obtain a component attribute prediction result corresponding to the component attribute prompt information;

[0119] The sixth eigenvector and the fifth eigenvector are decoded using the fourth decoder to obtain a component position prediction result corresponding to the component position prompt information.

[0120] S404, calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the pre-trained question analysis model according to the loss to obtain a trained question analysis model.

[0121] For example, sample questions and their corresponding annotation attributes are shown in Table 1 below. Table 1 uses two sample questions as examples for illustration:

[0122] Table 1 Sample questions and their corresponding annotation attributes

[0123]

[0124] The sample questions and the attribute prediction results corresponding to the sample questions are shown in Table 2 below:

[0125] Table 2 Sample questions and corresponding attribute prediction results

[0126]

[0127] The loss function used to calculate the loss between the attribute prediction result and the labeled attribute can be, for example, the cross-entropy loss function. The parameters of the pre-trained question analysis model are then adjusted based on the loss until a preset termination condition is met, resulting in a trained question analysis model. The preset termination condition can be a preset number of iterations or a loss reaching a preset loss threshold.

[0128] In an embodiment of the present invention, a pre-trained question analysis model is combined with preset prompt information to train the question analysis model, and the preset prompt information is used to effectively guide the pre-trained question analysis model to analyze sample questions, so that the trained question analysis model has the ability to analyze questions, which expands the use scenarios of large models. In addition, it is convenient to use the question parsing ability of the trained question analysis model to analyze questions, so as to accurately generate graphics corresponding to the questions based on the category analysis results, component analysis results, component attribute analysis results and component position analysis results obtained by the analysis, thereby realizing the rapid and accurate generation of graphics corresponding to the questions and improving the efficiency and accuracy of question setting.

[0129] In another embodiment, if Figure 5 As shown, the training method of the question analysis model provided by the embodiment of the present invention includes:

[0130] S501, obtaining a pre-trained question analysis model and preset prompt information.

[0131] The preset prompt information may include: category prompt information, component prompt information, component attribute prompt information, and component location prompt information.

[0132] S502: Obtain sample titles and their corresponding annotation attributes.

[0133] The annotation attributes corresponding to the sample title may include: category, component, component attribute and component position.

[0134] The implementation process of step S501 to step S502 may refer to the implementation process of the above-mentioned step S401 to step S402.

[0135] S503, adding a weight matrix to the pre-trained question analysis model and initializing the weight matrix.

[0136] In an embodiment of the present invention, the obtained sample questions and the labeled attributes corresponding to the sample questions can be used to fine-tune the pre-trained question analysis model using the LORA method to obtain a trained question analysis model.

[0137] like Figure 6 As shown, a bypass can be added next to the parameters of the pre-trained question analysis model. The bypass is represented by a weight matrix, and the dimension of the weight matrix is ​​the same as the dimension of the parameters of the pre-trained question analysis model. Among them, the input of the pre-trained question analysis model is represented as x, the output is represented as h, and the initial weight matrix is ​​a zero matrix.

[0138] In a possible implementation, a weight matrix may be added to a specified portion of the pre-trained question analysis model, and the weight matrix may be initialized.

[0139] In practical applications, the parameters of the pre-trained question analysis model can be taken as a whole, and a weight matrix can be added next to the parameters of the pre-trained question analysis model. The weight matrix can also be added next to the specified parts of the pre-trained question analysis model, such as the encoding layer of the encoder, the fully connected layer of the decoder, or each linear layer.

[0140] Taking the example of adding a weight matrix to a specified location, the weight matrix includes a dimensionality reduction matrix A and a dimensionality increase matrix B. Accordingly, a dimensionality reduction and then dimensionality increase operation can be performed based on the output dimension of the specified location of the pre-trained question analysis model to obtain the dimensionality reduction matrix and the dimensionality increase matrix. A bypass containing the dimensionality reduction matrix and the dimensionality increase matrix is ​​added to the specified location of the pre-trained question analysis model, and the dimensionality reduction matrix is ​​initialized using a random Gaussian distribution, and the dimensionality increase matrix is ​​initialized using a zero matrix.

[0141] For example, the output dimension of the designated part of the pre-trained question analysis model is d×d. An operation of reducing the dimension from d to r, and then increasing the dimension from r to d is performed to simulate the intrinsic rank of the pre-trained question analysis model, and a dimension reduction matrix A of r×d and a dimension increase matrix B of d×r are obtained, that is, the number of parameters is reduced from d×d to d×r+d×r, where r is generally 2, 4, 8 or 16, which is much smaller than d. This greatly reduces the number of parameters. A bypass containing the dimension reduction matrix A and the dimension increase matrix B is added to the designated part of the pre-trained question analysis model. Figure 6 In , the bypass weight matrix can be expressed as BA, where BA represents the dot product of B and A. The dimension-reduced matrix A is initialized using a random Gaussian distribution, and the dimension-increased matrix B is initialized using a zero matrix to ensure that the bypass weight matrix BA is a zero matrix at the beginning of fine-tuning training.

[0142] S504: Input the sample question and preset prompt information into the pre-trained question analysis model to obtain the attribute prediction result corresponding to the sample question.

[0143] The attribute prediction results may include: a category prediction result corresponding to the category prompt information, a component prediction result corresponding to the component prompt information, a component attribute prediction result corresponding to the component attribute prompt information, and a component position prediction result corresponding to the component position prompt information. The implementation process of this step may refer to the implementation process of step S403 above.

[0144] S505, calculate the loss between the attribute prediction result and the labeled attribute, and adjust the parameters of the weight matrix according to the loss to obtain a trained question analysis model.

[0145] In one possible implementation, the parameters of the pre-trained question analysis model are kept unchanged, the loss between the attribute prediction result and the labeled attribute is calculated, and the parameters of the weight matrix are adjusted according to the loss until the learning rate of the weight matrix meets the convergence condition. The parameters of the pre-trained question analysis model are then updated using the parameters of the weight matrix to obtain a trained question analysis model.

[0146] When fine-tuning a pre-trained question analysis model using the LORA method, the parameters of the pre-trained question analysis model are kept unchanged. The loss between the attribute prediction results output by the pre-trained question analysis model and the labeled attributes is calculated. The parameters of the dimensionality reduction matrix A and the dimensionality increase matrix B are adjusted based on the loss until the difference between the learning rate of the dimensionality reduction matrix A and the dimensionality increase matrix B and the preset learning rate meets the set threshold. The parameters of the pre-trained question analysis model are then updated to the superposition of the parameters of the pre-trained question analysis model and the value of the weight matrix BA to obtain the trained question analysis model. The preset learning rate can be set to 1, and the threshold can be set as needed.

[0147] For example, the parameters of the pre-trained question analysis model are represented as W0, the input is represented as x, and the output is represented as h, then h= W0x+BAx. When fine-tuning the pre-trained question analysis model, W0 is kept unchanged, and the dimensionality reduction matrix A and the dimensionality increase matrix B are adjusted according to the loss between the attribute prediction results output by the pre-trained question analysis model and the labeled attributes, that is, BA is the parameter that needs to be updated and is the object to be fine-tuned.

[0148] After obtaining the trained question analysis model, the trained question analysis model is deployed in the electronic device through the container Docker, so that the trained question analysis model can be used to parse the questions that need to generate graphics, and further generate corresponding graphics.

[0149] In an embodiment of the present invention, a pre-trained question analysis model is combined with preset prompt information to train the question analysis model, and the LORA method is used to fine-tune the pre-trained question analysis model. During the training process, only the parameters in the dimensionality reduction matrix A and the dimensionality increase matrix B need to be fine-tuned, which greatly reduces the time and data processing of model training. The preset prompt information is used to effectively guide the pre-trained question analysis model to analyze the sample questions, so that the trained question analysis model has the ability to analyze the questions, expands the use scenario of the large model, and facilitates the use of the question analysis ability of the trained question analysis model to analyze the questions, so as to accurately generate the graphics corresponding to the questions based on the category analysis results, component analysis results, component attribute analysis results and component position analysis results obtained by the analysis, thereby achieving rapid and accurate generation of graphics corresponding to the questions and improving the efficiency and accuracy of the questions. In addition, the LORA method is used to fine-tune the pre-trained question analysis model. Since only the parameters in the dimensionality reduction matrix A and the dimensionality increase matrix B need to be fine-tuned during the training process, when the model task changes, the task switching can be achieved by fine-tuning BA.

[0150] Corresponding to the above method embodiments, the embodiments of the present invention also provide corresponding device embodiments.

[0151] See also Figure 7 , an embodiment of the present invention further provides a graphics generating device, the device comprising:

[0152] The first acquisition module 701 is used to acquire a target topic and target prompt information; the target prompt information includes: category prompt information, component prompt information, component attribute prompt information and component location prompt information;

[0153] The first topic analysis module 702 is used to input the target topic and target prompt information into a pre-trained topic analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information;

[0154] The graphic generation module 703 is used to generate a graphic corresponding to the target topic using the category analysis results, component analysis results, component attribute analysis results, and component position analysis results.

[0155] Optionally, the above-mentioned question analysis model includes: an encoder and a decoder; a first question analysis module 702, specifically configured to:

[0156] Input the target question and category prompt information into a pre-trained question analysis model, use an encoder to encode the target question and category prompt information respectively to obtain a first eigenvector and a second eigenvector, and use a decoder to decode the first eigenvector and the second eigenvector to obtain a category analysis result corresponding to the category prompt information;

[0157] Input the target question and component prompt information into a pre-trained question analysis model, use an encoder to encode the target question and component prompt information to obtain a first eigenvector and a third eigenvector respectively, and use a decoder to decode the first eigenvector and the third eigenvector to obtain a component analysis result corresponding to the component prompt information;

[0158] Input the target question and component attribute prompt information into a pre-trained question analysis model, use an encoder to encode the target question and component attribute prompt information to obtain a first eigenvector and a fourth eigenvector respectively, and use a decoder to decode the first eigenvector and the fourth eigenvector to obtain a component attribute analysis result corresponding to the component attribute prompt information;

[0159] The target question and component position prompt information are input into a pre-trained question analysis model, and the target question and component position prompt information are respectively encoded using an encoder to obtain a first eigenvector and a fifth eigenvector. The first eigenvector and the fifth eigenvector are decoded using a decoder to obtain a component position analysis result corresponding to the component position prompt information.

[0160] Optionally, the above-mentioned question analysis model includes: an encoder and four decoders; a first question analysis module 702, specifically configured to:

[0161] Input the target question and category prompt information, component prompt information, component attribute prompt information, and component position prompt information into a pre-trained question analysis model, and use an encoder to encode the target question and category prompt information, component prompt information, component attribute prompt information, and component position prompt information, respectively, to obtain a first eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector;

[0162] Decoding the first feature vector and the second feature vector using a first decoder to obtain a category analysis result corresponding to the category prompt information;

[0163] Decoding the first and third eigenvectors using a second decoder to obtain a component analysis result corresponding to the component prompt information;

[0164] Decoding the first eigenvector and the fourth eigenvector using a third decoder to obtain a component attribute analysis result corresponding to the component attribute prompt information;

[0165] The first eigenvector and the fifth eigenvector are decoded by using the fourth decoder to obtain a component position analysis result corresponding to the component position prompt information.

[0166] Optionally, the above-mentioned category analysis results include: one-dimensional graphics, two-dimensional graphics, three-dimensional graphics or other graphics; the component analysis results include: at least one of arrows, shapes, positions, styles, styles, matrices, tables, graphics, trees, mind maps, backgrounds and adaptations; the component attribute analysis results include: at least one of basic shape attributes, style attributes, text attributes, node attributes, rectangles, circles, stars, arrow attributes, line types, colors, layers, coordinates and loops; the component position analysis results include: at least one of coordinate representation, node representation and path representation.

[0167] Optionally, the graphic generation module 703 is specifically configured to call a preset graphic generation tool to generate a graphic corresponding to the target topic based on the category analysis result, the component analysis result, the component property analysis result, and the component position analysis result.

[0168] See also Figure 8 The embodiment of the present invention further provides a training device for a question analysis model, the device comprising:

[0169] The second acquisition module 801 is used to obtain a pre-trained question analysis model and preset prompt information; the preset prompt information includes: category prompt information, component prompt information, component attribute prompt information and component location prompt information;

[0170] The third acquisition module 802 is used to obtain sample topics and their corresponding annotated attributes; the annotated attributes include: category, component, component attribute, and component position;

[0171] The second question analysis module 803 is used to input the sample question and preset prompt information into the pre-trained question analysis model to obtain the attribute prediction results corresponding to the sample question. The attribute prediction results include: the category prediction results corresponding to the category prompt information, the component prediction results corresponding to the component prompt information, the component attribute prediction results corresponding to the component attribute prompt information, and the component position prediction results corresponding to the component position prompt information.

[0172] The model training module 804 is used to calculate the loss between the attribute prediction result and the labeled attribute, and adjust the parameters of the pre-trained question analysis model according to the loss to obtain a trained question analysis model.

[0173] Optionally, the above device further includes:

[0174] The initialization module is used to add the weight matrix to the pre-trained question analysis model and initialize the weight matrix;

[0175] The model training module 804 is specifically used to calculate the loss between the attribute prediction result and the labeled attribute, and adjust the parameters of the weight matrix according to the loss to obtain a trained question analysis model.

[0176] Optionally, the initialization module is specifically used to add a weight matrix to a specified part of the pre-trained question analysis model and initialize the weight matrix;

[0177] The model training module 804 is specifically used to keep the parameters of the pre-trained question analysis model unchanged, calculate the loss between the attribute prediction results and the labeled attributes, and adjust the parameters of the weight matrix according to the loss until the learning rate of the weight matrix meets the convergence conditions; use the parameters of the weight matrix to update the parameters of the pre-trained question analysis model to obtain a trained question analysis model.

[0178] Optionally, the weight matrix includes a dimensionality reduction matrix and a dimensionality increase matrix; and the initialization module is specifically used to:

[0179] According to the output dimension of the specified part of the pre-trained question analysis model, a dimensionality reduction and dimensionality increase operation is performed to obtain the reduced dimensionality matrix and the increased dimensionality matrix;

[0180] Add bypasses containing dimensionality reduction and dimensionality increase matrices to designated locations in the pre-trained question analysis model;

[0181] Initialize the reduced-dimensional matrix with a random Gaussian distribution, and initialize the increased-dimensional matrix with a zero matrix.

[0182] The embodiment of the present invention further provides an electronic device, such as Figure 9 As shown, it includes a processor 901 , a communication interface 902 , a memory 903 and a communication bus 904 , wherein the processor 901 , the communication interface 902 and the memory 903 communicate with each other via the communication bus 904 .

[0183] Memory 903, used for storing computer programs;

[0184] The processor 901 is used to implement the steps of any of the above-mentioned graphics generation methods or question analysis model training methods when executing the program stored in the memory 903 to achieve the same technical effect.

[0185] The communication bus mentioned in the electronic devices mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into address buses, data buses, control buses, etc. For ease of illustration, only a single thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0186] The communication interface is used for communication between the above electronic device and other devices.

[0187] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0188] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0189] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, it implements the steps of any of the above-mentioned graphics generation methods or question analysis model training methods to achieve the same technical effect.

[0190] In another embodiment provided by the present invention, a computer program product containing instructions is also provided. When the computer is run on a computer, the computer executes the steps of any graphics generation method or question analysis model training method in the above embodiments to achieve the same technical effect.

[0191] In the above embodiments, all or part of the embodiments can be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state disk (SSD)).

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

[0193] Each embodiment in this specification is described in a related manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. In particular, the device / electronic device embodiments are generally similar to the method embodiments, so their description is relatively simple. For related portions, reference can be made to the description of the method embodiments.

[0194] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.

Claims

1. A method for generating a graph, characterized in that: The method comprises: Obtaining a target title and target prompt information; the target prompt information includes: category prompt information, component prompt information, component attribute prompt information, and component location prompt information; Input the target topic and the target prompt information into a pre-trained topic analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information; wherein the target prompt information is used to be input into the pre-trained topic analysis model together with the target topic to guide the pre-trained topic analysis model to output a response corresponding to the target prompt information; the target prompt information also includes information specifying the format of the output content of the pre-trained topic analysis model; Based on the category analysis result, the component analysis result, the component attribute analysis result and the component position analysis result, calling a preset graphic generation tool to generate a graphic corresponding to the target topic; The pre-trained question analysis model includes: an encoder and four decoders; the target question and the target prompt information are input into the pre-trained question analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information, including: Input the target topic and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information into a pre-trained topic analysis model, and use the encoder to encode the target topic and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information, respectively, to obtain a first eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector; Decoding the first feature vector and the second feature vector using a first decoder to obtain a category analysis result corresponding to the category prompt information; Decoding the first feature vector and the third feature vector using a second decoder to obtain a component analysis result corresponding to the component prompt information; Decoding the first feature vector and the fourth feature vector using a third decoder to obtain a component attribute analysis result corresponding to the component attribute prompt information; The first feature vector and the fifth feature vector are decoded by using a fourth decoder to obtain a component position analysis result corresponding to the component position prompt information.

2. The method according to claim 1, characterized in that The category analysis results include: one-dimensional graphics, two-dimensional graphics, three-dimensional graphics or other graphics; the component analysis results include: at least one of arrows, shapes, positions, styles, styles, matrices, tables, graphics, trees, mind maps, backgrounds and adaptations; the component attribute analysis results include: at least one of basic shape attributes, style attributes, text attributes, node attributes, rectangles, circles, stars, arrow attributes, line types, colors, layers, coordinates and loops; the component position analysis results include: at least one of coordinate representation, node representation and path representation.

3. A training method for a question analysis model, characterized in that: The method comprises: Obtaining a pre-trained topic analysis model and preset prompt information; the preset prompt information includes: category prompt information, component prompt information, component attribute prompt information, and component location prompt information; Obtaining sample titles and annotation attributes corresponding to the sample titles; the annotation attributes include: category, component, component attribute and component position; Input the sample topic and the preset prompt information into the pre-trained topic analysis model to obtain the attribute prediction result corresponding to the sample topic, the attribute prediction result including: the category prediction result corresponding to the category prompt information, the component prediction result corresponding to the component prompt information, the component attribute prediction result corresponding to the component attribute prompt information, and the component position prediction result corresponding to the component position prompt information; wherein the preset prompt information is used to be input into the pre-trained topic analysis model together with the sample topic to guide the pre-trained topic analysis model to output a response corresponding to the preset prompt information; the preset prompt information also includes information specifying the format of the output content of the pre-trained topic analysis model; Calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the pre-trained question analysis model according to the loss to obtain a trained question analysis model; The pre-trained question analysis model includes an encoder and four decoders, and the sample question and the preset prompt information are input into the pre-trained question analysis model to obtain the attribute prediction result corresponding to the sample question, including: Input the sample title and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information into a pre-trained title analysis model, and use the encoder to encode the sample title and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information, respectively, to obtain a sixth eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector; Decoding the sixth feature vector and the second feature vector using a first decoder to obtain a category prediction result corresponding to the category prompt information; Decoding the sixth eigenvector and the third eigenvector using a second decoder to obtain a component prediction result corresponding to the component prompt information; Decoding the sixth eigenvector and the fourth eigenvector using a third decoder to obtain a component attribute prediction result corresponding to the component attribute prompt information; The sixth eigenvector and the fifth eigenvector are decoded by using a fourth decoder to obtain a component position prediction result corresponding to the component position prompt information.

4. The method according to claim 3, characterized in that The method further comprises: Adding a weight matrix to the pre-trained question analysis model and initializing the weight matrix; The calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the pre-trained question analysis model according to the loss to obtain a trained question analysis model, includes: The loss between the attribute prediction result and the labeled attribute is calculated, and the parameters of the weight matrix are adjusted according to the loss to obtain a trained question analysis model.

5. The method according to claim 4, characterized in that The step of adding a weight matrix to the pre-trained question analysis model and initializing the weight matrix includes: Adding a weight matrix to a designated part of the pre-trained question analysis model and initializing the weight matrix; The calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the weight matrix according to the loss to obtain a trained question analysis model, includes: Keeping the parameters of the pre-trained question analysis model unchanged, calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the weight matrix according to the loss until the learning rate of the weight matrix meets the convergence condition; The parameters of the pre-trained question analysis model are updated using the parameters of the weight matrix to obtain a trained question analysis model.

6. The method according to claim 5, characterized in that The weight matrix includes a dimension reduction matrix and a dimension increase matrix; The step of adding a weight matrix to a designated part of the pre-trained question analysis model and initializing the weight matrix includes: According to the output dimension of the designated part of the pre-trained question analysis model, a dimension reduction and then dimension increase operation is performed to obtain the dimension reduction matrix and the dimension increase matrix; Adding a bypass including the dimension reduction matrix and the dimension increase matrix at a designated position of the pre-trained question analysis model; The reduced-dimensional matrix is ​​initialized using a random Gaussian distribution, and the increased-dimensional matrix is ​​initialized using a zero matrix.

7. A graphics generating device, characterized in that: The device comprises: The first acquisition module is used to acquire a target topic and target prompt information; the target prompt information includes: category prompt information, component prompt information, component attribute prompt information and component location prompt information; A first topic analysis module is used to input the target topic and the target prompt information into a pre-trained topic analysis model to obtain a category analysis result corresponding to the category prompt information, a component analysis result corresponding to the component prompt information, a component attribute analysis result corresponding to the component attribute prompt information, and a component position analysis result corresponding to the component position prompt information; wherein the target prompt information is used to be input into the pre-trained topic analysis model together with the target topic to guide the pre-trained topic analysis model to output a response corresponding to the target prompt information; the target prompt information also includes information specifying the format of the output content of the pre-trained topic analysis model; A graphics generation module, configured to call a preset graphics generation tool to generate a graphics corresponding to the target topic based on the category analysis result, the component analysis result, the component attribute analysis result, and the component position analysis result; The pre-trained question analysis model includes: an encoder and four decoders; the first question analysis module is specifically used for: Input the target topic and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information into a pre-trained topic analysis model, and use the encoder to encode the target topic and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information, respectively, to obtain a first eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector; Decoding the first feature vector and the second feature vector using a first decoder to obtain a category analysis result corresponding to the category prompt information; Decoding the first feature vector and the third feature vector using a second decoder to obtain a component analysis result corresponding to the component prompt information; Decoding the first feature vector and the fourth feature vector using a third decoder to obtain a component attribute analysis result corresponding to the component attribute prompt information; The first feature vector and the fifth feature vector are decoded by using a fourth decoder to obtain a component position analysis result corresponding to the component position prompt information.

8. A training device for a question analysis model, characterized in that: The device comprises: The second acquisition module is used to acquire a pre-trained topic analysis model and preset prompt information; the preset prompt information includes: category prompt information, component prompt information, component attribute prompt information and component location prompt information; A third acquisition module is used to acquire sample titles and the annotation attributes corresponding to the sample titles; the annotation attributes include: category, component, component attribute and component position; A second topic analysis module is used to input the sample topic and the preset prompt information into the pre-trained topic analysis model to obtain an attribute prediction result corresponding to the sample topic, wherein the attribute prediction result includes: a category prediction result corresponding to the category prompt information, a component prediction result corresponding to the component prompt information, a component attribute prediction result corresponding to the component attribute prompt information, and a component position prediction result corresponding to the component position prompt information; wherein the preset prompt information is used to be input into the pre-trained topic analysis model together with the sample topic to guide the pre-trained topic analysis model to output a response corresponding to the preset prompt information; the preset prompt information also includes information specifying the format of the output content of the pre-trained topic analysis model; A model training module, used for calculating the loss between the attribute prediction result and the labeled attribute, and adjusting the parameters of the pre-trained question analysis model according to the loss to obtain a trained question analysis model; The pre-trained question analysis model includes an encoder and four decoders, and the second question analysis module is specifically used for: Input the sample title and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information into a pre-trained title analysis model, and use the encoder to encode the sample title and the category prompt information, the component prompt information, the component attribute prompt information, and the component position prompt information, respectively, to obtain a sixth eigenvector, a second eigenvector, a third eigenvector, a fourth eigenvector, and a fifth eigenvector; Decoding the sixth feature vector and the second feature vector using a first decoder to obtain a category prediction result corresponding to the category prompt information; Decoding the sixth eigenvector and the third eigenvector using a second decoder to obtain a component prediction result corresponding to the component prompt information; Decoding the sixth eigenvector and the fourth eigenvector using a third decoder to obtain a component attribute prediction result corresponding to the component attribute prompt information; The sixth eigenvector and the fifth eigenvector are decoded by using a fourth decoder to obtain a component position prediction result corresponding to the component position prompt information.

Citation Information

Patent Citations

  • Data processing method, computer storage medium and related equipment

    CN111260516A

  • System and method for analyzing market research data based on AI model

    CN116579806A

  • Alarm solution generation method and computer equipment

    CN117852548A

  • Image generation method and device

    CN117893641A