High school chemistry knowledge base updating method based on large language model
Patent Information
- Application Number
- CN202411204618.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2044-08-30
AI Technical Summary
In the field of high school chemistry, existing technologies make it difficult to combine multimodal data, resulting in low interpretability of knowledge nodes in knowledge graphs, inability to accurately obtain other knowledge nodes associated with knowledge nodes, and difficulty in distinguishing isomers, which affects the effectiveness of information-based teaching.
By utilizing a large language model in a chemical knowledge base to respond to input chemical knowledge query text data, extracting structured data based on knowledge point entities and relationships in a chemical knowledge graph, generating query vectors, determining knowledge point types and updating the knowledge database through the large language model, and combining multimodal embedded knowledge vectors for clustering, the problem of combining multimodal data is solved.
It achieves more accurate query results output, avoids confusion between isomers, improves the efficiency and accuracy of information-based teaching, and maintains the timeliness of the knowledge base.
Smart Images

Figure CN118939672B_ABST
Abstract
Description
Technical Field
[0001] This 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 Technology
[0002] In today's rapidly developing information technology landscape, the education sector has been profoundly impacted. This is particularly true in high school chemistry education, where traditional teaching methods and resources struggle to meet the diverse and personalized learning needs of students. In recent years, with the advancements in artificial intelligence (AI) and big data technologies, knowledge base systems based on Large Language Models (LLMs) have begun to emerge as a significant direction for educational technology innovation. LLMs, through deep learning algorithms, automatically extract and learn language patterns from massive amounts of text data, generating high-quality natural language text. Leveraging the advantages of LLMs 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 typically populated with heterogeneous data, such as text, numbers, or images. This makes it difficult to combine multimodal data from various sources and in different forms into a single joint embedding when constructing a knowledge graph. Furthermore, in the field of chemical knowledge graph research, relying solely on the intrinsic topology of molecules and simple construction rules often results in low interpretability of knowledge nodes. It is difficult to obtain other knowledge nodes with external connections to existing knowledge nodes, leading to a lack of accurate data corresponding to those nodes. For example, considering that some organic molecules have multiple isomers, directly constructing a knowledge graph using a large language model can easily confuse the differences between various isomers, resulting in ineffective answers and hindering the development of information-based teaching. Summary of the Invention
[0004] This application provides a method for generating a dynamic knowledge base for high school chemistry based on a large language model, in order to overcome the shortcomings of the aforementioned related technologies. The technical solution is as follows:
[0005] In a first aspect, embodiments of this application provide a method for updating a high school chemistry knowledge base based on a large language model, including:
[0006] In response to the input chemical knowledge query text data, the structured data in the chemical knowledge query text data is extracted based on the chemical knowledge point entities in the chemical knowledge graph and the relationships between the chemical knowledge point entities, and the corresponding chemical knowledge query vector is generated based on the structured data.
[0007] Traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in the preset knowledge database, and generate prompt text based on the associated knowledge point data;
[0008] The prompt text is input into the large language model so that the large language model can determine the corresponding knowledge point type based on the prompt text and obtain query results related to the chemical knowledge query text data obtained by traversing the knowledge point type.
[0009] Update the query results to the preset knowledge database.
[0010] In one alternative embodiment of the first aspect, the process of constructing the chemical knowledge graph includes:
[0011] Obtain the first chemical knowledge data from the preset knowledge database;
[0012] Extract multiple chemical knowledge point entities from the first chemical knowledge data based on multiple preset basic types; determine whether there is at least one association relationship between the multiple chemical knowledge point entities, and add the target association corresponding to the target association relationship between the chemical knowledge point entities with the target association relationship;
[0013] The chemical knowledge graph is constructed based on the chemical knowledge point entities associated with the target.
[0014] In one alternative 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] Based on the multiple preset basic types, extract multiple chemical knowledge point entities and target associations between chemical knowledge point entities from the second chemical knowledge data, and output multimodal embedded knowledge vectors according to the multiple chemical knowledge point entities and target associations between chemical knowledge point entities in the second chemical knowledge data.
[0016] Feature extraction is performed on the multimodal embedded knowledge vector, and prompt text corresponding to the multimodal embedded knowledge vector is output. Based on the prompt text, clustering is performed by the large language model, and clustering results of chemical knowledge associated with the second chemical knowledge data are output.
[0017] The chemical knowledge graph is updated based on the clustering results.
[0018] In one alternative embodiment of the first aspect, the step of outputting a multimodal embedded knowledge vector based on multiple chemical knowledge point entities in the second chemical knowledge data and the target associations between the chemical knowledge point entities includes:
[0019] Each chemical knowledge point entity generates a corresponding feature embedding based on its basic type. All feature embeddings are then fused to obtain a combined embedding matrix, and the multimodal embedded knowledge vector is output.
[0020] The plurality of 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.
[0021] In one alternative embodiment of the first aspect, the step of traversing knowledge point data associated with structured data in the chemical knowledge query vector within a preset knowledge database, and generating prompt text based on the associated knowledge point data, includes:
[0022] The chemical knowledge query vector is compared with the knowledge point vector in the knowledge database by feature comparison. The similarity between the chemical knowledge query vector and each knowledge point vector is calculated. All knowledge point data with similarity values greater than the similarity threshold are obtained from the knowledge database. Based on all the knowledge point data, a prompt text for inputting into the large language model is generated using a preset prompt template, so that the large language model outputs query results based on the prompt text.
[0023] In one alternative embodiment of the first aspect, 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 obtains 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 chemical structure knowledge points and chemical text knowledge points;
[0025] For the chemical structure knowledge points, keywords related to chemical structure are extracted through the large language model, and the first query result is obtained by traversing the keywords related to chemical structure in the chemical knowledge graph.
[0026] For the chemical text knowledge points, keywords related to the chemical text are extracted using the large language model, and multiple text segments with keywords related to the chemical text are obtained by traversing the data. Each text segment is then concatenated to obtain the second query result.
[0027] Output the first and / or second query results related to the chemical knowledge query text data.
[0028] Secondly, embodiments of this application also provide a high school chemistry knowledge base updating device based on a large language model, comprising:
[0029] The data processing module is used to respond to the input chemical knowledge query text data, extract the structured data from the chemical knowledge point entities in the chemical knowledge graph and the relationship between the chemical knowledge point entities, and generate the corresponding chemical knowledge query vector based on the structured data.
[0030] The query module is used to traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in the preset knowledge database, and generate prompt text based on the associated knowledge point data;
[0031] The query module is also used to input the prompt text into the large language model, so that the large language model can determine the corresponding knowledge point type based on the prompt text and obtain query results related to the chemical knowledge query text data obtained by traversing the knowledge point type.
[0032] The update module is used to update the query results to the preset knowledge database.
[0033] Thirdly, embodiments of this application also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method provided by the first aspect or any implementation thereof of the embodiments of this application.
[0034] Fourthly, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided by the first aspect of the embodiments of this application or any implementation thereof.
[0035] The beneficial effects of the technical solutions provided in some embodiments of this application include at least the following:
[0036] On the one hand, the embodiments of this application can provide rich multimodal data based on the query text input by the user, combined with chemical knowledge graphs and large language models. The chemical knowledge graph can determine the structured data of knowledge points in the user's query text, taking into account not only several chemical knowledge points in the query text, but also the relationship between chemical knowledge points, so that the large language model can output more accurate query results.
[0037] On the other hand, the user-input query text is transformed into vectorized data. The structure of knowledge points is determined through a knowledge graph, and related knowledge point data is identified through a database. A large language model can then provide a large number of multi-source, multi-modal query results related to the knowledge point data. This allows for the output of answers that more closely match the user's query, avoiding the inability to distinguish between isomers caused by relying solely on knowledge graph queries. It also overcomes the problems of incomplete data and low query efficiency resulting from relying solely on database queries. Furthermore, it addresses the issue of low efficiency in outputting effective answers when accurate input text is lacking. The data retrieved in this way can be stored in a database for future queries of matching knowledge points, ensuring the knowledge base remains up-to-date. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a flowchart illustrating a method for updating a high school chemistry knowledge base based on a large language model, according to an embodiment of this application.
[0040] Figure 2 This is a schematic diagram of the structure of the knowledge graph in an embodiment of this 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 this application;
[0042] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0044] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or modules is not limited to the steps or modules listed, but may optionally include steps or modules not listed, or may optionally include other steps or modules inherent to such process, method, product, or apparatus.
[0045] It should be noted that the terms "first" and "second" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first" and "second" can be interchanged in a specific order or sequence where permitted. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in an order other than those described or illustrated herein.
[0046] It should be noted that the embodiments of this application are mainly applicable to the field of high school chemistry teaching. Students or teachers can use the database to query questions related to high school chemistry knowledge, thereby efficiently obtaining the information they need. Although the overall content of high school chemistry knowledge remains unchanged, the focus of knowledge point examination changes accordingly with the annual changes in the syllabus. This means that some new exercises may appear that involve new types of knowledge points, thus requiring the high school chemistry knowledge base to keep pace with the times.
[0047] The present application will now be described in detail with reference to specific embodiments.
[0048] Next, combine Figure 1 This paper introduces a method for updating a high school chemistry knowledge base based on a large language model, provided by embodiments of this application. For details, please refer to... Figure 1 , Figure 1 This illustration shows a flowchart of a high school chemistry knowledge base update method based on a large language model, as provided in an embodiment of this application. Figure 1 As shown, the method includes the following steps:
[0049] S101, in response to the input chemical knowledge query text data, extract the structured data from the chemical knowledge query text data based on the chemical knowledge point entities in the chemical knowledge graph and the relationship between the chemical knowledge point entities, and generate the corresponding chemical knowledge query vector based on the structured data.
[0050] S102, Traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in the preset knowledge database, and generate prompt text based on the associated knowledge point data;
[0051] S103, input the prompt text into the large language model so that the large language model can determine the corresponding knowledge point type based on the prompt text and obtain the query results related to the chemical knowledge query text data obtained by traversing the knowledge point type;
[0052] S104, update the query results to the preset knowledge database.
[0053] Specifically, in S101, the input chemistry knowledge query text data can be the high school chemistry-related question text Q manually entered by the student. x For example, "C8H" 10 What are the different types of isomers of [the substance]? Write their chemical structural formulas.
[0054] Specifically, in S101, structured data in chemical knowledge query text data can be extracted through the predefined chemical knowledge point entities in the chemical knowledge graph and the relationships between chemical knowledge point entities, thereby transforming 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 can be processed. x Operations such as word segmentation, entity tagging, and entity masking are performed to extract chemical knowledge entity information.
[0056] For example, a chemical knowledge graph can be used to... Figure 2 The form shown, Figure 2 The example demonstrates a knowledge graph composed of various chemical knowledge entities and the relationships between them. The basic types of this knowledge graph can include structural document data, lexical document data, and combined document data, thereby integrating basic knowledge related to elements and functional groups.
[0057] like Figure 2As shown, black blocks represent different classes, and black arrows reflect inclusion or disjointness relationships. For example, the "subclassing" construction between the reactive nonmetal class and the nonmetal class means that the set of entities in the reactive nonmetal class is a subset of the entities in the nonmetal class. Furthermore, each entity in the ester class is a member of its parent class, the oxygen-containing group. It's important to note that subclassing relationships are transitive, meaning the reactive nonmetal class is also a subclass of the element class. However, since literal names may not be sufficient to distinguish different classes, disjointness of classes is defined, and the term "disjoint" is used to indicate disjoint relationships. For example, disjointness between the metal and nonmetal classes means that element entities in the metal class cannot simultaneously be members of the nonmetal class. Using a class hierarchy, we assign corresponding entities to each class through "type" relationships; the C and O elements in the gray blocks are both members of the reactive nonmetal class. This determines the association relationships between entities in each class.
[0058] In some embodiments, a knowledge graph may include a list of chemical properties compiled from the periodic table and assigned as data attributes to each entity within it. Alternatively, for functional groups, the types of bonds contained in each functional group may 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 attributes can be used to model relationships between entities. Continuous chemical property values of elements can be discretized and used as object attributes (e.g., in radius group 1) to connect element entities to each other. For example, a triple (C, in radius group 1, O) indicates that entities C and O are both in radius group 1, while (C, gaseous, O) indicates that they are both in the gaseous state. Symmetry features can be added to these object attributes; (C, gaseous, O) is consistent with another symmetric triple (O, gaseous, C). Chemical knowledge graphs can also establish connections between element and functional group entities through "partial" object attributes, indicating that the element participated 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 tag is set for each knowledge point data in the knowledge base, and the same chemical knowledge point entity in the knowledge graph is identified by the tag.
[0061] In some embodiments, the process of constructing the chemical knowledge graph may include:
[0062] Obtain the first chemical knowledge data from the preset knowledge database;
[0063] Extract multiple chemical knowledge point entities from the first chemical knowledge data based on multiple preset basic types; determine whether there is at least one association relationship between the multiple chemical knowledge point entities, and add the target association corresponding to the target association relationship between the chemical knowledge point entities with the target association relationship;
[0064] The chemical knowledge graph is constructed based on the chemical knowledge point entities associated with the target.
[0065] In some embodiments, 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:
[0066] Based on the multiple preset basic types, extract multiple chemical knowledge point entities and target associations between chemical knowledge point entities from the second chemical knowledge data, and output multimodal embedded knowledge vectors according to the multiple chemical knowledge point entities and target associations between chemical knowledge point entities in the second chemical knowledge data.
[0067] Feature extraction is performed on the multimodal embedded knowledge vector, and prompt text corresponding to the multimodal embedded knowledge vector is output. Based on the prompt text, clustering is performed by the large language model, and clustering results of chemical knowledge associated with the second chemical knowledge data are output.
[0068] The chemical knowledge graph is updated based on the clustering results.
[0069] In some embodiments, the required versions 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 of chemistry teachers and students can be collected. Online learning materials can be searched, including but not limited to summaries and notes of chemistry knowledge points provided by educational forums, teaching websites and other sources.
[0070] Furthermore, data preprocessing can be performed on the collected data. This includes cleaning the collected data, such as removing noise, handling missing values, eliminating duplicates, and normalizing the format.
[0071] Specifically, contextual subgraphs can be used as text sequences input to the Big Prophecy model:
[0072] Context subgraph T G It is defined as a triple containing an entity and a relation. T G By the central triple T c and its surrounding neighborhood triple T context composition:
[0073] T G =T c ∪T context ;
[0074] The subgraph sampling process is at the triple level, and the sampled neighborhood triples T can be obtained. context:
[0075] T context ={T∣T i ∈N};
[0076] Where N is the central triplet T c A fixed-size neighborhood triplet is used. To better capture local structural features, a dynamic sampling strategy can be employed, randomly selecting multiple contextual subgraphs for the same central 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 aforementioned chemical knowledge point entities, and relations are the associations between chemical knowledge point entities. Entity-relationship pairs can be represented as plain text, and relations can be treated as special entities in the context subgraph. In this way, chemical knowledge point entity pair information can be obtained, including entity-relationship, entity-entity, and relation-relationship pair interactions. Another advantage is that relation nodes can be viewed as special nodes. Since the number of relations in the knowledge graph is much smaller than the number of entities, global semantic information can be maintained between sampled context subgraphs.
[0078] Understandably, the above prompt text can be constructed based on existing corpus data. The prompt template can be "You are an expert in the field of high school chemistry, you understand all the theoretical and experimental knowledge in the field of high school chemistry, and you have mastered the test-taking skills in the field of high school chemistry. Based on ...", you can find the information you need. The prompt text can be inserted appropriately at the "..." position of the prompt template.
[0079] The multimodal embedding knowledge vector can include at least one of image type, text type, and data attribute type, or it can be a fusion of the three types of data. Image feature embedding, text feature embedding, and data attribute feature embedding can be generated based on image type, text type, and data attribute type data respectively. Alternatively, after generating image feature embedding, text feature embedding, and data attribute feature embedding, the multiple embeddings can be fused to obtain the 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 atomic 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, S102, the knowledge point data associated with the structured data in the chemical knowledge query vector is traversed in a preset knowledge database, and prompt text is generated based on the associated knowledge point data, including:
[0082] The chemical knowledge query vector can be compared with the knowledge point vector in the knowledge database to calculate the similarity between the chemical knowledge query vector and each knowledge point vector. All knowledge point data with similarity values greater than the similarity threshold are obtained from the knowledge database. Based on all the knowledge point data, a prompt text for inputting into the large language model is generated using a preset prompt template, so that the large language model outputs query results based on the prompt text.
[0083] Specifically, the vectorized chemical problem V can be... x With vector V in the knowledge base c Similarity matching is performed using the cosine similarity method to calculate the similarity between the question vector and the vector of each knowledge point in the knowledge base. The calculated similarity values are then sorted to determine the knowledge points most relevant to the question.
[0084] Furthermore, vector retrieval methods can be used to traverse the knowledge base and obtain related knowledge point data based on the matched knowledge point data.
[0085] For example, a similarity threshold of 0.75 can be used to determine whether knowledge point data is related to chemical knowledge query text data. Knowledge point data with a similarity higher than the threshold will be regarded as relevant knowledge points.
[0086] Furthermore, the original similarity ranking score of the question triples (s,r,t) can be calculated using a decoder, as shown below:
[0087] φ(K x |s,r,t)=ReLU(vec(M(s t ,r t ))·W)K xt ;
[0088] Here, vec(·) converts a matrix into a vector, M(·,·) is a one-dimensional convolutional layer, and W is a linear transformation matrix. t r t and K xt They are s, r, and K respectively. x In the embedding at t, a higher score indicates a higher similarity of triples, where s represents the main entity, r represents the relation, and t represents the secondary entity.
[0089] Specifically, based on similarity ranking and threshold settings, knowledge point data related to the question can be traversed from the knowledge base 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 enhanced prompts, leveraging the functional group-related knowledge structure provided by the chemical knowledge graph to improve its performance in answering chemical questions. First, it can detect all functional group entities {x1, ..., x} in the input molecule. 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 embeddings of the mediator (denoted as x0) and the functional group entities to comprehensively aggregate the semantic information of these embeddings and obtain functional cues.
[0092] Specifically, the input X = {x0, x1, ..., x...} m First, it is projected into the 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, then multiplies it by that value, and outputs the embedding formula as follows:
[0096]
[0097] In this way, two self-attention layers were implemented, and the embedding of the mediator variable x′0=X′[∶,0] was obtained, reflecting the combined weights of functional groups with different importance. Then, a fully connected layer was applied, and layer normalization was performed to obtain functional cues.
[0098] x prompt =LayerNorm(W·x′0);
[0099] Finally, adding a learnable scale parameter α will provide the cue message x. prompt To arrive, to obtain:
[0100]
[0101] This results in a new output with enhanced prompts.
[0102] Furthermore, based on the prompt text constructed by S102, the prompt text can be understood as a question-and-answer pair or a dialogue-style contextual input. The large language model is applied to classify the knowledge points into chemical structure knowledge points and chemical text knowledge points.
[0103] The knowledge point type corresponding to the chemical knowledge query text data can be determined as follows: containing only chemical structure knowledge points, containing only chemical text knowledge points, containing both chemical structure knowledge points and chemical text knowledge points.
[0104] For chemical text-based knowledge points, the following steps can be applied:
[0105] First, initialize the seed segment V using TF-IDF search. s And the inference path queue P, then, for each seed channel v i ∈V s Set its adjacent channel node N i Add to candidate adjacent queue C;
[0106] Furthermore, based on the large language model, each node / retrieved paragraph is traversed. Perform reasoning, and then generate the next paragraph s. j+1 As shown below:
[0107]
[0108] Among them, X i Corresponding node v i Features By connecting the text information of previously retrieved paragraphs / visited nodes, the earliest enqueued inference path / candidate neighborhood P is iteratively added. i / C i Dequeue from P / C, and apply the above formula to the adjacent queue C. i Sort the outgoing neighbors in the queue.
[0109] Finally, based on the ranking, select from adjacent queue C i Select the first k channel nodes V i Proceed to the next step and update the candidate neighbor queue and inference path queue accordingly. The above process terminates when the candidate neighbor queue becomes empty or the prefix budget K of the retrieved paragraph is satisfied, and outputs K questions and answers related to the knowledge points.
[0110] For knowledge points related to chemical structures, keywords related to chemical structures can be extracted using the large language model, and the relevant query results can be obtained by traversing the chemical knowledge graph using these keywords.
[0111] In one specific embodiment, S104 includes:
[0112] For example, if the chemical knowledge query text data corresponds to the question "C8H" 10 What are the different types of isomers of [the substance]? Write their chemical structural formulas.
[0113] Answers can be output using large language models and knowledge graphs, and specific experimental phenomena, chemical reaction equations, or diagrams can be provided to aid explanation. For example, the answer to the question mentioned above is "C8H". 10 The isomers are ethylbenzene, o-xylene, m-xylene, and p-xylene.
[0114] In some embodiments, after the answer is generated, it can be carefully reviewed and corrected 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 problem and their explanations, as well as the source website of the data, can be provided at the same time. Similar problems and corresponding solutions can be selected from the chemical knowledge database to help students understand the relevant knowledge points more comprehensively. New problems and corresponding solutions can also be obtained by traversing through a large language model.
[0116] For example, knowledge points such as "Isomers are compounds with the same molecular formula but different structures" and "Aromatic hydrocarbons are hydrocarbons containing a benzene ring structure in their molecules, and are a class of aromatic compounds" are similar to the question Q. x1 The question could be: "What are the different carboxylic acid isomers of C8H8O2? Write their chemical structural formulas." The answer is A. x1 The list includes "four types, namely phenylacetic acid (C6H5CH2COOH), p-methylbenzoic acid (CH3C6H4COOH), o-methylbenzoic acid (CH3C6H4COOH), and m-methylbenzoic acid (CH3C6H4COOH)," etc.
[0117] Furthermore, step S104 can be executed to input the above knowledge points, questions, and answers into the knowledge base for updating.
[0118] The following are apparatus embodiments of this application, which can be used to execute the method embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the method embodiments of this application.
[0119] Please see below. Figure 3This is a schematic diagram of a high school chemistry knowledge base update device based on a large language model, provided as an exemplary embodiment of this application. This device can be implemented as all or part of a terminal through software, hardware, or a combination of both, or it can be integrated as an independent module on a server. The high school chemistry knowledge base update device based on a large language model in this embodiment 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 used to respond to the input chemical knowledge query text data, extract the structured data in the chemical knowledge query text data based on the chemical knowledge point entities in the chemical knowledge graph and the relationship between the chemical knowledge point entities, and generate the 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 the preset knowledge database, and generate prompt text based on the associated knowledge point data;
[0122] The query module 302 is also used to input the prompt text into the large language model, so that the large language model can determine the corresponding knowledge point type based on the prompt text and obtain query results related to the chemical knowledge query text data obtained by traversing the knowledge point type.
[0123] The update module 303 is used to update the query results to the preset knowledge database.
[0124] It should be noted that the device 30 provided in the above embodiments, when executing the high school chemistry knowledge base update method based on a large language model, is only illustrated by the division of the above functional modules. In practical applications, the above 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 embodiments and the high school chemistry knowledge base update method embodiments based on a large language model belong to the same concept, and its implementation process is detailed in the method embodiments, which will not be repeated here.
[0125] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods described above.
[0126] Please see Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of this application.
[0127] like Figure 4As shown, the electronic device 400 includes a processor 401 and a memory 402.
[0128] In this embodiment, the processor 401 is the control center of the computer system, and can be a processor of a physical machine or a processor of a virtual machine. The processor 401 may include one or more processing cores, such as a 4-core processor or an 8-core processor. The processor 401 can be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array).
[0129] Processor 401 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake-up state, also known as a CPU (Central Processing Unit). The coprocessor is a low-power processor used to process data in the standby state.
[0130] Memory 402 may include one or more computer-readable storage media, which may be non-transitory. Memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments of this application, the non-transitory computer-readable storage media in memory 402 is used to store at least one instruction, which is executed by processor 401 to implement the method in the embodiments of this 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, memory 402, and peripheral device interface 403 can be connected via a bus or signal line. Each peripheral device 404 can be connected to the peripheral device interface 403 via a bus, signal line, or circuit board. Specifically, the peripheral device 404 includes: a display screen, a camera, and audio circuitry. 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 memory 402.
[0132] In some embodiments of this application, the processor 401, memory 402, and peripheral device interface 403 are integrated on the same chip or circuit board; in other embodiments of this application, any one or two of the processor 401, memory 402, and peripheral device interface 403 can be implemented on separate chips or circuit boards. This application does not specifically limit the implementation in this regard.
[0133] The block diagram of the electronic device shown in the embodiments of this application does not constitute a limitation on the electronic device 400. The electronic device 400 may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0134] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the methods in any of the foregoing embodiments. The computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, as well as magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0135] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this 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 the input chemical knowledge query text data, the structured data in the chemical knowledge query text data is extracted based on the chemical knowledge point entities in the chemical knowledge graph and the relationships between the chemical knowledge point entities, and the corresponding chemical knowledge query vector is generated based on the structured data. Traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in the preset knowledge database, and generate prompt text based on the associated knowledge point data; 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 chemical structure knowledge points and chemical text knowledge points; For the chemical structure knowledge points, keywords related to chemical structure are extracted through the large language model, and the first query result is obtained by traversing the keywords related to chemical structure in the chemical knowledge graph. For the chemical text knowledge points, keywords related to the chemical text are extracted using the large language model, and multiple text segments with keywords related to the chemical text are obtained by traversing the data. Each text segment is then concatenated to obtain the second query result. Output the first and / or second query results related to the chemical knowledge query text data; Update the query results to the preset knowledge database.
2. The method for updating a high school chemistry knowledge base based on a large language model according to claim 1, characterized in that, The process of constructing the chemical knowledge graph includes: Obtain the first chemical knowledge data from the preset knowledge database; Extract multiple chemical knowledge point entities from the first chemical knowledge data based on multiple preset basic types; determine whether there is at least one association relationship between the multiple chemical knowledge point entities, and add the target association corresponding to the target association relationship between the chemical knowledge point entities with the target association relationship; The chemical knowledge graph is constructed based on the chemical knowledge point entities associated with the target.
3. The method for updating a high school chemistry knowledge base based on a large language model according to claim 2, characterized in that, 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: Based on the multiple preset basic types, extract multiple chemical knowledge point entities and target associations between chemical knowledge point entities from the second chemical knowledge data, and output multimodal embedded knowledge vectors according to the multiple chemical knowledge point entities and target associations between chemical knowledge point entities in the second chemical knowledge data. Feature extraction is performed on the multimodal embedded knowledge vector, and prompt text corresponding to the multimodal embedded knowledge vector is output. Based on the prompt text, clustering is performed by the large language model, and clustering results of chemical knowledge associated with the second chemical knowledge data are output. The chemical knowledge graph is updated based on the clustering results.
4. The method for updating a high school chemistry knowledge base based on a large language model according to claim 3, characterized in that, The step of outputting a multimodal embedded knowledge vector based on multiple chemical knowledge point entities in the second chemical knowledge data and the target associations between these entities includes: Each chemical knowledge point entity generates a corresponding feature embedding based on its basic type. All feature embeddings are then fused to obtain a combined embedding matrix, and the multimodal embedded knowledge vector is output. The plurality of 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. The 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 knowledge point data associated with structured data in the chemical knowledge query vector within a preset knowledge database, and generating prompt text based on the associated knowledge point data, includes: The chemical knowledge query vector is compared with the knowledge point vector in the knowledge database by feature comparison. The similarity between the chemical knowledge query vector and each knowledge point vector is calculated. All knowledge point data with similarity values greater than the similarity threshold are obtained from the knowledge database. Based on all the knowledge point data, a prompt text for inputting into the large language model is generated using a preset prompt template, so that the large language model outputs query results based on the prompt text.
6. An apparatus for updating a high school chemistry knowledge base based on a large language model as described in any one of claims 1-5, characterized in that, The device includes: The data processing module is used to respond to the input chemical knowledge query text data, extract the structured data from the chemical knowledge point entities in the chemical knowledge graph and the relationship between the chemical knowledge point entities, and generate the corresponding chemical knowledge query vector based on the structured data. The query module is used to traverse the knowledge point data associated with the structured data in the chemical knowledge query vector in the preset knowledge database, and generate 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 can determine the corresponding knowledge point type based on the prompt text and obtain query results related to the chemical knowledge query text data obtained by traversing the knowledge point type. The update module is used to update the query results to the preset knowledge database.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 5.
8. 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, it implements the steps of the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Knowledge base system and application method of knowledge base system
CN117133383A
Question response method and device based on large language model
CN117235226A
