Fine-grained entity classification method and interactive system based on knowledge injection

By injecting structured information from knowledge graphs into pre-trained language models and encoding it using graph neural networks, the problem of pre-trained language models being unable to effectively learn structured knowledge in fine-grained entity classification is solved, achieving higher classification accuracy and domain knowledge transfer capabilities.

CN115563274BActive Publication Date: 2026-05-12ZHEJIANG MAOJING ARTIFICIAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG MAOJING ARTIFICIAL INTELLIGENCE TECH CO LTD
Filing Date
2022-09-20
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

现有的预训练语言模型在细粒度实体分类任务中无法有效学习结构化的知识图谱信息,导致分类准确性和领域知识迁移能力不足。

Method used

By injecting factual knowledge from the knowledge base into sentences and constructing a graph structure, encoding it using a graph neural network, and combining a multi-task learning framework of sequence structure and graph structure, the learning ability of the entity classification model is enhanced.

Benefits of technology

提高了细粒度实体分类的准确性,增强了模型对领域知识的理解和迁移能力,提升了实体分类的准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115563274B_ABST
    Figure CN115563274B_ABST
Patent Text Reader

Abstract

A knowledge injection-based fine-grained entity classification method and an interactive system are disclosed. The method comprises: inputting a sentence, a mentioned entity and knowledge graph triple information of the mentioned entity into a sentence-level encoder; constructing a feature representation of a word, a mentioned entity and triple information output by the sentence-level encoder into a graph structure and inputting the graph structure into a graph-level encoder; and inputting knowledge-enhanced sentence feature representation output by the graph-level encoder into an entity classification model for fine-grained entity classification of a target phrase in the sentence. On the basis of injecting fact knowledge in a knowledge base into a sentence in a sequential encoding manner and encoding entities based on a sequence structure, the application further constructs a graph structure using the fact knowledge and the sentence and encodes the graph structure based on GNN. Thus, the entity classification model can jointly learn entity representation learning in the sentence and in the knowledge graph structure and perform fine-grained entity classification with higher accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of deep learning, and more particularly to a fine-grained entity classification method and interaction system based on knowledge injection. Background Technology

[0002] As a foundational model for Natural Language Processing (NLP), pre-trained language models (PLMs, including BERT, RoBERTa, XLNET, etc.) have achieved excellent results in various downstream Natural Language Understanding (NLU) tasks, demonstrating strong versatility. However, mainstream pre-trained language models are based on publicly available documents, learning general language knowledge from unstructured documents, neglecting the learning of a large amount of knowledge information, especially structured knowledge graph (KG) information. This leads to the model's inability to truly understand real-world entities and their relationships, and can produce counterfactual outputs (for example, the GPT model might output statements such as "the sun has two eyes"). It also significantly weakens the model's few-shot learning ability, domain knowledge transfer ability, and general knowledge induction ability. Therefore, when using PLMs to perform the important NLP task of fine-grained entity classification, there is a need to learn knowledge from knowledge graphs to improve classification accuracy.

[0003] Therefore, how to efficiently and accurately learn knowledge from triplet information to improve the accuracy of fine-grained entity classification has become a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] One technical problem this disclosure aims to solve is to provide a fine-grained entity classification method and interaction system based on knowledge injection. The entity classification scheme of this invention, based on, for example, injecting factual knowledge from a knowledge base into sentences in a sequential encoding manner and encoding entities based on sequence structures, further utilizes factual knowledge and sentences to construct a graph structure, and encodes it based on a graph neural network (GNN). Thus, the entity classification model can jointly learn entity representations in sentences and knowledge graph structures, achieving fine-grained entity classification with higher accuracy.

[0005] According to a first aspect of this disclosure, a fine-grained entity classification method based on knowledge injection is provided, comprising: feeding a sentence, the entities mentioned in the sentence, and knowledge graph triples related to the mentioned entities into a sentence-level encoder; constructing a graph structure from the feature representations of the words contained in the sentence, the feature representations of the mentioned entities, and the feature representations of the triples related to the mentioned entities output by the sentence-level encoder, and feeding it into a graph-level encoder; and feeding the knowledge-enhanced sentence feature representations based on the output of the graph-level encoder into an entity classification model for fine-grained entity classification of target phrases in the sentence.

[0006] Optionally, feeding the sentence, the mentioned entities in the sentence, and the knowledge graph triples related to the mentioned entities into the sentence-level encoder includes: feeding the word information contained in the sentence, the mentioned entity information, and the relational information of multiple knowledge graph triples of the mentioned entities into the sentence-level encoder.

[0007] Optionally, the method further includes: feeding the sentence into a pre-trained language model and using the word embeddings output by the pre-trained language model as the word information; feeding the mentioned entity into a pre-trained knowledge embedding matrix and using the entity embeddings output by the pre-trained knowledge embedding matrix as the mentioned entity information; and calculating the entity embeddings of the head entity and tail entity in the knowledge graph triple as the relation information.

[0008] Optionally, feeding the sentence and the knowledge graph triples related to the entities mentioned in the sentence into the sentence-level encoder includes: using a type embedding matrix to distinguish the word embedding, the entity embedding, and the relation embedding; and using start symbols and delimiters to concatenate the word embedding, the entity embedding, and the relation embedding, and using special symbols to label the target phrase.

[0009] Optionally, the knowledge graph triplet of the mentioned entity in the sentence is a knowledge graph triplet with the mentioned entity as the head entity and not exceeding a predetermined threshold.

[0010] Optionally, constructing a graph structure from the sentence output by the sentence-level encoder, which includes feature representations of words, reference entities, and triple-related information, comprises: using the feature representations of words, reference entities, and relations as word nodes, entity nodes, and relation nodes of the graph structure, respectively, wherein the feature representations of triple-related information include the feature representations of the relations of the triples; and connecting word nodes and related entity nodes, and connecting entity nodes and related relation nodes, to construct the edges of the graph structure.

[0011] Optionally, connecting word nodes and related entity nodes, and connecting entity nodes and related relation nodes, to construct the edges of the graph structure includes: using forward edges to represent connections from word nodes to related entity nodes, and connections from entity nodes to related relation nodes; and adding reverse edges to the graph structure in the opposite direction to the forward edges, wherein the forward edges and the reverse edges have trainable weights.

[0012] Optionally, the method further includes: during the training phase, using the natural language-enhanced entity features and relation features output by the graph encoder to predict entity classification categories as an auxiliary training task for the entity classification model.

[0013] According to a second aspect of this disclosure, a knowledge-injection-based interactive system is provided, comprising: a user input receiving unit for acquiring a domain-specific query input by a user; a question matching unit for performing fine-grained classification of entities contained in the query using the method described in the first aspect, and generating feedback based on the fine-grained classification; and a feedback providing unit for providing the generated feedback to the user.

[0014] According to a third aspect of this disclosure, a computing device is provided, comprising: a processor; and a memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method described in the first aspect above.

[0015] According to a fourth aspect of this disclosure, a non-transitory machine-readable storage medium is provided, on which executable code is stored, which, when executed by a processor of an electronic device, causes the processor to perform the method described in the first aspect above.

[0016] Therefore, this invention employs a sequence-structure-based knowledge injection method to encode entities and relations in the sentence context and knowledge base sequentially, enhancing word embedding representations. Meanwhile, graph-structure-based knowledge injection encodes based on graph structures, integrating structured information from the knowledge base. Finally, an entity classification model, serving as a multi-task learning framework, is used to jointly learn entity representations in the sentence and the knowledge base, thereby achieving more accurate fine-grained entity classification. Attached Figure Description

[0017] The above and other objects, features and advantages of this disclosure will become more apparent from the more detailed description of exemplary embodiments thereof taken in conjunction with the accompanying drawings, wherein like reference numerals generally denote like parts.

[0018] Figure 1 An example of using knowledge subgraphs for entity type classification tasks is shown.

[0019] Figure 2 A schematic flowchart of a knowledge injection-based fine-grained entity classification method according to an embodiment of the present invention is shown.

[0020] Figure 3 A schematic diagram of a specific implementation example of the knowledge injection-based entity classification method according to the present invention is shown.

[0021] Figure 4 An example of the fine-grained classification system trained according to the present invention being used in actual interaction is shown.

[0022] Figure 5A schematic diagram of a computing device is shown, which can be used to implement the above-described knowledge-injection-based fine-grained entity method according to an embodiment of the present invention. Detailed Implementation

[0023] Preferred embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0024] Pre-trained language models (PLMs) are a general term for a class of natural language processing models used to learn low-dimensional, dense real-valued vector representations of text. Early PLMs aimed to learn word embeddings (e.g., word embeddings in English, which correspond to the embeddings of individual Chinese characters) using shallow neural networks. These word embeddings were used for various downstream natural language processing tasks. Modern PLMs learn context-based word embedding representations, and the learned models are used for fine-tuning in downstream tasks. PLMs have achieved excellent results in various downstream natural language understanding (NLU) tasks, demonstrating strong versatility.

[0025] Mainstream pre-trained language models are based on publicly available documents, learning general language knowledge from unstructured documents, neglecting the learning of large amounts of knowledge information, especially structured knowledge graph (KG) information. Here, unstructured and structured refer to the way language knowledge is presented. In natural language processing, the presentation of language knowledge typically includes three forms: unstructured text, semi-structured tables, and structured triples. Specifically, triple knowledge is stored in artificially constructed large-scale knowledge graph data, consisting of <head entity, relation, tail entity>. Head and tail entities represent a specific thing existing in the real world (e.g., Hangzhou), and relations express a semantic association between entities (e.g., birthplace).

[0026] In PLM, the two-stage strategy (i.e., pre-training and fine-tuning) inherits the knowledge learned during pre-training and applies it to downstream tasks. While PLM stores a large amount of internal knowledge, it struggles to understand external contextual knowledge, such as facts and common sense, because it learns general language knowledge from unstructured documents and lacks systematic learning of structured knowledge. This lack of knowledge can lead to counterfactual statements (for example, the GPT model might output obviously false assertions like "the sun has two eyes"), and significantly weakens the model's few-shot learning ability, domain knowledge transfer ability, and general knowledge induction ability.

[0027] Therefore, when using PLM to perform downstream tasks, such as fine-grained entity classification, there is a need to learn knowledge from the knowledge graph to improve classification accuracy. Existing technologies have seen numerous attempts at knowledge injection, such as converting the representation of triple structures into natural language expressions according to a template, for example, converting <China, capital, Beijing> into "China's capital is Beijing," and linking this knowledge text to the original training text; or training the knowledge triple text linked to the original training text together. However, such methods only include the internal information of a single triple, not the structural information between triples.

[0028] The inventors of this invention have discovered that the graph structure in a knowledge graph itself contains a wealth of useful information. For example, the structural information of multiple associated triples for the same entity, or the structural information of other associated triples where the tail entity in the current triple is the head entity, can more comprehensively enhance the understanding of entities compared to a single triple or multiple concatenated triples.

[0029] In this invention, a "knowledge subgraph" is used to describe a subset of triples in the knowledge graph related to the entities mentioned in a sentence, and the "knowledge subgraph" itself includes the structural relationships between entities. This invention utilizes "knowledge subgraphs" to improve the accuracy of fine-grained entity classification. Figure 1 An example of using knowledge subgraphs for entity type classification tasks is shown.

[0030] Named Entity Recognition (NER) refers to the identification of entities with specific meanings in text, mainly including names of people, places, organizations, and proper nouns. NER is a very fundamental task in Natural Language Understanding (NLP) and is an important foundational tool for many NLP tasks such as information extraction, question answering systems, syntactic analysis, and machine translation.

[0031] In the current field of deep learning, traditional Non-Entity Relationship Extraction (NER) based on coarse-grained categories cannot meet the needs due to its insufficient precision in characterizing entities. In practical applications, finer-grained categories are often required to characterize entities, providing more specific semantic information and enhancing indicativeness, such as identifying basketball players and rock singers. Taking relation extraction as an example, fine-grained entity categories can significantly suggest candidate relationships between entities. The coarser the entity category information, the more complex the candidate relationships between entities tend to be, and the more difficult the relation extraction task becomes. Therefore, downstream applications have spurred the development of fine-grained entity classification (FGET). Fine-grained entity classification (FGET) predicts the possible set of types for a given candidate entity (mention) and its context.

[0032] like Figure 1 As shown, the current task is to perform fine-grained classification of the two entities "Margaret Mitchell" and "Gone with the Wind" contained in the natural language sentence "Margaret Mitchell wrote Gone with the Wind from 1926 to 1929." (The Chinese translation could be: Margaret Mitchell wrote Gone with the Wind between 1926 and 1929.) For example, instead of simply identifying "Margaret Mitchell" as a name, a more granular classification could be performed, such as labeling it "author" as shown in the figure; similarly, instead of simply identifying "Gone with the Wind" as a work, a more granular classification could be performed, such as labeling it "novel" as shown in the figure.

[0033] Unlike existing technologies that only consider relevant triples<Gone with the Wind,author,MargaretMitchell> The sentence can be directly concatenated to form "Gone with the Wind author Margaret Mitchell" or "author of Gone with the Wind is Margaret Mitchell," and the resulting triplet text is appended to the original natural language sentence as classification input. This invention feeds all the content contained in the knowledge subgraph into the entity classification model. Specifically, for the two entities "Margaret Mitchell" and "Gone with the Wind" involved in the sentence, multiple triples can be selected, and the relationships between the triples can be constructed into a graph structure and fed into the entity classification model.

[0034] Specifically, for the entity "Gone with the Wind", three triples were also selected: <Gone with the Wind, author, Margaret Mitchell>; <Gone with the Wind, is a, novel>; <Gone with the Wind, heroine, Scarlett O'Hara>. For the entity "Margaret Mitchell", two triples were selected: <Margaret Mitchell, occupation, novelist>; <Margaret Mitchell, born in, Atlanta>. The triples selected here have the current entity as the head entity.

[0035] When using the present invention for entity classification, a graph structure can be constructed for this knowledge subgraph, and the information contained in this graph structure can be used to help the classification model perform accurate classification. For example, compared with the concatenated triple information, the triple regarding Margaret Mitchell's occupation and the description of what kind of work Gone with the Wind is in the knowledge subgraph enable the classification model to more easily determine that in this sentence, "Gone with the Wind" is a "novel", rather than a (equally famous) movie.

[0036] As follows, in combination with Figure 2 and Figure 3 , the detailed implementation of the entity classification method based on graph structure for knowledge injection of the present invention will be described.

[0037] Figure 2 FIG. shows a schematic flowchart of a fine-grained entity classification method based on knowledge injection according to an embodiment of the present invention.

[0038] In step S210, the sentence, the entities mentioned in the sentence, and the information related to the knowledge graph triples of the mentioned entities are sent to the sentence-level encoder.

[0039] In one embodiment, the information of each word contained in the sentence can be fed into a sentence-level encoder. Here, for sentence input such as English, a word can be each "word" in the sentence; while for sentence input such as Chinese, a word can be each character in the sentence. In other words, in this invention, "words" are used to represent the basic building blocks of a sentence. The word information fed into the sentence-level encoder can be word embeddings; therefore, the classification method of this invention further includes feeding the sentence into a pre-trained language model and using the word embeddings output by the pre-trained language model as the word information.

[0040] Accordingly, the entity embeddings of the entities mentioned in the sentence can be fed into the sentence-level encoder as entity information. In this case, the classification method of the present invention may further include feeding the mentioned entities into a pre-trained knowledge embedding matrix, and using the entity embeddings output by the pre-trained knowledge embedding matrix as the mentioned entity information.

[0041] Regarding the knowledge graph triple information related to mentioned entities, in a preferred embodiment, the "relation" in the triple can be selected as the knowledge graph triple information related to the mentioned entity, and the entity embeddings of the head and tail entities in the knowledge graph triple can be calculated as the relation information. In a preferred embodiment, the knowledge graph triple of the sentence mentioning the entity is a triple with the mentioned entity as the head entity, and the relation is the relation of the triple with the mentioned entity as the head entity. For example, for the entity "Margaret Mitchell", two triples with "Margaret Mitchell" as the head entity are selected in the graph, and the relation information comes from the respective relations in these two triples, namely "occupation" and "born in". Using only the head entity can avoid introducing additional entities and avoid noise to a certain extent. Selecting relations through the head entity can enhance the information of the entity by utilizing the relation. Generally speaking, relations selected based on the head entity can describe the entity more intuitively than relations selected based on the tail entity. In one embodiment, multiple triples can be selected for an entity, for example, all triples with the entity as the head entity (as long as the number of triples does not exceed a predetermined threshold).

[0042] Therefore, step S210 can correspond to feeding the word embeddings contained in the sentence, the entity embeddings of the mentioned entities, and the relation embeddings of multiple knowledge graph triples of the mentioned entities into the sentence-level encoder. Further, feeding the sentence and the knowledge graph triples related to the mentioned entities into the sentence-level encoder includes: using a type embedding matrix to distinguish the word embeddings, the entity embeddings, and the relation embeddings; and concatenating the word embeddings, the entity embeddings, and the relation embeddings using start and delimiter symbols, and labeling the target phrase using special symbols. Thus, the sequence based on symbol concatenation is finally fed into the sentence-level encoder.

[0043] In step S220, the feature representations of words, mentioned entities, and triple-related information in the sentence output by the sentence-level encoder are constructed into a graph structure and fed into the graph-level encoder. Specifically, the feature representations of words, mentioned entities, and relations can be used as word nodes, entity nodes, and relation nodes of the graph structure, respectively, wherein the feature representation of triple-related information includes the feature representation of the relation of the triple; and connecting word nodes and related entity nodes, and connecting entity nodes and related relation nodes, to construct the edges of the graph structure. In a preferred embodiment, forward edges can be used to represent the connection from word nodes to related entity nodes, and the connection from entity nodes to related relation nodes; and reverse edges opposite in direction to the forward edges are added to the graph structure, wherein the forward edges and the reverse edges have trainable weights (corresponding to the trainable matrix in the following application example). and In forward edge connections, since the edges point from word nodes to entity nodes and from entity nodes to relation nodes, word nodes can influence entity nodes, and entity nodes can influence relation nodes during model computation. By introducing reverse edges—where entity nodes point to word nodes and relation nodes point to entity nodes—entity nodes can also influence word nodes, and relation nodes can influence entity nodes during model computation. Furthermore, because the edge weights are adjustable, the model can selectively learn more important relationships from the knowledge subgraph.

[0044] Subsequently, in step S230, the sentence feature representation output by the graph-level encoder is fed into the entity classification model for fine-grained entity classification of target phrases in the sentence. During the training phase, in addition to the main task of the entity classification model performing fine-grained entity classification of target phrases in the sentence based on the sentence feature representation, predicting fine-grained entity classification categories based on entity features and relation features output by the graph-level encoder can also be used as an auxiliary training task for the entity classification model. This allows the sentence-level encoder and the graph-level encoder to focus on different types of features.

[0045] Therefore, this invention discloses a multi-task knowledge embedding entity classification method based on sequence structure and graph structure. First, factual knowledge from a knowledge base is injected into sentences using sequential encoding, and then fed into a sentence-level encoder to encode entities based on the sequence structure. Second, to better learn structured information in the knowledge graph, a graph structure is constructed using factual knowledge and sentences, and encoded in a graph-level encoder based on a graph neural network (GNN). Finally, entity representations in the sentence and knowledge graph are jointly learned using an entity classification model (e.g., the multi-task framework KE-SGL in the following application example). This method embeds factual knowledge into sentences using entities and relations from a knowledge base, enhancing entity representations in sentences, and is particularly suitable for applications in natural language understanding tasks.

[0046] Application examples

[0047] To deepen the understanding of the inventive principles of this invention, the following will be combined with... Figure 3 This paper describes the specific implementation of the multi-task knowledge embedding entity classification method based on sequence structure and graph structure of the present invention.

[0048] Figure 3 A schematic diagram of a specific implementation example of the knowledge injection-based entity classification method according to the present invention is shown.

[0049] For ease of explanation, the symbols mentioned below will be explained.

[0050] For having N S Sentences with words The m-th mentioned entity is represented as The knowledge graph representation of sentence-related information is as follows: Where N G e represents the number of triples. h and e t Let G and S represent the head entity and tail entity, respectively, and r represent the relation. The goal of entity classification is to identify the type of target phrase T (entity) in sentence S based on G and S. As shown below:

[0051]

[0052] See Figure 3 The entity classification scheme of this invention is mainly divided into three modules:

[0053] (1) Knowledge injection based on sequence structure, which encodes sentence knowledge and graph knowledge in sequence (bottom left);

[0054] (2) Graph structure knowledge injection: Encode all knowledge in the form of a graph (top left); and

[0055] (3) Multi-task learning framework, collaborative learning of knowledge embedding (right side).

[0056] 1. Knowledge Injection Based on Sequence Structure

[0057] First, knowledge is injected at the sentence level using sequential encoding to enrich the semantic information of the sentences. The input to the sentence-level encoder includes sentence words, mentioned entities, and relations contained in the knowledge subgraph. These entities are generated during the preprocessing stage. A token embedding matrix (based on word embeddings from the pre-trained language model ROBERTα) can be used to obtain word embedding representations of the words in the sentence, and a graph embedding matrix (a pre-trained knowledge embedding matrix) can be used to obtain the embedding representations of entities and relations in the knowledge base.

[0058] like Figure 3 As shown in the lower left, the word in the classification embedding is represented by the following after being fed into the label embedding matrix: The entity embedding representation obtained after the entity is fed into the graph embedding matrix is ​​as follows Relational embedding Then it can be based on the relevant triples in the knowledge graph The entity embeddings of the head entity and the tail entity are obtained through calculation:

[0059]

[0060] Where N S S is the length of the sentence after word segmentation, N E It is the number of entities, N R It is the number of relations. It is a subset of G. Indicates that there is a relation r i The number of triples.

[0061] The natural language sentence “Margaret Mitchell wrote Gone with the Wind from 1926 to 1929” corresponds to N. S=12 (the numbers "1926" and "1929" as well as the period "." are included). The target entity T in this sentence includes "Margaret Mitchell" and "Gone with the Wind", therefore N E =2. In use Figure 1 When knowledge injection is performed on the knowledge subgraph shown above, it involves five triples with "Margaret Mitchell" and "Gone with the Wind" as head entities. The relations corresponding to the head entity "Margaret Mitchell" are "occupation" and "born in", and the relations corresponding to the head entity "Gone with the Wind" are "is a", "author" and "heroine".

[0062] Since the inputs of different data types are heterogeneous, a type embedding matrix can be used to distinguish words, entities, and relations. This type embedding matrix can also be initialized by RoBERTα. Subsequently, a start symbol [CLS] can be used at the beginning of the sentence, a delimiter [SEP] can be used between sentences, entities, and relations, and special symbols [ENT] and [ / ENT] can be added before and after the target phrase T, respectively (where the features of [ENT] will be used as features for entity classification at the end). Concatenating all the inputs sequentially yields the following representation as input to the sentence-level encoder:

[0063] [CLS]Sentence[SEP]Entity[SEP]Relation[SEP] (3)

[0064] Sentence-level encoders can employ a Transformer architecture to jointly compute representations of words, mentions, and relations. After encoding, the words, mentions, and relations within a sentence are mutually visible, resulting in the following representation:

[0065]

[0066] Where L = N S +N E +N R d represents the feature dimension of each token. Sequence-structure-based knowledge injection integrates sentence context and external factual knowledge, thereby enriching the semantic information of symbols in the sentence.

[0067] 2. Injection of Graph Structure Knowledge

[0068] Connecting and encoding sentences and knowledge sequentially can enrich semantic information, but it neglects the rich structural information in the knowledge graph. To address this issue, after generating sentence-level knowledge embeddings, we can construct a graph (V,Γ) from the words, mentioned entities, and knowledge base relationships of the sentence, using them as nodes V and connecting them with edges. Make connections. Specifically, for Γ, there are two types of edges: one connects the word nodes of the sentence to the entity nodes of the knowledge base (specifically, the edges from word nodes to entity nodes), and the other connects the entities and relations in the knowledge base (the edges from entity nodes to relation nodes).

[0069] It should be understood that the word embeddings used to construct the graph structure correspond only to words in a natural language sentence that relate to entities, and do not include words other than entity words. For example, in Figure 1 In the given example of the sentence "Margaret Mitchellwrote Gone with the Wind from 1926 to 1929," such as... Figure 3 The top left diagram structure It only corresponds to the words that make up the entities, such as "Margaret", "Mitchell", "Gone", "with", "the", and "Wind", and does not include "wrote", "from", and "to" in natural language sentences. It can be embedded with its corresponding entity. Connected, for example, the two word nodes corresponding to "Margaret" and "Mitchell". It can connect to the entity node corresponding to "Margaret Mitchell". The entity node corresponding to "Margaret Mitchell" It can also be associated with related nodes. For example, "born in" and "occupation" are connected.

[0070] To inject knowledge structure information into the knowledge embedding, a GNN-based graph-level encoder can be used to encode the generated graph (in this embodiment, both forward and reverse edges are used to construct the graph):

[0071]

[0072] in and It is a trainable matrix. and These correspond to forward and reverse edges, respectively, and can be randomly initialized. V jThis represents the set of nodes j connected to node i. * indicates element-wise multiplication. Embedded GNN nodes can be initialized based on the output of the sequence structure knowledge injection module. Specifically, forward edges represent connections from word nodes to related entity nodes, and from entity nodes to related relation nodes; reverse edges are in the opposite direction to forward edges. In forward edge connections, since the edge points from word nodes to entity nodes and from entity nodes to relation nodes, word nodes can influence entity nodes, and entity nodes can influence relation nodes during model computation. By introducing reverse edges, i.e., the edge points from entity nodes to word nodes and from relation nodes to entity nodes, entity nodes can also influence word nodes and relation nodes can influence entity nodes during model computation. Forward edges and reverse edges have trainable weights (corresponding to trainable matrices). and Because the weights of the edges are adjustable, the model is able to learn more important relationships from the knowledge subgraph in a differentiated way.

[0073] The graph structure knowledge injection module further enhances the word representation in sentences through factual knowledge. Structured information from the knowledge graph is injected into word tokens via edges between word nodes and entity nodes. Simultaneously, entity features and relational features in the knowledge graph are also connected, indirectly affecting the feature representation of the word tokens. The results from the graph structure knowledge injection module are then fed into a multi-task framework for entity classification.

[0074] Following sentence-level and graph-level knowledge injection, i.e., at the output of the graph-level encoder, knowledge-enhanced sentence representations can be obtained. and knowledge representation enhanced by natural language These representations will subsequently be used for sentence-level and graph-level tasks in the following multi-task framework.

[0075] 3. Multi-task learning framework

[0076] The fine-grained entity classification model of this invention can be implemented as a multi-task learning space. To enable the sentence-level encoder and graph-level encoder to focus on different types of features, an auxiliary task (knowledge graph-level task) based on entities in the knowledge graph can be designed for joint training with the entity classification task (sentence-level task). For example... Figure 3 As shown on the right, the sentence-level task is used to classify the entity types of target word phrases in a sentence; the knowledge graph-level task serves as an auxiliary task, aiming to classify the entity representations in the knowledge base corresponding to the entities mentioned in the sentence. The two tasks are jointly trained in a weighted manner, and the model's language representation ability is finally evaluated on the sentence-level task.

[0077] Specifically, for sentence-level tasks, knowledge-enhanced sentence feature representations can be achieved using sequence structure knowledge injection modules and graph structure knowledge injection modules. The primary task of the KE-SGL model in this invention is to classify the target phrase T in the sentence. The feature representation of the special marker [ENT] can be extracted as entity phrase features, and then... The probability value for each entity type, used for entity type classification, can be calculated as follows:

[0078]

[0079] Where Linear(·) represents a linear layer, and σ(.) represents the Sigmoid function.

[0080] exist Figure 3 In the example, special markers The entity classification model calculates and classifies the data, for example, determining which label(s) are true.

[0081] Knowledge graph-level tasks, used as auxiliary tasks, aim to identify the types of entities mentioned in an external knowledge base. Feature representations of entities and their relationships can be derived. and And predict the following labels:

[0082]

[0083] Where N′ R Representation and entity The number of related relationships.

[0084] exist Figure 3 In the example, and The connection relationship represents the classification calculated by the entity classification model, for example, determining which label(s) are true.

[0085] Binary cross-entropy loss can be used to jointly optimize sentence-level and graph-level tasks, and the final loss function is:

[0086]

[0087] Where λ∈[0,1] serves as a weighting factor to control sentence-level loss. And graph-level loss The proportion. Therefore, the KE-SGL model of this invention obtains knowledge-enhanced word feature representations for entity classification tasks.

[0088] Therefore, the present invention can also be implemented as an interactive system based on knowledge injection. Figure 4An example of the fine-grained classification system trained according to the present invention being used in actual interaction is shown.

[0089] Specifically, an interactive system based on knowledge injection includes: a user input receiving unit for acquiring domain-specific queries input by a user; a question matching unit for performing fine-grained classification of entities contained in the queries using the method described above, and generating feedback based on the fine-grained classification; and a feedback providing unit for providing the generated feedback to the user.

[0090] Specifically, a sentence-level encoder as described above can be trained. Figure 3 Bottom left), map encoder ( Figure 3 (Top left) and fine-grained entity classification model ( Figure 3 The right side serves as the overall "entity classification" model for implementing the fine-grained entity classification method of this invention, and is used by the interactive system to perform fine-grained classification of entities contained in the user input content.

[0091] Figure 5 A schematic diagram of a computing device is shown, which can be used to implement the above-described knowledge-injection-based fine-grained entity method according to an embodiment of the present invention.

[0092] See Figure 5 The computing device 500 includes a memory 510 and a processor 520.

[0093] Processor 520 may be a multi-core processor or may contain multiple processors. In some embodiments, processor 520 may include a general-purpose main processor and one or more special-purpose coprocessors, such as a graphics processing unit (GPU), a digital signal processor (DSP), etc. In some embodiments, processor 520 may be implemented using custom circuitry, such as an application-specific integrated circuit (ASIC) or a field-programmable gate array (FPGA).

[0094] Memory 510 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. ROM may store static data or instructions required by the processor 520 or other modules of the computer. Permanent storage devices may be read-write storage devices. Permanent storage devices may be non-volatile storage devices that retain stored instructions and data even when the computer is powered off. In some embodiments, permanent storage devices use mass storage devices (e.g., magnetic or optical disks, flash memory) as permanent storage devices. In other embodiments, permanent storage devices may be removable storage devices (e.g., floppy disks, optical drives). System memory may be a read-write storage device or a volatile read-write storage device, such as dynamic random access memory. System memory may store some or all of the instructions and data required by the processor during operation. Furthermore, memory 510 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, memory 510 may include a removable storage device that is readable and / or writable, such as a laser disc (CD), a read-only digital multifunction optical disc (e.g., DVD-ROM, dual-layer DVD-ROM), a read-only Blu-ray disc, an ultra-high-density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not contain carrier waves or transient electronic signals transmitted wirelessly or via wired connections.

[0095] The memory 510 stores executable code, which, when processed by the processor 520, enables the processor 520 to execute the knowledge injection-based fine-grained entity method described above.

[0096] The fine-grained entity method based on knowledge injection and the interactive system using the method according to the present invention have been described in detail above with reference to the accompanying drawings.

[0097] Existing techniques typically combine sentence context and factual knowledge from knowledge graphs to predict entity types, using only entities from the knowledge graph as supplementary knowledge data. However, these approaches neglect the structured information within the knowledge graph. To address this issue, this proposal considers not only entities and relations but also the structured information from knowledge graph subgraphs when using knowledge graphs as supplementary factual knowledge. Specifically, this proposal suggests a multi-task knowledge embedding entity classification method based on sequence and graph structures. First, it encodes sentence context and entities and relations from the knowledge graph using sequence structures. Then, it uses graph structures to fuse the structured information from the knowledge graph. Finally, it optimizes the encoding of both structures simultaneously using a multi-task learning strategy. This approach effectively injects factual knowledge into entities within sentences.

[0098] Furthermore, the method according to the present invention can also be implemented as a computer program or computer program product, which includes computer program code instructions for performing the steps defined in the above-described method of the present invention.

[0099] Alternatively, the present invention can also be implemented as a non-transitory machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) storing executable code (or computer program, or computer instruction code) thereon, which, when executed by a processor of an electronic device (or computing device, server, etc.), causes the processor to perform the various steps of the method described above according to the present invention.

[0100] Those skilled in the art will also understand that the various exemplary logic blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein can be implemented as electronic hardware, computer software, or a combination of both.

[0101] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems and methods according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0102] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A fine-grained entity classification method based on knowledge injection, comprising: The sentence, the entities mentioned in the sentence, and the knowledge graph triples related to the mentioned entities are fed into the sentence-level encoder. The feature representations of words, mentioned entities, and triple-related information in the sentence output by the sentence-level encoder are constructed into a graph structure and fed into the graph-level encoder; and The knowledge-enhanced sentence feature representation based on the output of the graph-level encoder is fed into the entity classification model for fine-grained entity classification of target phrases in the sentence.

2. The method as described in claim 1, wherein, The process of feeding the sentence, the entities mentioned in the sentence, and the knowledge graph triples related to the mentioned entities into the sentence-level encoder includes: The sentence contains word information, mentioned entity information, and relational information of multiple knowledge graph triples of the mentioned entities, which are then fed into the sentence-level encoder.

3. The method of claim 2, further comprising: The sentence is fed into a pre-trained language model, and the word embeddings output by the pre-trained language model are used as the word information. The mentioned entity is fed into a pre-trained knowledge embedding matrix, and the entity embedding output by the pre-trained knowledge embedding matrix is ​​used as the mentioned entity information. as well as The entity embeddings of the head and tail entities in the knowledge graph triples are calculated as the relation information.

4. The method of claim 3, wherein, The sentence and related knowledge graph triples of the entities mentioned in the sentence are fed into the sentence-level encoder, including: The type embedding matrix is ​​used to distinguish the word embeddings, the entity embeddings, and the relation embeddings, wherein the relation embeddings are the relation information; and The word embedding, the entity embedding, and the relation embedding are concatenated using start and delimiter symbols, and the target phrase is marked with special symbols.

5. The method of claim 2, wherein, The knowledge graph triplet of the mentioned entity is a triplet with the mentioned entity as the head entity and the number does not exceed a predetermined threshold.

6. The method of claim 2, wherein, The sentence output by the sentence-level encoder is constructed into a graph structure by including the feature representations of words, the feature representations of mentioned entities, and the feature representations of triple-related information. The feature representations of the words, the feature representations of the mentioned entities, and the feature representations of the relations are respectively used as word nodes, entity nodes, and relation nodes in the graph structure, wherein the feature representation of the triple-related information includes the feature representation of the relation of the triple; and Connect word nodes and related entity nodes, and connect entity nodes and related relation nodes to construct the edges of the graph structure.

7. The method of claim 6, wherein, The edges that connect word nodes and related entity nodes, and connect entity nodes and related relation nodes, to construct the graph structure include: Forward edges are used to represent connections from word nodes to related entity nodes, and connections from entity nodes to related relation nodes; and Add a reverse edge to the graph structure that is opposite in direction to the forward edge, wherein the forward edge and the reverse edge have trainable weights.

8. The method of claim 2, further comprising: During the training phase, the prediction of entity classification categories based on the natural language-enhanced entity features and relation features output by the graph encoder is used as an auxiliary training task for the entity classification model.

9. A knowledge-injection-based interactive system, comprising: The user input receiving unit is used to acquire user input queries; The question matching unit performs fine-grained classification of the entities contained in the query using the method described in any one of claims 1-8, and generates feedback based on the fine-grained classification. as well as A feedback providing unit is used to provide the generated feedback to the user.

10. A computing device, comprising: processor; as well as A memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method as described in any one of claims 1-8.

11. A non-transitory machine-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method as described in any one of claims 1-8.