High school chemistry knowledge base updating method based on large language model
Through the high school chemistry knowledge base update method based on large language model, structured data in the chemistry knowledge graph is extracted and updated, and the problem of multimodal data combination is solved, the accuracy and efficiency of knowledge query is improved, and the timeliness of the knowledge base is ensured. .
Patent Information
- Application Number
- CN202411204618.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-08-30
AI Technical Summary
The existing high school chemistry knowledge graphs are difficult to combine multimodal data from multiple sources, resulting in low interpretability of knowledge nodes and the inability to accurately distinguish isomers, affecting information teaching.
Using the high school chemistry knowledge base update method based on the large language model, query vectors are generated by extracting chemical knowledge query structured data in text data, combining preset knowledge databases and large language models, determining the knowledge point types and updating the knowledge graph to achieve multiple Modal embedding and clustering enhance the accuracy of the knowledge graph.
It improves the accuracy and efficiency of knowledge query, can better distinguish isomers, provide answers that are closer to user needs, and maintain the timeliness of the knowledge base.
Smart Images

Figure CN118939672A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of knowledge graph technology, and in particular to a method for updating a high school chemistry knowledge base based on a large language model. Background Art
[0002] With the rapid development of information technology, the field of education has also been profoundly impacted. This is particularly true in high school chemistry education, where traditional teaching methods and resources struggle to meet students' diverse and personalized learning needs. In recent years, with the advancement of artificial intelligence (AI) and big data technologies, knowledge base systems based on large language models (LLMs) have emerged as a key area of innovation in educational technology. Using deep learning algorithms, large language models automatically extract and learn language patterns from massive amounts of text data, generating high-quality natural language text. Leveraging the advantages of large language models in natural language processing (NLP), knowledge points can be extracted from various resources and organized and managed in the form of knowledge graphs (KGs).
[0003] However, current knowledge graphs are usually populated with heterogeneous data, such as text, numbers, or images, which makes it difficult to combine multimodal data of different forms from multiple sources into a joint embedding when constructing knowledge graphs. In addition, in the current field of chemical knowledge graph research, if only the intrinsic topology of molecules and simple construction rules are used, it usually leads to low interpretability of knowledge nodes in the knowledge graph, and it is difficult to obtain other knowledge nodes that have external associations with knowledge nodes, resulting in the inability to obtain accurate data corresponding to the knowledge nodes. For example, considering that some organic molecules have multiple isomers, if the knowledge graph is constructed directly through a large language model, it is easy to confuse the differences between the various isomers, resulting in the inability to obtain effective answers, which is not conducive to the development of information-based teaching. Summary of the Invention
[0004] The present application embodiment provides a method for generating a dynamic knowledge base for high school chemistry based on a large language model to address the shortcomings of the above-mentioned related technologies. The technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for updating a high school chemistry knowledge base based on a large language model, comprising:
[0006] In response to input chemical knowledge query text data, extracting structured data from the chemical knowledge query text data based on chemical knowledge point entities and association relationships between chemical knowledge point entities in a chemical knowledge graph, and generating a corresponding chemical knowledge query vector based on the structured data;
[0007] Traversing the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database, and generating prompt text based on the associated knowledge point data;
[0008] Inputting the prompt text into the large language model, so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtains query results related to the chemical knowledge query text data obtained by traversing the knowledge point type;
[0009] The query result is updated in the preset knowledge database.
[0010] In an optional solution of the first aspect, the process of constructing the chemical knowledge graph includes:
[0011] Acquire first chemical knowledge data from the preset knowledge database;
[0012] Extracting multiple chemical knowledge point entities from the first chemical knowledge data based on multiple preset basic types; determining whether there is at least one association relationship between the multiple chemical knowledge point entities, and adding a target association corresponding to the target association relationship between the chemical knowledge point entities having a target association relationship;
[0013] The chemical knowledge graph is constructed based on the chemical knowledge point entity to which the target association is added.
[0014] In an optional solution of the first aspect, second chemical knowledge data is acquired at preset time intervals, and the chemical knowledge graph is updated based on the second chemical knowledge data. The step of updating the chemical knowledge graph includes:
[0015] Extracting multiple chemical knowledge point entities and target associations between the chemical knowledge point entities in the second chemical knowledge data based on the multiple preset basic types, and outputting a multimodal embedded knowledge vector according to the multiple chemical knowledge point entities and the target associations between the chemical knowledge point entities in the second chemical knowledge data;
[0016] performing feature extraction on the multimodal embedded knowledge vector, outputting prompt text corresponding to the multimodal embedded knowledge vector, performing clustering based on the prompt text using the large language model, and outputting a clustering result of chemical knowledge associated with the second chemical knowledge data;
[0017] The chemical knowledge graph is updated based on the clustering results.
[0018] In an optional solution of the first aspect, outputting a multimodal embedded knowledge vector based on the plurality of chemical knowledge point entities and the target associations between the chemical knowledge point entities in the second chemical knowledge data includes:
[0019] Generate corresponding feature embeddings according to the basic types corresponding to each chemical knowledge point entity, fuse all feature embeddings to obtain a combined embedding matrix, and output the multimodal embedding knowledge vector;
[0020] Among them, the multiple preset basic types include at least one of image type, text type, and data attribute type; and the feature embedding is one of image feature embedding, text feature embedding, and data attribute feature embedding.
[0021] In an optional solution of the first aspect, traversing the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database and generating prompt text based on the associated knowledge point data includes:
[0022] A feature comparison is performed on the chemical knowledge query vector and the knowledge point vectors in the knowledge database, and the similarity between the chemical knowledge query vector and each of the knowledge point vectors is calculated. All knowledge point data with similarity values greater than a similarity threshold are traversed from the knowledge database, and prompt text for input into the large language model is generated based on all the knowledge point data using a preset prompt template, so that the large language model outputs a query result based on the prompt text.
[0023] In an optional solution of the first aspect, inputting the prompt text into the large language model so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtaining query results related to the chemical knowledge query text data obtained by traversing the knowledge point type, includes:
[0024] The large language model determines the knowledge point type corresponding to the chemical knowledge query text data based on the prompt text; wherein the knowledge point type includes at least one of a chemical structure knowledge point and a chemical text knowledge point;
[0025] For the chemical structure knowledge point, extract chemical structure-related keywords using the large language model, and traverse the chemical structure-related keywords in the chemical knowledge graph to obtain a first query result;
[0026] For the chemical text knowledge point, extract chemical text-related keywords using the large language model, traverse to obtain multiple text segments containing keywords related to the chemical text, and concatenate each of the text segments to obtain a second query result;
[0027] Outputting a first query result and / or a second query result related to the chemical knowledge query text data.
[0028] In a second aspect, an embodiment of the present application further provides a high school chemistry knowledge base updating device based on a large language model, comprising:
[0029] a data processing module for extracting structured data from the chemical knowledge query text data in response to input chemical knowledge query text data based on chemical knowledge point entities and association relationships between chemical knowledge point entities in the chemical knowledge graph, and generating a corresponding chemical knowledge query vector based on the structured data;
[0030] A query module, configured to traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database, and generate a prompt text based on the associated knowledge point data;
[0031] The query module is further configured to input the prompt text into the large language model, so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtains query results related to the chemical knowledge query text data obtained by traversing the knowledge point type;
[0032] An updating module is used to update the query result into the preset knowledge database.
[0033] In a third aspect, an embodiment of the present application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method provided in the first aspect of the embodiment of the present application or any one of the implementations of the first aspect is implemented.
[0034] In a fourth aspect, the present application also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the method provided by the first aspect of the embodiment of the present application or any one of the implementation methods of the first aspect.
[0035] The beneficial effects of the technical solutions provided by some embodiments of the present application include at least:
[0036] On the one hand, the embodiment of the present application can provide rich multimodal data based on the query text input by the user in combination with the chemical knowledge graph and the large language model, and can determine the structured data of the knowledge points in the user's query text through the chemical knowledge graph, not only considering several chemical knowledge points in the query text, but also considering the correlation between the chemical knowledge points, so that the large language model can output more accurate query results.
[0037] On the other hand, the query text input by the user is converted into vectorized data, the structure of the knowledge point is determined through the knowledge graph, the knowledge point data related to the knowledge point is determined through the database, and a large number of multi-source and multi-modal query results related to the knowledge point data can be given through the large language model, so that the answer that is closer to the question the user needs to query can be output, avoiding the defect of not being able to distinguish the difference between each isomer caused by querying knowledge only through the knowledge graph, overcoming the problem of incomplete data and low query efficiency caused by querying knowledge point data only through the database, and also solving the problem of low efficiency of the large language model in outputting effective answers when there is a lack of accurate input text. The data queried in this way by the embodiment of the present application can be saved in the database so that the matching knowledge point can be queried next time, keeping the knowledge points of the knowledge base up to date. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in this application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 This is a flow chart of a method for updating a high school chemistry knowledge base based on a large language model according to an embodiment of the present application;
[0040] Figure 2 This is a schematic diagram of the structure of the knowledge graph of an embodiment of the present application;
[0041] Figure 3 This is a schematic diagram of the structure of a high school chemistry knowledge base updating device based on a large language model provided in an embodiment of the present application;
[0042] Figure 4 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0044] The terms "including" and "having," and any variations thereof, in the specification and claims of this application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or modules is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other steps or modules inherent to the process, method, product, or apparatus.
[0045] It should be noted that the terms "first" and "second" used in this application are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that the terms "first" and "second" may interchangeably represent a specific order or precedence, where permitted. It should be understood that the objects distinguished by "first" and "second" may interchangeably represent a specific order or precedence, where appropriate, such that the embodiments of the present application described herein can be implemented in an order other than that described or illustrated herein.
[0046] It should be noted that the embodiments of the present application are mainly for the field of high school chemistry teaching, and students or teachers can use the database to query questions related to high school chemistry knowledge, thereby efficiently obtaining the required information. Although the overall content of high school chemistry knowledge has not changed, with the changes in the knowledge outline each year, the focus of the knowledge point examination will also change accordingly, which means that some new exercises may appear involving some new knowledge point types, thus requiring the high school chemistry knowledge base to keep pace with the times.
[0047] The present application is described in detail below with reference to specific embodiments.
[0048] Next, combine Figure 1 , introduces a method for updating a high school chemistry knowledge base based on a large language model provided by the embodiment of this application. Figure 1 , Figure 1 The flowchart of a method for updating a high school chemistry knowledge base based on a large language model provided in an embodiment of the present application is shown. Figure 1 As shown, the method includes the following steps:
[0049] S101, in response to input chemical knowledge query text data, extracting structured data from the chemical knowledge query text data based on chemical knowledge point entities and association relationships between chemical knowledge point entities in a chemical knowledge graph, and generating a corresponding chemical knowledge query vector based on the structured data;
[0050] S102, traversing the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database, and generating a prompt text based on the associated knowledge point data;
[0051] S103, inputting the prompt text into the large language model, so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtains query results related to the chemical knowledge query text data obtained by traversing the knowledge point type;
[0052] S104: Update the query result to the preset knowledge database.
[0053] Specifically, in S101, the input chemical knowledge query text data can be a high school chemistry related question text Q manually input by the student. x , such as "C8H 10 What are the isomers of? Write down their chemical structural formulas.”
[0054] Specifically, in S101, structured data in the chemical knowledge query text data can be extracted through the chemical knowledge point entities defined in the chemical knowledge graph and the association relationships between the chemical knowledge point entities, thereby converting the chemical knowledge query text data into a chemical knowledge query vector containing knowledge point entities and the relationships between entities.
[0055] Specifically, before converting the chemical knowledge query text data into a chemical knowledge query vector containing knowledge point entities and the relationships between entities, the question text Q x Perform operations such as word segmentation, entity tagging, and entity masking to extract the chemical knowledge point entities.
[0056] For example, the chemical knowledge graph can be Figure 2 The form shown, Figure 2 The knowledge graph composed of various chemical knowledge point entities and the relationships between chemical knowledge point entities is exemplified in the figure. The basic types of the knowledge graph may include structural document data, vocabulary document data, and combination document data, thereby integrating the basic knowledge related to elements and functional groups.
[0057] like Figure 2As shown, the black blocks represent different classes, and the black arrows reflect the inclusion or disjoint relationships. For example, the "subclass" construction between the active non-metal class and the non-metal class means that the set of entities in the active non-metal is a subset of the entities in the non-metal. In addition, each entity in the ester class is a member of its parent class, the oxygen-containing group. It should be noted that the subclass relationship is transitive, which means that the active non-metal class is also a subclass of the element class. However, since the textual names may not be sufficient to distinguish different classes, the disjointness of the classes is defined, and the disjoint relationship is indicated by "disjoint". For example, the disjointness between the metal class and the non-metal class indicates that the element entity in the metal class cannot be a member of the non-metal class at the same time. Using the class hierarchy, we assign the corresponding entity to each class through the "type" relationship. The C and O elements in the gray blocks are both members of the active non-metal class. This determines the association relationship between the entities of each class.
[0058] In some embodiments, the knowledge graph can include a list of chemical properties compiled from the periodic table and assigned as data attributes to each entity in the knowledge graph. Alternatively, for functional groups, the types of bonds each functional group contains can be recorded. For example, a carboxyl group contains both single and double bonds, while a phenyl group contains both single and aromatic bonds.
[0059] In some embodiments, object properties can be used to model the relationship between entities. The continuous chemical property values of the elements can be discretized and used as object properties (e.g., in radius group 1) to connect the element entities to each other. For example, the triple (C, in radius group 1, O) means that the entities C and O are both in radius group 1, while (C, gaseous, O) means that they are both in gaseous state. Symmetric features can be added to these object properties, and (C, gaseous, O) is true for another symmetric triple (O, gaseous, C). The chemical knowledge graph can also establish connections between elements and functional group entities through the "partial" object property, which indicates that the element participates in the formation of the functional group.
[0060] Specifically, a data association can be established between the knowledge graph and the knowledge base, that is, a corresponding knowledge label is set for each knowledge point data in the knowledge base, and the same chemical knowledge point entity in the knowledge graph is determined by the label.
[0061] In some embodiments, the process of constructing the chemical knowledge graph may include:
[0062] Acquire first chemical knowledge data from the preset knowledge database;
[0063] Extracting multiple chemical knowledge point entities from the first chemical knowledge data based on multiple preset basic types; determining whether there is at least one association relationship between the multiple chemical knowledge point entities, and adding a target association corresponding to the target association relationship between the chemical knowledge point entities having a target association relationship;
[0064] The chemical knowledge graph is constructed based on the chemical knowledge point entity to which the target association is added.
[0065] In some embodiments, second chemical knowledge data is acquired at predetermined intervals, and the chemical knowledge graph is updated based on the second chemical knowledge data. The step of updating the chemical knowledge graph includes:
[0066] Extracting multiple chemical knowledge point entities and target associations between the chemical knowledge point entities in the second chemical knowledge data based on the multiple preset basic types, and outputting a multimodal embedded knowledge vector according to the multiple chemical knowledge point entities and the target associations between the chemical knowledge point entities in the second chemical knowledge data;
[0067] performing feature extraction on the multimodal embedded knowledge vector, outputting prompt text corresponding to the multimodal embedded knowledge vector, performing clustering based on the prompt text using the large language model, and outputting a clustering result of chemical knowledge associated with the second chemical knowledge data;
[0068] The chemical knowledge graph is updated based on the clustering results.
[0069] In some embodiments, the required version of high school chemistry curriculum standards and chemistry textbooks can be obtained by visiting the official website of the Ministry of Education. Past high school chemistry exam papers can also be collected from schools, educational institutions, and online education platforms. Class notes and review materials from chemistry teachers and students can also be collected. Online publicly available learning materials can be searched for, including but not limited to summaries and notes on chemistry knowledge points provided by educational forums and teaching websites.
[0070] Furthermore, the collected data can be preprocessed to clean the collected data, including removing noise, processing missing values, eliminating duplicates, and normalizing the format.
[0071] Specifically, the context subgraph can be used as the text sequence input to the large oracle model:
[0072] Context subgraph T G It is defined as a triple containing entities and relations. G By the central triplet T c and its surrounding neighborhood triples T context composition:
[0073] T G =T c ∪T context ;
[0074] The subgraph sampling process is at the triplet level, and the sampled neighborhood triplet T can be obtained context:
[0075] T context ={T|T i ∈N};
[0076] Where N is the central triple T c To better capture local structural features, a dynamic sampling strategy can be utilized and multiple context subgraphs are randomly selected for the same center triplet in each epoch.
[0077] Specifically, the context subgraph T can be obtained G The local structure of the context subgraph is preserved in the adjacency matrix. Entities are the chemical knowledge point entities mentioned above, and relationships are the associations between chemical knowledge point entities. Entity-association-relationship pairs can be represented as plain text, and relationships can be treated as special entities in the context subgraph. In this way, information about chemical knowledge point entity pairs can be obtained, including entity-relationship, entity-entity, and relationship-relationship pair interactions. Another advantage is that relationship nodes can be treated as special nodes. Since the number of relationships in a knowledge graph is much smaller than the number of entities, global semantic information can be maintained between sampled context subgraphs.
[0078] It can be understood that the above-mentioned prompt text can be constructed based on the existing corpus data. The prompt template can be "You are an expert in the field of high school chemistry knowledge. You understand all theoretical knowledge and experimental knowledge in the field of high school chemistry knowledge, and master the test-taking skills in the field of high school chemistry knowledge. Based on...", find the required query information. The prompt text can be adaptively inserted at the "..." position of the prompt template.
[0079] Among them, the multimodal embedding knowledge vector may include at least one of the image type, text type, and data attribute type, or it may be the fusion data of the three types of data. Image feature embedding, text feature embedding, and data attribute feature embedding may be generated according to the image type, text type, and data attribute type data respectively. After generating the image feature embedding, text feature embedding, and data attribute feature embedding, multiple embeddings may be fused to obtain a multimodal embedding knowledge vector.
[0080] Among them, data attributes can be understood as the type of data, for example, the number of electrons outside the nucleus is an integer, and the minimum atomic number is 1, that is, data attributes are used to determine the format attributes of the corresponding data.
[0081] In some embodiments, in S102, traversing the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database and generating prompt text based on the associated knowledge point data includes:
[0082] A feature comparison can be performed between the chemical knowledge query vector and the knowledge point vectors in the knowledge database, and the similarity between the chemical knowledge query vector and each of the knowledge point vectors can be calculated. All knowledge point data with similarity values greater than a similarity threshold can be traversed from the knowledge database. A prompt text for input into the large language model can be generated based on all the knowledge point data using a preset prompt template, so that the large language model outputs a query result based on the prompt text.
[0083] Specifically, the vectorized chemical problem V can be x and the vector V in the knowledge base c Perform similarity matching and use the cosine similarity method to calculate the similarity between the question vector and each knowledge point vector in the knowledge base. Then sort the calculated similarity values to determine the knowledge point most relevant to the question.
[0084] Furthermore, by using a vector retrieval method, the associated knowledge point data can be traversed from the knowledge base based on the matched knowledge point data.
[0085] For example, a similarity threshold of 0.75 may be used to determine whether the knowledge point data is relevant to the chemical knowledge query text data, and knowledge point data above the threshold will be regarded as relevant knowledge points.
[0086] Furthermore, the decoder can be used to calculate the original similarity ranking score of the question triple (s, r, t) as follows:
[0087] φ(K x |s,r,t)=ReLU(vec(M(s t ,r t ))·W)K xt ;
[0088] Among them, vec(·) converts the matrix into a vector, M(·,·) is a one-dimensional convolution layer. W is the linear transformation matrix. s t 、r t and K xt They are s, r and K respectively x For the embedding at t, a larger score indicates a higher triple similarity, where s represents the main entity, r represents the relationship, and t represents the secondary entity.
[0089] Specifically, the knowledge point data related to the question can be traversed from the knowledge base according to similarity sorting and threshold setting, in order to improve the accuracy and diversity of the traversal results.
[0090] In some embodiments, in S103, the large language model can extract keywords based on the content of the prompt text, thereby determining the corresponding knowledge point type based on the prompt text, and obtaining query results related to the chemical knowledge query text data obtained by traversing the knowledge point type.
[0091] Specifically, the large language model can be fine-tuned with hint enhancement based on the functional group-related knowledge structure provided by the chemical knowledge graph to improve the performance of the large language model in answering chemical questions. First, all functional group entities {x1, ..., x m}, where m is the number of detected functional groups, a mediator with learnable embeddings is constructed to capture the weight of each functional group. Then, a self-attention mechanism is applied to the embedding of the mediator (denoted as x0) and the embedding of the functional group entities to comprehensively aggregate the semantic information of these embeddings and obtain functional hints.
[0092] Specifically, input X = {x0, x1, ..., x m} is first projected into a query / key / value vector:
[0093] S=XW S ,C=XW C ,P=XW P ;
[0094] in, d is the hidden dimension.
[0095] The self-attention mechanism calculates the attention weight between the query and the key, and then multiplies it by this value. The formula for the output embedding is:
[0096]
[0097] In this way, two self-attention layers are implemented and the embedding of the mediating variable x′0=X′[∶,0] is obtained, which reflects the comprehensive weights of functional groups with different importance. Then a fully connected layer is applied and layer normalization is performed to obtain the functional hint:
[0098] x prompt =LayerNorm(W·x′0);
[0099] Finally, adding a learnable scale parameter α will hint the information x prompt To get:
[0100]
[0101] Thus, a new output result with enhanced generation prompts is obtained.
[0102] Furthermore, based on the prompt text constructed in S102, the prompt text can be understood as a context input in the form of a question-answer pair or a dialogue, and the large language model is applied to classify the knowledge points into chemical structure knowledge points and chemical text knowledge points.
[0103] The types of knowledge points corresponding to the chemical knowledge query text data may be: only chemical structure knowledge points, only chemical text knowledge points, or both chemical structure knowledge points and chemical text knowledge points.
[0104] For chemistry text knowledge points, the following steps can be applied:
[0105] First, initialize the seed paragraph V by TF-IDF search s And the inference path queue P, then, for each seed channel v i ∈V s , its adjacent channel node N i Add to candidate adjacent queue C;
[0106] Further, traverse each node / retrieved paragraph based on the large language model Make inferences and then generate the next paragraph s j+1 , as shown below:
[0107]
[0108] Among them, X i Corresponding node v i Features, Connect the text information of the previously retrieved paragraphs / visited nodes and iteratively queue the earliest inference path / candidate neighborhood P i / C i Dequeue from P / C, and perform the adjacent queue C according to the above formula i Sort the dequeued neighbors in .
[0109] Finally, according to the ranking, i Select the first k channel nodes V i ′ proceeds to the next visit and updates the candidate neighbor queue and reasoning path queue accordingly. When the candidate neighbor queue becomes empty or the prefix budget K of the retrieved paragraph is met, the above process terminates and K questions and answers of the relevant knowledge points are output.
[0110] For chemical structure knowledge points, chemical structure-related keywords can be extracted through the large language model, and the chemical structure-related keywords can be traversed in the chemical knowledge graph to obtain chemical structure-related query results.
[0111] In a specific embodiment, S104 includes:
[0112] For example, if the chemical knowledge query text data corresponds to the question "C8H 10 What are the isomers of? Write down their chemical structural formulas.”
[0113] The answer can be output through a large language model and knowledge graph, and specific experimental phenomena, chemical reaction equations or charts can be output to assist in explanation. For example, the answer to the above question is "C8H 10 The isomers of ethylbenzene are ethylbenzene, o-xylene, m-xylene and p-xylene.
[0114] In some embodiments, after the answer is generated, it can be carefully reviewed and revised to ensure the accuracy and completeness of the answer content. Automatic proofreading tools or manual proofreading can be used to ensure the quality of the answer;
[0115] In some embodiments, the knowledge points involved in the question and their explanations as well as the source website of the data can also be provided at the same time, and similar questions and corresponding answers can be selected from the chemical knowledge database to help students understand the relevant knowledge points more comprehensively. New questions and corresponding answers can also be obtained through traversal of the large language model.
[0116] For example, the knowledge point type is "isomers refer to compounds with the same molecular formula but different structures", "aromatic hydrocarbons refer to hydrocarbons containing benzene ring structures in the molecule, which are a type of aromatic compounds", and similar questions Q x1 You can answer "What are the carboxylic acid isomers of C8H8O2? Write their chemical structural formulas." The answer is A. x1 "There are four types, namely phenylacetic acid C6H5CH2COOH, p-toluic acid CH3C6H4COOH, o-toluic acid CH3C6H4COOH, m-toluic acid CH3C6H4COOH", etc.;
[0117] Furthermore, step S104 may be executed to enter the above knowledge points, questions, and answers into the knowledge base for updating.
[0118] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0119] See next Figure 3, is a structural diagram of a high school chemistry knowledge base updating device based on a large language model provided by an exemplary embodiment of the present application. The device can be implemented as all or part of a terminal through software, hardware, or a combination of both, and can also be integrated on a server as an independent module. The high school chemistry knowledge base updating device based on a large language model in the embodiment of the present application can be applied to a terminal or the cloud. The device 30 includes a data processing module 301, a query module 302, and an update module 303, wherein:
[0120] The data processing module 301 is configured to extract structured data from the chemical knowledge query text data in response to input chemical knowledge query text data based on chemical knowledge point entities and association relationships between chemical knowledge point entities in the chemical knowledge graph, and generate a corresponding chemical knowledge query vector based on the structured data;
[0121] The query module 302 is used to traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database, and generate a prompt text based on the associated knowledge point data;
[0122] The query module 302 is further configured to input the prompt text into the large language model, so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtains query results related to the chemical knowledge query text data obtained by traversing the knowledge point type;
[0123] The updating module 303 is used to update the query result into the preset knowledge database.
[0124] It should be noted that the device 30 provided in the above embodiment, when executing the method for updating the high school chemistry knowledge base based on the large language model, only uses the division of the above-mentioned functional modules as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the embodiment of the method for updating the high school chemistry knowledge base based on the large language model belong to the same concept. The implementation process thereof is detailed in the method embodiment and will not be repeated here.
[0125] An embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of any of the above-mentioned method embodiments are implemented.
[0126] See Figure 4 , is a structural block diagram of an electronic device provided in an embodiment of the present application.
[0127] like Figure 4As shown, the electronic device 400 includes a processor 401 and a memory 402 .
[0128] In the embodiment of the present application, the processor 401 is the control center of the computer system and can be the processor of a physical machine or the processor of a virtual machine. The processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 401 can be implemented in the form of at least one hardware selected from the group consisting of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array).
[0129] The processor 401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state.
[0130] The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments of the present application, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, which is used to be executed by the processor 401 to implement the method in the embodiment of the present application.
[0131] In some embodiments, the electronic device 400 further includes: a peripheral device interface 403 and at least one peripheral device 404. The processor 401, the memory 402, and the peripheral device interface 403 can be connected via a bus or signal lines. Each peripheral device 404 can be connected to the peripheral device interface 403 via a bus, signal lines, or a circuit board. Specifically, the peripheral devices 404 include: a display screen, a camera, and an audio circuit. The peripheral device interface 403 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 401 and the memory 402.
[0132] In some embodiments of the present application, the processor 401, the memory 402, and the peripheral device interface 403 are integrated on the same chip or circuit board; in some other embodiments of the present application, any one or two of the processor 401, the memory 402, and the peripheral device interface 403 may be implemented on separate chips or circuit boards. This embodiment of the present application is not specifically limited to this.
[0133] The electronic device structure block diagram shown in the embodiment of the present application does not constitute a limitation on the electronic device 400. The electronic device 400 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0134] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method of any of the aforementioned embodiments. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a microdrive, a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0135] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for updating a high school chemistry knowledge base based on a large language model, characterized in that: include: In response to input chemical knowledge query text data, extracting structured data in the chemical knowledge query text data based on chemical knowledge point entities in a chemical knowledge graph and association relationships between chemical knowledge point entities, and generating a corresponding chemical knowledge query vector based on the structured data; Traversing the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database, and generating a prompt text based on the associated knowledge point data; Inputting the prompt text into the large language model, so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtains the query result related to the chemical knowledge query text data obtained by traversing the knowledge point type; The query result is updated into the preset knowledge database.
2. A method for updating a high school chemistry knowledge base based on a large language model according to claim 1, characterized in that: The construction process of the chemical knowledge graph includes: Acquire first chemical knowledge data from the preset knowledge database; Extracting multiple chemical knowledge point entities in the first chemical knowledge data based on multiple preset basic types; determining whether there is at least one association relationship between the multiple chemical knowledge point entities, and adding a target association corresponding to the target association relationship between the chemical knowledge point entities having the target association relationship; The chemical knowledge graph is constructed based on the chemical knowledge point entities to which the target association is added.
3. A method for updating a high school chemistry knowledge base based on a large language model according to claim 2, characterized in that: Acquire second chemical knowledge data at preset intervals, and update the chemical knowledge graph based on the second chemical knowledge data. The step of updating the chemical knowledge graph includes: Extracting multiple chemical knowledge point entities and target associations between chemical knowledge point entities in the second chemical knowledge data based on the multiple preset basic types, and outputting a multimodal embedded knowledge vector according to the multiple chemical knowledge point entities and target associations between chemical knowledge point entities in the second chemical knowledge data; Performing feature extraction on the multimodal embedded knowledge vector, outputting prompt text corresponding to the multimodal embedded knowledge vector, performing clustering based on the prompt text through the large language model, and outputting a clustering result of chemical knowledge associated with the second chemical knowledge data; The chemical knowledge graph is updated based on the clustering results.
4. A method for updating a high school chemistry knowledge base based on a large language model according to claim 2, characterized in that: The step of outputting a multimodal embedded knowledge vector according to the plurality of chemical knowledge point entities in the second chemical knowledge data and the target association between the chemical knowledge point entities comprises: Generate corresponding feature embeddings according to the basic types corresponding to each chemical knowledge point entity, fuse all feature embeddings to obtain a combined embedding matrix, and output the multimodal embedded knowledge vector; Among them, the multiple preset basic types include at least one of image type, text type, and data attribute type; the feature embedding is one of image feature embedding, text feature embedding, and data attribute feature embedding.
5. A method for updating a high school chemistry knowledge base based on a large language model according to claim 1, characterized in that: The step of traversing the knowledge point data associated with the structured data in the chemical knowledge query vector in the preset knowledge database and generating a prompt text based on the associated knowledge point data includes: Perform feature comparison between the chemical knowledge query vector and the knowledge point vectors in the knowledge database, calculate the similarity between the chemical knowledge query vector and each of the knowledge point vectors, traverse the knowledge database to obtain all knowledge point data with similarity values greater than a similarity threshold, and generate prompt text for input into the large language model based on all the knowledge point data using a preset prompt template, so that the large language model outputs a query result based on the prompt text.
6. A method for updating a high school chemistry knowledge base based on a large language model according to claim 1, characterized in that: The step of inputting the prompt text into the large language model so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtaining the query result related to the chemical knowledge query text data obtained by traversing the knowledge point type, comprises: The large language model determines the knowledge point type corresponding to the chemical knowledge query text data based on the prompt text; wherein the knowledge point type includes at least one of a chemical structure knowledge point and a chemical text knowledge point; For the chemical structure knowledge points, extracting chemical structure-related keywords through the large language model, and traversing the chemical structure-related keywords in the chemical knowledge graph to obtain a first query result; For the chemical text knowledge point, extract the chemical text related keywords through the large language model, traverse to obtain multiple text segments of the keywords related to the chemical text, and splice each of the text segments to obtain a second query result; Output the first query result and / or the second query result related to the chemical knowledge query text data.
7. A high school chemistry knowledge base updating device based on a large language model, characterized in that: include: A data processing module, configured to extract structured data from the chemical knowledge query text data in response to input chemical knowledge query text data based on chemical knowledge point entities in the chemical knowledge graph and association relationships between chemical knowledge point entities, and generate a corresponding chemical knowledge query vector based on the structured data; A query module, used to traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in a preset knowledge database, and generate a prompt text based on the associated knowledge point data; The query module is also used to input the prompt text into the large language model, so that the large language model determines the corresponding knowledge point type based on the prompt text, and obtains the query results related to the chemical knowledge query text data obtained by traversing the knowledge point type; An updating module is used to update the query result into the preset knowledge database.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Graph embedding method and system based on rule reasoning and syntactic graph
CN110245238A
Central routing method and device combining atlas questions and answers with retrieval questions and answers
CN110909140A
Probability hypergraph-driven geoscience knowledge graph reasoning optimization system and method
CN114547325A
Knowledge base system and application method of knowledge base system
CN117133383A
Local knowledge base updating method and system based on large language model and BERT model
CN117194602A
