Entity comparison and model training method, device, equipment, computer storage medium

By obtaining the attribute and type information of an entity, combining the correlation degree and importance distribution characteristics and attention distribution parameters, the entity comparison problem under different entity types is solved, and efficient and accurate entity disambiguation is achieved.

CN113705235BActive Publication Date: 2025-07-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110361949.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-02
Publication Date
2025-07-29
Estimated Expiration
2041-04-02

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently compare entities in different entity type scenarios, and requires separate models to be constructed and trained, which is time-consuming and difficult to support a large number of entity disambiguation needs of different entity types.

Method used

By obtaining the attribute information and type information of the entity to be compared, using the correlation distribution characteristics and importance distribution characteristics, combined with the attention distribution parameters, we determine whether the entities are the same, and realize the general entity comparison task.

Benefits of technology

Improves the accuracy and iterative efficiency of entity comparison, supports disambiguation tasks of different entity types, and the processing process is interpretable.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113705235B_ABST
    Figure CN113705235B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, device, and computer storage medium for entity comparison and model training. Among them, the entity comparison method includes: respectively obtaining the attribute information and type information of a first entity and a second entity to be compared; based on the attribute information of the first entity and the attribute information of the second entity, determining the correlation degree distribution characteristics between the attributes of the first entity and the attributes of the second entity; based on the type information of the first entity and the type information of the second entity, and a first attention distribution parameter, determining the importance distribution characteristics of the correlation degree between the attributes of the first entity and the attributes of the second entity; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity pairs; based on the correlation degree distribution characteristics and the importance distribution characteristics, determining whether the first entity is the same as the second entity. In the present application, the comparison task of general entities can be realized, and thus the iteration efficiency of the entity disambiguation task can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of artificial intelligence, and in particular, to a method, device, equipment, and computer-readable storage medium for entity comparison and model training. Background Art

[0002] In recent years, with the development of knowledge graph technology, entity comparison or entity matching technology has been widely used in the construction of knowledge graphs, aiming to confirm whether two given entities are the same entity, and if so, fuse them. In related technologies, in solving entity comparison or entity matching problems, mainly through the method of aggregating attribute similarities, or first constructing vector representations using attributes, and then further encoding the vector representations in combination with traditional machine learning models or deep learning models, and solving the entity comparison task as a classification problem. However, most of the above solutions are for comparison tasks of vertical entities or single entity types, and it is difficult to generalize to different entity types. For scenarios of different entity types, separate model construction and training are often required, which is time-consuming and difficult to support the entity disambiguation needs of a large number of different entity types. Summary of the Invention

[0003] Embodiments of this application provide a method, device, equipment, and computer-readable storage medium for entity comparison and model training, which can implement the comparison task of general entities, thereby improving the iteration efficiency of the entity disambiguation task, and can also improve the accuracy of entity comparison to a certain extent, and the processing process is interpretable.

[0004] The technical solution of the embodiments of this application is implemented as follows:

[0005] Embodiments of this application provide an entity comparison method, including:

[0006] Obtain the attribute information and type information of the first entity and the second entity to be compared respectively;

[0007] Based on the attribute information of the first entity and the attribute information of the second entity, determine the correlation degree distribution characteristics between each attribute of the first entity and each attribute of the second entity;

[0008] Based on the type information of the first entity and the type information of the second entity, and the first attention distribution parameter, determine the importance distribution characteristics of the correlation degree between each attribute of the first entity and each attribute of the second entity; the first attention distribution parameter characterizes the attention distribution of the correlation degree between each attribute of different entity pairs.

[0009] Based on the correlation degree distribution characteristics and the importance distribution characteristics, determine whether the first entity is the same as the second entity.

[0010] An embodiment of the present application provides a model training method for training an entity comparison model, and the trained entity comparison model is used to compare entity pairs in a content service, including:

[0011] Obtain a sample entity pair and an annotation result for annotating whether the first sample entity and the second sample entity in the sample entity pair are the same;

[0012] Input the sample entity pair into the entity comparison model to be trained; the entity comparison model is used to respectively obtain the attribute information and type information of the first sample entity and the second sample entity; based on the attribute information of the first sample entity and the attribute information of the second sample entity, determine the correlation degree distribution characteristics between the attributes of the first sample entity and the attributes of the second sample entity; based on the type information of the first sample entity and the type information of the second sample entity, and the first attention distribution parameter, determine the importance distribution characteristics of the correlation degree between the attributes of the first sample entity and the attributes of the second sample entity; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity type pairs; based on the correlation degree distribution characteristics and the importance distribution characteristics, determine a prediction result indicating whether the first sample entity and the second sample entity are the same;

[0013] Based on the prediction result and the annotation result, adjust the parameters of the entity comparison model to obtain a trained entity comparison model.

[0014] An embodiment of the present application provides an entity comparison device, including:

[0015] A first acquisition module for respectively acquiring the attribute information and type information of a first entity and a second entity to be compared;

[0016] A first determination module for determining the correlation degree distribution characteristics between the attributes of the first entity and the attributes of the second entity based on the attribute information of the first entity and the attribute information of the second entity;

[0017] A second determination module for determining the importance distribution characteristics of the correlation degree between the attributes of the first entity and the attributes of the second entity based on the type information of the first entity and the type information of the second entity, and the first attention distribution parameter; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity type pairs;

[0018] A third determination module for determining whether the first entity and the second entity are the same based on the correlation degree distribution characteristics and the importance distribution characteristics.

[0019] In some embodiments, the third determination module is further configured to: perform feature fusion processing on the association degree distribution feature and the importance degree distribution feature to obtain an important association degree distribution feature between each attribute of the first entity and each attribute of the second entity; perform classification processing on the important association degree distribution feature to obtain a classification result indicating whether the first entity is the same as the second entity; and determine whether the first entity is the same as the second entity based on the classification result.

[0020] In some embodiments, the first determination module is further configured to: determine an association degree distribution feature between each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity, the attribute information of the second entity, and a second attention distribution parameter; where the second attention distribution parameter characterizes an attention distribution of comparability between each attribute of the first entity and each attribute of the second entity.

[0021] In some embodiments, the association degree distribution feature includes an association degree between each attribute of the first entity and each attribute of the second entity, and the first determination module is further configured to: determine each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity and the attribute information of the second entity; for each attribute of the first entity, determine an association degree between each attribute value of the attribute and each attribute value of each attribute of the second entity based on the second attention distribution parameter; and determine an association degree between each attribute of the first entity and each attribute of the second entity based on the association degree between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity.

[0022] In some embodiments, the first determination module is further configured to: for each group of an attribute of the first entity and an attribute of the second entity, determine the maximum value among the association degrees between each attribute value of the attribute of the first entity and each attribute value of the attribute of the second entity as the association degree between the attribute of the first entity and the attribute of the second entity.

[0023] In some embodiments, the attribute information of the first entity includes a first attribute tensor, the attribute information of the second entity includes a second attribute tensor, the second attention distribution parameter includes an attribute attention tensor, both the first attribute tensor and the second attribute tensor are three-dimensional tensors with a shape of K*N*D1, and the attribute attention tensor is a three-dimensional tensor with a shape of K*N*N, where K is a preset maximum number of attributes, N is a preset maximum number of attribute values, and D1 is the dimension of the representation vector of the attribute value.

[0024] In some embodiments, the second determination module is further configured to: perform an association process on the type information of the first entity and the type information of the second entity to obtain the association degree between each entity type of the first entity and each entity type of the second entity; based on the association degree between each entity type of the first entity and each entity type of the second entity, determine the association degree between each entity type of the first entity and the second entity; based on the association degree between each entity type of the first entity and the second entity, and the first attention distribution parameter, determine the importance distribution characteristics of the association degree between each attribute of the first entity and each attribute of the second entity.

[0025] In some embodiments, the second determination module is further configured to: for each entity type of the first entity, determine the maximum value among the association degrees between the entity type of the first entity and each entity type of the second entity as the association degree between the entity type of the first entity and the second entity.

[0026] In some embodiments, the type information of the first entity includes a first type matrix, the type information of the second entity includes a second type matrix, the first attention distribution parameter includes a type attention tensor, the shapes of the first type matrix and the second type matrix are both T*D2, and the type attention tensor is a three-dimensional tensor with a shape of T*K*K, where T is the total number of entity types in the current knowledge graph, D2 is the dimension of the representation vector of the preset entity type, and K is the maximum value of the preset number of attributes.

[0027] In some embodiments, the device further includes: a second acquisition module, configured to acquire a sample entity pair and an annotation result for annotating whether a first sample entity and a second sample entity in the sample entity pair are the same; a third acquisition module, configured to respectively acquire the attribute information and type information of the first sample entity and the second sample entity; a fourth determination module, configured to determine the correlation degree distribution feature between each attribute of the first sample entity and each attribute of the second sample entity based on the attribute information of the first sample entity and the attribute information of the second sample entity; a fifth determination module, configured to determine the importance distribution feature of the correlation degree between each attribute of the first sample entity and each attribute of the second sample entity based on the type information of the first sample entity, the type information of the second sample entity, and a first attention distribution parameter, where the first attention distribution parameter characterizes the attention distribution of the correlation degree between each attribute of different entity type pairs; a sixth determination module, configured to determine a prediction result indicating whether the first sample entity and the second sample entity are the same based on the correlation degree distribution feature and the importance distribution feature; a first adjustment module, configured to adjust the first attention distribution parameter based on the prediction result and the annotation result.

[0028] An embodiment of the present application provides a model training device for training an entity comparison model, and the trained entity comparison model is used to compare entity pairs in content services. The device includes:

[0029] A fourth acquisition module, configured to acquire a sample entity pair and an annotation result for annotating whether a first sample entity and a second sample entity in the sample entity pair are the same;

[0030] A comparison module, configured to: input the sample entity pair into an entity comparison model to be trained; the entity comparison model is configured to respectively acquire the attribute information and type information of the first sample entity and the second sample entity; determine the correlation degree distribution feature between each attribute of the first sample entity and each attribute of the second sample entity based on the attribute information of the first sample entity and the attribute information of the second sample entity; determine the importance distribution feature of the correlation degree between each attribute of the first sample entity and each attribute of the second sample entity based on the type information of the first sample entity, the type information of the second sample entity, and a first attention distribution parameter, where the first attention distribution parameter characterizes the attention distribution of the correlation degree between each attribute of different entity type pairs; determine a prediction result indicating whether the first sample entity and the second sample entity are the same based on the correlation degree distribution feature and the importance distribution feature;

[0031] A second adjustment module, configured to adjust parameters of the entity comparison model based on the prediction result and the annotation result, so as to obtain a trained entity comparison model.

[0032] An embodiment of the present application provides an entity comparison device, including: a memory for storing executable instructions; a processor for implementing the entity comparison method provided by the embodiment of the present application when executing the executable instructions stored in the memory.

[0033] An embodiment of the present application provides a model training device, including: a memory for storing executable instructions; a processor for implementing the model training method provided by the embodiment of the present application when executing the executable instructions stored in the memory.

[0034] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to implement the method provided by the embodiment of the present application when executed.

[0035] The embodiment of the present application has the following beneficial effects:

[0036] First, obtain the attribute information and type information of the first entity and the second entity to be compared respectively; secondly, determine the correlation degree distribution characteristics between the attributes of the first entity and the attributes of the second entity based on the attribute information of the first entity and the attribute information of the second entity; then, based on the type information of the first entity and the type information of the second entity, and the first attention distribution parameter, determine the importance distribution characteristics of the correlation degree between the attributes of the first entity and the attributes of the second entity; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity types; finally, determine whether the first entity and the second entity are the same based on the correlation degree distribution characteristics and the importance distribution characteristics. In this way, when comparing entities, both attribute information and type information are comprehensively considered, and different attributes can be focused on according to different entity types based on the attention mechanism, so that the comparison task of general entities can be realized, the needs of different entity type disambiguation tasks can be met, the accuracy of entity comparison can be improved to a certain extent, and the iteration efficiency of the entity disambiguation task can be improved to a certain extent, and the processing process is interpretable. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is an optional architecture diagram of the entity comparison system provided by the embodiment of the present application;

[0038] Figure 2A is an optional structural diagram of the entity comparison device provided by the embodiment of the present application;

[0039] Figure 2B is an optional structural diagram of the model training device provided by the embodiment of the present application;

[0040] Figure 3 is an optional flowchart of the entity comparison method provided by an embodiment of the present application;

[0041] Figure 4 is an optional flowchart of the entity comparison method provided by an embodiment of the present application;

[0042] Figure 5 is an optional flowchart of the entity comparison method provided by an embodiment of the present application;

[0043] Figure 6 is an optional flowchart of the entity comparison method provided by an embodiment of the present application;

[0044] Figure 7 is an optional flowchart of the entity comparison method provided by an embodiment of the present application;

[0045] Figure 8 is an optional flowchart of the model training method provided by an embodiment of the present application;

[0046] Figure 9 is a schematic diagram of the implementation architecture of an entity comparison method provided by an embodiment of the present application. Detailed implementation manners

[0047] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be construed as limitations on the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application.

[0048] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0049] If similar descriptions such as "first / second" appear in the application documents, the following explanation is added. In the following description, the terms "first\second\third" only distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence when permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this application belongs. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0051] Before further elaborating on the embodiments of this application, the nouns and terms involved in the embodiments of this application are described. The nouns and terms involved in the embodiments of this application are applicable to the following explanations.

[0052] 1) Knowledge Graph: A Knowledge Graph is essentially a large-scale semantic network that is rich in entities, concepts, attributes, and various semantic relationships.

[0053] 2) Entity: Refers to things in the real world stored in the Knowledge Graph, such as people, place names, concepts, drugs, companies, etc.

[0054] 3) Entity Type: Each entity in the Knowledge Graph corresponds to an entity type, and the entity type can be regarded as a general classification of the entity. An entity type can include multiple entities. For example, the entity type of the entity "rose" is "plant category"; another example is that the entity type of the entity "refrigerator" is "household appliance category".

[0055] 4) Attribute: A feature or characteristic used to describe an entity of an entity type. For example, the entity type "person" has the attribute "birthday". An entity type can correspond to multiple attributes, and the attributes corresponding to different entity types vary greatly. For example, each entity under the entity type "plant category" usually has attributes such as "kingdom", "phylum", "class", "order", etc., while each entity under the entity type "movie category" usually has attributes such as "release date", "duration", "movie type", etc.

[0056] 5) Entity Disambiguation: An entity reference can correspond to multiple entities in the real world, resulting in the problem of entity ambiguity. For example, Jordan can refer to a basketball player, a computer scientist, or other entities. Entity disambiguation refers to eliminating the problem of unclear entity reference and determining the entity in the real world that an entity reference points to. When implementing the entity disambiguation requirement, it can be achieved by comparing whether two specified entities are the same entity. If they are the same entity, these two entities are fused, thereby realizing entity disambiguation.

[0057] 6) General Entity Comparison: Refers to a method that does not distinguish entity categories and supports the comparison of any category of entities.

[0058] The embodiments of the present application provide a method, apparatus, device, and computer-readable storage medium for entity comparison and model training. When performing entity comparison, the attribute information and type information can be comprehensively considered, and different attributes can be focused on according to different entity types based on the attention mechanism, so as to achieve the comparison task of general entities, meet the needs of disambiguation tasks for different entity types, and then improve the iteration efficiency of entity disambiguation tasks to a certain extent, and the processing process is interpretable. The following describes the exemplary applications of the entity comparison device and model training device provided by the embodiments of the present application. The entity comparison device and model training device provided by the embodiments of the present application are both electronic devices, which can be implemented as various types of user terminals such as laptop computers, tablet computers, desktop computers, vehicle navigation devices, set-top boxes, and mobile devices (such as mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable game devices), or can be implemented as servers. The following will describe the exemplary application when the electronic device provided by the embodiments of the present application is implemented as a server.

[0059] See Figure 1 , Figure 1 FIG. is an optional schematic architecture diagram of the entity comparison system 100 provided by the embodiments of the present application, which can implement the task of comparing the entity pairs to be compared. The terminals (exemplarily showing terminals 400-1 and 400-2) are connected to the server 200 through the network 300. The network 300 can be a wide area network, a local area network, or a combination of the two.

[0060] The terminal is used for: displaying an interactive interface for the user to perform entity comparison on a graphical interface (exemplarily showing graphical interfaces 410-1 and 410-2), receiving the entity comparison operation performed by the user on the entity pairs to be compared, and sending the entity pairs to be compared to the server 200.

[0061] The server 200 is used for: respectively obtaining the attribute information and type information of the first entity and the second entity to be compared; determining the correlation degree distribution characteristics between the attributes of the first entity and the attributes of the second entity based on the attribute information of the first entity and the attribute information of the second entity; determining the importance degree distribution characteristics of the correlation degree between the attributes of the first entity and the attributes of the second entity based on the type information of the first entity, the type information of the second entity, and the first attention distribution parameter; the first attention distribution parameter represents the attention distribution of the correlation degree between the attributes of different entity type pairs; determining whether the first entity is the same as the second entity based on the correlation degree distribution characteristics and the importance degree distribution characteristics.

[0062] Alternatively, the server 200 is configured to: obtain a sample entity pair and an annotation result for annotating whether a first sample entity and a second sample entity in the sample entity pair are the same; input the sample entity pair into an entity comparison model to be trained; the entity comparison model is configured to respectively obtain attribute information and type information of the first sample entity and the second sample entity; based on the attribute information of the first sample entity and the attribute information of the second sample entity, determine a correlation degree distribution feature between each attribute of the first sample entity and each attribute of the second sample entity; based on the type information of the first sample entity and the type information of the second sample entity, and a first attention distribution parameter, determine an importance distribution feature of the correlation degree between each attribute of the first sample entity and each attribute of the second sample entity; the first attention distribution parameter represents an attention distribution condition of the correlation degree between each attribute of different entity type pairs; based on the correlation degree distribution feature and the importance distribution feature, determine a prediction result indicating whether the first sample entity and the second sample entity are the same; based on the prediction result and the annotation result, adjust parameters of the entity comparison model to obtain a trained entity comparison model.

[0063] In addition, the entity comparison system involved in the embodiments of the present application may also be a distributed system applied to a blockchain system, and the server 200 may be implemented as a node on the blockchain. The distributed system may be a distributed node formed by multiple nodes and clients. The nodes may be any form of computing device connected to the network, such as a server, a user terminal, etc. The nodes form a peer-to-peer (P2P) network.

[0064] In some embodiments, the server 200 may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers. It may also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal 400 may be a map data automatic collection vehicle, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected through a wired or wireless communication method, which is not limited in the embodiments of the present invention.

[0065] See Figure 2A , Figure 2A is a schematic structural diagram of an entity comparison device provided by an embodiment of the present application. Figure 2AThe illustrated entity comparison device includes: at least one processor 210, a memory 250, at least one network interface 220, and a user interface 230. The various components in the entity comparison device are coupled together via a bus system 240. It is understood that the bus system 240 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 240 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 240 is not described in detail. Figure 2A Various buses are labeled as bus system 240 .

[0066] The processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0067] The user interface 230 includes one or more output devices 231 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 230 also includes one or more input devices 232, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0068] The memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 250 may optionally include one or more storage devices that are physically remote from the processor 210.

[0069] The memory 250 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 250 described in the embodiments of the present application is intended to include any suitable type of memory.

[0070] In some embodiments, the memory 250 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0071] Operating system 251, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;

[0072] A network communication module 252 for reaching other computing devices via one or more (wired or wireless) network interfaces 220. Exemplary network interfaces 220 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB), etc.;

[0073] A presentation module 253 for enabling the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 231 associated with the user interface 230 (such as a display screen, a speaker, etc.);

[0074] An input processing module 254 for detecting and translating one or more user inputs or interactions from one of one or more input devices 232.

[0075] In some embodiments, the entity comparison device provided by the embodiments of the present application can be implemented in software. Figure 2A Shown is an entity comparison device 255 stored in the memory 250, which can be software in the form of a program and a plug-in, etc., including the following software modules: a first acquisition module 2551, a first determination module 2552, a second determination module 2553, and a third determination module 2554. These modules are logical, and thus can be combined arbitrarily or further split according to the functions implemented.

[0076] The functions of each module will be described below.

[0077] In other embodiments, the entity comparison device provided by the embodiments of the present application can be implemented in hardware. As an example, the entity comparison device provided by the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the entity comparison method provided by the embodiments of the present application. For example, a processor in the form of a hardware decoding processor can employ one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field-Programmable Gate Arrays (FPGAs), or other electronic components.

[0078] See Figure 2B , Figure 2B is a schematic structural diagram of a model training device provided by the embodiments of the present application. Figure 2BThe model training device shown includes: at least one processor 310, a memory 350, at least one network interface 320, and a user interface 330. Each component in the model training device is coupled together through a bus system 340. It can be understood that the bus system 340 is used to implement connection and communication between these components. In addition to a data bus, the bus system 340 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 2B all kinds of buses are labeled as the bus system 340.

[0079] The processor 310 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0080] The user interface 330 includes one or more output devices 331 that enable the presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 330 also includes one or more input devices 332, including user interface components that facilitate user input, such as keyboards, mice, microphones, touch screen displays, cameras, other input buttons, and controls.

[0081] The memory 350 can be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memories, hard disk drives, optical disc drives, etc. The memory 350 optionally includes one or more storage devices that are physically located away from the processor 310.

[0082] The memory 350 includes volatile memory or non-volatile memory, and can also include both volatile and non-volatile memory. The non-volatile memory can be a read-only memory (ROM, Read Only Memory), and the volatile memory can be a random access memory (RAM, Random Access Memory). The memory 350 described in the embodiments of the present application is intended to include any suitable type of memory.

[0083] In some embodiments, the memory 350 is capable of storing data to support various operations. Examples of such data include programs, modules, and data structures, or subsets or supersets thereof, which are illustrated below.

[0084] An operating system 351, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0085] A network communication module 352 for reaching other computing devices via one or more (wired or wireless) network interfaces 320. Exemplary network interfaces 320 include: Bluetooth, WiFi, USB, etc.

[0086] A presentation module 353 for enabling the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 331 associated with the user interface 330 (such as a display screen, a speaker, etc.).

[0087] An input processing module 354 for detecting and translating one or more user inputs or interactions from one of one or more input devices 332.

[0088] In some embodiments, the model training device provided by the embodiments of the present application may be implemented in software. Figure 2B Shown is a model training device 355 stored in the memory 350, which may be software in the form of a program and a plug-in, etc., including the following software modules: a fourth acquisition module 3551, a comparison module 3552, and a second adjustment module 3553. These modules are logical, so they can be combined arbitrarily or further split according to the functions implemented.

[0089] The functions of each module will be described below.

[0090] In other embodiments, the model training device provided by the embodiments of the present application may be implemented in hardware. As an example, the model training device provided by the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the model training method provided by the embodiments of the present application. For example, a processor in the form of a hardware decoding processor may employ one or more ASICs, DSPs, PLDs, complex CPLDs, FPGAs, or other electronic components.

[0091] The entity comparison method provided by the embodiments of the present application will be described below in combination with the exemplary applications and implementations of the terminal or server provided by the embodiments of the present application.

[0092] See Figure 3 , Figure 3 is an optional flowchart of the entity comparison method provided by the embodiments of the present application. The following will be described in combination with the Figure 3 steps shown. The execution subject of the following steps may be the terminal or server mentioned above.

[0093] In step S101, the attribute information and type information of the first entity and the second entity to be compared are respectively obtained.

[0094] Here, the first entity and the second entity to be compared are two entities for which it is necessary to determine whether they are the same entity. When the two entities refer to the same thing in the real world, these two entities are the same entity. In implementation, the first entity and the second entity can be entities in any suitable field, such as entities in content services, entities in the medical field, entities on the Internet, entities in the education field, etc.

[0095] The attribute information and type information of the first entity, as well as the attribute information and type information of the second entity, can be obtained from an existing knowledge graph or from entity data crawled from the network by a web crawler. For example, a web crawler can be used to crawl the unstructured data of each entity on the network, and the attribute information and type information of the first entity, as well as the attribute information and type information of the second entity, can be obtained from the crawled unstructured data. The data sources for crawling unstructured data can include, but are not limited to, websites with basic description data of entities, such as encyclopedia websites and forum websites. During the process of constructing or updating the knowledge graph, since the descriptions of the same entity in different data sources may vary, multiple entities to be compared that point to the same entity can be fused to achieve entity disambiguation.

[0096] The attribute information of an entity can include at least one entity attribute of the entity, and each entity attribute can include at least one attribute value. For example, if there is an entity "Tencent", the entity attributes corresponding to this entity can include: "company name", and the corresponding attribute value can be "Tencent"; "address", and the corresponding attribute values can include "address 1", "address 2", etc. In implementation, the attribute information of the entity can be represented in any suitable manner such as text, vector, matrix, tensor, etc., which is not limited here.

[0097] The type information of an entity can include at least one entity type associated with the entity. For example, if there is an entity "Wolf Warrior", the entity types corresponding to this entity can include "pan-entertainment", "movie", "action movie". Another example is that for the entity "refrigerator", the corresponding entity types can include "electrical appliance", "household appliance", etc. In implementation, the type information of the entity can be represented in any suitable manner such as text, vector, matrix, tensor, etc., which is not limited here.

[0098] In step S102, based on the attribute information of the first entity and the attribute information of the second entity, determine the correlation degree distribution characteristics between the attributes of the first entity and the attributes of the second entity.

[0099] Here, the correlation degree distribution feature between the attributes of the first entity and the attributes of the second entity is a feature that characterizes the correlation relationship between each attribute of the first entity and each attribute of the second entity. The correlation relationship between attributes can include, but is not limited to, one or more of any information that can characterize the correlation between the first entity and the second entity at the attribute level, such as the similarity between attributes, logical association, etc. In implementation, each attribute of the entity can be obtained from the attribute information of the entity, and the correlation degree distribution feature between the attributes of the first entity and the attributes of the second entity can be determined by determining the correlation relationship between each attribute of the first entity and each attribute of the second entity. For example, the similarity between each attribute of the first entity and each attribute of the second entity can be calculated, and the correlation degree distribution feature between the attributes of the first entity and the attributes of the second entity can include the similarity between each attribute of the first entity and each attribute of the second entity.

[0100] In step S103, based on the type information of the first entity, the type information of the second entity, and the first attention distribution parameter, determine the importance distribution feature of the correlation degree between the attributes of the first entity and the attributes of the second entity; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity pairs.

[0101] Here, the first attention distribution parameter can characterize the attention distribution of the correlation degree between the attributes of different entity pairs, and can include the attention that needs to be paid to the correlation degree between the attributes of different entity pairs when comparing entities. Therefore, the first attention distribution parameter can reflect the distribution of the importance degree of the correlation degree between each attribute of different entity pairs in the process of entity comparison. Different entity pairs can include some or all entity pairs composed of any entity types in the current knowledge graph or the entity types currently crawled. In implementation, the first attention distribution parameter can be preset, or initialized in any suitable initialization manner in advance, or obtained through pre-training, which is not limited here.

[0102] The importance distribution feature of the correlation degree between the attributes of the first entity and the attributes of the second entity is a feature that characterizes the importance of the correlation degree between each attribute of the first entity and each attribute of the second entity. In implementation, each type associated with the entity can be obtained from the type information of the entity. Since the first attention distribution parameter can characterize the attention distribution of the correlation degree between the attributes of different entity types, after determining the types associated with the first entity and the second entity, based on the first attention distribution parameter, the importance of the correlation degree between each attribute of the first entity and each attribute of the second entity can be determined, so as to obtain the importance distribution feature of the correlation degree between the attributes of the first entity and the attributes of the second entity.

[0103] In step S104, based on the correlation degree distribution feature and the importance distribution feature, determine whether the first entity is the same as the second entity.

[0104] Here, since the correlation degree distribution feature can characterize the correlation relationship between each attribute of the first entity and each attribute of the second entity, and the importance distribution feature can characterize the importance of the correlation degree between each attribute of the first entity and each attribute of the second entity, therefore, based on the correlation degree distribution feature and the importance distribution feature, it can be determined whether the first entity is the same as the second entity. In implementation, based on the correlation degree distribution feature and the importance distribution feature, any suitable method can be used to determine whether the first entity is the same as the second entity, which is not limited here. For example, based on a preset comparison condition, by judging whether the correlation degree distribution feature and the importance distribution feature meet the comparison condition, it can be determined whether the first entity is the same as the second entity. Any suitable classification model can also be used to classify the correlation degree distribution feature and the importance distribution feature to obtain a classification result indicating whether the first entity is the same as the second entity.

[0105] In some embodiments, the attribute information of the first entity includes a first attribute tensor, and the attribute information of the second entity includes a second attribute tensor. Both the first attribute tensor and the second attribute tensor are three-dimensional tensors with a shape of K*N*D1, where K is the maximum value of the preset number of attributes, N is the maximum value of the preset number of attribute values, and D1 is the dimension of the representation vector of the preset attribute value. In implementation, based on the pre-set K, N, and D1, the attribute information of the first entity and the attribute information of the second entity can be modeled to obtain the first attribute tensor and the second attribute tensor. For example, if K is 3, N is 4, and D1 is 3, the first attribute tensor and the second attribute tensor can be three-dimensional tensors with a shape of 3*4*3 respectively. In this way, using three-dimensional tensors to represent the attribute information of entities can distinguish different attribute values of multi-valued attributes, thereby enhancing the ability to flexibly process multi-valued attributes.

[0106] In some embodiments, the type information of the first entity includes a first type matrix, the type information of the second entity includes a second type matrix, the first attention distribution parameter includes a type attention tensor, the shapes of the first type matrix and the second type matrix are both T*D2, and the type attention tensor is a three-dimensional tensor with a shape of T*K*K, where T is the total number of entity types in the current knowledge graph, D2 is the dimension of the representation vector of the preset entity type, and K is the maximum value of the preset number of attributes. During implementation, the type information of the first entity, the type information of the second entity, and the first attention distribution parameter can be modeled according to the preset T, K, and D2 to obtain the first type matrix, the second type matrix, and the type attention tensor. For example, if T is 5, K is 3, and D1 is 3, the first type matrix and the second type matrix can be matrices with a shape of 5*3 respectively, and the type attention tensor can be a three-dimensional tensor with a shape of 5*3*3.

[0107] In some embodiments, the entity comparison method provided by the embodiments of the present application can be used to compare entity pairs in content services. Content services may refer to delivering information content to users in various ways, including but not limited to transmitting programs through television stations, transmitting news highlights, economy, entertainment, technology, culture, etc. through the Internet, transmitting various information through wireless mobile phones, etc. The entity pair includes a first entity and a second entity to be compared, and the first entity and the second entity can be any type of entity in the content service. For example, programs transmitted through television stations, content transmitted through the Internet, etc. The first entity and the second entity can be of the same type or different types.

[0108] In the embodiments of the present application, first, the attribute information and type information of the first entity and the second entity to be compared are obtained respectively; secondly, based on the attribute information of the first entity and the attribute information of the second entity, the correlation degree distribution characteristics between the attributes of the first entity and the attributes of the second entity are determined; then, based on the type information of the first entity, the type information of the second entity, and the first attention distribution parameter, the importance degree distribution characteristics of the correlation degree between the attributes of the first entity and the attributes of the second entity are determined; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity types; finally, based on the correlation degree distribution characteristics and the importance degree distribution characteristics, it is determined whether the first entity is the same as the second entity. In this way, when comparing entities, the attribute information and type information are comprehensively considered, and different attributes can be focused on according to different entity types based on the attention mechanism, so that the comparison task of general entities can be realized, the needs of different entity type disambiguation tasks can be met, the accuracy of entity comparison can be improved to a certain extent, and the iteration efficiency of the entity disambiguation task can be improved to a certain extent, and the processing process is interpretable.

[0109] In some embodiments, referring to Figure 4 , Figure 4 is an optional flowchart of the entity comparison method provided by the embodiments of the present application. Based on Figure 3 , Figure 3 the step S104 shown in

[0110] In step S401, perform feature fusion processing on the correlation degree distribution feature and the importance degree distribution feature to obtain the important correlation degree distribution feature between each attribute of the first entity and each attribute of the second entity.

[0111] Here, the important correlation degree distribution feature between each attribute of the first entity and each attribute of the second entity can reflect the distribution of the correlation degree between the important attributes of the first entity and the second entity. In implementation, a suitable method can be adopted according to the actual situation to perform feature fusion processing on the correlation degree distribution feature and the importance degree distribution feature, so as to extract the important correlation degree distribution feature between each attribute of the first entity and each attribute of the second entity from the correlation degree distribution feature by using the importance degree distribution feature. For example, the importance degree of the correlation degree between each attribute of the first entity and each attribute of the second entity in the importance degree distribution feature can be multiplied by the correlation degree between the corresponding attribute of the first entity and the corresponding attribute of the second entity in the correlation degree distribution feature respectively to obtain the important correlation degree distribution feature between each attribute of the first entity and each attribute of the second entity.

[0112] In step S402, perform classification processing on the important correlation degree distribution feature to obtain a classification result indicating whether the first entity is the same as the second entity.

[0113] Here, any suitable classification algorithm can be used to perform classification processing on the important correlation degree distribution feature. The classification algorithm can include, but is not limited to, one or more of the k-nearest neighbor (KNN) classification algorithm, the Support Vector Machine (SVM) algorithm, the Bayesian algorithm, the logistic regression algorithm, etc. The classification result can include the probability that the first entity is the same as the second entity and the probability that the first entity is different from the second entity. The classification result can also include the similarity score between the first entity and the second entity. The classification result can also include the result that the first entity is the same as the second entity or the result that the first entity is different from the second entity.

[0114] In step S403, based on the classification result, determine whether the first entity is the same as the second entity.

[0115] Here, the classification result can characterize whether the first entity is the same as the second entity. Based on the classification result, it can be determined whether the first entity is the same as the second entity. In implementation, according to the actual situation, a suitable method can be adopted to determine whether the first entity is the same as the second entity, which is not limited here. For example, if the classification result includes the probability that the first entity is the same as the second entity and the probability that the first entity is different from the second entity, then it can be determined that the first entity is the same as the second entity when the probability that the first entity is the same as the second entity is greater than the probability that the first entity is different from the second entity, and vice versa, it can be determined that the first entity is different from the second entity. Another example, if the classification result includes the similarity score between the first entity and the second entity, then it can be determined that the first entity is the same as the second entity when the similarity score is greater than the preset score threshold, and vice versa, it can be determined that the first entity is different from the second entity.

[0116] In the embodiments of the present application, feature fusion processing is performed on the association degree distribution feature and the importance degree distribution feature to obtain the important association degree distribution feature between each attribute of the first entity and each attribute of the second entity, and classification processing is performed on the important association degree distribution feature to obtain a classification result characterizing whether the first entity is the same as the second entity. Based on the classification result, it is determined whether the first entity is the same as the second entity. In this way, it can be conveniently and quickly determined whether the first entity is the same as the second entity based on the association degree distribution feature and the importance degree distribution feature. In addition, since the important association degree distribution feature between each attribute of the first entity and each attribute of the second entity includes the association degree between the important attributes of the first entity and the second entity, based on the association degree between the important attributes, determining whether the first entity is the same as the second entity can further improve the accuracy of entity comparison.

[0117] In some embodiments, refer to Figure 5 , Figure 5 which is an optional process schematic diagram of the entity comparison method provided by the embodiments of the present application. Based on Figure 3 , Figure 3 the step S102 shown in can be implemented through the following step S501. The following will be described in combination with each step. The execution subject of the following steps can be the terminal or server mentioned above.

[0118] In step S501, based on the attribute information of the first entity, the attribute information of the second entity, and the second attention distribution parameter, the association degree distribution feature between each attribute of the first entity and each attribute of the second entity is determined; the second attention distribution parameter characterizes the attention distribution of the comparability between each attribute of the first entity and each attribute of the second entity.

[0119] Here, the second attention distribution parameter can characterize the attention distribution of the comparability between the attributes of the first entity and the attributes of the second entity. It can include the attention used when comparing each attribute of the first entity with each attribute of the second entity during entity comparison. Since different attributes have different comparabilities, the attention used for comparing two attributes can be determined according to the comparability between the two attributes. In implementation, the second attention distribution parameter can be preset, or initialized in any suitable way in advance, or obtained through pre-training, which is not limited here. Those skilled in the art can determine the association degree distribution characteristics between the attributes of the first entity and the attributes of the second entity based on the attribute information of the first entity, the attribute information of the second entity, and the second attention distribution parameter according to the actual situation. For example, on the basis of determining the association degree distribution characteristics between the attributes of the first entity and the attributes of the second entity based on the attribute information of the first entity and the attribute information of the second entity, the determined association degree distribution characteristics can be adjusted using the second attention distribution parameter to obtain the final association degree distribution characteristics. Another example is that the second attention distribution parameter can be used to extract features from the attribute information of the first entity and the attribute information of the second entity respectively to obtain the key attribute information of the first entity and the key attribute information of the second entity, and then determine the association degree distribution characteristics between the attributes of the first entity and the attributes of the second entity.

[0120] In some embodiments, the association degree distribution characteristics include the association degree between each attribute of the first entity and each attribute of the second entity. The above step S501 can be implemented through the following steps S511 to S513:

[0121] In step S511, based on the attribute information of the first entity and the attribute information of the second entity, each attribute of the first entity and each attribute of the second entity are determined.

[0122] Here, the attribute information of the first entity may include at least one attribute of the first entity. The attribute information of the second entity may include at least one attribute of the second entity.

[0123] In step S512, for each attribute of the first entity, based on the second attention distribution parameter, the association degree between each attribute value of the attribute and each attribute value of each attribute of the second entity is determined.

[0124] Here, each attribute of an entity may include at least one attribute value. By comparing each attribute value of each attribute of the first entity with each attribute value of each attribute of the second entity, the degree of association between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity can be obtained. In some embodiments, the similarity between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity may be calculated as the degree of association between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity.

[0125] In step S513, based on the degree of association between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity, determine the degree of association between each attribute of the first entity and each attribute of the second entity.

[0126] Here, the degree of association between each attribute of the first entity and each attribute of the second entity can be determined by the degree of association between each attribute value of the corresponding attribute of the first entity and each attribute value of the corresponding attribute of the second entity. For example, for the first attribute of the first entity and the second attribute of the second entity to be compared, the degree of association between each attribute value of the first attribute and each attribute value of the second attribute can be calculated respectively, and the degree of association between the first attribute and the second attribute can be determined based on the degree of association between each attribute value of the first attribute and each attribute value of the second attribute. In some embodiments, the sum of the degrees of association between each attribute value of the first attribute and each attribute value of the second attribute may be determined as the degree of association between the first attribute and the second attribute. In some embodiments, the maximum value among the degrees of association between each attribute value of the first attribute and each attribute value of the second attribute may be determined as the degree of association between the first attribute and the second attribute. In implementation, based on the degree of association between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity, any suitable pooling algorithm (such as the max pooling algorithm, etc.) or multi-head fusion algorithm, etc., may be used to determine the degree of association between each attribute of the first entity and each attribute of the second entity, which is not limited here. In this way, when comparing entities, multiple attribute values of multi-valued attributes can be processed specifically, thereby improving the accuracy of entity comparison to a certain extent and making the processing process interpretable.

[0127] In some embodiments, the above step S513 may be implemented through the following step S521:

[0128] Step S521, for each group of the attributes of the first entity and the attributes of the second entity, determine the maximum value among the degrees of association between each attribute value of the attribute of the first entity and each attribute value of the attribute of the second entity as the degree of association between the attribute of the first entity and the attribute of the second entity.

[0129] Here, the maximum value among the association degrees between each attribute value of the attributes of the first entity and each attribute value of the attributes of the second entity is determined as the association degree between the attributes of the first entity and the attributes of the second entity. In implementation, the maximum pooling algorithm can be used to determine the association degree between the attributes of the first entity and the attributes of the second entity. For example, if the number of maximum attribute values of each attribute is N, the association degree between each attribute value of the attributes of the first entity and each attribute value of the attributes of the second entity can be an N*N matrix, and the element with the largest value in each matrix can be selected as the association degree between the corresponding attributes of the first entity and the corresponding attributes of the second entity.

[0130] In some embodiments, the attribute information of the first entity includes a first attribute tensor, the attribute information of the second entity includes a second attribute tensor, the second attention distribution parameter includes an attribute attention tensor, both the first attribute tensor and the second attribute tensor are three-dimensional tensors with a shape of K*N*D1, and the attribute attention tensor is a three-dimensional tensor with a shape of K*N*N, where K is the maximum value of the preset number of attributes, N is the maximum value of the preset number of attribute values, and D1 is the dimension of the representation vector of the preset attribute value. In implementation, according to the preset K, N, and D1, the attribute information of the first entity, the attribute information of the second entity, and the second attention distribution parameter can be modeled to obtain the first attribute tensor, the second attribute tensor, and the attribute attention tensor. For example, if K is 3, N is 4, and D1 is 3, the first attribute tensor and the second attribute tensor can be three-dimensional tensors with a shape of 3*4*3 respectively, and the attribute attention tensor can be a three-dimensional tensor with a shape of 3*4*4.

[0131] In the embodiments of the present application, based on the attribute information of the first entity, the attribute information of the second entity, and the second attention distribution parameter, the association degree distribution characteristics between each attribute of the first entity and each attribute of the second entity are determined. In this way, since the second attention distribution parameter can reflect the comparability between each attribute of the first entity and each attribute of the second entity, the obtained association degree distribution characteristics can better reflect the association degree between each attribute of the first entity and each attribute of the second entity, thereby further improving the accuracy of entity comparison.

[0132] In some embodiments, refer to Figure 6 , Figure 6 is an optional flowchart of the entity comparison method provided by the embodiments of the present application. Based on Figure 3 , the above step S103 can be implemented through the following steps S601 to S603. The following will describe each step. The execution subject of the following steps can be the terminal or server mentioned above.

[0133] In step S601, the type information of the first entity and the type information of the second entity are associated to obtain the association degree between each entity type of the first entity and each entity type of the second entity;

[0134] Here, the type information of the first entity may include at least one entity type, and the type information of the second entity may include at least one entity type. By associating each entity type of the first entity with each entity type of the second entity, each entity type of the first entity can be associated with each entity type of the second entity, and the corresponding association degree can be obtained. In implementation, the association process can be determined by those skilled in the art according to the actual situation, and is not limited here. For example, the association process can be one or more vector operations such as summing or multiplying the representation vectors of each entity type of the first entity and the representation vectors of each entity type of the second entity, and the result of the operation can be used as the association degree between each entity type of the first entity and each entity type of the second entity. Another example is that the association process can be the similarity calculation between the text information describing each entity type of the first entity and the text information describing each entity type of the second entity, and the obtained similarity can be used as the association degree between each entity type of the first entity and each entity type of the second entity.

[0135] In step S602, based on the association degree between each entity type of the first entity and each entity type of the second entity, the association degree between each entity type of the first entity and the second entity is determined.

[0136] Here, the association degree between each entity type of the first entity and the second entity can be determined by the association degree between the corresponding entity type of the first entity and each entity type of the second entity. For example, for the first entity type of the first entity to be compared, the association degree between the first entity type and each entity type of the second entity can be calculated respectively, and based on the association degree between the first entity type and each entity type of the second entity, the association degree between the first entity type of the first entity and the second entity is determined. In some embodiments, the sum of the association degrees between the first entity type and each entity type of the second entity can be determined as the association degree between the first entity type of the first entity and the second entity. In some embodiments, the maximum value among the association degrees between the first entity type and each entity type of the second entity can be determined as the association degree between the first entity type of the first entity and the second entity. In implementation, based on the association degree between each entity type of the first entity and each entity type of the second entity, any suitable pooling algorithm (such as the max pooling algorithm, etc.) or multi-head fusion algorithm, etc. can be used to determine the association degree between each entity type of the first entity and the second entity, and is not limited here.

[0137] In step S603, based on the association degree between each entity type of the first entity and the second entity, and the first attention distribution parameter, determine the importance distribution characteristics of the association degree between each attribute of the first entity and each attribute of the second entity.

[0138] Here, since the first attention distribution parameter can reflect the distribution of the importance degree of the association degree between each attribute of different entity type pairs during the entity comparison process, therefore, based on the association degree between each entity type of the first entity and the second entity, and the first attention distribution parameter, the importance of the association degree between each attribute of the first entity and each attribute of the second entity can be determined. In implementation, the association degree between each entity type of the first entity and the second entity can be used to determine the importance degree of the association degree between the entity type of the first entity and the corresponding attributes of the entity type of the second entity from the first attention distribution parameter, and then the importance distribution characteristics of the association degree between each attribute of the first entity and each attribute of the second entity can be determined.

[0139] In some embodiments, the above step S602 can be implemented through the following step S611:

[0140] Step S611, for each entity type of the first entity, determine the maximum value among the association degrees between the entity type of the first entity and each entity type of the second entity as the association degree between the entity type of the first entity and the second entity.

[0141] Here, determine the maximum value among the association degrees between each entity type of the first entity and each entity type of the second entity as the association degree between each entity type of the first entity and the second entity. In implementation, the maximum pooling algorithm can be used to determine the association degree between each entity type of the first entity and the second entity. For example, if the number of entity types is T, the association degree between each entity type of the first entity and each entity type of the second entity can be a T*T matrix, and the element with the largest value in each matrix can be selected as the association degree between each entity type of the first entity and the second entity.

[0142] In the embodiments of the present application, the type information of the first entity and the type information of the second entity are associated to obtain the association degree between each entity type of the first entity and each entity type of the second entity. Based on the association degree between each entity type of the first entity and each entity type of the second entity, the association degree between each entity type of the first entity and the second entity is determined. Based on the association degree between each entity type of the first entity and the second entity, and the first attention distribution parameter, the importance distribution characteristics of the association degree between each attribute of the first entity and each attribute of the second entity are determined. In this way, the importance distribution characteristics of the association degree between each attribute of the first entity and each attribute of the second entity can be determined simply and quickly, thereby improving the efficiency of entity comparison.

[0143] In some embodiments, referring to Figure 7 , Figure 7 is an optional flowchart of the entity comparison method provided by the embodiments of the present application. Based on Figure 3 , the method may further perform the following steps S701 to S706, which will be described in combination with each step below. The execution subject of the following steps may be the terminal or server described above.

[0144] In step S701, a sample entity pair and a labeling result for labeling whether the first sample entity and the second sample entity in the sample entity pair are the same are obtained.

[0145] Here, the sample entity pair is an entity pair used to train the parameters in the entity comparison process, and may include a first sample entity and a second sample entity. In implementation, the sample entity pair may be obtained from a sample library or the network, or may be pre-constructed by a user.

[0146] The labeling result of the sample entity pair may be pre-represented according to whether the first sample entity and the second sample entity in the sample entity pair are the same. In implementation, the sample entity pair is labeled manually or automatically.

[0147] In step S702, the attribute information and type information of the first sample entity and the second sample entity are respectively obtained.

[0148] Step S703, based on the attribute information of the first sample entity and the attribute information of the second sample entity, determine the association degree distribution characteristics between each attribute of the first sample entity and each attribute of the second sample entity.

[0149] Step S704: Based on the type information of the first sample entity, the type information of the second sample entity, and the first attention distribution parameter, determine the importance distribution characteristics of the correlation degrees between the attributes of the first sample entity and the attributes of the second sample entity; the first attention distribution parameter characterizes the attention distribution of the correlation degrees between the attributes of different entity pairs.

[0150] Step S705: Based on the correlation degree distribution characteristics and the importance distribution characteristics, determine a prediction result indicating whether the first sample entity is the same as the second sample entity.

[0151] Here, Step S702 to Step S705 respectively correspond to the foregoing Step S101 to Step S104. During implementation, reference may be made to the specific implementation manners of the foregoing Step S101 to Step S104.

[0152] Step S706: Update the first attention distribution parameter based on the prediction result and the annotation result.

[0153] Here, the first attention distribution parameter may be updated by using a preset parameter update strategy, or may be updated by using a loss function and a parameter optimization algorithm. There is no limitation here. During implementation, any suitable loss function and parameter optimization algorithm may be used. For example, the loss function may be one or more of an absolute value loss function, a square loss function, a cross-entropy loss function, an exponential loss function, etc., and the parameter optimization algorithm may be one or more of a gradient descent method, a conjugate gradient method, a Newton algorithm, etc.

[0154] In some embodiments, other parameters involved in the entity comparison process may also be updated based on the prediction result and the annotation result. During implementation, those skilled in the art may update appropriate parameters according to actual situations, and this application embodiment does not limit this. For example, the second attention distribution parameter characterizing the attention distribution of the comparability between the attributes of the first entity and the attributes of the second entity may be updated.

[0155] In the embodiment of the present application, a prediction result indicating whether the first sample entity is the same as the second sample entity is obtained by comparing the first sample entity and the second sample entity in the sample entity pair, and the first attention distribution parameter is updated based on the prediction result and the annotation result. In this way, the first attention distribution parameter can be continuously optimized, thereby further improving the accuracy of entity comparison.

[0156] Next, the model training method provided by the embodiment of the present application will be described in combination with the exemplary applications and implementations of the terminal or server provided by the embodiment of the present application.

[0157] SeeFigure 8 , Figure 8 is an alternative process schematic diagram of the model training method provided by an embodiment of the present application, which is used to train an entity comparison model. The trained entity comparison model is used to compare entity pairs in a content service. The following will be described in conjunction with Figure 8 the steps shown below. The execution subject of the following steps can be the terminal or server mentioned above.

[0158] In step S801, obtain a sample entity pair and an annotation result for annotating whether the first sample entity and the second sample entity in the sample entity pair are the same;

[0159] Here, the first sample entity and the second sample entity in the sample entity pair can be entities of any type in the content service. For example, programs transmitted by a television station, content transmitted over the Internet, etc. The first sample entity and the second sample entity can be of the same type or different types.

[0160] In step S802, input the sample entity pair into the entity comparison model to be trained; the entity comparison model is used to respectively obtain the attribute information and type information of the first sample entity and the second sample entity; based on the attribute information of the first sample entity and the attribute information of the second sample entity, determine the correlation degree distribution characteristics between the attributes of the first sample entity and the attributes of the second sample entity; based on the type information of the first sample entity and the type information of the second sample entity, and the first attention distribution parameter, determine the importance distribution characteristics of the correlation degree between the attributes of the first sample entity and the attributes of the second sample entity; the first attention distribution parameter represents the attention distribution of the correlation degree between the attributes of different entity type pairs; based on the correlation degree distribution characteristics and the importance distribution characteristics, determine a prediction result indicating whether the first sample entity and the second sample entity are the same;

[0161] In step S803, based on the prediction result and the annotation result, adjust the parameters of the entity comparison model to obtain a trained entity comparison model.

[0162] Here, steps S801 to S803 correspond to the foregoing steps S701 to S705. When implemented, the specific implementation manners of the foregoing steps S701 to S705 can be referred to. The parameters of the entity comparison model can be any suitable parameters involved in the entity comparison process, which are not limited here.

[0163] In the embodiments of the present application, when training the entity comparison model, the attribute information and type information of the entity are comprehensively considered. Based on the attention mechanism, different attributes can be focused on for different entity types. Thus, the trained entity comparison model can implement the comparison task of general entities, meet the needs of disambiguation tasks for different entity types, and further improve the iteration efficiency of the entity disambiguation task to a certain extent, and the training process is interpretable.

[0164] Next, an exemplary application of the embodiments of the present application in an actual application scenario will be described. The entity comparison method provided by the embodiments of the present application can be applied to the construction or update process of the knowledge graph. For example, it can be applied to the entity fusion in the construction process of the Tencent News Knowledge Graph to support general entity fusion tasks. Since there are many entity types defined in the knowledge graph, it is not very realistic to design corresponding vertical disambiguation strategies for each type of entity, which is time-consuming and laborious. The embodiments of the present application provide an entity comparison method that can be independent of the types of entity pairs to be compared, support general disambiguation capabilities, separate the attribute information and type information of the entity pairs to be compared, and perform information interaction processing by introducing independent attribute attention tensors and type attention tensors respectively, to obtain an attribute similarity matrix representing the similarity distribution characteristics between the attributes of the corresponding entity pair, and an attribute importance matrix representing the importance distribution characteristics of the correlation between the attributes of the entity pair. Then, by fusing the attribute similarity matrix and the attribute importance matrix, a key similarity vector of the entity pair is obtained. Finally, based on this similarity vector, classification scoring is performed to determine whether the two entities in the entity pair to be compared are the same entity, thereby completing the comparison task of general entities.

[0165] In the embodiments of the present application, three-dimensional tensors can be used to represent the attribute information of a given entity, so as to separately represent multiple attribute values in the multi-valued attribute, which is convenient for processing the multi-valued attribute in the process of entity comparison. In addition, by introducing entity type information, the disambiguation requirements of multiple entity types can be satisfied to a certain extent, and targeted processing of multi-valued attributes at the attribute interaction level can improve the model performance and model interpretability to a certain extent. Here, the attribute interaction level refers to the operation level for processing the correlation between the attributes of each entity in the entity pair to be compared.

[0166] See Figure 9 , Figure 9 which is a schematic diagram of the implementation architecture of an entity comparison method provided by the embodiments of the present application. As Figure 9 shown, the method may include three sub-processes: an attribute interaction process 910, a type interaction process 920, and a classification scoring process 930. Each sub-process will be specifically described below:

[0167] 1) Attribute interaction process:

[0168] This process is mainly used to extract the attribute interaction information of entity pairs to be compared, that is, the attribute similarity between two entities. The attribute interaction process can be implemented through the following steps S911 to S913:

[0169] Step S911: Model entity 1 and entity 2 in the entity pair to be compared into three-dimensional tensors with the shape of K*N*D1 respectively, where K is the maximum number of preset important attributes of each entity, N is the maximum number of attribute values of each attribute, and D1 is the vector representation dimension of each attribute value.

[0170] Here, it should be noted that if the number of attribute values included in attribute A of the entity is less than N, special characters (such as <PAD_ATTR>, etc.) preset can be used for complementation; the vector representation of the attribute value can be obtained by taking the average of the word vectors corresponding to each character included in the attribute value. In implementation, entity 1 can correspond to the first entity in the foregoing embodiment, and entity 2 can correspond to the second entity in the foregoing embodiment.

[0171] Step S912: Introduce a three-dimensional tensor with the shape of K*N*N as the attribute attention tensor, and use matrix multiplication between the three-dimensional tensors to multiply the three-dimensional tensors corresponding to entity 1 and entity 2 respectively with the attribute attention tensor to implement the interactive calculation between attributes, so as to obtain a four-dimensional attribute value similarity tensor with the shape of K*K*N*N, which is used to characterize the similarity between the respective attribute values of entity 1 and entity 2.

[0172] Here, the values of the attribute attention matrix can be randomly initialized and then optimized through continuous training. The process of multiplying the three-dimensional tensors corresponding to entity 1 and entity 2 respectively with the attribute attention tensor to implement the interactive calculation between attributes can include: multiplying the three-dimensional tensors with the shape of K*N*D1 corresponding to entity 1 and entity 2 respectively to obtain K*K matrices of N*N, and then converting the K*K matrices of N*N into K three-dimensional tensors with the shape of K*N*N. For each three-dimensional tensor with the shape of K*N*N, multiply this three-dimensional tensor with the attribute attention tensor with the shape of K*N*N, that is, multiply the elements at each corresponding position to obtain K updated three-dimensional tensors with the shape of K*N*N, that is, an attribute value similarity tensor with the shape of K*K*N*N. Each element in this attribute value similarity tensor can characterize the similarity between the corresponding attribute value of the corresponding attribute of entity 1 and the corresponding attribute value of the corresponding attribute of entity 2.

[0173] It should be noted that when multiplying the three-dimensional tensors with the shape of K*N*D1 corresponding to Entity 1 and Entity 2 respectively, the matrices in the three-dimensional tensors corresponding to Entity 1 or Entity 2 can be transposed to obtain a three-dimensional tensor with the shape of K*D1*N, and the matrices at the corresponding positions in the three-dimensional tensor with the shape of K*N*D1 that is not transposed are multiplied with the matrices in the K*D1*N three-dimensional tensor to obtain K*K matrices of N*N.

[0174] Step S913, use the max pooling algorithm to extract key information from the four-dimensional attribute value similarity tensor to obtain an attribute similarity matrix with the shape of K*K.

[0175] In implementation, the attribute value similarity tensor with the shape of K*K*N*N can be converted into K*K two-dimensional matrices of N*N. Each two-dimensional matrix corresponds to a group of attribute pairs of Entity 1 and Entity 2. For each N*N two-dimensional matrix, the maximum value is selected from the elements of the two-dimensional matrix as the attribute similarity between the two attributes in the corresponding attribute pair of the two-dimensional matrix. Finally, K*K attribute similarities can be obtained, and the K*K attribute similarities can form an attribute similarity matrix with the shape of K*K. In implementation, the attribute value similarity matrix can correspond to the association degree distribution feature in the foregoing embodiment.

[0176] 2) Type interaction process:

[0177] This process is mainly used to extract the type interaction information of the entity pairs to be compared, and this information is used to characterize the importance degree of the similarity between each attribute under the entity types of the specified entity pairs. The type interaction process can be implemented through the following steps S921 to S923:

[0178] Step S921, model the types of Entity 1 and Entity 2 in the given entity pair into two-dimensional type matrices with the shape of T*D2 respectively, where T represents the total number of entity types in the current knowledge graph, and D2 is the vector representation dimension of each preset entity type.

[0179] Here, in implementation, the two-dimensional type matrices corresponding to the types of Entity 1 and Entity 2 respectively can correspond to the first type matrix and the first type matrix in the foregoing embodiment.

[0180] Step S922, multiply the two-dimensional type matrices corresponding to Entity 1 and Entity 2 to simulate the interaction between the two entities at the type level. Finally, an interaction information matrix with the shape of T*T can be obtained, and then through the max pooling algorithm, the interaction information matrix is mapped into a mutual information vector of T*1.

[0181] Here, the type interaction level refers to the operation level for processing the relevance between each entity type of each entity in the entity pair to be compared.

[0182] Step S923: Introduce a type attention tensor of shape T*K*K, and multiply the type attention tensor by the mutual information vector to obtain an attribute importance matrix of shape K*K, which is used to characterize the importance of the similarity between the K attributes of entity 1 and the K attributes of entity 2.

[0183] Here, the values of the type attention tensor can be randomly initialized and then optimized through continuous training. In implementation, the attribute importance matrix can correspond to the importance distribution characteristics of the correlation between each attribute of the first entity and each attribute of the second entity in the foregoing embodiment.

[0184] 3) Classification and scoring process:

[0185] This process is mainly used to fuse the attribute interaction information and the type interaction information, use the type interaction information to capture the important part in the attribute interaction information, finally form a unified representation information, and perform a classification and scoring operation based on this representation information. The attribute interaction process can be implemented through the following steps S931 to S933:

[0186] Step S931: Dot-multiply the attribute similarity matrix obtained from the attribute interaction process by the attribute importance matrix obtained from the type interaction process to highlight the important information in the attribute similarity matrix, and then flatten the two-dimensional matrix obtained by the dot-multiplication into a representation vector of shape 1*(K*K).

[0187] Here, in implementation, both the two-dimensional matrix obtained by the dot-multiplication or the representation vector of shape 1*(K*K) can correspond to the important correlation distribution characteristics in the foregoing embodiment.

[0188] Step S932: Input the obtained final representation vector into a fully connected network for a secondary dimensionality transformation, and use the final sigmoid function to classify and score the representation vector after the dimensionality transformation to obtain a classification score.

[0189] Step S933: If the obtained classification score is greater than a pre-set score threshold, it means that the entity pair is the same and can be fused; otherwise, it cannot be fused.

[0190] In some embodiments, the above explicit operations on the matrix can be implemented through some complex network structures (such as convolutional networks or custom networks, etc.), so as to mine deeper useful information.

[0191] In some embodiments, the above maximum pooling algorithm can be replaced by a pooling algorithm or multi-head fusion, so as to further improve the performance of the model.

[0192] In some embodiments, the above entity comparison method can be implemented through an entity comparison model.

[0193] The innovation points of the entity comparison method provided by the embodiments of the present application are as follows: 1) Using a three-dimensional tensor to represent entity information, which achieves the purpose of flexibly processing multi-valued attributes; 2) Using matrix multiplication and pooling algorithms to simulate the calculation process of single-attribute value similarity and the aggregation process of multiple attribute value similarities corresponding to the same attribute pair respectively, greatly improving the interpretability of the model; 3) Introducing entity type information into the entity comparison model to generate a corresponding attribute importance matrix, achieving the purpose of focusing on different key attributes according to different entity types.

[0194] The entity comparison method provided by the embodiments of the present application has the following beneficial effects: 1) Improving the iterative efficiency of the entity disambiguation task. By introducing entity type information, this method can learn important attribute information under the current entity type during the entity comparison process, meeting the need to use the same model to handle disambiguation tasks of different entity types. Thus, to a certain extent, it liberates some human resources and does not require corresponding model construction and training for each new type of entity, thereby improving the iterative efficiency of the entity disambiguation task to a certain extent; 2) Having higher model performance and model interpretability. This method separately processes the attribute information and type information of the entity pairs to be compared, introducing independent attribute attention tensors and type attention tensors for information interaction processing respectively, obtaining different useful information at the attribute and type levels, and then fusing the two to select important information, which can improve the accuracy of entity comparison to a certain extent, and makes targeted processing of multi-valued attributes at the attribute interaction level, which can enhance the model interpretability to a certain extent.

[0195] The following continues to describe the exemplary structure of the implementation of the entity comparison device 255 provided by the embodiments of the present application as software modules. In some embodiments, as Figure 2A shown, the software modules in the entity comparison device 255 stored in the memory 250 may include:

[0196] A first acquisition module 2551, configured to acquire the attribute information and type information of the first entity and the second entity to be compared respectively;

[0197] A first determination module 2552, configured to determine the association degree distribution characteristics between each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity and the attribute information of the second entity;

[0198] A second determination module 2553, configured to determine an importance distribution feature of the correlation degree between each attribute of the first entity and each attribute of the second entity based on the type information of the first entity, the type information of the second entity, and a first attention distribution parameter; the first attention distribution parameter characterizes the attention distribution of the correlation degree between each attribute of different entity types.

[0199] A third determination module 2554, configured to determine whether the first entity is the same as the second entity based on the correlation degree distribution feature and the importance distribution feature.

[0200] In some embodiments, the third determination module is further configured to: perform feature fusion processing on the correlation degree distribution feature and the importance distribution feature to obtain an important correlation degree distribution feature between each attribute of the first entity and each attribute of the second entity; perform classification processing on the important correlation degree distribution feature to obtain a classification result indicating whether the first entity is the same as the second entity; and determine whether the first entity is the same as the second entity based on the classification result.

[0201] In some embodiments, the first determination module is further configured to: determine a correlation degree distribution feature between each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity, the attribute information of the second entity, and a second attention distribution parameter; the second attention distribution parameter characterizes the attention distribution of the comparability between each attribute of the first entity and each attribute of the second entity.

[0202] In some embodiments, the correlation degree distribution feature includes the correlation degree between each attribute of the first entity and each attribute of the second entity, and the first determination module is further configured to: determine each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity and the attribute information of the second entity; for each attribute of the first entity, determine the correlation degree between each attribute value of the attribute and each attribute value of each attribute of the second entity based on the second attention distribution parameter; and determine the correlation degree between each attribute of the first entity and each attribute of the second entity based on the correlation degree between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity.

[0203] In some embodiments, the first determination module is further configured to: for each group of the attributes of the first entity and the attributes of the second entity, determine the maximum value among the correlation degrees between each attribute value of the attribute of the first entity and each attribute value of the attribute of the second entity as the correlation degree between the attribute of the first entity and the attribute of the second entity.

[0204] In some embodiments, the attribute information of the first entity includes a first attribute tensor, the attribute information of the second entity includes a second attribute tensor, the second attention distribution parameter includes an attribute attention tensor, both the first attribute tensor and the second attribute tensor are three-dimensional tensors with a shape of K*N*D1, and the attribute attention tensor is a three-dimensional tensor with a shape of K*N*N, where K is the maximum value of the preset number of attributes, N is the maximum value of the preset number of attribute values, and D1 is the dimension of the representation vector of the preset attribute value.

[0205] In some embodiments, the second determination module is further configured to: perform an association process on the type information of the first entity and the type information of the second entity to obtain the association degree between each entity type of the first entity and each entity type of the second entity; based on the association degree between each entity type of the first entity and each entity type of the second entity, determine the association degree between each entity type of the first entity and the second entity; based on the association degree between each entity type of the first entity and the second entity, and the first attention distribution parameter, determine the importance distribution characteristics of the association degree between each attribute of the first entity and each attribute of the second entity.

[0206] In some embodiments, the second determination module is further configured to: for each entity type of the first entity, determine the maximum value among the association degrees between the entity type of the first entity and each entity type of the second entity as the association degree between the entity type of the first entity and the second entity.

[0207] In some embodiments, the type information of the first entity includes a first type matrix, the type information of the second entity includes a second type matrix, the first attention distribution parameter includes a type attention tensor, the shapes of both the first type matrix and the second type matrix are T*D2, and the type attention tensor is a three-dimensional tensor with a shape of T*K*K, where T is the total number of entity types in the current knowledge graph, D2 is the dimension of the representation vector of the preset entity type, and K is the maximum value of the preset number of attributes.

[0208] In some embodiments, the apparatus further includes: a second acquisition module, configured to acquire a sample entity pair and an annotation result for annotating whether a first sample entity and a second sample entity in the sample entity pair are the same; a third acquisition module, configured to respectively acquire attribute information and type information of the first sample entity and the second sample entity; a fourth determination module, configured to determine a correlation degree distribution feature between each attribute of the first sample entity and each attribute of the second sample entity based on the attribute information of the first sample entity and the attribute information of the second sample entity; a fifth determination module, configured to determine an importance distribution feature of the correlation degree between each attribute of the first sample entity and each attribute of the second sample entity based on the type information of the first sample entity, the type information of the second sample entity, and a first attention distribution parameter, where the first attention distribution parameter represents an attention distribution of the correlation degree between each attribute of different entity pairs; a sixth determination module, configured to determine a prediction result indicating whether the first sample entity and the second sample entity are the same based on the correlation degree distribution feature and the importance distribution feature; a first adjustment module, configured to adjust the first attention distribution parameter based on the prediction result and the annotation result.

[0209] Next, the exemplary structure of the model training apparatus 355 provided in the embodiments of the present application implemented as a software module will be further described. In some embodiments, the model training apparatus 355 is used to train an entity comparison model, and the trained entity comparison model is used to compare entity pairs in content services, such as Figure 2B As shown, the software module in the model training apparatus 355 stored in the memory 350 may include:

[0210] A fourth acquisition module 3551, configured to acquire a sample entity pair and an annotation result for annotating whether a first sample entity and a second sample entity in the sample entity pair are the same;

[0211] A comparison module 3552 is configured to: input the sample entity pair into an entity comparison model to be trained; the entity comparison model is configured to respectively obtain the attribute information and type information of the first sample entity and the second sample entity; based on the attribute information of the first sample entity and the attribute information of the second sample entity, determine the correlation degree distribution characteristics between the attributes of the first sample entity and the attributes of the second sample entity; based on the type information of the first sample entity and the type information of the second sample entity, and a first attention distribution parameter, determine the importance distribution characteristics of the correlation degree between the attributes of the first sample entity and the attributes of the second sample entity; the first attention distribution parameter represents the attention distribution of the correlation degree between the attributes of different entity types; based on the correlation degree distribution characteristics and the importance distribution characteristics, determine a prediction result indicating whether the first sample entity is the same as the second sample entity;

[0212] A second adjustment module 3553 is configured to adjust the parameters of the entity comparison model based on the prediction result and the annotation result, so as to obtain a trained entity comparison model.

[0213] An embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the entity comparison method or the model training method described above in the embodiments of the present application.

[0214] An embodiment of the present application provides a computer-readable storage medium storing executable instructions, where the executable instructions are stored, and when the executable instructions are executed by a processor, the processor will be caused to execute the entity comparison method or the model training method provided in the embodiments of the present application, for example, the method Figure 3 shown.

[0215] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disc, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0216] In some embodiments, the executable instructions may be in the form of a program, software, software module, script, or code, and may be written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0217] As an example, the executable instructions may or may not correspond to files in a file system, and may be stored as part of a file that stores other programs or data. For example, they may be stored in one or more scripts in a Hyper Text Markup Language (HTML) document, stored in a single file dedicated to the program under discussion, or stored in multiple cooperating files (e.g., files that store one or more modules, subroutines, or portions of code).

[0218] As an example, the executable instructions may be deployed to execute on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed across multiple locations and interconnected by a communication network.

[0219] In summary, when performing entity comparison through the embodiments of the present application, both attribute information and type information are comprehensively considered. Based on the attention mechanism, different attributes can be focused on for different entity types, thereby enabling the comparison task of general entities, meeting the needs of disambiguation tasks for different entity types, and further improving the iterative efficiency of the entity disambiguation task to a certain extent, and the processing process is interpretable.

[0220] The above is only the embodiments of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. An entity comparison method, characterized in that, Including: Obtain the attribute information and type information of a first entity and a second entity to be compared respectively, wherein the representation forms of the attribute information and the type information include text; Based on the attribute information of the first entity and the attribute information of the second entity, determine the correlation degree distribution characteristics between each attribute of the first entity and each attribute of the second entity; Perform correlation processing on the type information of the first entity and the type information of the second entity to obtain the correlation degree between each entity type of the first entity and each entity type of the second entity; Based on the correlation degree between each entity type of the first entity and each entity type of the second entity, determine the correlation degree between each entity type of the first entity and the second entity; Based on the correlation degree between each entity type of the first entity and the second entity, and a first attention distribution parameter, determine the importance distribution characteristics of the correlation degree between each attribute of the first entity and each attribute of the second entity; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity type pairs; Based on the correlation degree distribution characteristics and the importance distribution characteristics, determine whether the first entity is the same as the second entity.

2. The method according to claim 1, characterized in that The determining whether the first entity is the same as the second entity based on the correlation degree distribution characteristics and the importance distribution characteristics includes: Perform feature fusion processing on the correlation degree distribution characteristics and the importance distribution characteristics to obtain the important correlation degree distribution characteristics between each attribute of the first entity and each attribute of the second entity; Perform classification processing on the important correlation degree distribution characteristics to obtain a classification result indicating whether the first entity is the same as the second entity; Based on the classification result, determine whether the first entity is the same as the second entity.

3. The method according to claim 1, wherein The determining the correlation degree distribution characteristics between each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity and the attribute information of the second entity includes: Based on the attribute information of the first entity, the attribute information of the second entity, and a second attention distribution parameter, determine the correlation degree distribution characteristics between each attribute of the first entity and each attribute of the second entity; the second attention distribution parameter characterizes the attention distribution of the comparability between each attribute of the first entity and each attribute of the second entity.

4. The method according to claim 3, wherein The correlation degree distribution characteristics include the correlation degree between each attribute of the first entity and each attribute of the second entity. The determining the correlation degree distribution characteristics between each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity, the attribute information of the second entity, and the second attention distribution parameter includes: Based on the attribute information of the first entity and the attribute information of the second entity, determine each attribute of the first entity and each attribute of the second entity; For each attribute of the first entity, based on the second attention distribution parameter, determine the degree of association between each attribute value of the attribute and each attribute value of each attribute of the second entity; Based on the degree of association between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity, determine the degree of association between each attribute of the first entity and each attribute of the second entity.

5. The method according to claim 4, characterized in that, The determining the degree of association between each attribute of the first entity and each attribute of the second entity based on the degree of association between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity includes: For each group of attributes of the first entity and attributes of the second entity, determine the maximum value among the degrees of association between each attribute value of the attribute of the first entity and each attribute value of the attribute of the second entity as the degree of association between the attribute of the first entity and the attribute of the second entity.

6. The method according to any one of claims 3 to 5, characterized in that The attribute information of the first entity includes a first attribute tensor, the attribute information of the second entity includes a second attribute tensor, the second attention distribution parameter includes an attribute attention tensor, both the first attribute tensor and the second attribute tensor are three-dimensional tensors of shape K*N*D1, and the attribute attention tensor is a three-dimensional tensor of shape K*N*N, where K is the maximum value of the preset number of attributes, N is the maximum value of the preset number of attribute values, and D1 is the dimension of the representation vector of the preset attribute value.

7. The method according to claim 1, wherein The determining the degree of association between each entity type of the first entity and the second entity based on the degree of association between each entity type of the first entity and each entity type of the second entity includes: For each entity type of the first entity, determine the maximum value among the degrees of association between the entity type of the first entity and each entity type of the second entity as the degree of association between the entity type of the first entity and the second entity.

8. The method according to any one of claims 1 to 5, characterized in that The type information of the first entity includes a first type matrix, the type information of the second entity includes a second type matrix, the first attention distribution parameter includes a type attention tensor, the shapes of both the first type matrix and the second type matrix are T*D2, and the type attention tensor is a three-dimensional tensor of shape T*K*K, where T is the total number of entity types in the current knowledge graph, D2 is the dimension of the representation vector of the preset entity type, and K is the maximum value of the preset number of attributes.

9. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Obtain a sample entity pair and a labeling result for labeling whether the first sample entity and the second sample entity in the sample entity pair are the same; Respectively obtain the attribute information and type information of the first sample entity and the second sample entity; Based on the attribute information of the first sample entity and the attribute information of the second sample entity, determine the distribution characteristics of the degree of association between each attribute of the first sample entity and each attribute of the second sample entity; Based on the type information of the first sample entity and the type information of the second sample entity, as well as the first attention distribution parameter, determine the importance distribution characteristics of the association degrees between the attributes of the first sample entity and the attributes of the second sample entity; the first attention distribution parameter characterizes the attention distribution of the association degrees between the attributes of different entity pairs; Based on the association degree distribution characteristics and the importance distribution characteristics, determine a prediction result indicating whether the first sample entity and the second sample entity are the same; Based on the prediction result and the annotation result, update the first attention distribution parameter.

10. A model training method, characterized in that, For training an entity comparison model, and the trained entity comparison model is used to compare entity pairs in a content service. The method includes: Obtain a sample entity pair and an annotation result for annotating whether the first sample entity and the second sample entity in the sample entity pair are the same; Input the sample entity pair into the entity comparison model to be trained; the entity comparison model is used to respectively obtain the attribute information and type information of the first sample entity and the second sample entity. Among them, the representation forms of the attribute information and the type information include text. Based on the attribute information of the first sample entity and the attribute information of the second sample entity, determine the association degree distribution characteristics between the attributes of the first sample entity and the attributes of the second sample entity. Perform an association process on the type information of the first sample entity and the type information of the second sample entity to obtain the association degrees between each entity type of the first sample entity and each entity type of the second sample entity. Based on the association degrees between each entity type of the first sample entity and each entity type of the second sample entity, determine the association degrees between each entity type of the first sample entity and the second sample entity. Based on the association degrees between each entity type of the first sample entity and the second sample entity, and the first attention distribution parameter, determine the importance distribution characteristics of the association degrees between the attributes of the first sample entity and the attributes of the second sample entity; the first attention distribution parameter characterizes the attention distribution of the association degrees between the attributes of different entity pairs. Based on the association degree distribution characteristics and the importance distribution characteristics, determine a prediction result indicating whether the first sample entity and the second sample entity are the same; Based on the prediction result and the annotation result, adjust the parameters of the entity comparison model to obtain a trained entity comparison model.

11. An entity comparison device, characterized in that, Includes: A first acquisition module for respectively obtaining the attribute information and type information of a first entity and a second entity to be compared, where the representation forms of the attribute information and the type information include text; A first determination module for determining the association degree distribution characteristics between the attributes of the first entity and the attributes of the second entity based on the attribute information of the first entity and the attribute information of the second entity; A second determination module, configured to perform an association process on the type information of the first entity and the type information of the second entity to obtain the association degree between each entity type of the first entity and each entity type of the second entity; based on the association degree between each entity type of the first entity and each entity type of the second entity, determine the association degree between each entity type of the first entity and the second entity; based on the association degree between each entity type of the first entity and the second entity, and a first attention distribution parameter, determine the importance distribution characteristics of the association degree between each attribute of the first entity and each attribute of the second entity; the first attention distribution parameter characterizes the attention distribution of the association degree between the attributes of different entity type pairs. A third determination module, configured to determine whether the first entity is the same as the second entity based on the association degree distribution characteristics and the importance distribution characteristics.

12. The apparatus according to claim 11, wherein the third determination module is further configured to perform a feature fusion process on the association degree distribution characteristics and the importance distribution characteristics to obtain the important association degree distribution characteristics between each attribute of the first entity and each attribute of the second entity; perform a classification process on the important association degree distribution characteristics to obtain a classification result indicating whether the first entity is the same as the second entity; Based on the classification result, determine whether the first entity is the same as the second entity.

13. The apparatus according to claim 11, wherein the first determination module is further configured to determine the association degree distribution characteristics between each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity, the attribute information of the second entity, and a second attention distribution parameter; The second attention distribution parameter characterizes the attention distribution of the comparability between each attribute of the first entity and each attribute of the second entity.

14. The device according to claim 13, characterized in that, The association degree distribution characteristics include the association degree between each attribute of the first entity and each attribute of the second entity; the first determination module is further configured to determine each attribute of the first entity and each attribute of the second entity based on the attribute information of the first entity and the attribute information of the second entity; For each attribute of the first entity, based on the second attention distribution parameter, determine the association degree between each attribute value of the attribute and each attribute value of each attribute of the second entity; Based on the association degree between each attribute value of each attribute of the first entity and each attribute value of each attribute of the second entity, determine the association degree between each attribute of the first entity and each attribute of the second entity.

15. A model training device, characterized in that, For training an entity comparison model, the trained entity comparison model is used to compare entity pairs in content services, and the apparatus includes: A fourth acquisition module, configured to acquire sample entity pairs and an annotation result for annotating whether a first sample entity and a second sample entity in the sample entity pair are the same. A comparison module for: inputting the sample entity pair into an entity comparison model to be trained; the entity comparison model is used to respectively obtain the attribute information and type information of the first sample entity and the second sample entity, wherein the representation forms of the attribute information and the type information include text; based on the attribute information of the first sample entity and the attribute information of the second sample entity, determining the correlation degree distribution characteristics between each attribute of the first sample entity and each attribute of the second sample entity; performing correlation processing on the type information of the first sample entity and the type information of the second sample entity to obtain the correlation degree between each entity type of the first sample entity and each entity type of the second sample entity; based on the correlation degree between each entity type of the first sample entity and each entity type of the second sample entity, determining the correlation degree between each entity type of the first sample entity and the second sample entity; based on the correlation degree between each entity type of the first sample entity and the second sample entity, and a first attention distribution parameter, determining the importance distribution characteristics of the correlation degree between each attribute of the first sample entity and each attribute of the second sample entity; the first attention distribution parameter characterizes the attention distribution of the correlation degree between the attributes of different entity type pairs; based on the correlation degree distribution characteristics and the importance distribution characteristics, determining a prediction result indicating whether the first sample entity and the second sample entity are the same; A second adjustment module for adjusting the parameters of the entity comparison model based on the prediction result and the annotation result to obtain a trained entity comparison model.

16. An electronic device, characterized in that, Comprising: A memory for storing executable instructions; A processor for implementing the method according to any one of claims 1 to 10 when executing the executable instructions stored in the memory.

17. A computer-readable storage medium, characterized in that, Stored with executable instructions for implementing the method according to any one of claims 1 to 10 when being executed by a processor.

18. A computer program product comprising computer instructions, characterized in that, The computer instructions implement the method according to any one of claims 1 to 10 when being executed by a processor.

Citation Information

Patent Citations

  • Method and equipment for connecting entity mention in short text with entity in semantic knowledge base

    CN106940702A

  • Training method, service data classification processing method and device, and electronic device

    CN108985929A