Entity alignment method and device based on large language model, equipment and storage medium
By converting knowledge graph nodes into a unified format and using a large language model to generate entity semantic information, the problem of incomplete entity semantic representation in existing technologies is solved, and more accurate entity alignment and semantic understanding are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-04-03
AI Technical Summary
Existing entity alignment methods ignore the rich background information of entities in real-world contexts, resulting in incomplete semantic representations of entities in knowledge graphs.
The nodes in the knowledge graph are converted into the same format, and entity semantic information is generated using a large language model, including entity definitions, synonyms and hyponyms. Target nodes are determined through similarity filtering and deep semantic matching.
It improves the accuracy of heterogeneous entity recognition, makes up for the problem of incomplete entity semantic representation in traditional methods, and enhances the semantic understanding ability of knowledge graphs.
Smart Images

Figure CN121787536A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of large language model technology, and more specifically to a method, apparatus, device, medium, and program product for entity alignment based on a large language model. Background Technology
[0002] With the development of information technology, the explosive growth of data volume has led to enterprises facing the need to integrate massive amounts of heterogeneous data. Entity alignment technology can be used to solve the entity mapping problem between different data sources, which is crucial for building a unified knowledge graph and improving the accuracy and efficiency of data analysis.
[0003] Embedding technology is a technique that transforms discrete, non-numerical data into continuous, low-dimensional, real-valued vector representations. It enables vectors to capture the semantic information and inherent relationships of the original data, helping machine learning models process and understand this data more effectively. Entity alignment based on embedding technology has become mainstream due to its efficient computation and good generalization ability. It utilizes deep learning to map entities and relationships into low-dimensional dense vectors, achieving entity alignment through similarity calculations in the vector space, and mining the structural and semantic information of knowledge graphs.
[0004] However, due to the lack of integration of external knowledge, this entity alignment method relies mainly on the internal topological structure of the graph for machine learning models, ignoring the rich background information of entities in the real-world context, resulting in incomplete semantic representation of entities in the knowledge graph. Summary of the Invention
[0005] In view of the above problems, this disclosure provides a method, apparatus, device, medium and program product for entity alignment based on a large language model.
[0006] The first aspect of this disclosure provides an entity alignment method based on a large language model, comprising: converting each node in a knowledge graph into a first node set with the same format as the target entity; determining second nodes from the first node set whose similarity to the target entity is greater than or equal to a similarity threshold, thereby obtaining a second node set; inputting the target entity and the second node set into a large language model to generate entity semantic information for the target entity and each second node, wherein the entity semantic information includes at least one of entity definition, synonyms, and hyponyms / hypernyms; determining a target node matching the target entity from the second node set based on the entity semantic information; and using the target node as the aligned entity of the target entity in the knowledge graph.
[0007] According to embodiments of this disclosure, the method further includes: in response to the failure to determine a target node matching the target entity from the second node set, determining a third node associated with each second node in the knowledge graph to obtain a third node set, wherein each third node is an upper-level or lower-level node adjacent to the associated second node in the relational chain of the knowledge graph; merging the second node set and the third node set to obtain a fourth node set; and inputting the fourth node set into a large language model to determine the target node matching the target entity from the fourth node set.
[0008] According to embodiments of this disclosure, in response to the failure to determine a target node matching the target entity from the second node set, at least one of the following is included: in response to the similarity between each node in the first node set and the target entity being less than a similarity threshold; in response to the inference results of the large language model for each node in the second node set being mismatched with the target entity.
[0009] According to embodiments of this disclosure, determining a second node from a first node set whose similarity to a target entity is greater than or equal to a similarity threshold to obtain a second node set includes: obtaining the embedding vector corresponding to each node in the first node set, wherein the embedding vector is generated by a pre-trained entity alignment model based on the embedding vector corresponding to each first node; calculating the similarity between the target entity and each node in the first node set; and determining a second node from the first node set whose similarity is greater than or equal to a similarity threshold to obtain a second node set.
[0010] According to embodiments of this disclosure, determining a target node that matches a target entity from a second node set based on entity semantic information includes: determining the semantic matching degree between the target entity and each node in the second node set based on entity semantic information; and determining the target node that matches the target entity from the second node set based on the semantic matching degree.
[0011] According to embodiments of this disclosure, determining the semantic matching degree between a target entity and each node in the second node set based on entity semantic information includes: generating natural language prompts for each second node based on the entity semantic information of the target entity and each second node; inputting the natural language prompts into a large language model to obtain inference results; performing confidence processing on the inference results to generate the semantic matching degree between the target entity and each node in the second node set; wherein, the natural language prompts are used to prompt the large language model to determine whether the semantic information of the target entity and each second node is the same.
[0012] According to embodiments of this disclosure, based on the semantic information of the target entity and each second node, natural language prompt words corresponding to each second node are generated, including: structurally filling the semantic information of the target entity and each second node according to a preset natural language prompt template to generate natural language prompt words for reasoning by a large language model; wherein, the preset natural language prompt template includes: a task instruction part, used to instruct the large language model to determine whether two entities point to the same real-world concept; an information filling part, used to fill in placeholders for node name, node definition, node list, and node hierarchy; and a reasoning step part, used to instruct the large language model to perform the following operations: comparing the definitions, synonyms, and hierarchy of the two entities to identify matching points and conflict points, and performing logical deduction based on the matching points and conflict points to arrive at a matching conclusion.
[0013] A second aspect of this disclosure provides an entity alignment device based on a large language model, comprising: a first node filtering module, configured to convert each node in the knowledge graph into a first node set in the same format as the target entity; and to determine second nodes from the first node set whose similarity to the target entity is greater than or equal to a similarity threshold, thereby obtaining a second node set; a model processing module, configured to input the target entity and the second node set into the large language model, and generate entity semantic information for the target entity and each second node, wherein the entity semantic information includes at least one of entity definition, synonyms, and hyponyms / hypernyms; a second node filtering module, configured to determine target nodes that match the target entity from the second node set based on the entity semantic information; and a result determination module, configured to use the target nodes as aligned entities of the target entity in the knowledge graph.
[0014] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0015] A fourth aspect of this disclosure also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0016] The fifth aspect of this disclosure also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method. Attached Figure Description
[0017] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0018] Figure 1 The illustrations depict application scenarios of entity alignment methods, apparatuses, devices, media, and program products based on large language models according to embodiments of the present disclosure.
[0019] Figure 2 One of the flowcharts illustrating an entity alignment method based on a large language model according to an embodiment of the present disclosure is shown schematically;
[0020] Figure 3 The flowchart illustrating the entity alignment method based on a large language model according to an embodiment of the present disclosure is shown in the second example.
[0021] Figure 4 A schematic diagram illustrates a structural block diagram of an entity alignment device based on a large language model according to an embodiment of the present disclosure; and
[0022] Figure 5 A block diagram schematically illustrates an electronic device suitable for implementing a large language model-based entity alignment method according to embodiments of the present disclosure. Detailed Implementation
[0023] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0024] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0025] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0026] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0027] It should be noted that the methods and apparatus determined in the embodiments of this disclosure can be used in the financial field for applications in the field of large language models, and can also be used in any field other than the financial field. The application fields of the methods and apparatus in the embodiments of this disclosure are not limited.
[0028] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0029] In the technical solution disclosed herein, the user information (including but not limited to user personal information, user image information, user device information, such as location information) and data (including but not limited to data used for analysis, stored data, and displayed data) involved are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with relevant laws, regulations, and standards, and necessary measures have been taken to ensure that they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse.
[0030] In scenarios involving automated decision-making using personal information, the methods, devices, and systems provided in this disclosure all offer users corresponding entry points for choosing to agree to or reject the automated decision-making results. If the user chooses to reject, the process proceeds to the expert decision-making stage. Here, "automated decision-making" refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests, or economic, health, and credit status through computer programs, and then making a decision. Here, "expert decision-making" refers to the activity of making decisions by personnel who specialize in a particular field, possess specialized experience, knowledge, and skills, and have reached a certain level of professional expertise.
[0031] Embodiments of this disclosure provide an entity alignment method based on a large language model, comprising: converting each node in a knowledge graph into a first node set with the same format as the target entity; determining second nodes from the first node set whose similarity to the target entity is greater than or equal to a similarity threshold, thereby obtaining a second node set; inputting the target entity and the second node set into a large language model to generate entity semantic information for the target entity and each second node, wherein the entity semantic information includes at least one of entity definition, synonyms, and hyponyms / hypernyms; determining a target node matching the target entity from the second node set based on the entity semantic information; and using the target node as the aligned entity of the target entity in the knowledge graph.
[0032] By standardizing knowledge graph nodes into a first set of nodes and combining this with initial similarity filtering to obtain a second set of nodes, the candidate range is effectively narrowed. At the same time, a large language model is introduced to generate deep semantic information containing definitions, synonyms, and hyponyms and hypernyms, and fine-grained matching is performed based on this information. This avoids the limitations of relying on name or structural similarity, improves the recognition accuracy of heterogeneous entities with large differences in expression and complex semantics, and solves the problem of incomplete semantic representation of entities in knowledge graphs caused by non-standard naming or information sparsity.
[0033] Figure 1 The illustration shows an application scenario of the entity alignment method based on a large language model according to an embodiment of the present disclosure.
[0034] like Figure 1 As shown, application scenario 100 according to this embodiment may include process processing in the field of syndicated lending in the financial sector. Network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0035] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0036] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0037] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0038] It should be noted that the entity alignment method based on a large language model provided in this disclosure can generally be executed by server 105. Correspondingly, the entity alignment device based on a large language model provided in this disclosure can generally be located in server 105. The entity alignment method based on a large language model provided in this disclosure can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the entity alignment device based on a large language model provided in this disclosure can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0039] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0040] The following will be based on Figure 1 The described scene, through Figures 2-3 The entity alignment method based on a large language model according to the disclosed embodiments is described in detail.
[0041] Figure 2 One of the flowcharts illustrating an entity alignment method based on a large language model according to an embodiment of the present disclosure is shown schematically.
[0042] like Figure 2 As shown, the entity alignment method based on a large language model in the embodiments of this disclosure includes operations S210 to S240, which can be executed by a server.
[0043] In operation S210, each node in the knowledge graph is converted into a first node set with the same format as the target entity; and second nodes with a similarity to the target entity greater than or equal to the similarity threshold are determined from the first node set to obtain the second node set.
[0044] In the embodiments of this disclosure, the knowledge graph is a structured form of knowledge representation that describes concepts in the real world and their interrelationships through nodes (entities) and edges (relationships); a node (entity) is the basic unit in the knowledge graph, representing a specific entity. For example, in the financial field, a knowledge graph may contain entities such as customers, accounts, and transactions, as well as the relationships between them.
[0045] In the embodiments of this disclosure, the target entity is a specific entity that needs to be matched with an object in the knowledge graph. For example, in a customer information integration scenario in the financial field, the target entity might be a customer's name or unique identifier. The target entity can come from a new data source, document, or database, and the task of this method is to correctly "align" it to an existing node in the knowledge graph.
[0046] Specifically, to facilitate the unified format for subsequent similarity calculations, the names or identifiers of all nodes in the knowledge graph are uniformly converted into the same data format as the target entity. For example, the names of all nodes in the knowledge graph are converted to lowercase, special characters are removed, and a unified naming convention is adopted to form the first node set.
[0047] Furthermore, an entity alignment model based on embedding technology is constructed. The core function of the entity alignment model is to transform discrete entity symbols in the knowledge graph into continuous, low-dimensional numerical vectors. The model's training relies on the structured data of the knowledge graph itself. A deep learning model is pre-trained on large-scale knowledge graph triples. Through training, the entity alignment model learns the topological position and semantic relationships of entities in the graph and generates a high-quality embedding vector for each entity. The embedding vector is a fixed-length array of real numbers, and its position in the vector space reflects the semantic features and contextual information of the entity. For example, semantically similar entities (such as "Apple" and "technology company") will be relatively close in the vector space. Subsequently, the trained entity alignment model is used to obtain the embedding vectors of the target entity and each node in the first node set. For each node in the first node set, the similarity between its embedding vector and the target entity's embedding vector is calculated.
[0048] In the embodiments of this disclosure, cosine similarity is used as the primary similarity metric. Cosine similarity measures the directional similarity of two embedded vectors by calculating the cosine of the angle between them. Its value range is [-1, 1], and the closer the value is to 1, the more consistent the directions of the two vectors are, and the more semantically similar they are. A preset similarity threshold is set for the similarity calculation, such as 0.6 or 0.7, which can be adjusted according to the specific application scenario. All calculated similarity scores are traversed, and all nodes with similarity scores greater than or equal to the threshold are selected to obtain a second set of nodes, which serves as a candidate set for subsequent refined semantic analysis.
[0049] In operation S220, the target entity and the set of second nodes are input into the large language model, and the entity semantic information of the target entity and each second node is generated respectively. The entity semantic information includes at least one of entity definition, synonyms and hyponyms.
[0050] In the embodiments of this disclosure, entity semantic information is used as supplementary information to describe the deeper meaning of an entity or node. This includes three types of information generated by a large language model to assist alignment: entity definition, used for a clear and accurate textual description of the entity; synonyms, used to represent different names or expressions referring to the same thing as the entity or node; and hierarchical relationships, determining the broader category to which the entity or node belongs or the more specific category it encompasses; for example, a hierarchical relationship, such as "Apple Inc." being a subordinate category of "technology company," and a subordinate relationship, such as "iPhone" being a product of "Apple Inc."
[0051] Specifically, after receiving instructions and entity names, the large language model invokes the world knowledge encoded by its massive internal parameters to generate corresponding semantic information. The large language model outputs the generated definitions, synonym lists, and hyponyms in a structured form (such as JSON).
[0052] This information is then associated and stored with the "target entity" and each "second node" to form their respective entity semantic information files. The generated definitions, synonym lists, and hierarchical relationships are output in a structured format.
[0053] In operation S230, based on entity semantic information, the target node that matches the target entity is determined from the second node set.
[0054] Specifically, after semantic information analysis and matching by the large language model, the node in the knowledge graph corresponding to the target entity is finally determined as the final result of entity alignment.
[0055] In operation S240, the target node is used as the aligned entity of the target entity in the knowledge graph.
[0056] Alignment entities are entities in the knowledge graph that correspond to the target entity and have similar semantic relationships.
[0057] By employing the above method, nodes in the knowledge graph are converted into the same format as the target entity, similar nodes are selected to form a second node set, and entity semantic information is generated using a large language model. This allows for a more comprehensive and in-depth understanding of the entity's meaning. The large language model can capture rich background information of entities in real-world contexts, compensating for the shortcomings of traditional methods based on the internal topology of the knowledge graph. Therefore, it accurately determines the matching target node based on entity semantic information, improving the accuracy of entity alignment.
[0058] According to embodiments of this disclosure, the method further includes operations S250 to S260.
[0059] In operation S250, in response to the failure to determine a target node that matches the target entity from the set of second nodes, a third node associated with each second node is determined in the knowledge graph to obtain a set of third nodes, wherein each third node is an upper or lower node of the associated second node in the relation chain of the knowledge graph.
[0060] In embodiments of this disclosure, when a matching result that meets the similarity threshold is not obtained in the second node set, a new set of candidate nodes introduced by searching the structure of the knowledge graph is used as the third node set, wherein the third node is the neighboring node of each node in the second node set.
[0061] In embodiments of this disclosure, a higher-level node can refer to a node that is upstream of a given node and represents a more abstract or general concept. For example, in the knowledge chain “Apple Inc.” > “Technology Company” > “Company”, both “Technology Company” and “Company” are higher-level nodes of “Apple Inc.”
[0062] In embodiments of this disclosure, a lower-level node can refer to a node that is downstream of a given node and represents a more specific or subdivided concept. For example, in the chain “Company” > “Technology Company” > “Apple Inc.”, both “Technology Company” and “Apple Inc.” are lower-level nodes of “Company”.
[0063] In operation S260, the second and third node sets are merged to obtain the fourth node set; the fourth node set is input into the large language model to determine the target node that matches the target entity from the fourth node set.
[0064] Specifically, the second and third node sets are merged, and duplicate nodes are removed, resulting in a fourth node set with a larger number of nodes. This fourth set includes the original preliminary candidate nodes and their neighbors, thus expanding the search scope. The name (or identifier) of each node in the fourth node set (including the original second nodes and the newly added third nodes) is then input into the large language model. Using the same prompt template as when processing the second node set, the large language model is instructed to generate its entity semantic information for each node.
[0065] By employing the above method, when a matching target node cannot be determined from the second node set, the search space is expanded by finding a third node associated with the second node and merging them to form a fourth node set. This increases the chance of finding a node that matches the target entity, and is particularly suitable for situations in knowledge graphs where entity relationships are complex and direct matching is difficult.
[0066] According to embodiments of this disclosure, in response to the failure to determine a target node that matches the target entity from the second set of nodes, at least one of the following situations applies.
[0067] Case 1: The response is that the similarity between each node in the first node set and the target entity is less than the similarity threshold.
[0068] In the second scenario, the reasoning results of the large language model for each node in the second node set are all mismatched with the target entity.
[0069] In this context, the reasoning result refers to the answer or conclusion output by the large language model after receiving input (such as natural language prompts) and undergoing internal calculation and reasoning processes. In this embodiment, it specifically refers to the large language model's judgment result on whether the target entity matches the second node, such as "match," "do not match," or a confidence score.
[0070] According to an embodiment of this disclosure, in operation S210, determining a second node from the first node set whose similarity to the target entity is greater than or equal to a similarity threshold to obtain a second node set includes: obtaining the embedding vector corresponding to each node in the first node set, wherein the embedding vector is generated by a pre-trained entity alignment model based on the embedding vector corresponding to each first node; calculating the similarity between the target entity and each node in the first node set; and determining a second node from the first node set whose similarity is greater than or equal to a similarity threshold to obtain a second node set.
[0071] Specifically, embedding vectors transform discrete entity symbols into fixed-length, continuous real-valued vectors through an entity alignment model. These embedding vectors reside in a low-dimensional, dense vector space, capturing the semantic and structural information of entities. The distance or angle between vectors can be used to measure the similarity between entities.
[0072] By employing the above method, embedding vectors of nodes are generated using a pre-trained entity alignment model, and the similarity with the target entity is calculated based on these vectors to filter the second set of nodes, achieving efficient and automated preliminary candidate filtering. This fully leverages the ability of graph embedding technology to capture structural information from knowledge graphs, and compared to traditional string matching or manual rules, it can more effectively and quickly locate semantically similar candidate entities from a massive number of nodes.
[0073] According to an embodiment of this disclosure, in operation S230, a target node matching the target entity is determined from the second set of nodes, including operations S2301 to S2302.
[0074] In operation S2301, based on the entity semantic information, the semantic matching degree between the target entity and each node in the second node set is determined.
[0075] Specifically, for each candidate node in the second node set, a semantic similarity evaluation task is constructed. By comprehensively analyzing the semantic information of the target entity and the candidate node across multiple dimensions such as definition, synonyms, and hierarchical relationships, it is determined whether they refer to the same concept in the real world. For example, it is necessary to determine whether the definitions of two entities are consistent, whether their synonym lists overlap, and whether the superordinate category of one entity matches the hypothetical instance of another entity.
[0076] Furthermore, deep reasoning is performed using a large language model. The semantic comparison task described above, along with the complete semantic information of the target entity and candidate nodes, is submitted to the large language model as input. Pre-designed prompts guide the large language model to perform multi-step logical reasoning. Based on its massive knowledge base and reasoning capabilities, the large language model deeply integrates and analyzes the input semantic information, outputting a natural language response that includes the reasoning process and the final judgment. Subsequently, the reasoning output of the large language model is received. Through result parsing and confidence evaluation, the model's natural language judgment is converted into a quantitative score, yielding the semantic matching degree of each node in the second node set.
[0077] Operation S2302 determines the target node that matches the target entity from the second node set based on the semantic matching degree.
[0078] By employing the above method, the semantic matching degree metric is quantified, transforming the qualitative inference results of large language models into comparable numerical values. This makes the process of determining the optimal match from multiple candidate nodes more objective. While retaining the semantic understanding advantages of large language models, it also facilitates ranking and threshold judgment during node determination.
[0079] Figure 3 A flowchart illustrating a large language model-based entity alignment method according to an embodiment of the present disclosure is shown in the diagram.
[0080] According to an embodiment of this disclosure, in operation S2301, the semantic matching degree between the target entity and each node in the second node set is determined based on entity semantic information, including operations S310 to S330.
[0081] In operation S310, based on the semantic information of the target entity and each second node, natural language prompt words corresponding to each second node are generated.
[0082] When operating the S320, natural language prompts are input into the large language model to obtain inference results.
[0083] In operation S330, the inference results are processed for confidence, and the semantic matching degree between the target entity and each node in the second node set is generated.
[0084] Among them, natural language prompts are used to prompt the large language model to determine whether the semantic information of the target entity and each second node is the same.
[0085] For example, the target entity can also be configured as a newly launched smartwatch, and a second node in the second node set can be configured as a smartwatch of brand A. Based on the semantic information of the target entity and each second node, structured filling is performed according to a preset natural language prompt template to generate natural language prompt words. For example, for the target entity "newly launched smartwatch" and the second node "brand A smartwatch", the preset natural language prompt template is as follows:
[0086] Task instruction section: "Please determine whether the following two entities refer to the same real-world concept."
[0087] Information filling section: "Entity 1 name: Newly launched smart watch, Entity 1 definition: Wearable smart device with multiple health monitoring functions and Bluetooth connection, Entity 1 synonym: Smart wristband, Entity 1 hierarchical relationship: Belongs to the category of smart wearable devices, Brand B is its superior concept; Entity 2 name: Brand A smart watch, Entity 2 definition: Wearable device with sports monitoring and message reminder functions, Entity 2 synonym: Sports smart bracelet, Entity 2 hierarchical relationship: Belongs to the category of smart wearable devices, Brand A is its superior concept."
[0088] The reasoning steps include: "Please compare the definitions, synonyms, and hierarchical relationships of the two entities to identify matching points and conflict points, and perform logical deduction based on the matching points and conflict points to arrive at a matching conclusion." After filling in the blanks, the resulting natural language prompt is: "Please determine whether the following two entities refer to the same real-world concept. Entity 1 Name: Newly Launched Smartwatch; Entity 1 Definition: A wearable smart device with multiple health monitoring functions and Bluetooth connectivity; Entity 1 Synonym: Smart Wristband; Entity 1 Hierarchical Relationship: Belongs to the category of smart wearable devices, Brand B is its superordinate concept; Entity 2 Name: Brand A Smartwatch; Entity 2 Definition: A wearable device with sports monitoring and message notification functions; Entity 2 Synonym: Sports Smart Bracelet; Entity 2 Hierarchical Relationship: Belongs to the category of smart wearable devices, Brand A is its superordinate concept. Please compare the definitions, synonyms, and hierarchical relationships of the two entities to identify matching points and conflict points, and perform logical deduction based on the matching points and conflict points to arrive at a matching conclusion." The generated natural language prompts are input into the large language model, which then performs inference based on the prompts and outputs the inference results. The two entities are similar in function and category, but have different brands, and the overall judgment shows a high degree of matching.
[0089] By adopting the above method, natural language prompts are constructed and fed into a large language model for reasoning. The reasoning results are then converted into confidence scores to generate semantic matching scores. This fully utilizes the contextual understanding and logical deduction capabilities of the large language model, enabling in-depth analysis of semantic relationships and conflicts between entities, thereby generating a more reliable matching score assessment.
[0090] According to an embodiment of this disclosure, in operation S310, based on the semantic information of the target entity and each second node, natural language prompt words corresponding to each second node are generated respectively, including: structurally filling the semantic information of the target entity and each second node according to a preset natural language prompt template to generate natural language prompt words for large language model inference.
[0091] The preset natural language prompt template includes: a task instruction section, which instructs the large language model to determine whether two entities refer to the same real-world concept; an information filling section, which fills in placeholders for node names, node definitions, node lists, and node hierarchical relationships; and a reasoning step section, which instructs the large language model to perform the following operations: compare the definitions, synonyms, and hierarchical relationships of the two entities to identify matching points and conflict points, and perform logical deduction based on the matching points and conflict points to arrive at a matching conclusion.
[0092] Specifically, the pre-defined natural language prompt template consists of a task instruction section, an information filling section, and an inference step section. The task instruction section clearly instructs the large language model on the task to complete, namely, determining whether two entities refer to the same real-world concept. The information filling section provides placeholders for filling in information such as node names, node definitions, node lists, and hierarchical relationships between nodes, facilitating the large language model to obtain detailed information about relevant entities. The inference step section guides the large language model on how to perform inference, identifying matching points and conflict points by comparing the definitions, synonyms, and hierarchical relationships of the two entities, and then logically deriving a matching conclusion based on these.
[0093] In embodiments of this disclosure, the task instruction portion is used to clarify the task. The task instruction portion can clearly tell the large language model what specific work the user needs it to perform. This is achieved by transforming the vague "comparing two things" into a clear and specific classification task, namely, "determining whether two entities refer to the same real-world concept."
[0094] In embodiments of this disclosure, the information filling section is used to provide the credentials required for reasoning. This embodiment employs a structured format (e.g., using headings, bullet points, and colons) to associate key semantic information of the "target entity" and "candidate nodes," reducing the difficulty for large language models to understand input information and avoiding information clutter. Placeholders serve as the template interface; during actual runtime, pre-generated entity semantic information is dynamically filled into these positions, thereby generating unique and complete prompts for each reasoning iteration.
[0095] By using pre-defined natural language prompt templates to generate prompt words in a structured manner, the consistency of instructions, integrity of information, and rigor of logic in each inference task are ensured. This effectively guides the large language model to process according to the pre-defined process, reduces the randomness and bias of the model output, ensures the stability and repeatability of the semantic matching degree generation process, and further improves the accuracy of entity alignment results.
[0096] Based on the aforementioned entity alignment method based on a large language model, this disclosure also provides an entity alignment device based on a large language model. The following will combine... Figure 4 The device is described in detail.
[0097] Figure 4 A schematic block diagram of a large language model-based entity alignment device according to an embodiment of the present disclosure is shown.
[0098] like Figure 4 As shown, the entity alignment device 400 based on a large language model in this embodiment includes a first node filtering module 410, a model processing module 420, a second node filtering module 430, and a result determination module 440.
[0099] The first node filtering module 410 is used to convert each node in the knowledge graph into a first node set with the same format as the target entity; and to determine the second nodes from the first node set whose similarity to the target entity is greater than or equal to the similarity threshold, thus obtaining the second node set.
[0100] The model processing module 420 is used to input the target entity and the second node set into the large language model and generate entity semantic information for the target entity and each second node respectively. The entity semantic information includes at least one of entity definition, synonyms and hyponyms.
[0101] The second node filtering module 430 is used to determine the target node that matches the target entity from the second node set based on entity semantic information.
[0102] The result determination module 440 is used to identify the target node as the aligned entity of the target entity in the knowledge graph.
[0103] According to embodiments of this disclosure, the entity alignment device 400 based on a large language model further includes a third node filtering module.
[0104] The third node filtering module is used to determine the third node associated with each second node in the knowledge graph in response to the failure to identify a target node that matches the target entity from the second node set, thereby obtaining a third node set. Each third node is an upper or lower node of the associated second node in the relation chain of the knowledge graph. The second node set and the third node set are merged to obtain a fourth node set. The fourth node set is input into the large language model to identify the target node that matches the target entity from the fourth node set.
[0105] According to an embodiment of this disclosure, the third node filtering module is further configured to respond to the fact that the similarity between each node in the first node set and the target entity is less than a similarity threshold; and to respond to the fact that the reasoning results of the large language model for each node in the second node set are all mismatched with the target entity.
[0106] According to an embodiment of this disclosure, the first node filtering module 410 is further configured to obtain the embedding vector corresponding to each node in the first node set, wherein the embedding vector is generated by a pre-trained entity alignment model based on the embedding vector corresponding to each first node, calculate the similarity between the target entity and each node in the first node set, and determine the second node from the first node set whose similarity is greater than or equal to the similarity threshold to obtain the second node set.
[0107] According to an embodiment of this disclosure, the second node filtering module 430 is further configured to determine the semantic matching degree between the target entity and each node in the second node set based on entity semantic information; and to determine the target node that matches the target entity from the second node set based on the semantic matching degree.
[0108] According to an embodiment of this disclosure, the second node filtering module 430 is further configured to generate natural language prompts corresponding to each second node based on the semantic information of the target entity and each second node; input the natural language prompts into a large language model to obtain inference results; perform confidence processing on the inference results to generate the semantic matching degree between the target entity and each node in the set of second nodes; wherein, the natural language prompts are used to prompt the large language model to determine whether the semantic information of the target entity and each second node is the same.
[0109] According to embodiments of this disclosure, the second node filtering module 430 is further configured to structurally fill in the semantic information of the target entity and each second node according to a preset natural language prompt template, generating natural language prompt words for reasoning by the large language model; wherein, the preset natural language prompt template includes: a task instruction part, used to instruct the large language model to determine whether two entities point to the same real-world concept; an information filling part, used to fill in placeholders for node name, node definition, node list, and node hierarchical relationship; and a reasoning step part, used to instruct the large language model to perform the following operations: compare the definitions, synonyms, and hierarchical relationships of the two entities to identify matching points and conflict points, and perform logical deduction based on the matching points and conflict points to arrive at a matching conclusion.
[0110] According to embodiments of this disclosure, any plurality of modules among the first node filtering module 410, model processing module 420, second node filtering module 430, and result determination module 440 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the first node filtering module 410, model processing module 420, second node filtering module 430, and result determination module 440 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the first node filtering module 410, model processing module 420, second node filtering module 430, and result determination module 440 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0111] Figure 5 A block diagram schematically illustrates an electronic device suitable for implementing a large language model-based entity alignment method according to embodiments of the present disclosure.
[0112] like Figure 5As shown, an electronic device 500 according to an embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage portion 508 into a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0113] RAM 503 stores various programs and data required for the operation of electronic device 500. Processor 501, ROM 502, and RAM 503 are interconnected via bus 504. Processor 501 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 502 and / or RAM 503. It should be noted that the programs may also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0114] According to embodiments of this disclosure, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to a bus 504. The electronic device 500 may also include one or more of the following components connected to the input / output (I / O) interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 510 as needed so that computer programs read from it can be installed into the storage section 508 as needed.
[0115] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0116] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 502 and / or RAM 503 and / or one or more memories other than ROM 502 and RAM 503 described above.
[0117] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the entity alignment method based on a large language model provided in embodiments of this disclosure.
[0118] When the computer program is executed by the processor 501, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0119] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 509, and / or installed from a removable medium 511. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0120] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by processor 501, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0121] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0122] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0123] Those skilled in the art will understand that the features described in the various embodiments of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments of this disclosure can be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0124] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. An entity alignment method based on a large language model, characterized in that, The method includes: Each node in the knowledge graph is converted into a first set of nodes with the same format as the target entity; and a second set of nodes is obtained from the first set of nodes whose similarity to the target entity is greater than or equal to a similarity threshold. The target entity and the second node set are input into the large language model to generate entity semantic information for the target entity and each second node, respectively. The entity semantic information includes at least one of entity definition, synonyms and hyponyms / hypernyms. Based on the entity semantic information, a target node matching the target entity is determined from the second node set; The target node is used as the aligned entity of the target entity in the knowledge graph.
2. The method according to claim 1, characterized in that, The method further includes: In response to the failure to determine a target node that matches the target entity from the second node set, a third node associated with each second node is determined in the knowledge graph to obtain a third node set, wherein each third node is an upper or lower node of the associated second node in the relation chain of the knowledge graph. The second set of nodes and the third set of nodes are merged to obtain the fourth set of nodes; The fourth node set is input into the large language model to determine the target node that matches the target entity from the fourth node set.
3. The method according to claim 2, characterized in that, The response to not determining a target node matching the target entity from the second set of nodes includes at least one of the following: In response to the fact that the similarity between each node in the first node set and the target entity is less than the similarity threshold; The reasoning results of the large language model for each node in the second node set are all inconsistent with the target entity.
4. The method according to claim 1, characterized in that, The step of determining a second node from the first node set whose similarity to the target entity is greater than or equal to a similarity threshold, to obtain a second node set, includes: Obtain the embedding vector corresponding to each node in the first node set. The embedding vector is generated by a pre-trained entity alignment model. Based on the embedding vectors corresponding to each first node, the similarity between the target entity and each node in the first node set is calculated. From the first set of nodes, determine the second set of nodes whose similarity is greater than or equal to the similarity threshold.
5. The method according to claim 1, characterized in that, Based on the entity semantic information, determining the target node that matches the target entity from the second node set includes: Based on the entity semantic information, the semantic matching degree between the target entity and each node in the second node set is determined; Based on the semantic matching degree, target nodes that match the target entity are determined from the second set of nodes.
6. The method according to claim 5, characterized in that, Determining the semantic matching degree between the target entity and each node in the second node set based on the entity semantic information includes: Based on the semantic information of the target entity and each second node, natural language prompts are generated for each second node. The natural language prompts are input into the large language model to obtain the inference results; The reasoning results are processed for confidence, and the semantic matching degree between the target entity and each node in the second node set is generated. The natural language prompt words are used to prompt the large language model to determine whether the semantic information of the target entity and each second node is the same.
7. The method according to claim 6, characterized in that, Based on the semantic information of the target entity and each second node, natural language prompts are generated for each second node, including: The semantic information of the target entity and each second node is respectively structured and filled according to a preset natural language prompt template to generate natural language prompt words for reasoning in a large language model. The preset natural language prompt template includes: a task instruction section, used to instruct the large language model to determine whether two entities refer to the same real-world concept; an information filling section, used to fill in placeholders for node names, node definitions, node lists, and node hierarchical relationships; and a reasoning step section, used to instruct the large language model to perform the following operations: compare the definitions, synonyms, and hierarchical relationships of the two entities to identify matching points and conflict points, and perform logical deduction based on the matching points and conflict points to arrive at a matching conclusion.
8. An entity alignment device based on a large language model, characterized in that, The device includes: The first node filtering module is used to convert each node in the knowledge graph into a first node set with the same format as the target entity; and to determine the second node from the first node set whose similarity to the target entity is greater than or equal to a similarity threshold, thus obtaining a second node set. The model processing module is used to input the target entity and the second node set into the large language model, and generate entity semantic information for the target entity and each second node respectively. The entity semantic information includes at least one of entity definition, synonyms and hyponyms. The second node filtering module is used to determine the target node that matches the target entity from the second node set based on the entity semantic information; The result determination module is used to identify the target node as the aligned entity of the target entity in the knowledge graph.
9. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.