Method for training entity classification model, entity classification method and apparatus

HK40076041BActive Publication Date: 2026-07-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
HK · HK
Patent Type
Patents
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2022-12-07
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Existing technologies have low accuracy in fine-grained entity classification in knowledge graphs and lack effective modeling of category differences, resulting in poor performance in identifying similar entities and refining entity domains.

Method used

By acquiring a sample training set, including original sample sentences, sample entities and their coarse and fine granular category labels, an entity classification model is constructed. The model is trained using the first and second sample sentences, guiding the model to learn the correct entity category. Furthermore, through a category-rich hierarchical comparison strategy and descriptive information, the accuracy of the model in fine-grained classification is improved.

Benefits of technology

It improves the entity classification model's ability to identify fine-grained entities, enhances its ability to distinguish similar multi-level entity categories and identify different levels of categories, and improves the quality of knowledge graph construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

This application provides a fine-grained entity classification method, apparatus, and electronic device for knowledge graph construction, relating to the field of machine learning in artificial intelligence. The fine-grained entity classification method includes: acquiring a statement to be classified; the statement to be classified includes entities to be classified; acquiring a first statement based on the entities to be classified, the statement to be classified, and preset annotation information; performing entity classification prediction on the first statement using an entity classification model to obtain a fine-grained entity classification result corresponding to the statement to be classified; the entity classification model is trained as follows: acquiring a sample training set; sample category labels include coarse-grained category labels and fine-grained category labels; acquiring a first sample statement and a second sample statement corresponding to the original sample statement; the first sample statement includes the original sample statement and annotation information; the second sample statement includes the original sample statement and fine-grained category labels; and training the initial classification model to obtain an entity classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and more specifically, to a training method for an entity classification model, an entity classification method, and an apparatus. Background Technology

[0002] In the library and information science field, knowledge graphs are known as knowledge domain visualization or knowledge domain mapping maps. They are a series of different graphics that show the development process and structural relationships of knowledge. They use visualization technology to describe knowledge resources and their carriers, and to mine, analyze, construct, draw and display knowledge and the interrelationships between them.

[0003] With the development of knowledge graph technology, entity classification is a fundamental task in knowledge graph construction, aiming to categorize entities within the graph. Currently, classification is typically performed by constructing representation features of entities, but this method has relatively low accuracy for fine-grained entity classification. Summary of the Invention

[0004] The purpose of this application is to provide a training method for an entity classification model, an entity classification method, and an apparatus. The technical solution provided by this application is as follows:

[0005] On the one hand, embodiments of this application provide a fine-grained entity classification method for knowledge graph construction, the method comprising:

[0006] Obtain the statement to be classified; the statement to be classified includes the entity to be classified;

[0007] The first statement is obtained based on the entity to be classified, the statement to be classified, and the preset annotation information;

[0008] The entity classification model is used to predict the entity classification of the first statement, and the fine-grained entity classification result corresponding to the statement to be classified is obtained.

[0009] The entity classification model was trained in the following way:

[0010] Obtain a sample training set; wherein, the sample training set includes multiple original sample statements, and sample category labels of sample entities in each original sample statement; the sample category labels include coarse-grained category labels and fine-grained category labels, and the fine-grained category labels are sub-category labels of the coarse-grained category labels;

[0011] For each original sample statement, obtain the first sample statement and the second sample statement corresponding to the original sample statement; wherein, the first sample statement includes the original sample statement and annotation information; the second sample statement includes the original sample statement and fine-grained category label;

[0012] Based on each first sample statement, each second sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

[0013] In some possible implementations, obtaining the first sample statement corresponding to the original sample statement includes:

[0014] The sample entities in the original sample statement are combined with the annotation information to form the first sample reference statement.

[0015] The first sample reference statement is combined with the original sample statement to form the first sample statement.

[0016] In some possible implementations, obtaining a second sample statement corresponding to the original sample statement includes:

[0017] Based on the sample entities and fine-grained category labels in the original sample statement, obtain the second sample reference statement corresponding to the original sample statement;

[0018] The second sample statement is obtained by combining the second sample reference statement with the original sample statement.

[0019] In some possible implementations, the training method for the entity classification model also includes the following steps:

[0020] For each original sample statement, obtain the third sample statement corresponding to the original sample statement; wherein, the third sample statement includes descriptive information for the fine-grained category label;

[0021] Based on each first sample statement, each second sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain an entity classification model, including:

[0022] Based on each first sample statement, each second sample statement, each third sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

[0023] In some possible implementations, obtaining a third sample statement corresponding to the original sample statement includes:

[0024] Retrieve descriptive information for fine-grained category labels from the pre-defined concept database;

[0025] The descriptive information of the fine-grained category labels is concatenated after the preset entity to obtain the first combination of information;

[0026] By attaching fine-grained category labels to the preset entities, a second set of combined information is obtained;

[0027] By concatenating the second set of information after the first set of information, a third sample statement is obtained.

[0028] In some possible implementations, the initial classification model includes a first initial encoder, a second initial encoder, and an initial predictor;

[0029] Based on each first sample statement, each second sample statement, each third sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain an entity classification model, including:

[0030] Each first sample statement is input into the first initial encoder to obtain the first semantic vector for the first sample statement and the first category expression vector for the first sample reference statement.

[0031] The first semantic vector is input into the initial predictor to obtain the predicted category label;

[0032] Each second sample statement and each third sample statement are input into the second initial encoder to obtain the second category expression vector and the third category expression vector;

[0033] The total training loss is determined based on the first class expression vector, the second class expression vector, the third class expression vector, the predicted class label, and the sample class label.

[0034] If the total training loss does not meet the preset training termination condition, the steps of adjusting the parameters of the initial classification model, obtaining the first class expression vector, predicted class label, second class expression vector, third class expression vector, and determining the total training loss are repeated until the total training loss meets the training termination condition. The first initial encoder and initial predictor at the end of training are then used as the trained entity classification model.

[0035] In some possible implementations, the total training loss is determined based on the first class expression vector, the second class expression vector, the third class expression vector, the predicted class label, and the sample class label, including:

[0036] The first loss is determined based on the predicted class label and the sample class label of each first sample statement;

[0037] The second loss is determined based on the first-class expression vector, the second-class expression vector, and the third-class expression vector corresponding to each original sample statement.

[0038] The total training loss is determined based on the first loss and the second loss.

[0039] In some possible implementations, a second loss is determined based on the first-class expression vector, the second-class expression vector, and the third-class expression vector corresponding to each original sample statement, including:

[0040] The first category expression vector, the second category expression vector, and the third category expression vector are divided according to coarse-grained category labels and fine-grained category labels;

[0041] The coarse-grained difference loss value is determined based on the category expression vectors with the same coarse-grained category label and the category expression vectors with different coarse-grained category labels.

[0042] The fine-grained difference loss value is determined based on the category expression vectors with the same fine-grained category label and the category expression vectors with different fine-grained category labels.

[0043] The second loss is determined based on the coarse-grained difference loss value and the fine-grained difference loss value.

[0044] In some possible implementations, the coarse-grained difference loss value is determined based on category representation vectors with the same coarse-grained category label and category representation vectors with different coarse-grained category labels, including:

[0045] The differences between category representation vectors with the same coarse-grained category labels are determined to obtain the first coarse-grained difference;

[0046] The difference between category representation vectors with different coarse-grained category labels is determined to obtain the second coarse-grained difference;

[0047] The coarse-grained difference loss value is determined based on the first coarse-grained difference and the second coarse-grained difference.

[0048] In some possible implementations, the fine-grained difference loss value is determined based on category representation vectors with the same fine-grained category label and category representation vectors with different fine-grained category labels, including:

[0049] The first fine-grained difference is obtained by determining the differences between category representation vectors with the same fine-grained category label;

[0050] The difference between category representation vectors with different fine-grained category labels is determined to obtain the second fine-grained difference;

[0051] The fine-grained difference loss value is determined based on the first fine-grained difference and the second fine-grained difference.

[0052] On the other hand, embodiments of this application provide a fine-grained entity classification device for knowledge graph construction, characterized in that the device includes:

[0053] The first acquisition module is used to acquire statements to be classified; the statements to be classified include entities to be classified.

[0054] The second acquisition module is used to acquire the first statement based on the entity to be classified, the statement to be classified, and the preset annotation information;

[0055] The classification module is used to predict the entity classification of the first statement using an entity classification model, and obtain the fine-grained entity classification result corresponding to the statement to be classified.

[0056] The training module is used to train the entity classification model, specifically for:

[0057] Obtain a sample training set; wherein, the sample training set includes multiple original sample statements, and sample category labels of sample entities in each original sample statement; the sample category labels include coarse-grained category labels and fine-grained category labels, and the fine-grained category labels are sub-category labels of the coarse-grained category labels;

[0058] For each original sample statement, obtain the first sample statement and the second sample statement corresponding to the original sample statement; wherein, the first sample statement includes the original sample statement and annotation information; the second sample statement includes the original sample statement and fine-grained category label;

[0059] Based on each first sample statement, each second sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

[0060] In some possible implementations, when the training module obtains the first sample statement corresponding to the original sample statement, it specifically performs the following:

[0061] The sample entities in the original sample statement are combined with the annotation information to form the first sample reference statement.

[0062] The first sample reference statement is combined with the original sample statement to form the first sample statement.

[0063] In some possible implementations, obtaining a second sample statement corresponding to the original sample statement includes:

[0064] Based on the sample entities and fine-grained category labels in the original sample statement, obtain the second sample reference statement corresponding to the original sample statement;

[0065] The second sample statement is obtained by combining the second sample reference statement with the original sample statement.

[0066] In some possible implementations, the training module is also used for:

[0067] For each original sample statement, obtain the third sample statement corresponding to the original sample statement; wherein, the third sample statement includes descriptive information for the fine-grained category label;

[0068] When the training module trains the initial classification model based on each first sample statement, each second sample statement, and the corresponding sample category labels to obtain the entity classification model, it is specifically used for:

[0069] Based on each first sample statement, each second sample statement, each third sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

[0070] In some possible implementations, when the training module obtains the third sample statement corresponding to the original sample statement, it specifically performs the following:

[0071] Retrieve descriptive information for fine-grained category labels from the pre-defined concept database;

[0072] The descriptive information of the fine-grained category labels is concatenated after the preset entity to obtain the first combination of information;

[0073] By attaching fine-grained category labels to the preset entities, a second set of combined information is obtained;

[0074] By concatenating the second set of information after the first set of information, a third sample statement is obtained.

[0075] In some possible implementations, the initial classification model includes a first initial encoder, a second initial encoder, and an initial predictor;

[0076] When the training module trains the initial classification model based on each first sample statement, each second sample statement, each third sample statement, and the corresponding sample category labels to obtain the entity classification model, it is specifically used for:

[0077] Each first sample statement is input into the first initial encoder to obtain the first semantic vector for the first sample statement and the first category expression vector for the first sample reference statement.

[0078] The first semantic vector is input into the initial predictor to obtain the predicted category label;

[0079] Each second sample statement and each third sample statement are input into the second initial encoder to obtain the second category expression vector and the third category expression vector;

[0080] The total training loss is determined based on the first class expression vector, the second class expression vector, the third class expression vector, the predicted class label, and the sample class label.

[0081] If the total training loss does not meet the preset training termination condition, the steps of adjusting the parameters of the initial classification model, obtaining the first class expression vector, predicted class label, second class expression vector, third class expression vector, and determining the total training loss are repeated until the total training loss meets the training termination condition. The first initial encoder and initial predictor at the end of training are then used as the trained entity classification model.

[0082] In some possible implementations, when determining the total training loss based on the first class representation vector, the second class representation vector, the third class representation vector, the predicted class label, and the sample class label, the training module specifically performs the following:

[0083] The first loss is determined based on the predicted class label and the sample class label of each first sample statement;

[0084] The second loss is determined based on the first-class expression vector, the second-class expression vector, and the third-class expression vector corresponding to each original sample statement.

[0085] The total training loss is determined based on the first loss and the second loss.

[0086] In some possible implementations, when the training module determines the second loss based on the first-class expression vector, the second-class expression vector, and the third-class expression vector corresponding to each original sample statement, it is specifically used for:

[0087] The first category expression vector, the second category expression vector, and the third category expression vector are divided according to coarse-grained category labels and fine-grained category labels;

[0088] The coarse-grained difference loss value is determined based on the category expression vectors with the same coarse-grained category label and the category expression vectors with different coarse-grained category labels.

[0089] The fine-grained difference loss value is determined based on the category expression vectors with the same fine-grained category label and the category expression vectors with different fine-grained category labels.

[0090] The second loss is determined based on the coarse-grained difference loss value and the fine-grained difference loss value.

[0091] In some possible implementations, when the training module determines the coarse-grained difference loss value based on class representation vectors with the same coarse-grained class label and class representation vectors with different coarse-grained class labels, it is specifically used for:

[0092] The differences between category representation vectors with the same coarse-grained category labels are determined to obtain the first coarse-grained difference;

[0093] The difference between category representation vectors with different coarse-grained category labels is determined to obtain the second coarse-grained difference;

[0094] The coarse-grained difference loss value is determined based on the first coarse-grained difference and the second coarse-grained difference.

[0095] In some possible implementations, when the training module determines the fine-grained difference loss value based on class representation vectors with the same fine-grained class label and class representation vectors with different fine-grained class labels, it is specifically used for:

[0096] The first fine-grained difference is obtained by determining the differences between category representation vectors with the same fine-grained category label;

[0097] The difference between category representation vectors with different fine-grained category labels is determined to obtain the second fine-grained difference;

[0098] The fine-grained difference loss value is determined based on the first fine-grained difference and the second fine-grained difference.

[0099] On the other hand, embodiments of this application also provide an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method provided in any optional embodiment of this application.

[0100] On the other hand, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method provided in any optional embodiment of this application.

[0101] On the other hand, embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the methods provided in any optional embodiment of this application.

[0102] The beneficial effects of the technical solution provided in this application are as follows:

[0103] By obtaining a first sample statement corresponding to the original sample statement (which includes the original sample statement and annotation information) and a second sample statement (which includes the original sample statement and fine-grained category labels), an entity classification model can be trained using the first and second sample statements. This can guide the initial entity classification model to learn the correct entity category, thereby improving the accuracy of entity classification in the obtained model. Furthermore, it can also guide the model to learn the differences between annotation information and fine-grained category labels, thereby further improving the accuracy of fine-grained entity classification.

[0104] By comparing and interacting with the annotation information and fine-grained category labels, and sharing parameters with the first and second initial encoders, category knowledge is transferred from the second initial encoder, which encodes the second sample statement containing fine-grained category labels, to the first initial encoder, which encodes the first sample statement whose sample category labels are occluded. This improves the ability of the trained entity classification model to distinguish similar multi-level entity categories and further enhances the accuracy of the entity classification model for fine-grained classification.

[0105] Furthermore, by introducing descriptive information for fine-grained category labels into the third sample statement, richer category knowledge is directly exposed to the initial classification model, further demonstrating to the initial classification model what a specific type is, thereby improving the recognition ability of different levels of categories of the trained entity classification model. Attached Figure Description

[0106] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0107] Figure 1 A schematic diagram of a scheme for constructing a knowledge graph provided in an example;

[0108] Figure 2 This is a schematic diagram of a scheme for a fine-grained entity classification task provided in an example.

[0109] Figure 3 A schematic diagram illustrating the application environment of the training method for the entity classification model provided in this embodiment of the application;

[0110] Figure 4 A flowchart illustrating a training method for an entity classification model provided in an embodiment of this application;

[0111] Figure 5 This is a schematic diagram illustrating a scheme for obtaining the first and second sample statements in one example of this application;

[0112] Figure 6 This is a diagram illustrating the comparison of categories at different levels in one example of this application;

[0113] Figure 7 This is a schematic diagram illustrating the training method of an entity classification model in one example of this application;

[0114] Figure 8 A schematic diagram of the structure of a training device for an entity classification model provided in an embodiment of this application;

[0115] Figure 9 This is a schematic diagram of the structure of an electronic device to which this application applies. Detailed Implementation

[0116] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0117] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.” When describing multiple (two or more) items, if the relationship between the multiple items is not explicitly defined, the multiple items can refer to one, several or all of the multiple items. For example, the description of "parameter A includes A1, A2, A3" can be implemented as parameter A includes A1 or A2 or A3, or it can be implemented as parameter A includes at least two of the three items A1, A2 and A3.

[0118] In the library and information science field, knowledge graphs are known as knowledge domain visualization or knowledge domain mapping maps. They are a series of different graphics that show the development process and structural relationships of knowledge. They use visualization technology to describe knowledge resources and their carriers, and to mine, analyze, construct, draw and display knowledge and the interrelationships between them.

[0119] The knowledge graph construction process is as follows Figure 1As shown, the process includes: 1) Data extraction: obtaining structured raw entity data through three channels: web crawling, partner support, and internal ecosystem data support; 2) Data parsing: parsing the raw entity data into a unified format; 3) Classification and alignment: based on the parsed entity data, assigning entities to corresponding domain categories in the knowledge graph schema (a collection of database objects), and aligning entity attributes according to the predefined attributes of each domain in the schema; 4) Quality filtering and format cleaning of the values ​​of each attribute of the aligned entity; 5) Entity fusion: merging identical entities from different sources into one entity; 6) Relationship building: establishing links with other entities in the graph associated with the entity attribute values; 7) Entity output: outputting the complete knowledge graph data and storing it in a table; 8) Configuration platform management: managing the key links of each of the above stages in the configuration platform, and mounting the output data on the front-end kgop (a type of operation platform) operation platform.

[0120] like Figure 1 As shown, this fine-grained entity classification method can be applied to the classification alignment step in the knowledge graph construction process. Based on the descriptive text information of entities and targeting the category system in the knowledge graph schema, it can more accurately distinguish similar entity categories and classify them into more suitable domain categories for input entities. The entity category domain is an important attribute of the entity and one of the key pieces of information relied upon in the subsequent graph construction process.

[0121] In business practice, the fine-grained entity classification framework can assign entities in the knowledge graph to fine domains in the schema category system, better supporting the display of Lingxi cards in search scenarios, high-quality question answering in KBQA (Knowledge Graph-based Question Answering System) in search scenarios, data access in various vertical categories, and graph construction.

[0122] In the process of technological accumulation, downstream entity fusion and entity edge construction depend on the domain category assigned to the entities, especially the fine-grained domain category. Therefore, fine-grained entity classification methods with better ability to distinguish similar categories can improve the effect of downstream entity fusion and entity edge construction, thereby improving the quality of knowledge graph construction.

[0123] Fine-grained entity classification (FET) aims to assign the correct semantic category to an input entity based on its context. Figure 2 As shown in the example, for the input entity "Vivien Leigh", the FET framework identifies the entity's category in its context as "person,person / actor", which includes both coarse-grained and fine-grained categories.

[0124] The input to Fine-Grained Entity Classification (FET) is a dataset D = {x1, x2, ..., xn} containing n sentences. n Given a predefined hierarchical ontology Y, where each sentence x contains a labeled entity e, the FET system needs to assign a corresponding category to a given labeled entity. Methodologically, for sentence x... n Each input sequence w n ={w 1 n ,w 2 n ,...,w t n}, FET aims to predict the correct hierarchical category Y n ={y 1 n ,y 2 n ,...,y m n The marked entity e ∈ Y n ={w l n ,...,w r n}. Among them, Y n Refers to entity e n The correct set of categories, where m is the m-th category in that set. For example, in Figure 2 In the example, the correct category set for "Vivien Leigh" is { / person, / person / actor}, which contains a coarse-grained category " / person" and a fine-grained category " / person / actor".

[0125] Optionally, the training of the entity classification model involved in the method provided in this application embodiment can be implemented based on artificial intelligence (AI).

[0126] Artificial intelligence (AI) encompasses the theories, methods, technologies, and application systems that utilize digital computers or computers-controlled machines to simulate, extend, and expand human intelligence, enabling them to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce new intelligent machines capable of reacting in a manner similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.

[0127] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0128] Machine Learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.

[0129] The solutions provided in this application involve technologies such as training methods for entity classification models in artificial intelligence, which are specifically illustrated through the following embodiments.

[0130] The following description of several optional embodiments illustrates the technical solutions provided in this application and the technical effects produced by these solutions. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0131] Current fine-grained entity classification methods typically classify entities by constructing representation features, resulting in low accuracy.

[0132] Furthermore, most approaches primarily focus on identifying what a category is like, but rarely directly model the differences between categories—that is, learning the degree to which one category differs from others. This type of framework has a problem that can be further optimized: identifying fine-grained entity categories by mining more category information, category representations, and entity representations, compared to directly modeling category differences, these methods mostly learn category differences indirectly. Relatively speaking, they are not efficient at identifying similar categories, especially similar fine-grained categories. This problem becomes more pronounced when transferring FET methods to business knowledge graph entity classification tasks, particularly when identifying more similar and refined entity domains.

[0133] To address the aforementioned issues, this paper proposes a training method for an entity classification model. By embedding entity categories into the entity context, the model is guided to learn the correct entity category, thereby improving the accuracy of entity classification.

[0134] By employing a hierarchical comparison strategy rich in categories, this method directly quantifies the differences between hierarchical categories, improving the model's ability to distinguish similar multi-level entity categories. Specifically, this method embeds entity categories into the entity context through a prompt, establishing a category-rich entity representation and guiding the model to learn the correct entity category. Here, the prompt is a non-specific or completely abstract text (or continuous word sequence) fragment expressing a certain pattern.

[0135] In addition, this method introduces a small number of category descriptions, directly exposing the model to richer category knowledge, further showing the model what a specific type is, and improving the hierarchical category recognition capability.

[0136] The training method and entity classification method of the entity classification model provided in this application embodiment can be executed by any computer device. Optionally, they can be executed by a server. The server can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed system.

[0137] like Figure 3 As shown, Figure 3 This is an entity diagram illustrating the application environment of the fine-grained entity classification method provided in this embodiment. The fine-grained entity classification method is executed by server 301. Specifically, server 301 acquires a sample training set, and for each original sample statement, acquires a first sample statement and a second sample statement corresponding to the original sample statement; based on each first sample statement, each second sample statement, and the corresponding sample category labels, it trains an initial classification model to obtain an entity classification model. Server 301 receives the statement to be classified sent by terminal 302, acquires the first statement corresponding to the entity to be classified; performs entity classification prediction on the first statement using the entity classification model to obtain a fine-grained entity classification result, and sends the fine-grained entity classification result to terminal 302.

[0138] In the above embodiments, the entity classification model is trained by a server; in other embodiments, the entity classification model can be trained directly by the terminal, and entity classification can be performed.

[0139] Those skilled in the art will understand that a server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0140] The terminal (also referred to as a user terminal or user equipment) can be a smartphone, tablet, laptop, desktop computer, intelligent voice interaction device (such as a smart speaker), wearable electronic device (such as a smartwatch), in-vehicle terminal, smart home appliance (such as a smart TV), AR / VR device, etc., but is not limited thereto. The terminal and the server can be connected directly or indirectly through wired or wireless communication, which is not limited herein.

[0141] Figure 4 This illustration shows a flowchart of a fine-grained entity classification method for knowledge graph construction provided in an embodiment of this application. This method can be executed by a server or a terminal. Figure 4 As shown, the fine-grained entity classification method provided in this application may include the following steps:

[0142] Step S401: Obtain the statement to be classified.

[0143] The statements to be classified include entities to be classified.

[0144] Specifically, the statement to be classified includes the entity to be classified and the position of the entity in the statement, but what needs to be determined is the category label of the entity in the statement.

[0145] Step S402: Obtain the first statement based on the entity to be classified, the statement to be classified, and the preset annotation information.

[0146] The annotation information may include the first annotation word that has no category meaning.

[0147] Specifically, the preset annotation information and the entities to be classified in the statement to be classified can be combined to obtain the first reference statement for the statement to be classified.

[0148] For example, the first tag word could be "mask". If the entity to be classified in the statement to be classified is "X", then the first reference statement for the statement to be classified could be "X is a[MASK]".

[0149] In the specific implementation process, the first reference statement corresponding to the entity to be classified is combined with the statement to be classified to obtain the first statement.

[0150] Specifically, the first reference statement can be appended to the statement to be classified to obtain the first statement.

[0151] In some possible implementations, a first reference statement corresponding to the entity to be classified can be connected to the statement to be classified by a preset second label word to obtain the first statement.

[0152] The second tag can be used to represent the semantics of the first statement after encoding.

[0153] For example, the second tag word could be [ENT], which, after encoding, could indicate that the first reference statement tends to express a different category of expression.

[0154] Step S403: Perform entity classification prediction on the first statement using the entity classification model to obtain the fine-grained entity classification result corresponding to the statement to be classified.

[0155] The entity classification model may include a first encoder and a predictor. The first encoder encodes a first statement to obtain the semantics of the first reference statement. The predictor then classifies the semantics of the first reference statement to obtain the fine-grained entity classification result corresponding to the statement to be classified.

[0156] The entity classification model can be trained in the following way:

[0157] (1) Obtain the sample training set.

[0158] The training set includes multiple original sample statements and sample category labels for the sample entities in each original sample statement.

[0159] Specifically, each original sample statement in the sample training set includes: the sample entity, the position of the sample entity in the original sample statement, and the sample category label of the sample entity in the original sample statement.

[0160] The sample category labels include coarse-grained category labels and fine-grained category labels, with the fine-grained category labels being subcategories of the coarse-grained category labels.

[0161] For example, if the original sample statement is "he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper", the sample entity can be labeled as "Vivien Leigh". This allows us to determine the position of the sample entity in the original sample statement. In addition, we can also label the sample entity "Vivien Leigh" with the coarse-grained category label "person" and the fine-grained category label "person / actor".

[0162] (2) For each original sample statement, obtain the first sample statement and the second sample statement corresponding to the original sample statement.

[0163] The first sample statement includes the original sample statement and annotation information; the second sample statement includes the original sample statement and fine-grained category labels.

[0164] Specifically, the annotation information and the sample entities in the original sample statement can be combined, and the combined information can be concatenated after the original sample statement to obtain the first sample statement. The first sample statement obtained in this way can mask the sample category label of the original statement.

[0165] Specifically, fine-grained category labels and sample entities in the original sample statement can be combined, and the combined information can be appended to the original sample statement to obtain a second sample statement. This second sample statement can directly represent the fine-grained category label of the original sample statement.

[0166] The specific process of obtaining the first and second sample statements will be explained in more detail below.

[0167] (3) Based on each first sample statement, each second sample statement and the corresponding sample category label, the initial classification model is trained to obtain the entity classification model.

[0168] Step S404: Based on each first sample statement and its corresponding sample category label, repeatedly perform training operations on the initial classification model until the total training loss meets the preset training termination condition, and obtain the trained entity classification model based on the classification model at the end of training.

[0169] The training operation may include:

[0170] a) Input each first sample statement into the initial classification model. Through the initial classification model, extract the first category expression vector of the first sample statement and predict the predicted category label corresponding to each first sample statement.

[0171] b. Input each second sample statement into the initial classification model, and extract the second category expression vector of the second sample statement through the initial classification model;

[0172] c. Determine the total training loss based on the predicted class label and sample class label of each first sample statement, as well as the first class expression vector and the second class expression vector;

[0173] d. Adjust the model parameters of the initial classification model based on the total training loss.

[0174] Specifically, if the total training loss does not meet the preset training termination condition, the process of adjusting the model parameters of the initial classification model, inputting each first sample statement and second sample statement into the initial classification model, predicting the predicted class label corresponding to each first sample statement through the initial classification model, extracting the first class expression vector of the first sample statement, extracting the second class expression vector of the second sample statement, and determining the total training loss based on the predicted class label and sample class label of each first sample statement, as well as the first class expression vector and the second class expression vector, continues until the total training loss meets the preset training termination condition.

[0175] If the total training loss meets the preset training termination condition, then the entity classification model is obtained through the initial classification model at this point.

[0176] The training termination condition may include reaching a preset number of training iterations, convergence of the total training loss, or the total training loss being less than a preset threshold; no specific limitations are specified here.

[0177] In the above embodiments, by obtaining a first sample statement corresponding to the original sample statement, which includes annotation information to obscure the sample category label in the original sample statement; and obtaining a second sample statement corresponding to the original sample statement, which includes fine-grained labels of the original sample statement to directly reflect the fine-grained labels in the original sample statement, and then training the initial classification model based on the first and second sample statements, the initial entity classification model can be guided to distinguish between the annotation information and the fine-grained category labels, thereby improving the accuracy of fine-grained entity classification of the obtained entity classification model.

[0178] The following will further illustrate the specific process of obtaining the first sample statement and the second sample statement with reference to the embodiments.

[0179] In some possible implementations, obtaining the first sample statement corresponding to the original sample statement may include:

[0180] A. Combine the sample entities and annotation information in the original sample statement to form the first sample reference statement.

[0181] The annotation information is used to replace the sample category label in the original sample statement.

[0182] Specifically, the annotation information may include a first annotation word that has no category meaning. The first annotation word is used to replace the sample category label, so that the first sample reference statement does not directly reflect the meaning of the sample category label.

[0183] For example, the first label word could be "mask". If the original sample statement is "he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper", then the first sample reference statement could be "Vivien Leigh is a [MASK]". The position of "[MASK]" should be the sample category label, but a [MASK] with no actual category meaning is used to replace the sample category label.

[0184] Specifically, for different original sample statements, the first tag word can be the same, which is a word without category meaning; different first tag words can also be set for different original sample statements, but the first tag word does not reflect the meaning of the sample category label of the original sample statement.

[0185] In the specific implementation process, the first annotation word can be connected to the sample entity using preset connector words to obtain the first sample reference statement.

[0186] The conjunction can be a grammatical conjunction. For example, if the sample entity is the person "Vivien Leigh", the conjunction can be "is a"; if the sample entity is a building, the conjunction can be "is".

[0187] B. Combine the first sample reference statement with the original sample statement to form the first sample statement. Specifically, the first sample reference statement can be appended after the original sample statement to obtain the first sample statement.

[0188] In the specific implementation process, a preset second annotation word can be used to connect the first sample reference statement after the original sample statement to obtain the first sample statement.

[0189] The second annotation term can be used to represent the semantics of the first sample reference statement after encoding.

[0190] For example, the second tag word could be [ENT], which, after encoding, could indicate that the first sample reference statement tends to express a different category of expression.

[0191] For example, if the original sample statement is "he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper", then the first sample reference statement can be "Vivien Leigh is a [MASK]". By connecting the first sample reference statement to the original sample statement using the second tag [ENT], we get "he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper [ENT] Vivien Leigh is a [MASK]".

[0192] In some possible implementations, obtaining the second sample statement corresponding to the original sample statement may include:

[0193] C. Based on the sample entities and fine-grained category labels in the original sample statement, obtain the second sample reference statement corresponding to the original sample statement.

[0194] Specifically, the sample entity can be directly combined with the second category label to obtain the second sample reference statement.

[0195] In practice, a connector can be used to link the second category label after the sample entity to obtain the second sample reference statement.

[0196] The conjunction can be a grammatical conjunction. For example, if the sample entity is the person "Vivien Leigh", the conjunction can be "is a"; if the sample entity is a building, the conjunction can be "is".

[0197] For example, if the sample entity is "Vivien Leigh", the first category label is "person", and the second category label is "actor", then the second sample reference statement could be "Vivien Leigh is an actor".

[0198] D. Combine the second sample reference statement with the original sample statement to obtain the second sample statement.

[0199] Specifically, the second sample reference statement can be concatenated after the original sample statement to obtain the second sample statement.

[0200] In the specific implementation process, a pre-set second annotation term can be used to connect the second sample reference statement after the original sample statement to obtain the second sample statement.

[0201] The second annotation term can be used to represent the semantics of the first sample reference statement after encoding.

[0202] For example, the second tag word could be [ENT], which, after encoding, could indicate that the second sample reference statement tends to express a different category of expression.

[0203] For example, if the original sample statement is "he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper", then the second sample reference statement can be "Vivien Leigh is an actor". By connecting the second sample reference statement to the original sample statement using the second tag [ENT], we get "he described his portrait of actress Vivien Leigh aslit by a top spotlight diffused by tracing paper [ENT] Vivien Leigh is an anancot".

[0204] In the specific implementation process, the initial classification model may include a first initial encoder, a second initial encoder, and an initial predictor. Using the original sample statements, corresponding first and second sample statements are obtained. The first initial encoder encodes the first sample statement to obtain a first category expression vector for the first sample reference statement and a first semantic vector for the first sample statement. The second initial encoder encodes the second sample statement to obtain a second category expression vector for the second sample reference statement. The initial predictor predicts the sample prediction label based on the first semantic vector. The first initial encoder, second initial encoder, and initial predictor are trained based on the differences between the sample prediction label and the sample category label, and the differences between the first and second category expression vectors. The trained first encoder and predictor are then used as the entity classification model.

[0205] In the above embodiments, by comparing and interacting with the annotation information and fine-grained category labels, and by sharing parameters with the first and second initial encoders, category knowledge is transferred from the second initial encoder, which is used to encode the second sample statement containing fine-grained category labels, to the first initial encoder, which is used to encode the first sample statement whose sample category labels are occluded. This improves the ability of the trained entity classification model to distinguish similar multi-level entity categories and further improves the accuracy of the entity classification model for fine-grained classification.

[0206] In other implementations, descriptive information for the second category label may be introduced, and the corresponding third sample statement may be obtained based on the descriptive information.

[0207] In some possible implementations, the training method for the entity classification model also includes the following steps:

[0208] For each original sample statement, obtain the third sample statement corresponding to the original sample statement.

[0209] The third sample statement includes descriptive information for fine-grained category labels.

[0210] The descriptive information can be an explanation of the second category label.

[0211] Specifically, obtaining the third sample statement corresponding to the original sample statement can include:

[0212] (1) Query the description information for fine-grained category labels from the preset concept database.

[0213] Specifically, descriptive information for the second category label can be obtained from a pre-set concept database. The second category label is a noun, and the concept database has corresponding explanations, i.e., corresponding descriptive information, for different nouns.

[0214] For example, if the fine-grained category label is "person / actor", the corresponding description information could be "person who can perform".

[0215] (2) Connect the description information of the fine-grained category label to the preset entity to obtain the first combination information.

[0216] The preset entity can be a fictitious entity that is unrelated to the entity in the original sample statement.

[0217] For example, if the sample entity in the original sample statement is "Vivien Leigh", then an entity "e" that is unrelated to the sample entity can be set. vir ".

[0218] Specifically, the descriptive information of fine-grained category labels can be concatenated after the preset entity to obtain the first combination of information.

[0219] For example, if the fine-grained category label is "actor" and the description information for the fine-grained category label is "person who can perform", then the first combination of information could be "e". vir "person who can perform".

[0220] (3) Connect the fine-grained category label after the preset entity to obtain the second combination information.

[0221] For example, the default entity is "e" vir If the coarse-grained category label is "person" and the fine-grained category label is "actor", then the second combination of information could be "e". vir "is an actor."

[0222] (4) Connect the second set of information after the first set of information to obtain the third sample statement.

[0223] Specifically, a second tag can be used to connect the second combination of information after the first combination of information.

[0224] The second tag, after encoding, can indicate that the second combination of information tends to express different categories. For example, the second tag can be "[ENT]".

[0225] For example, if the first combination of information is "e" vir The second set of information is "e" (person who can perform). vir "is an actor", then the third sample statement can be "e vir a person who can perform [ENT]e vir is anactor.

[0226] In the above embodiments, by introducing descriptive information for fine-grained category labels into the third sample statement, richer category knowledge is directly exposed to the initial classification model, further showing the initial classification model what a specific type is, thereby improving the recognition ability of different levels of categories of the trained entity classification model.

[0227] To more clearly illustrate the first, second, and third sample statements of this application, the following will further explain the specific construction process of the first, second, and third sample statements of this application with examples.

[0228] like Figure 5 As shown, in one example, the original sample statement is "he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper"; the sample entity is "Vivien Leigh"; the sample category labels for the sample entity "Vivien Leigh" include the coarse-grained category label "person" and the fine-grained category label "actor";

[0229] Obtaining the first sample statement may include the following steps:

[0230] 1) Use preset connectors to connect the first annotation word after the sample entity to obtain the first sample reference statement;

[0231] The first tag word is "[MASK]", and the first sample reference statement is "Vivien Leigh is a[MASK]".

[0232] 2) The first sample reference statement is appended to the original sample statement using a pre-defined second annotation term to obtain the first sample statement;

[0233] By connecting the first sample reference statement to the original sample statement using the second annotation [ENT], we get "he described his portrait of actress Vivien Leigh as lit by a top spotlight dimiffused by tracing paper [ENT] Vivien Leigh is a [MASK]";

[0234] 3) A third tag word “[CLS]” can be inserted at the beginning of the first sample sentence. The third tag word can be used to express the first semantic vector of the first sample sentence after encoding, that is, the result is “[CLS]he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper[ENT]Vivien Leigh is a[MASK]” shown in the figure.

[0235] The first sample statement mentioned above can also be called a type-scare expression.

[0236] Obtaining a second sample statement may include the following steps:

[0237] 1) Combine the sample entity in the original sample statement with the fine-grained category label to obtain the second sample reference statement; the sample entity is "Vivien Leigh", the coarse-grained category label is "person", and the fine-grained category label is "actor", then the second sample reference statement can be "Vivien Leigh is an actor".

[0238] 2) Combine the second sample reference statement with the original sample statement to obtain the second sample statement; the second sample reference statement is "Vivien Leigh is an actor". By using the second annotation word [ENT], the second sample reference statement "Vivien Leigh is an actor" is connected to the original sample statement to obtain "he described his portrait of actress Vivien Leigh as lit by a top spotlight diffused by tracing paper [ENT]Vivien Leigh is an actor".

[0239] Obtaining a third-sample statement may include the following steps:

[0240] 1) Concatenate the description information of the fine-grained category labels after the preset entity to obtain the first combination information; set an entity "e" that is unrelated to the sample entity. vir If the fine-grained category label is "actor" and the description information for the fine-grained category label is "person who can perform", then the first combination of information can be "e". vir "person who can perform";

[0241] 2) Fine-grained category tags are appended to a preset entity using a predefined connector to obtain the second set of information; the preset entity is "e". vir If the coarse-grained category label is "person" and the fine-grained category label is "actor", then the second combination of information could be "e". vir "is an actor";

[0242] 3) The second combination of information is appended to the first combination of information using a preset second tag word to obtain the second combination statement; the second tag word can be "[ENT]", and the first combination of information is "e". vir The second set of information is "e" (person who can perform).vir "is an actor", then the third sample statement can be "e vir a person who can perform [ENT]e vir "is an actor";

[0243] Both the second and third sample statements mentioned above can be referred to as type-rich expressions.

[0244] The above embodiments illustrate the specific process of obtaining the first sample statement, the second sample statement, and the third sample statement. The following will illustrate the specific process of determining the total loss in conjunction with the embodiments.

[0245] In some possible implementations, the initial classification model includes a first initial encoder, a second initial encoder, and an initial predictor.

[0246] Based on each first sample statement, each second sample statement, each third sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain an entity classification model, including:

[0247] (1) Input each first sample statement into the first initial encoder to obtain the first semantic vector for the first sample statement and the first category expression vector for the first sample reference statement.

[0248] Specifically, a third tag word can be inserted into the first sample statement. The third tag word can be used to express the first semantic vector of the first sample statement after encoding.

[0249] For example, the third tag word could be "[CLS]". "[CLS]" can be inserted at the beginning of the first sample statement. The first sample statement after the insertion of the third tag word is encoded to obtain the expression vector for "[CLS]", which is the first semantic vector.

[0250] Specifically, the first sample statement includes the second annotation word "[ENT]". After encoding, "[ENT]" can indicate that the first sample reference statement tends to express different categories of expression. Therefore, by obtaining the expression vector of "[ENT]" in the first sample statement, the first category expression vector of the first sample reference statement can be obtained.

[0251] (2) Input the first semantic vector into the initial predictor to obtain the predicted category label.

[0252] Specifically, the initial predictor is used for classification, predicting the category of the first semantic vector to obtain the predicted category label.

[0253] (3) Input each second sample statement and the third sample statement into the second initial encoder to obtain the second category expression vector and the third category expression vector.

[0254] Similarly, the second sample statement also includes the second tag word "[ENT]". After encoding, "[ENT]" in the second sample statement can also represent the expression of the second sample reference statement that tends to express different categories. Therefore, by obtaining the expression vector of "[ENT]" in the second sample statement, the second category expression vector of the second sample reference statement can be obtained.

[0255] (4) Determine the total training loss based on the first category expression vector, the second category expression vector, the third category expression vector, the predicted category label, and the sample category label.

[0256] Specifically, the first loss can be determined based on the difference between the predicted class label and the sample class label; the second loss can be determined based on the difference between the first class expression vector, the second class expression vector, and the third class expression vector; and the total training loss can be determined based on the first loss and the second loss.

[0257] The specific calculation process for the total training loss will be explained in more detail below.

[0258] (5) If the total training loss does not meet the preset training termination condition, the steps of adjusting the parameters of the initial classification model and obtaining the first category expression vector, predicted category label, second category expression vector, third category expression vector and determining the total training loss are repeated until the total training loss meets the training termination condition. The first initial encoder and initial predictor at the end of training are used as the trained entity classification model.

[0259] Specifically, if the total training loss does not meet the training termination condition, the parameters of the initial classification model are continuously adjusted and training is repeated until the training termination condition is met.

[0260] It is important to note that during training, the parameters of the first initial encoder, the second initial encoder, and the initial predictor in the initial classification model are all adjusted. However, at the end of training, the first initial encoder and the initial predictor at the end of training are used as the trained entity classification model. That is, the second initial encoder is trained simultaneously during training, but when using the trained entity classification model in the actual online environment, the trained second initial encoder is not required.

[0261] The process of obtaining the total training loss will be further explained below with reference to specific embodiments.

[0262] In some possible implementations, the total training loss is determined based on the first class expression vector, the second class expression vector, the third class expression vector, the predicted class label, and the sample class label, and may include:

[0263] (1) Determine the first loss based on the predicted category label and sample category label of each first sample statement.

[0264] Specifically, the first loss can be determined based on the difference between the predicted class label and the sample class label.

[0265] In practice, the first loss can be determined based on cross-entropy or logistic regression function.

[0266] In the specific implementation process, the first sample statement is input into the first initial encoder to obtain the first semantic vector h for the first sample statement. [CLS]ts n The first semantic vector h [CLS]ts n Having already learned category knowledge, it is fed into the initial predictor to identify the category of the input sample entity, and the first loss is calculated using the following formula:

[0267]

[0268]

[0269] in, The first semantic vector is represented; MLP (Multilayer Perceptron) is a multilayer perceptron used for classifying people; L δ This represents the first loss, also known as the classification loss; BCEWithLogits is a commonly used cross-entropy loss function, suitable for multi-label classification tasks.

[0270] (2) Determine the second loss based on the first category expression vector, the second category expression vector and the third category expression vector corresponding to each original sample statement.

[0271] The second loss is used to represent the difference between the first category expression vector, the second category expression vector, and the third category expression vector.

[0272] Specifically, based on the first-class expression vector, second-class expression vector, and third-class expression vector corresponding to each original sample statement, the second loss is determined, including:

[0273] a. Divide the first category expression vector, the second category expression vector, and the third category expression vector according to coarse-grained category labels and fine-grained category labels.

[0274] In practice, it can be divided into the following four types:

[0275] Category representation vectors with the same coarse-grained category label and the same fine-grained category label, with the same coarse-grained category label but different fine-grained category labels, with different coarse-grained category labels but the same fine-grained category label, and with different coarse-grained category labels and different fine-grained category labels.

[0276] For a batch of input data There are two optimization objectives L f θ and L c θ The differences between fine-grained and coarse-grained optimization types are simulated respectively. Each optimization objective includes two sub-optimization objectives, one for narrowing the distance (L0) between similar types. f+ θ and L c+ θ ), while another is used to create different types of distances (L f- θ and L c- θ ):

[0277] b. Determine the coarse-grained difference loss value based on the category expression vectors with the same coarse-grained category label and the category expression vectors with different coarse-grained category labels.

[0278] like Figure 6 As shown, in the coarse-grained comparison space, this method does not concern itself with the fine-grained category for the coarse-grained category. For example, in the coarse-grained comparison space, for the coarse-grained category "Person", entities belonging to the same category are considered to be in the same category, while those not belonging to the "Person" category are considered to be in different categories. The figure does not compare the fine-grained categories for the different coarse-grained categories "building", "person", and "location", but the distance between sample entities belonging to "building" is reduced, and the distance between entities belonging to "person" is reduced.

[0279] Specifically, determining the coarse-grained difference loss value based on category representation vectors with the same coarse-grained category label and category representation vectors with different coarse-grained category labels can include:

[0280] b1. Determine the differences between category representation vectors with the same coarse-grained category labels to obtain the first coarse-grained difference.

[0281] Specifically, the first coarse-grained difference can be calculated using the following formula:

[0282]

[0283] in, This indicates the difference between labels with the same coarse-grainedness, i.e., the first coarse-grainedness difference; It is a collection of all coarse-grained categories in a batch. It is one of them; B C+ From all categories with the same coarse granularity of and Composition. s is x i and x j The similarity between them.

[0284] b2. Determine the differences between category representation vectors with different coarse-grained category labels to obtain the second coarse-grained difference.

[0285] Specifically, the second coarse-grained difference can be calculated using the following formula:

[0286]

[0287] in, This indicates the difference between labels with different coarse-grained levels, i.e., the second coarse-grained difference; B C- From all categories with different coarseness of and Composition. s is x i and x j The similarity between them.

[0288] b3. Determine the coarse-grained difference loss value based on the first coarse-grained difference and the second coarse-grained difference.

[0289] Specifically, the sum of the first coarse-grained difference and the second coarse-grained difference can be used as the coarse-grained difference loss value.

[0290] c. Determine the fine-grained difference loss value based on the category representation vectors with the same fine-grained category label and the category representation vectors with different fine-grained category labels.

[0291] like Figure 7 As shown, in the fine-grained contrast space, only the differences between fine-grained categories under the same coarse-grained category are modeled. The same fine-grained category under the same coarse-grained category is treated as the same category, and the distance between its corresponding sample entities is shortened. At the same time, different fine-grained categories under the same coarse-grained category are treated as different categories, and the distance between their corresponding sample entities is increased. In the figure, the distances between different fine-grained categories "actor," "coach," and "athlete" under the same coarse-grained category "person" are increased.

[0292] Specifically, determining the fine-grained difference loss value based on category representation vectors with the same fine-grained category label and category representation vectors with different fine-grained category labels can include:

[0293] c1. Determine the differences between category representation vectors with the same fine-grained category labels to obtain the first fine-grained difference.

[0294] Specifically, the first fine-grained difference can be calculated using the following formula:

[0295]

[0296] in, This indicates the difference between those with the same fine-grained labels, i.e., the first fine-grained difference; It is a collection of all fine-grained categories in a batch. It is one of them; B f+ From all categories with the same fine granularity of and Composition. s is x i and x j The similarity between them.

[0297] c2. Determine the differences between category representation vectors with different fine-grained category labels to obtain the second fine-grained difference.

[0298] Specifically, the second fine-grained difference can be calculated using the following formula:

[0299]

[0300] in, This indicates the difference between labels with different fine-grained levels, i.e., the second fine-grained difference; B f- From all categories with different fineness of and Composition. s is x i and x j The similarity between them.

[0301] c3. Determine the fine-grained difference loss value based on the first fine-grained difference and the second fine-grained difference.

[0302] Specifically, the sum of the first and second fine-grained differences can be used as the fine-grained difference loss value.

[0303] d. Determine the second loss based on the coarse-grained difference loss value and the fine-grained difference loss value.

[0304] Specifically, the weighted sum of the coarse-grained difference loss value and the fine-grained difference loss value can be used as the second loss.

[0305] (3) Determine the total training loss based on the first loss and the second loss.

[0306] Specifically, the sum of the first loss and the second loss can be used as the total training loss, or the weighted sum of the first loss and the second loss can be used as the total training loss.

[0307] Specifically, the total training loss can be calculated using the following formula:

[0308]

[0309] Among them, L δ This represents the first loss, namely the entity classification loss; Indicates the first level of fine-grained difference; This indicates the second level of fine-grained difference; This represents the fine-grained difference loss value; Indicates the difference in the first coarseness; This indicates the difference in the second coarse-grained level; Indicates the coarse-grained difference loss value; λ f and λ c They are and The weights, where η is the learning rate; This represents the second loss, namely the restricted contrast loss at both the coarse-grained and fine-grained levels.

[0310] For training the first initial encoder, the second initial encoder, and the initial predictor, the total training loss L of this method is the sum of the first loss and the second loss, i.e., the entity classification loss function L. δ In addition to the limiting contrast loss at both coarse and fine granular levels and

[0311] Finally, L and stochastic gradients are minimized to update the encoder parameters θ and predictor parameters δ, where BCEWithLogits is a commonly used cross-entropy loss function suitable for multi-label classification tasks.

[0312] In the above embodiments, by comparing and interacting with the annotation information and fine-grained category labels, and by sharing parameters with the first and second initial encoders, category knowledge is transferred from the second initial encoder, which is used to encode the second sample statement containing fine-grained category labels, to the first initial encoder, which is used to encode the first sample statement whose sample category labels are occluded. This improves the ability of the trained entity classification model to distinguish similar multi-level entity categories and further improves the accuracy of the entity classification model for fine-grained classification.

[0313] Furthermore, by introducing descriptive information for fine-grained category labels into the third sample statement, richer category knowledge is directly exposed to the initial classification model, further demonstrating to the initial classification model what a specific type is, thereby improving the recognition ability of different levels of categories of the trained entity classification model.

[0314] The following section will further illustrate the process of training the initial classification model of this application to obtain the entity classification model, using examples.

[0315] like Figure 7 As shown in one example, the training method for the entity classification model of this application may include:

[0316] Obtain the sample training set; the sample training set includes multiple original sample statements, and the sample category labels of the sample entities in each original sample statement;

[0317] Sampling is performed on the training set of samples, that is, for each original sample sentence, the corresponding first sample sentence is obtained based on the preset annotation information.

[0318] Based on the fine-grained category labels of the original sample statements, obtain the second sample statements of the original sample statements;

[0319] Based on the descriptive information for the fine-grained category labels, obtain the third sample statement from the original sample statement;

[0320] Each first sample statement is input into the first initial encoder to obtain the first semantic vector for the first sample statement, namely [CLS] as shown in the figure, and the first category expression vector for the first sample reference statement, namely [ENT]sca as shown in the figure.

[0321] The first semantic vector is input into the initial predictor to obtain the predicted category label;

[0322] The second and third sample statements corresponding to each original sample statement are input into the second initial encoder to obtain the second category expression vector and the third sample category expression vector; that is, [ENT]ric as shown in the figure;

[0323] The first loss is determined based on the predicted class label and the sample class label of each first sample statement;

[0324] The second loss is determined based on the first-class expression vector, the second-class expression vector, and the third-class expression vector corresponding to each original sample statement.

[0325] The total training loss is determined based on the first loss and the second loss.

[0326] Based on each first sample statement, the corresponding sample category label, and each second sample statement, the training operation is repeatedly performed on the first initial encoder, the second initial encoder, and the initial predictor until the total training loss meets the preset training termination condition. The first initial encoder and the initial predictor at the end of the training are then used as the trained entity classification model.

[0327] The training method for the entity classification model described above involves obtaining a first sample statement corresponding to the original sample statement, which includes the original sample statement and annotation information, and obtaining a second sample statement, which includes the original sample statement and fine-grained category labels. The entity classification model is trained using the first and second sample statements, which can guide the initial entity classification model to learn the correct category of the entity, thereby improving the accuracy of entity classification in the obtained entity classification model. In addition, it can also guide the model to learn the differences between the annotation information and the fine-grained category labels, thereby further improving the accuracy of fine-grained entity classification.

[0328] By comparing and interacting with the annotation information and fine-grained category labels, and sharing parameters with the first and second initial encoders, category knowledge is transferred from the second initial encoder, which encodes the second sample statement containing fine-grained category labels, to the first initial encoder, which encodes the first sample statement whose sample category labels are occluded. This improves the ability of the trained entity classification model to distinguish similar multi-level entity categories and further enhances the accuracy of the entity classification model for fine-grained classification.

[0329] Furthermore, by introducing descriptive information for fine-grained category labels into the third sample statement, richer category knowledge is directly exposed to the initial classification model, further demonstrating to the initial classification model what a specific type is, thereby improving the recognition ability of different levels of categories of the trained entity classification model.

[0330] The following section will provide a detailed explanation of the effectiveness of the training method for the entity classification model proposed in this application, based on experimental data.

[0331] As shown in Table 1 below, Table 1 presents the entity classification results obtained using different entity classification models:

[0332]

[0333] Table 1. Results of the main experiment for fine-grained entity classification

[0334] On three public datasets for fine-grained entity classification tasks—BBN, OntoNotes, and FIGER—with limited labeled data, this method achieves state-of-the-art results across five metrics related to macro-F1 and micro-F1 scores. The main experimental results are shown in Table 1. PICOT represents this method; * indicates that the result relies on large-scale external data or resources and is not used for comparison. The state-of-the-art results for each evaluation metric on each dataset are bolded. The table above shows that this method directly models the differences between hierarchical categories, enabling more accurate differentiation of similar categories and improving performance on FET tasks.

[0335]

[0336] Table 2 shows the experimental results of entity representation using the first and second sample statements.

[0337]

[0338] Table 3 uses the comparison space of different granularities to determine the differences between different categories.

[0339] Tables 2 and 3 respectively show the cue-guided expressions, i.e. entity representation using the first and second sample statements, and the restricted comparison strategy, i.e. ablation experiments using different granularity comparison spaces to determine the differences between different categories. The experiments show that both category-missing and category-rich cue expressions can better represent categories, and both coarse-grained and fine-grained comparisons help improve the distinguishability of similar categories at their respective granularities.

[0340] like Figure 8 As shown, in some possible implementations, a fine-grained entity classification apparatus for knowledge graph construction is provided, the apparatus including:

[0341] The first acquisition module 801 is used to acquire the statement to be classified; the statement to be classified includes the entity to be classified.

[0342] The second acquisition module 802 is used to acquire the first statement based on the entity to be classified, the statement to be classified, and the preset annotation information;

[0343] The classification module 803 is used to predict the entity classification of the first statement through the entity classification model, and obtain the fine-grained entity classification result corresponding to the statement to be classified.

[0344] Training module 804 is used to train the entity classification model, specifically for:

[0345] Obtain a sample training set; wherein, the sample training set includes multiple original sample statements, and sample category labels of sample entities in each original sample statement; the sample category labels include coarse-grained category labels and fine-grained category labels, and the fine-grained category labels are sub-category labels of the coarse-grained category labels;

[0346] For each original sample statement, obtain the first sample statement and the second sample statement corresponding to the original sample statement; wherein, the first sample statement includes the original sample statement and annotation information; the second sample statement includes the original sample statement and fine-grained category label;

[0347] Based on each first sample statement, each second sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

[0348] In some possible implementations, when the training module 804 obtains the first sample statement corresponding to the original sample statement, it specifically performs the following:

[0349] The sample entities in the original sample statement are combined with the annotation information to form the first sample reference statement.

[0350] The first sample reference statement is combined with the original sample statement to form the first sample statement.

[0351] In some possible implementations, obtaining a second sample statement corresponding to the original sample statement includes:

[0352] Based on the sample entities and fine-grained category labels in the original sample statement, obtain the second sample reference statement corresponding to the original sample statement;

[0353] The second sample statement is obtained by combining the second sample reference statement with the original sample statement.

[0354] In some possible implementations, the training module 804 is also used for:

[0355] For each original sample statement, obtain the third sample statement corresponding to the original sample statement; wherein, the third sample statement includes descriptive information for the fine-grained category label;

[0356] Training module 804, when training the initial classification model based on each first sample statement, each second sample statement, and the corresponding sample category labels to obtain the entity classification model, is specifically used for:

[0357] Based on each first sample statement, each second sample statement, each third sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

[0358] In some possible implementations, when the training module 804 obtains the third sample statement corresponding to the original sample statement, it specifically performs the following:

[0359] Retrieve descriptive information for fine-grained category labels from the pre-defined concept database;

[0360] The descriptive information of the fine-grained category labels is concatenated after the preset entity to obtain the first combination of information;

[0361] By attaching fine-grained category labels to the preset entities, a second set of combined information is obtained;

[0362] By concatenating the second set of information after the first set of information, a third sample statement is obtained.

[0363] In some possible implementations, the initial classification model includes a first initial encoder, a second initial encoder, and an initial predictor;

[0364] Training module 804, when training the initial classification model based on each first sample statement, each second sample statement, each third sample statement, and the corresponding sample category labels to obtain the entity classification model, is specifically used for:

[0365] Each first sample statement is input into the first initial encoder to obtain the first semantic vector for the first sample statement and the first category expression vector for the first sample reference statement.

[0366] The first semantic vector is input into the initial predictor to obtain the predicted category label;

[0367] Each second sample statement and each third sample statement are input into the second initial encoder to obtain the second category expression vector and the third category expression vector;

[0368] The total training loss is determined based on the first class expression vector, the second class expression vector, the third class expression vector, the predicted class label, and the sample class label.

[0369] If the total training loss does not meet the preset training termination condition, the steps of adjusting the parameters of the initial classification model, obtaining the first class expression vector, predicted class label, second class expression vector, third class expression vector, and determining the total training loss are repeated until the total training loss meets the training termination condition. The first initial encoder and initial predictor at the end of training are then used as the trained entity classification model.

[0370] In some possible implementations, when determining the total training loss based on the first class representation vector, the second class representation vector, the third class representation vector, the predicted class label, and the sample class label, the training module 804 is specifically used for:

[0371] The first loss is determined based on the predicted class label and the sample class label of each first sample statement;

[0372] The second loss is determined based on the first-class expression vector, the second-class expression vector, and the third-class expression vector corresponding to each original sample statement.

[0373] The total training loss is determined based on the first loss and the second loss.

[0374] In some possible implementations, when the training module determines the second loss based on the first-class expression vector, the second-class expression vector, and the third-class expression vector corresponding to each original sample statement, it is specifically used for:

[0375] The first category expression vector, the second category expression vector, and the third category expression vector are divided according to coarse-grained category labels and fine-grained category labels;

[0376] The coarse-grained difference loss value is determined based on the category expression vectors with the same coarse-grained category label and the category expression vectors with different coarse-grained category labels.

[0377] The fine-grained difference loss value is determined based on the category expression vectors with the same fine-grained category label and the category expression vectors with different fine-grained category labels.

[0378] The second loss is determined based on the coarse-grained difference loss value and the fine-grained difference loss value.

[0379] In some possible implementations, when determining the coarse-grained difference loss value based on class representation vectors with the same coarse-grained class label and class representation vectors with different coarse-grained class labels, the training module 804 is specifically used for:

[0380] The differences between category representation vectors with the same coarse-grained category labels are determined to obtain the first coarse-grained difference;

[0381] The difference between category representation vectors with different coarse-grained category labels is determined to obtain the second coarse-grained difference;

[0382] The coarse-grained difference loss value is determined based on the first coarse-grained difference and the second coarse-grained difference.

[0383] In some possible implementations, when determining the fine-grained difference loss value based on category representation vectors with the same fine-grained category label and category representation vectors with different fine-grained category labels, the training module 804 is specifically used for:

[0384] The first fine-grained difference is obtained by determining the differences between category representation vectors with the same fine-grained category label;

[0385] The difference between category representation vectors with different fine-grained category labels is determined to obtain the second fine-grained difference;

[0386] The fine-grained difference loss value is determined based on the first fine-grained difference and the second fine-grained difference.

[0387] The training device for the aforementioned entity classification model obtains a first sample statement corresponding to the original sample statement, which includes the original sample statement and annotation information, and obtains a second sample statement, which includes the original sample statement and fine-grained category labels. The entity classification model is trained using the first and second sample statements, which can guide the initial entity classification model to learn the correct category of the entity, thereby improving the accuracy of entity classification of the obtained entity classification model. In addition, it can also guide the model to learn the differences between the annotation information and the fine-grained category labels, thereby further improving the accuracy of fine-grained entity classification.

[0388] By comparing and interacting with the annotation information and fine-grained category labels, and sharing parameters with the first and second initial encoders, category knowledge is transferred from the second initial encoder, which encodes the second sample statement containing fine-grained category labels, to the first initial encoder, which encodes the first sample statement whose sample category labels are occluded. This improves the ability of the trained entity classification model to distinguish similar multi-level entity categories and further enhances the accuracy of the entity classification model for fine-grained classification.

[0389] Furthermore, by introducing descriptive information for fine-grained category labels into the third sample statement, richer category knowledge is directly exposed to the initial classification model, further demonstrating to the initial classification model what a specific type is, thereby improving the recognition ability of different levels of categories of the trained entity classification model.

[0390] The apparatus in this application embodiment can execute the method provided in this application embodiment, and the implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.

[0391] This application provides an electronic device, including a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program stored in the memory, it can perform the following:

[0392] Obtain the statement to be classified; the statement to be classified includes the entity to be classified;

[0393] The first statement is obtained based on the entity to be classified, the statement to be classified, and the preset annotation information;

[0394] The entity classification model is used to predict the entity classification of the first statement, and the fine-grained entity classification result corresponding to the statement to be classified is obtained.

[0395] The entity classification model was trained in the following way:

[0396] Obtain a sample training set; wherein, the sample training set includes multiple original sample statements, and sample category labels of sample entities in each original sample statement; the sample category labels include coarse-grained category labels and fine-grained category labels, and the fine-grained category labels are sub-category labels of the coarse-grained category labels;

[0397] For each original sample statement, obtain the first sample statement and the second sample statement corresponding to the original sample statement; wherein, the first sample statement includes the original sample statement and annotation information; the second sample statement includes the original sample statement and fine-grained category label;

[0398] Based on each first sample statement, each second sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

[0399] Figure 9 A schematic diagram of the structure of an electronic device to which an embodiment of the present invention applies is shown, such as... Figure 9 As shown, the electronic device can be a server or a user terminal, and it can be used to implement the methods provided in any embodiment of the present invention.

[0400] like Figure 9 As shown, the electronic device 900 may primarily include at least one processor 901. Figure 9 The diagram shows components such as a memory 902, a communication module 903, and an input / output interface 904. Optionally, these components can be connected and communicate with each other via a bus 905. It should be noted that... Figure 9 The structure of the electronic device 900 shown is merely illustrative and does not constitute a limitation on the electronic devices to which the methods provided in the embodiments of this application are applicable.

[0401] The memory 902 can be used to store operating systems and applications, etc. The applications can include computer programs that implement the methods shown in the embodiments of the present invention when invoked by the processor 901, and can also include programs for implementing other functions or services. The memory 902 can be ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices that can store information and computer programs, or it can be EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disk storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.

[0402] Processor 901 is connected to memory 902 via bus 905 and performs corresponding functions by calling application programs stored in memory 902. Processor 901 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the present invention disclosure. Processor 901 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0403] Electronic device 900 can connect to a network via communication module 903 (which may include, but is not limited to, components such as a network interface) to communicate with other devices (such as user terminals or servers) through the network and achieve data interaction, such as sending data to or receiving data from other devices. Communication module 903 may include wired network interfaces and / or wireless network interfaces, meaning the communication module may include at least one of wired or wireless communication modules.

[0404] Electronic device 900 can connect to required input / output devices, such as keyboards and display devices, via input / output interface 904. Electronic device 900 itself may have a display device, and other display devices can also be connected externally via interface 904. Optionally, storage devices, such as hard drives, can also be connected via interface 904 to store data from electronic device 900, read data from storage device, or store data from storage device into memory 902. It is understood that input / output interface 904 can be a wired interface or a wireless interface. Depending on the actual application scenario, the device connected to input / output interface 904 can be a component of electronic device 900 or an external device connected to electronic device 900 when needed.

[0405] The bus 905 used to connect the components may include a pathway for transmitting information between the components. The bus 905 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Depending on its function, the bus 905 can be classified as an address bus, data bus, control bus, etc.

[0406] Optionally, for the solution provided in the embodiments of the present invention, the memory 902 can be used to store a computer program that executes the solution of the present invention, and the processor 901 runs the computer program. When the processor 901 runs the computer program, it implements the operation of the method or apparatus provided in the embodiments of the present invention.

[0407] Based on the same principle as the method provided in the embodiments of this application, the embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the corresponding content of the aforementioned method embodiments.

[0408] This application also provides a computer program product, which includes a computer program that, when executed by a processor, can implement the corresponding content of the aforementioned method embodiments.

[0409] It should be noted that the terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.

[0410] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.

[0411] The above are only optional implementation methods for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application, without departing from the technical concept of this application, also fall within the protection scope of the embodiments of this application.

Claims

1. A fine-grained entity classification method in knowledge graph construction, characterized in that, The method includes: Obtain the statement to be classified; the statement to be classified includes the entity to be classified; The first statement is obtained based on the entity to be classified, the statement to be classified, and the preset annotation information; The first statement is classified using an entity classification model to obtain a fine-grained entity classification result corresponding to the statement to be classified. The entity classification model is trained in the following manner: Obtain a sample training set; wherein the sample training set includes multiple original sample statements and sample category labels for sample entities in each original sample statement; the sample category labels include coarse-grained category labels and fine-grained category labels, wherein the fine-grained category labels are sub-category labels of the coarse-grained category labels; For each original sample statement, a first sample statement and a second sample statement corresponding to the original sample statement are obtained; wherein, the first sample statement includes the original sample statement and the annotation information, and the annotation information is used to mask the sample category label in the original sample statement; the second sample statement includes the original sample statement and the fine-grained category label; Based on each of the first sample statements, each of the second sample statements, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

2. The fine-grained entity classification method according to claim 1, characterized in that, Obtaining the first sample statement corresponding to the original sample statement includes: The sample entities in the original sample statement are combined with the annotation information to form the first sample reference statement; The first sample reference statement is combined with the original sample statement to form the first sample statement.

3. The fine-grained entity classification method according to claim 1, characterized in that, Obtaining the second sample statement corresponding to the original sample statement includes: Based on the sample entities in the original sample statement and the fine-grained category labels, obtain the second sample reference statement corresponding to the original sample statement; The second sample statement is obtained by combining the second sample reference statement with the original sample statement.

4. The fine-grained entity classification method according to claim 1, characterized in that, The training method for the entity classification model also includes the following steps: For each of the original sample statements, a third sample statement corresponding to the original sample statement is obtained; wherein, the third sample statement includes descriptive information for the fine-grained category label; The step of training an initial classification model based on each of the first sample statements, each of the second sample statements, and the corresponding sample category labels to obtain the entity classification model includes: Based on each of the first sample statements, each of the second sample statements, each of the third sample statements, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

5. The fine-grained entity classification method according to claim 4, characterized in that, The step of obtaining the third sample statement corresponding to the original sample statement includes: Retrieve the description information for the fine-grained category label from the preset concept database; The description information of the fine-grained category label is concatenated after the preset entity to obtain the first combination information; The fine-grained category label is attached to the preset entity to obtain the second combination information; The second combination of information is concatenated after the first combination of information to obtain the third sample statement.

6. The fine-grained entity classification method according to claim 4, characterized in that, The initial classification model includes a first initial encoder, a second initial encoder, and an initial predictor; The step of training the initial classification model based on each of the first sample statements, each of the second sample statements, each of the third sample statements, and the corresponding sample category labels to obtain the entity classification model includes: Each of the first sample statements is input into the first initial encoder to obtain a first semantic vector for the first sample statement and a first category expression vector for the first sample reference statement. The first sample reference statement is formed by combining the sample entities in the original sample statement with the annotation information. The first semantic vector is input into the initial predictor to obtain the predicted category label; Each of the second sample statements and the third sample statements is input into the second initial encoder to obtain the second category expression vector and the third category expression vector; Based on the first category expression vector, the second category expression vector, the third category expression vector, the predicted category label, and the sample category label, the total training loss is determined; If the total training loss does not meet the preset training termination condition, the steps of adjusting the parameters of the initial classification model, obtaining the first class expression vector, predicted class label, second class expression vector, third class expression vector, and determining the total training loss are repeated until the total training loss meets the training termination condition. The first initial encoder and initial predictor at the end of training are then used as the trained entity classification model.

7. The fine-grained entity classification method according to claim 6, characterized in that, The step of determining the total training loss based on the first category expression vector, the second category expression vector, the third category expression vector, the predicted category label, and the sample category label includes: The first loss is determined based on the predicted category label and the sample category label of each of the first sample statements; Based on the first category expression vector, the second category expression vector, and the third category expression vector corresponding to each of the original sample statements, the second loss is determined; The total training loss is determined based on the first loss and the second loss.

8. The fine-grained entity classification method according to claim 7, characterized in that, The determination of the second loss based on the first category expression vector, the second category expression vector, and the third category expression vector corresponding to each of the original sample statements includes: The first category expression vector, the second category expression vector, and the third category expression vector are divided according to coarse-grained category labels and fine-grained category labels; The coarse-grained difference loss value is determined based on the category expression vectors with the same coarse-grained category label and the category expression vectors with different coarse-grained category labels. The fine-grained difference loss value is determined based on the category expression vectors with the same fine-grained category label and the category expression vectors with different fine-grained category labels. The second loss is determined based on the coarse-grained difference loss value and the fine-grained difference loss value.

9. The fine-grained entity classification method according to claim 8, characterized in that, The step of determining the coarse-grained difference loss value based on category expression vectors with the same coarse-grained category label and category expression vectors with different coarse-grained category labels includes: The differences between category representation vectors with the same coarse-grained category labels are determined to obtain the first coarse-grained difference; The difference between category representation vectors with different coarse-grained category labels is determined to obtain the second coarse-grained difference; The coarse-grained difference loss value is determined based on the first coarse-grained difference and the second coarse-grained difference.

10. The fine-grained entity classification method according to claim 8, characterized in that, The step of determining the fine-grained difference loss value based on category expression vectors with the same fine-grained category label and category expression vectors with different fine-grained category labels includes: The first fine-grained difference is obtained by determining the differences between category representation vectors with the same fine-grained category label; The difference between category representation vectors with different fine-grained category labels is determined to obtain the second fine-grained difference; The fine-grained difference loss value is determined based on the first fine-grained difference and the second fine-grained difference.

11. A fine-grained entity classification device for knowledge graph construction, characterized in that, The device includes: The first acquisition module is used to acquire statements to be classified; the statements to be classified include entities to be classified. The second acquisition module is used to acquire the first statement based on the entity to be classified, the statement to be classified, and preset annotation information; The classification module is used to perform entity classification prediction on the first statement through an entity classification model to obtain the fine-grained entity classification result corresponding to the statement to be classified. The training module is used to train the entity classification model, specifically for: Obtain a sample training set; wherein the sample training set includes multiple original sample statements and sample category labels for sample entities in each original sample statement; the sample category labels include coarse-grained category labels and fine-grained category labels, wherein the fine-grained category labels are sub-category labels of the coarse-grained category labels; For each original sample statement, a first sample statement and a second sample statement corresponding to the original sample statement are obtained; wherein, the first sample statement includes the original sample statement and the annotation information, and the annotation information is used to mask the sample category label in the original sample statement; the second sample statement includes the original sample statement and the fine-grained category label; Based on each first sample statement, each second sample statement, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

12. The fine-grained entity classification device according to claim 11, characterized in that, When the training module obtains the first sample statement corresponding to the original sample statement, it is specifically used for: The sample entities in the original sample statement are combined with the annotation information to form the first sample reference statement; The first sample reference statement is combined with the original sample statement to form the first sample statement.

13. The fine-grained entity classification device according to claim 11, characterized in that, When the training module obtains the second sample statement corresponding to the original sample statement, it is specifically used for: Based on the sample entities in the original sample statement and the fine-grained category labels, obtain the second sample reference statement corresponding to the original sample statement; The second sample statement is obtained by combining the second sample reference statement with the original sample statement.

14. The fine-grained entity classification device according to claim 11, characterized in that, The training module is also used for: For each of the original sample statements, a third sample statement corresponding to the original sample statement is obtained; wherein, the third sample statement includes descriptive information for the fine-grained category label; When the training module trains the initial classification model based on each of the first sample statements, each of the second sample statements, and the corresponding sample category labels to obtain the entity classification model, it is specifically used for: Based on each of the first sample statements, each of the second sample statements, each of the third sample statements, and the corresponding sample category labels, the initial classification model is trained to obtain the entity classification model.

15. The fine-grained entity classification device according to claim 14, characterized in that, When the training module obtains the third sample statement corresponding to the original sample statement, it is specifically used for: Retrieve the description information for the fine-grained category label from the preset concept database; The description information of the fine-grained category label is concatenated after the preset entity to obtain the first combination information; The fine-grained category label is attached to the preset entity to obtain the second combination information; The second combination of information is concatenated after the first combination of information to obtain the third sample statement.

16. The fine-grained entity classification device according to claim 14, characterized in that, The initial classification model includes a first initial encoder, a second initial encoder, and an initial predictor; When the training module trains the initial classification model based on each of the first sample statements, each of the second sample statements, each of the third sample statements, and the corresponding sample category labels to obtain the entity classification model, it is specifically used for: Each of the first sample statements is input into the first initial encoder to obtain a first semantic vector for the first sample statement and a first category expression vector for the first sample reference statement. The first sample reference statement is formed by combining the sample entities in the original sample statement with the annotation information. The first semantic vector is input into the initial predictor to obtain the predicted category label; Each of the second sample statements and the third sample statements is input into the second initial encoder to obtain the second category expression vector and the third category expression vector; Based on the first category expression vector, the second category expression vector, the third category expression vector, the predicted category label, and the sample category label, the total training loss is determined; If the total training loss does not meet the preset training termination condition, the steps of adjusting the parameters of the initial classification model, obtaining the first class expression vector, predicted class label, second class expression vector, third class expression vector, and determining the total training loss are repeated until the total training loss meets the training termination condition. The first initial encoder and initial predictor at the end of training are then used as the trained entity classification model.

17. The fine-grained entity classification device according to claim 16, characterized in that, When determining the total training loss based on the first category expression vector, the second category expression vector, the third category expression vector, the predicted category label, and the sample category label, the training module is specifically used for: The first loss is determined based on the predicted category label and the sample category label of each of the first sample statements; Based on the first category expression vector, the second category expression vector, and the third category expression vector corresponding to each of the original sample statements, the second loss is determined; The total training loss is determined based on the first loss and the second loss.

18. The fine-grained entity classification device according to claim 17, characterized in that, When determining the second loss based on the first category expression vector, the second category expression vector, and the third category expression vector corresponding to each of the original sample statements, the training module is specifically used for: The first category expression vector, the second category expression vector, and the third category expression vector are divided according to coarse-grained category labels and fine-grained category labels; The coarse-grained difference loss value is determined based on the category expression vectors with the same coarse-grained category label and the category expression vectors with different coarse-grained category labels. The fine-grained difference loss value is determined based on the category expression vectors with the same fine-grained category label and the category expression vectors with different fine-grained category labels. The second loss is determined based on the coarse-grained difference loss value and the fine-grained difference loss value.

19. The fine-grained entity classification device according to claim 18, characterized in that, When determining the coarse-grained difference loss value based on category representation vectors with the same coarse-grained category label and category representation vectors with different coarse-grained category labels, the training module is specifically used for: The differences between category representation vectors with the same coarse-grained category labels are determined to obtain the first coarse-grained difference; The difference between category representation vectors with different coarse-grained category labels is determined to obtain the second coarse-grained difference; The coarse-grained difference loss value is determined based on the first coarse-grained difference and the second coarse-grained difference.

20. The fine-grained entity classification device according to claim 18, characterized in that, When determining the fine-grained difference loss value based on category representation vectors with the same fine-grained category label and category representation vectors with different fine-grained category labels, the training module is specifically used for: The first fine-grained difference is obtained by determining the differences between category representation vectors with the same fine-grained category label; The difference between category representation vectors with different fine-grained category labels is determined to obtain the second fine-grained difference; The fine-grained difference loss value is determined based on the first fine-grained difference and the second fine-grained difference.

21. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method of any one of claims 1 to 10.

22. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method of any one of claims 1 to 10.

23. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 10.