Training method, device, equipment, medium and program product for alignment model

By calculating intra-modal and inter-modal losses and training the model in multi-modal knowledge graph alignment, the problem of unused modal interaction relationships is solved, the alignment effect is improved, and more accurate knowledge graph alignment results are obtained.

CN116756554BActive Publication Date: 2024-10-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202210208340.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-04
Publication Date
2024-10-01
Estimated Expiration
2042-03-04

AI Technical Summary

Technical Problem

Existing multi-modal knowledge graph alignment methods fail to fully utilize the interactive relationships between modalities, resulting in poor alignment results.

Method used

By obtaining the node data of at least two sample knowledge graphs, mapping them to vector space, calculating the intra-modal and inter-modal losses, and training the alignment model based on these losses to improve the alignment effect.

Benefits of technology

Through intra-modal and inter-modal loss training, we can obtain more discriminative and distinctive feature representations, improve the training effect of the alignment model, and achieve more accurate knowledge graph alignment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116756554B_ABST
    Figure CN116756554B_ABST
Patent Text Reader

Abstract

The present application discloses a training method, device, equipment, medium and program product for an alignment model, and relates to the field of machine learning. The method includes: obtaining at least two sample knowledge graphs, wherein the nodes in the sample knowledge graphs correspond to the first modal data and the second modal data; obtaining the first modal feature representation corresponding to the first modal data; obtaining the second modal feature representation corresponding to the second modal data; performing comparative analysis on the first modal feature representation within the modality, and performing comparative analysis on the second modal feature representation, to obtain the intra-modal loss; performing alignment analysis on the first modal feature representation and the second modal feature representation between modalities, to obtain the inter-modal loss; training the alignment model with the intra-modal loss and the inter-modal loss, to obtain the target alignment model. In the above manner, the interactive relationship within and between modalities is utilized to improve the training effect of the alignment model. The present application can be applied to various scenarios such as cloud technology, artificial intelligence, and smart transportation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of machine learning, and in particular to a training method, apparatus, device, medium and program product for an alignment model. Background Art

[0002] Knowledge graphs are composed of interconnected entities and the relationships between entities. Knowledge graphs that use multiple modal data such as language, vision, and hearing are called multimodal knowledge graphs. Knowledge graph alignment, also known as entity alignment, aims to determine whether the entities of two or more different knowledge graphs refer to the same thing. Knowledge graph alignment technology has very important practical significance for building large-scale, high-quality knowledge graphs.

[0003] In related technologies, different encoders are usually used to extract features from information of different modalities, and the modal features corresponding to multiple modal information are fused to obtain a multimodal entity representation, and the alignment result is determined by the cosine similarity of the multimodal entity representation.

[0004] However, when performing multimodal entity alignment using the above method, the alignment result is usually judged based on the multimodal entity representation obtained by direct fusion, without considering the possible complementary information between different modalities, which results in poor information correlation between different modalities during the alignment process, thus affecting the alignment effect. Summary of the invention

[0005] The embodiments of the present application provide a method, apparatus, device, medium and program product for training an alignment model, which can utilize the interaction between modalities and modalities to improve the training effect of the alignment model. The technical solution is as follows.

[0006] In one aspect, a method for training an alignment model is provided, the method comprising:

[0007] Obtain at least two sample knowledge graphs, where nodes in the at least two sample knowledge graphs correspondingly include first modal data and second modal data;

[0008] Mapping the first modality data and the second modality data corresponding to the nodes in the at least two sample knowledge graphs into a vector space through an alignment model to obtain a first modality feature representation corresponding to the first modality data and a second modality feature representation corresponding to the second modality data;

[0009] Performing comparative analysis on the first modal feature representation corresponding to the node and performing comparative analysis on the second modal feature representation corresponding to the node to obtain intra-modal loss;

[0010] Perform alignment analysis on the first modal feature representation and the second modal feature representation corresponding to the node to obtain the inter-modal loss;

[0011] The alignment model is trained based on the intra-modality loss and the inter-modality loss to obtain a target alignment model, and the target alignment model is used to perform alignment analysis on at least two knowledge graphs to obtain an alignment result.

[0012] On the other hand, a training device for an alignment model is provided, the device comprising:

[0013] An acquisition module, used to acquire at least two sample knowledge graphs, wherein nodes in the at least two sample knowledge graphs correspond to first modal data and second modal data;

[0014] A mapping module, used to map the first modality data and the second modality data corresponding to the nodes in the at least two sample knowledge graphs into a vector space through an alignment model to obtain a first modality feature representation corresponding to the first modality data and a second modality feature representation corresponding to the second modality data;

[0015] A comparison module, used for performing a comparison analysis on the first modal feature representation corresponding to the node and a comparison analysis on the second modal feature representation corresponding to the node to obtain an intra-modal loss;

[0016] An alignment module, used for performing alignment analysis on the first modal feature representation and the second modal feature representation corresponding to the node to obtain an inter-modal loss;

[0017] A training module is used to train the alignment model based on the intra-modality loss and the inter-modality loss to obtain a target alignment model, and the target alignment model is used to perform alignment analysis on at least two knowledge graphs to obtain an alignment result.

[0018] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the training method of the alignment model as described in any of the above-mentioned embodiments of the present application.

[0019] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the training method of the alignment model as described in any of the above-mentioned embodiments of the present application.

[0020] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being 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 training method of the alignment model described in any of the above embodiments.

[0021] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0022] Extract the first modal feature representation corresponding to the first modal data in the node, and the second modal feature representation corresponding to the second modal data, perform comparative analysis within different modal feature representations to obtain intra-modal loss, and perform alignment analysis between different modalities to obtain inter-modal loss; train the alignment model based on the intra-modal loss and inter-modal loss to obtain the target alignment model. Through the above method, the different modal data corresponding to the node are mapped to a unified vector space to obtain different modal feature representations corresponding to different modal data, and the modal feature representations corresponding to different nodes are compared and analyzed within the modality to fully capture the dynamic features within the modality, thereby obtaining a more discriminative and distinguishable modal feature representation; in addition, between different modalities, the modal feature representations corresponding to different nodes are aligned and analyzed to make full use of the interactive relationship between modalities, improve the alignment effect during the alignment model training process, and minimize the differences between modalities of the same node while maintaining the semantic proximity between the aligned nodes, thereby achieving better training effects and obtaining a target alignment model with better alignment effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 It is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;

[0025] Figure 2 is a flow chart of a method for training an alignment model provided by an exemplary embodiment of the present application;

[0026] Figure 3 It is a schematic diagram of the interface of a medical knowledge graph provided by an exemplary embodiment of the present application;

[0027] Figure 4 is a flowchart of a method for training an alignment model provided by another exemplary embodiment of the present application;

[0028] Figure 5 is a flow chart of a method for training an alignment model provided by an exemplary embodiment of the present application;

[0029] Figure 6 is a structural block diagram of a training device for an alignment model provided by an exemplary embodiment of the present application;

[0030] Figure 7 is a structural block diagram of a training device for an alignment model provided by another exemplary embodiment of the present application;

[0031] Figure 8 It is a structural block diagram of a server provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0032] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0033] First, a brief introduction is given to the terms involved in the embodiments of the present application.

[0034] Artificial Intelligence (AI): It is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0035] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0036] Machine Learning (ML): It is a multi-disciplinary interdisciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.

[0037] In related technologies, different encoders are usually used to extract features from information of different modalities, and the modal features corresponding to the multiple modal information are fused to obtain a multimodal entity representation, and the alignment result is determined by the cosine similarity of the multimodal entity representation. However, when performing multimodal entity alignment using the above method, the alignment result is usually determined based on the multimodal entity representation obtained by direct fusion, without considering the possible complementary information between different modalities, which results in poor correlation between the information of different modalities during the alignment process, thereby affecting the alignment effect.

[0038] In an embodiment of the present application, a training method for an alignment model is provided, which can utilize the interaction between the modality and between the modalities to improve the training effect of the alignment model. The training method for the alignment model trained in the present application includes at least one of the following scenarios when applied.

[0039] 1. Application in the medical field

[0040] Schematically, in the medical field, related medical terms are used as nodes, and the associations between medical terms are used as edges connecting nodes, thereby forming a medical knowledge graph. The semantics of the nodes themselves, the relationships with other nodes, and the images and videos associated with the node relationships can all be regarded as modal data. Based on different modal data, a multimodal medical knowledge graph can be obtained. Aligning multimodal knowledge graphs is conducive to expanding the scale of knowledge graphs and improving the modal coverage of knowledge graphs. However, generally speaking, when aligning multimodal knowledge graphs, the differences between multiple modal data can easily interfere with the alignment process of the knowledge graph. The training method of the above-mentioned alignment model is adopted. According to the sample knowledge graph, within the same modality, a contrast loss is performed on the modal feature representations corresponding to different nodes to improve the discrimination between different nodes within the modality; between different modalities, an alignment loss is performed on the modal feature representations corresponding to different nodes to make full use of the interaction between modalities and reduce the differences between multiple modalities corresponding to nodes, thereby improving the training effect of the alignment model and obtaining a target alignment model that can better realize the alignment function. Then, the target alignment model is used to align different medical knowledge graphs to obtain a larger-scale and more accurate medical knowledge graph.

[0041] 2. Application in Information Retrieval System

[0042] Schematically, when the knowledge graph is applied to the field of information retrieval, different information exists in the form of nodes, and the association between information exists in the form of edges. In order to vividly represent different information, different modalities can be associated with the information, so as to give play to the complementarity of different modalities in the information. When expanding the coverage of information, the knowledge graph is usually aligned. However, generally speaking, when aligning knowledge graphs associated with multiple modalities, different modal information can easily interfere with the alignment process of the knowledge graph. The training method of the above alignment model is adopted, according to the sample knowledge graph, in the same modality, the modal feature representations corresponding to different nodes are subjected to contrast loss to improve the discrimination between different nodes in the modality; between different modalities, the modal feature representations corresponding to different nodes are subjected to alignment loss, the interactive relationship between modalities is fully utilized, and the differences between multiple modalities corresponding to nodes are reduced, thereby improving the training effect of the alignment model, and obtaining a target alignment model that can achieve better alignment function, and then using the target alignment model to align different knowledge graphs, while obtaining the aligned multimodal knowledge graph, the effectiveness of obtaining information is fully improved.

[0043] It is worth noting that the above application scenarios are only illustrative examples. The training method of the alignment model provided in this embodiment can also be applied to other scenarios, and the embodiments of the present application are not limited to this.

[0044] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the medical data involved in this application are all obtained with full authorization.

[0045] Next, the implementation environment involved in the embodiments of the present application is described. For illustration, please refer to Figure 1 The implementation environment involves a terminal 110 and a server 120 , and the terminal 110 and the server 120 are connected via a communication network 130 .

[0046] In some embodiments, the terminal 110 is used to send a plurality of sample knowledge graphs for training the alignment model to the server 120. In some embodiments, the terminal 110 is installed with an application having a knowledge graph acquisition function or a knowledge graph construction function.

[0047] The image processing method provided in the embodiment of the present application can be implemented by the terminal 110 alone, or by the server 120, or by the terminal 110 and the server 120 through data interaction, and the embodiment of the present application does not limit this. In this embodiment, after the terminal 110 acquires the knowledge graph through an application with a knowledge graph acquisition function, it sends the acquired sample knowledge graph to the server 120, and the server 120 trains the alignment model to obtain the target alignment model based on the sample knowledge graph.

[0048] Optionally, after receiving the sample knowledge graph sent by the terminal 110, the server 120 processes the modal data corresponding to the nodes in the different sample knowledge graphs, maps the first modal data and the second modal data to the vector space, and obtains multiple first modal feature representations corresponding to the first modal data in different nodes, and multiple second modal feature representations corresponding to the second modal data in different nodes. Under the first modal feature representation, a comparative analysis is performed on multiple first modal feature representations; under the second modal feature representation, a comparative analysis is performed on multiple second modal feature representations to obtain intra-modal loss. The first modal feature representation and the second modal feature representation are aligned and analyzed to obtain inter-modal loss, and the alignment model is trained with the intra-modal loss and the inter-modal loss until the target alignment model is obtained, thereby realizing the training process of the alignment model. Optionally, the knowledge graph to be aligned is passed through the target alignment model to obtain the alignment result, and the alignment result is fed back to the terminal 110 for display.

[0049] It is worth noting that the above-mentioned terminals include but are not limited to mobile terminals such as mobile phones, tablet computers, portable laptops, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, and can also be implemented as desktop computers, etc.; the above-mentioned servers can be independent physical servers, or they can be server clusters or distributed systems composed of multiple physical servers, or they can be cloud servers that provide 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, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0050] Among them, cloud technology refers to a hosting technology that unifies hardware, application programs, networks and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of technical network systems require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.

[0051] In some embodiments, the above server can also be implemented as a node in a blockchain system.

[0052] Combined with the above-mentioned noun introduction and application scenarios, the training method of the alignment model provided in this application is explained, taking the application of this method to the server as an example. Figure 2 As shown, the method includes the following steps 210 to 250.

[0053] Step 210, obtain at least two sample knowledge graphs.

[0054] The knowledge graph is a relational network obtained by connecting various types of information together. It is a graph-based data structure composed of nodes and edges. Each node is used to indicate an entity, and each edge is used to indicate the relationship or attribute between entities (between nodes). Schematically, an entity refers to something that is distinguishable and exists independently, such as a person, an animal, a plant, a commodity, etc. Nodes are the most basic elements in the knowledge graph. Different nodes have different relationships, and different relationships are represented by different edges. That is, the knowledge graph is composed of some interconnected nodes and the corresponding attributes of different nodes. Schematically, a knowledge graph includes node A, node B, and node C. There is a relationship a between node A and node B, and a relationship b between node B and node C, etc.

[0055] The sample knowledge graph is the knowledge graph used in the process of training the alignment model. Knowledge graph alignment is also called entity alignment. Schematically, the at least two sample knowledge graphs obtained are knowledge graphs with an alignment relationship. For example, a node M in the first sample knowledge graph is aligned with a node N in the second sample knowledge graph.

[0056] Illustratively, based on the fact that at least two sample knowledge graphs are knowledge graphs with an alignment relationship, it can be known that the nodes in at least two sample knowledge graphs are aligned, and at least two sample knowledge graphs are different knowledge graphs, for example: the text content of the nodes in the first sample knowledge graph and the second sample knowledge graph is different; or, the number of nodes in the first sample knowledge graph and the second sample knowledge graph is different, etc. Illustratively, the embodiment of the present application does not limit the size, content, etc. of the first sample knowledge graph and the second sample knowledge graph.

[0057] Optionally, the nodes in at least two sample knowledge graphs correspond to first modal data and second modal data. After associating the nodes in the knowledge graph with various modal data, a multimodal knowledge graph is obtained. Compared with the traditional knowledge graph, the multimodal knowledge graph constructs nodes including multiple modal data (for example: visual modal data, auditory modal data, etc.), as well as multimodal semantic relationships between multiple modal entities.

[0058] Among them, modality is the source or form of information. Schematically, each source or form of information can be called a modality. For example, information media includes voice, pictures, text, etc. Schematically, modal data is used to indicate the data corresponding to the above modalities, that is, modal data includes: text data, image data, video data, auditory data and other forms.

[0059] In an optional embodiment, the first modal data and the second modal data are only used to indicate different types of modal data, and not only indicate that they include two modal data, but also multiple modal data. That is, when the nodes in the sample knowledge graph are analyzed using the alignment model training method, each node can correspond to not only two modal data, but also multiple modal data.

[0060] Optionally, after obtaining a knowledge graph consisting of nodes and relationships, modal data is associated with at least one node of the knowledge graph to obtain a multimodal knowledge graph. For example, the attributes of the entity corresponding to the node are used as a modal data; or, the corresponding relationship between nodes is used as a modal data; or, the modality associated with the node is used as a modal data, etc.

[0061] Schematically, taking image modal data as an example, after obtaining a knowledge graph composed of multiple entity nodes based on the correlation between multiple entity nodes, at least one image is associated with each node of the knowledge graph to obtain a multimodal knowledge graph, wherein the modal data in the multimodal knowledge graph includes text data (text content of the node) and image data; or, taking video modal data as an example, at least one video is associated with each node of the knowledge graph to obtain a multimodal knowledge graph, wherein the modal data in the multimodal knowledge graph includes text data and video data, etc.

[0062] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.

[0063] Optionally, the graph category of the sample knowledge graph can be roughly determined based on the node categories in the sample knowledge graph. Figure 3As shown, it is a schematic diagram of the interface of a sample knowledge graph obtained according to a search entity 300 (for example, the search entity 300 is diabetes). If the node category in the sample knowledge graph is related to medicine, the sample knowledge graph can be classified as a medical graph category, and the sample knowledge graph is a medical knowledge graph. For example, diabetes 310 is the root node of the medical knowledge graph, and entity nodes such as gout 320 and gestational diabetes 330 are nodes associated with diabetes 310, wherein the relationship between gout 320 and diabetes 310 is "primary disease 321", which is used to indicate that diabetes 310 is the primary symptom of gout 320, and the relationship between gestational diabetes 330 and diabetes 310 is "modified hypernym 331", which is used to indicate that diabetes 310 is a modified hypernym of gestational diabetes 330, etc.; or, if the node category of the node in the sample knowledge graph is related to agriculture, then the graph category of the sample knowledge graph is the agricultural category, and the sample knowledge graph is an agricultural graph, etc. Schematically, at least two sample graphs are knowledge graphs with the same category but different node contents or node numbers.

[0064] Step 220, mapping the first modality data and the second modality data corresponding to the nodes in at least two sample knowledge graphs into the vector space through the alignment model, and obtaining the first modality feature representation corresponding to the first modality data and the second modality feature representation corresponding to the second modality data.

[0065] Schematically, multiple modalities in a multimodal knowledge graph are used to describe information of different dimensions of an entity, and information of different dimensions complements each other. Optionally, when mapping data corresponding to different modalities to a vector space, it includes mapping data corresponding to different modalities to one vector space, and also includes mapping data corresponding to different modalities to vector spaces corresponding to different modalities.

[0066] Optionally, when the training method of the above alignment model is used to analyze the nodes in the sample knowledge graph, the first modal data and the second modal data are used to indicate different types of modal data, that is, at least two modal data may be included, such as: first modal data and second modal data; or, first modal data, second modal data and third modal data, etc. For example: the entity name corresponding to the node is the first modal data, and the entity image corresponding to the node is the second modal data; or, the entity name corresponding to the node is the first modal data, the entity relationship corresponding to the node is the second modal data, and the entity image corresponding to the node is the third modal data, etc.

[0067] The first modality data and the second modality data are mapped to the vector space, that is, the first modality data and the second modality data are subjected to a feature extraction process respectively, so as to obtain a first modality feature representation corresponding to the first modality data and a second modality feature representation corresponding to the second modality data.

[0068] Illustratively, the first modal data is the entity name corresponding to the node, and after mapping the entity name to the vector space, the entity name embedding representation corresponding to the entity name (first modal feature representation) is obtained; or, the first modal data is the entity relationship corresponding to the node, and after mapping the entity relationship to the vector space, the entity relationship embedding representation corresponding to the entity relationship (first modal feature representation) is obtained; or, the second modal data is the entity image corresponding to the node, and after mapping the entity image to the vector space, the visual embedding representation corresponding to the entity image (second modal feature representation) is obtained, etc.

[0069] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.

[0070] Step 230 , performing comparative analysis on the first modal feature representation corresponding to the node, and performing comparative analysis on the second modal feature representation corresponding to the node, to obtain intra-modal loss.

[0071] Optionally, after obtaining the first modal feature representation corresponding to each node in the two sample knowledge graphs, a comparative analysis is performed on multiple first modal feature representations within the first modal feature representation corresponding to the first modal data.

[0072] Among them, comparative analysis is used to analyze the correlation between different nodes for the same modal data. For example, based on the alignment relationship between sample knowledge graphs, the correlation between aligned nodes is made stronger, and the correlation between unaligned nodes is made weaker.

[0073] Schematically, the first sample knowledge graph has an alignment relationship with the second sample knowledge graph, the first sample knowledge graph is composed of multiple first sample nodes, and the second sample knowledge graph is composed of multiple second sample nodes. The modal data corresponding to the first sample nodes include first image data and first entity relationship data; the modal data corresponding to the second sample nodes include second image data and second entity relationship data. The first image data and the second image data are collectively referred to as first modal data, and the first entity relationship data and the second entity relationship data are collectively referred to as second modal data.

[0074] For example: after obtaining the visual embedding representation (first modal feature representation) corresponding to the image data, a comparative analysis is performed on the first visual embedding representation corresponding to the first sample node and the second visual embedding representation corresponding to the second sample node, so that multiple first sample nodes under the first modal feature representation meet the comparison conditions.

[0075] The comparison condition is used to indicate the goal to be achieved after comparative analysis of the first modal feature representations corresponding to at least two nodes. Schematically, the comparison condition is: making the modal feature representations corresponding to two nodes with an alignment relationship closer in the vector space, making the modal feature representations corresponding to two nodes without an alignment relationship farther in the vector space, etc.

[0076] In an optional embodiment, based on the alignment relationship corresponding to at least two sample knowledge graphs, an alignment entity pair having an alignment relationship is determined.

[0077] Indicatively, based on the alignment relationship between the first sample knowledge graph and the second sample knowledge graph, the alignment relationship of the nodes between the first sample knowledge graph and the second sample knowledge graph is determined. For example, if node e1 in the first sample knowledge graph and node e2 in the second sample knowledge graph have an alignment relationship, then node e1 and node e2 form an alignment entity pair, and the alignment entity pair is used to indicate that the two nodes present an alignment relationship, and are used to indicate the same object.

[0078] Optionally, based on the distribution of nodes in the knowledge graph, the nodes in the same knowledge graph present a non-aligned relationship, and then two different nodes in the same knowledge graph constitute a non-aligned entity pair.

[0079] In an optional embodiment, at least two sample knowledge graphs include a first entity node and a second entity node distributed in different sample knowledge graphs.

[0080] Among them, being distributed in different sample knowledge graphs is used to indicate that the first entity node and the second entity node belong to different sample knowledge graphs. Schematically, the at least two sample knowledge graphs include a first sample knowledge graph and a second sample knowledge graph, the first sample knowledge graph includes the first entity node, and the second sample knowledge graph includes the second entity node.

[0081] Optionally, based on the alignment relationship between the first sample knowledge graph and the second sample knowledge graph, the alignment relationship between the first entity node and the second entity node is determined. When determining the aligned entity pair based on the alignment relationship between the first entity node and the second entity node, the aligned entity pairs in two directions are determined according to the alignment direction between the first entity node and the second entity node. The aligned entity pairs in two directions are as follows.

[0082] (1) Aligning the first entity node to the first alignment entity pair of the second entity node

[0083] Schematically, different alignment effects may be produced according to the difference in the knowledge graph alignment direction. For example, in the process of aligning the first sample knowledge graph to the second sample knowledge graph, that is, the process of aligning the first entity node in the first sample knowledge graph to the second entity node in the second sample knowledge graph, based on the alignment direction, a first aligned entity pair obtained by aligning the first entity node to the second entity node is determined.

[0084] (2) Align the second entity node to the second aligned entity pair of the first entity node

[0085] Optionally, the second sample knowledge graph is used as the source knowledge graph, and the first sample knowledge graph is used as the target knowledge graph, that is, the first sample knowledge graph is used as the aligned knowledge graph, and the nodes corresponding to each node in the first sample knowledge graph are determined from the nodes in the second sample knowledge graph. Schematically, after determining the first entity node to be aligned in the first sample knowledge graph, a node having an alignment relationship with the first entity node is determined from the second sample knowledge graph as the second entity node, and the aligned entity pair obtained by aligning the second entity node to the first entity node is used as the second aligned entity pair.

[0086] That is, the aligned entity pairs include a first aligned entity pair in which the first entity node is aligned to the second entity node, and a second aligned entity pair in which the second entity node is aligned to the first entity node.

[0087] In an optional embodiment, based on the difference in the alignment direction of the knowledge graph, the nodes in the first aligned entity pair and the second aligned entity pair include both the same situation and different situations. Schematically, after aligning the first sample knowledge graph to the second sample knowledge graph, at least two aligned entity pairs are obtained. When the nodes in the first aligned entity pair and the second aligned entity pair are the same, such as: the first aligned entity pair is represented as (e1, e2), and the second aligned entity pair is represented as (e2, e1); or, when the nodes in the first aligned entity pair and the second aligned entity pair are different, such as: the first aligned entity pair is represented as (e1, e2), and the second aligned entity pair is represented as (e3, e1), etc.

[0088] Illustratively, two sample knowledge graphs will generate multiple aligned entity pairs during the alignment process. The above is only an illustrative example and the embodiments of the present application are not limited to this.

[0089] In an optional embodiment, a first probability distribution of the aligned entity pairs under a first modality feature representation and a second probability distribution of the aligned entity pairs under a second modality feature representation are determined.

[0090] Among them, the first probability distribution is used to indicate the alignment probability of the aligned entity pairs under the first modal feature representation; the second probability distribution is used to indicate the alignment probability of the aligned entity pairs under the second modal feature representation.

[0091] In an optional embodiment, a first probability distribution of a first aligned entity pair under a first modal feature representation is determined; and a second probability distribution of a second aligned entity pair under the first modal feature representation is determined.

[0092] Optionally, Indicating a first aligned entity pair, schematically, after obtaining the first aligned entity pair, a first probability distribution corresponding to the first modal feature representation is determined through a probability distribution function, wherein the probability distribution function is shown below.

[0093]

[0094] Wherein, m is used to indicate the modal data (first modal data); i is used to indicate the alignment state; j is used to indicate the non-alignment state; Used to indicate a first probability distribution of a first aligned entity pair under a first modal feature representation; Used to indicate the set of entities in the non-aligned entity pairs in the first sample knowledge graph, It is used to indicate the set of entities in the non-aligned entity pairs in the second sample knowledge graph, δ m Used to indicate the encoding function, which is shown below.

[0095] δ m (u,v)=exp(f m (u) T f m (v) / τ1

[0096] Among them, f m (·) is used to indicate the encoder of the modal data m; τ1 is the temperature parameter; u and v are the independent variables corresponding to the encoding function. When the encoding function is applied to the above probability distribution function, u can be realized as v can be implemented as The above are merely illustrative examples.

[0097] Illustratively, the above probability distribution function is the probability distribution formula obtained when applied to the modal data m. When applied to other modalities, the encoder corresponding to the other modal data is used, and the above probability distribution formula can also be used to perform the probability determination process.

[0098] Optionally, The second aligned entity pair is indicated, and the above probability distribution function is used to determine the second probability distribution of the second aligned entity pair, that is, the alignment probability of the second aligned entity pair is as follows.

[0099]

[0100] Wherein, m is used to indicate the modal data (first modal data); i is used to indicate the alignment state; j is used to indicate the non-alignment state; Used to indicate a second probability distribution of a second aligned entity pair under the first modal feature representation; Used to indicate the set of entities in the non-aligned entity pairs in the first sample knowledge graph, It is used to indicate the set of entities in the non-aligned entity pairs in the second sample knowledge graph, δ m Used to indicate the encoding function mentioned above.

[0101] Optionally, after determining a first probability distribution of the first aligned entity pair under the first modal feature representation and a second probability distribution of the second aligned entity pair under the first modal feature representation based on the above-mentioned probability distribution function, the first probability distribution and the second probability distribution are combined to obtain a first probability distribution.

[0102] Illustratively, the numerical values ​​of the first probability distribution are added to the numerical values ​​of the second probability distribution to obtain the first probability distribution represented by the first modal feature.

[0103] In an optional embodiment, the above-mentioned method for obtaining the first probability distribution under the first modal feature representation is applied to the process of determining the second probability distribution under the second modal feature representation, that is: determining the third probability distribution of the first aligned entity pair under the second modal feature representation; determining the fourth probability distribution of the second aligned entity pair under the second modal feature representation, and combining the third probability distribution and the fourth probability distribution to obtain the second probability distribution.

[0104] Among them, the above-mentioned probability distribution function is used to determine the third probability distribution and the fourth probability distribution. Among them, the encoder corresponding to the encoding function is the encoder for determining the second modal feature representation, so this part of the content will not be repeated.

[0105] In an optional embodiment, a first intra-modal loss corresponding to the first modal feature representation is determined based on a first probability distribution, and a second intra-modal loss corresponding to the second modal feature representation is determined based on a second probability distribution.

[0106] Schematically, the first modal intra-loss corresponding to the first modal feature representation is determined based on the first probability distribution as an example for explanation. After obtaining the first probability distribution, the first modal intra-loss is determined using a contrast loss function, and the contrast loss function is shown below.

[0107]

[0108] in, It is used to indicate the intramodal loss (ICL is the abbreviation of intramodal contrast loss, i.e., Intramodal Contrast Loss) of the modal data m (first modal data); i is used to indicate the alignment state; is the batch training data extracted from several nodes; Used to indicate a first probability distribution of a first aligned entity pair under a first modal feature representation; It is used to indicate the second probability distribution of the second aligned entity pair under the first modal feature representation, that is: Used to indicate the first probability distribution under the first modal feature representation.

[0109] In an optional embodiment, the method for obtaining the first modal intra-loss under the first modal feature representation is applied to the process of determining the second modal intra-loss under the second modal feature representation. That is, the second modal intra-loss under the second modal feature representation is determined using the above-mentioned contrast loss function, so the part of the second modal intra-loss is not repeated.

[0110] Optionally, after determining the first intra-modal loss under the first modal feature representation and the second intra-modal loss under the second modal feature representation based on the above-mentioned contrast loss function, the first intra-modal loss and the second intra-modal loss are combined to obtain the intra-modal loss.

[0111] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.

[0112] Step 240 , aligning and analyzing the first modal feature representation and the second modal feature representation corresponding to the node to obtain the inter-modal loss.

[0113] Schematically, in addition to the comparative analysis of the relationships between nodes within different modalities, the relationships between different modalities corresponding to the nodes are also aligned and analyzed, so as to fully capture the dynamic relationships within and between modalities.

[0114] Optionally, in the process of aligning and analyzing the first modal feature representation and the second modal feature representation corresponding to the node, the first modal feature representation and the second modal feature representation corresponding to the node are fused to obtain a fusion feature that fuses different modal feature representations, and the relationship between different modalities corresponding to the node is aligned and analyzed through the fusion feature.

[0115] The above alignment analysis process is described in detail in the following steps 410 to 440.

[0116] Step 250 , training the alignment model based on the intra-modality loss and the inter-modality loss to obtain a target alignment model.

[0117] Among them, the target alignment model is used to perform alignment analysis on at least two knowledge graphs to obtain alignment results.

[0118] Schematically, the intra-modal loss is used to indicate the comparison result after comparative analysis of different nodes for the same modal data; the inter-modal loss is used to indicate the alignment result after alignment analysis of different modal data corresponding to the node.

[0119] In an optional embodiment, a first adjustment is made to the intra-modal loss corresponding to different types of modal data using a first preset parameter, and a second adjustment is made to the inter-modal loss corresponding to different types of modal data using a second preset parameter. The first adjustment result after the first adjustment and the second adjustment result after the second adjustment are substituted into a predetermined loss function to obtain a target loss value.

[0120] Illustratively, the alignment model is trained with a target loss value; in response to the alignment model training reaching a training target, a target alignment model is obtained.

[0121] Optionally, in the process of training the alignment model using the target loss value, a target alignment model may be obtained because the training of the alignment model reaches a training target. Schematically, the training target includes at least one of the following situations.

[0122] 1. In response to the target loss value reaching a convergence state, the alignment model obtained by the most recent iterative training is used as the target alignment model.

[0123] In schematic form, the target loss value reaches a convergence state to indicate that the target loss value obtained by the loss function no longer changes or the change amplitude is less than a preset threshold. For example, if the target loss value after the nth adjustment is 0.1, and the target loss value after the n+1th adjustment is also 0.1, it can be considered that the target loss value has reached a convergence state, and the alignment model corresponding to the target loss value after the nth adjustment or the target loss value after the n+1th adjustment is used as the target alignment model to implement the training process of the alignment model.

[0124] 2. In response to the number of acquisitions of the target loss value reaching a threshold, the alignment model obtained by the most recent iterative training is used as the target alignment model.

[0125] Schematically, one acquisition can get a target loss value, and the number of acquisitions of the loss value used to train the alignment model is pre-set. When one adjustment corresponds to one target loss value, the number of acquisitions of the target loss value is the number of alignments; or, when one adjustment corresponds to multiple target loss values, the number of acquisitions of the loss is the number of target loss values. For example: it is pre-set that one acquisition can get a target loss value, and the threshold of the number of acquisitions of the target loss value is 10 times, that is, when the acquisition number threshold is reached, the alignment model with the most recent target loss value adjustment is used as the target alignment model, or the alignment model with the smallest target loss value adjustment during the 10 adjustments of the target loss value is used as the target alignment model to implement the training process of the alignment model. The above is only an illustrative example, and the embodiments of the present application are not limited to this.

[0126] In addition, the introduction of the above loss function is described in detail in the following steps 450 to 470.

[0127] In summary, the first modal feature representation corresponding to the first modal data in the node and the second modal feature representation corresponding to the second modal data are extracted, and the intra-modal loss is obtained by comparative analysis within different modal features, and the inter-modal loss is obtained by alignment analysis between different modalities; the alignment model is trained based on the intra-modal loss and the inter-modal loss to obtain the target alignment model. Through the above method, the different modal data corresponding to the node are mapped to the vector space to obtain the different modal feature representations corresponding to the different modal data, and the modal feature representations corresponding to different nodes are compared and analyzed within the modality to fully capture the dynamic features within the modality, thereby obtaining a more discriminative and higher distinctive modal feature representation; in addition, the modal feature representations corresponding to the nodes are aligned and analyzed between different modalities, and the interactive relationship between modalities is fully utilized to improve the alignment effect during the alignment model training process. Under the condition of keeping the semantic proximity between the aligned nodes, the difference between the modalities of the same node is minimized, thereby achieving better training effect and obtaining a target alignment model with better alignment effect.

[0128] In an optional embodiment, when the alignment analysis is performed on the first modal feature representation and the second modal feature representation corresponding to the node, the analysis process is performed through the fusion feature after the first modal feature representation and the second modal feature representation are fused. Figure 4 As shown above Figure 2 Step 240 and step 250 in the illustrated embodiment may also be implemented as steps 410 to 470 as follows.

[0129] Step 410, performing weighted fusion on the first modality feature representation and the second modality feature representation to obtain a fused feature.

[0130] Optionally, after obtaining the first modal feature representation and the second modal feature representation, the first modal feature representation and the second modal feature representation are weighted fused according to their importance in the vector space to obtain a fused feature. Schematically, the process of fusing different modal feature representations is as follows.

[0131]

[0132] in, Used to indicate fusion features; M is used to indicate a set of modal data types; m is used to indicate a type of modal data; j is used to indicate another type of modal data; w m A trainable attention parameter for indicating the modality data m; w j Trainable attention parameters for indicating the modality data j; Used to indicate the modal feature representation of the modal data m in the i-th process.

[0133] Optionally, before weighted concatenation of the first modal feature representation and the second modal feature representation, the different modal feature representations are subjected to norm normalization processing (L2), that is, each dimensional data in the first modal feature representation and the second modal feature representation is divided by ‖x‖2 to obtain a vector after feature adjustment of the first modal feature representation and the second modal feature representation, and the adjusted vector is subjected to the above-mentioned vector concatenation process. Wherein, x is used to indicate the feature representation to be adjusted, for example: when adjusting the first modal feature representation, x is the first modal feature representation; or, when adjusting the second modal feature representation, x is the second modal feature representation, etc.

[0134] The above fusion features are used to perform alignment analysis with the first modal feature representation corresponding to the node and the second modal feature representation corresponding to the node, so as to obtain the inter-modal loss.

[0135] Step 420, determining a first inter-modal loss based on the fused features and the first modal feature representation corresponding to the node.

[0136] Schematically, the fusion feature contains the relationship between multiple different types of modal feature representations. Therefore, in the process of determining the loss between the first modalities, the first modal feature representation is used as a reference to determine the loss between the first modal feature representation and the fusion feature (such as: covering the first modal data and the second modal data).

[0137] In an optional embodiment, a divergence solution is performed on the fused feature and the first modal feature representation corresponding to the node to obtain a first divergence value between the fused feature and the first modal feature representation corresponding to the node.

[0138] Indicatively, a divergence solution formula is used to solve the divergence of the fusion feature and the first modal feature representation corresponding to the node. The divergence solution formula is shown below.

[0139]

[0140] Among them, KL is used to indicate the relative entropy divergence (Kullback-Leibler), Used to indicate the alignment distribution corresponding to the first alignment entity pair under the fusion feature; Used to indicate the alignment distribution corresponding to the first alignment entity pair under the first modal feature representation (the modal feature representation of the modal data m); Used to indicate the alignment distribution corresponding to the second alignment entity pair under the fusion feature; Used to indicate the alignment distribution corresponding to the second alignment entity pair under the first modal feature representation (modal feature representation of modal data m).

[0141] That is, when the divergence of the fusion feature and the first modal feature representation corresponding to the node is solved by the divergence solving formula, the solving process needs to be performed through the first aligned entity pair and the second aligned entity pair.

[0142] also, The calculation process is as follows.

[0143]

[0144] Wherein, m is used to indicate the modal data (first modal data); i is used to indicate the alignment state; j is used to indicate the non-alignment state; Used to indicate the alignment distribution of the first alignment entity pair under the fusion feature; Used to indicate the set of entities in the non-aligned entity pairs in the first sample knowledge graph, It is used to indicate the set of entities in the non-aligned entity pairs in the second sample knowledge graph, δ m Used to indicate the encoding function, which is shown below.

[0145] δ m (u,v)=exp(f m (u) T f m (v) / τ2

[0146] Among them, fm (·) is used to indicate the encoder of the modal data m; τ2 is the temperature parameter; u and v are the independent variables corresponding to the encoding function. When the encoding function is applied to the above probability distribution function, u can be realized as v can be implemented as The above is only an illustrative example. That is, the alignment distribution of the first alignment entity pair Alignment probability with the first aligned entity pair The difference lies in the difference in the temperature parameter τ in the encoding function, where τ2≠τ1.

[0147] Optionally, minimizing the first divergence value is used as a training objective to determine a first inter-modal loss corresponding to the first modal feature representation.

[0148] In an illustrative manner, after obtaining the first divergence value based on the above-mentioned divergence solution formula, the first inter-modal loss between the fusion feature and the first modal feature representation corresponding to the node is determined according to the inter-modal loss calculation formula. The first inter-modal loss calculation formula is shown below.

[0149]

[0150] in, A first inter-modal loss between the modal feature representations of the modal data m corresponding to the node and the fused feature; Used to indicate a collection of nodes.

[0151] Illustratively, if the modal data m is the first modal data, then based on the above inter-modal loss calculation formula, the modal feature representation of the modal data m is determined to represent the corresponding first inter-modal loss.

[0152] Step 430 , determining the second inter-modal loss based on the fused features and the second modal feature representation corresponding to the node.

[0153] In an optional embodiment, a divergence solution is performed on the fused feature and the second modal feature representation corresponding to the node to obtain a second divergence value between the fused feature and the second modal feature representation corresponding to the node.

[0154] In schematic form, the above-mentioned divergence solution formula is used to solve the divergence of the fusion feature and the second modal feature representation corresponding to the node. The divergence solution formula is shown below.

[0155]

[0156] Among them, KL is used to indicate the relative entropy divergence (Kullback-Leibler), Used to indicate the alignment distribution corresponding to the first alignment entity pair under the fusion feature; Used to indicate the alignment distribution corresponding to the first alignment entity pair under the second modal feature representation (the modal feature representation of the modal data n); Used to indicate the alignment distribution corresponding to the second alignment entity pair under the fusion feature; Used to indicate the alignment distribution corresponding to the second aligned entity pair under the second modal feature representation (modal feature representation of modal data n).

[0157] That is, when the divergence of the fused feature and the second modal feature representation corresponding to the node is solved by the divergence solving formula, the solving process needs to be performed through the first aligned entity pair and the second aligned entity pair.

[0158] also, The calculation process is as follows.

[0159]

[0160] Wherein, n is used to indicate the modal data (second modal data); i is used to indicate the alignment state; j is used to indicate the non-alignment state; Used to indicate the alignment distribution of the first alignment entity pair under the fusion feature; Used to indicate the set of entities in the non-aligned entity pairs in the first sample knowledge graph, It is used to indicate the set of entities in the non-aligned entity pairs in the second sample knowledge graph, δ n Used to indicate the encoding function, which is shown below.

[0161] δ n (u,v)=exp(f n (u) T f n (v) / τ2

[0162] Among them, f n (·) Encoder used to indicate modal data n; τ2 is the temperature parameter.

[0163] Optionally, minimizing the second divergence value is used as a training objective to determine the second inter-modal loss corresponding to the second modality feature representation.

[0164] In an illustrative manner, after obtaining the second divergence value based on the above-mentioned divergence solution formula, the second inter-modal loss between the fusion feature and the second modal feature representation corresponding to the node is determined according to the inter-modal loss calculation formula. The second inter-modal loss calculation formula is shown below.

[0165]

[0166] in, The second inter-modal loss is used to indicate the difference between the fused feature and the modal feature representation of the modal data n corresponding to the node.

[0167] Illustratively, if the modal data n is the second modal data, then based on the above inter-modal loss calculation formula, the modal feature representation of the modal data n corresponding to the second inter-modal loss is determined.

[0168] Step 440 , combining the first inter-modal loss and the second inter-modal loss to obtain an inter-modal loss.

[0169] Illustratively, after obtaining the first inter-modal loss and the second inter-modal loss, the first inter-modal loss and the second inter-modal loss are summed to obtain the inter-modal loss.

[0170] Step 450: Determine a first target loss value corresponding to the first modal feature representation based on the intra-modal loss and the inter-modal loss.

[0171] In an optional embodiment, it is determined that the first modal feature representation in the intra-modal loss corresponds to the first intra-modal loss, and the first modal feature representation in the inter-modal loss corresponds to the first inter-modal loss.

[0172] Optionally, the first intra-modality loss is adjusted with a first hyperparameter to determine a first comparison adjustment result; and the first inter-modality loss is adjusted with a second hyperparameter to determine a first alignment adjustment result.

[0173] Illustratively, the first hyperparameter and the second hyperparameter are variable parameters that are manually adjusted during the loss calculation process; or, the first hyperparameter and the second hyperparameter are parameters that are automatically learned based on the loss value.

[0174] Schematically, the purpose of the first hyperparameter and the second hyperparameter is to balance the importance of intra-modal loss and inter-modal loss. In the process of adjusting the intra-modal loss and inter-modal loss corresponding to multiple nodes, multiple loss values ​​(intra-modal loss value and inter-modal loss value) corresponding to different nodes will be obtained. Due to the large number of loss values, manual adjustment of the first hyperparameter and the second hyperparameter has the disadvantage of being time-consuming. Therefore, the method of homoscedastic uncertainty can be used to learn the first hyperparameter and the second hyperparameter, that is, the first hyperparameter and the second hyperparameter are learned together with the model.

[0175] In an optional embodiment, after summing up the first contrast adjustment results corresponding to at least two first modal feature representations, a first contrast adjustment sum is obtained; after summing up the first alignment adjustment results corresponding to at least two first modal feature representations, a first alignment adjustment sum is obtained; and the first target loss value is determined by the first contrast adjustment sum and the first alignment adjustment sum.

[0176] Optionally, based on the first comparison adjustment result and the first alignment adjustment result, a first target loss value corresponding to the first modal feature representation is determined. Schematically, α m Represents the first hyperparameter; β m Represents the second hyperparameter. The process of adjusting the first intra-modal loss and the second inter-modal loss with the hyperparameters (the first hyperparameter and the second hyperparameter) to determine the first target loss value is as follows.

[0177]

[0178] in, Used to indicate the first target loss value; Used to indicate the intra-modal loss corresponding to the fused features; Used to indicate a set of modal data types (multiple modal data); m is used to indicate modal data (first modal data); It is used to indicate the intramodal loss (IAL is the abbreviation of intermodal alignment loss, i.e.: Intramodal Alignment Loss) corresponding to the modal data m (the first modal feature representation); Used to indicate the inter-modal loss corresponding to the modal data m.

[0179] Illustratively, taking the first hyperparameter and the second hyperparameter as parameters automatically learned according to the loss value as an example, the above first target loss value formula can be changed into the following form.

[0180]

[0181] Step 460: Determine a second target loss value corresponding to the second modal feature representation based on the intra-modal loss and the inter-modal loss.

[0182] In an optional embodiment, it is determined that the second modal feature in the intra-modal loss represents a corresponding second intra-modal loss, and the second modal feature in the inter-modal loss represents a corresponding second inter-modal loss.

[0183] Optionally, the second intra-modality loss is adjusted with the first hyperparameter to determine a second comparison adjustment result; and the second inter-modality loss is adjusted with the second hyperparameter to determine a second alignment adjustment result.

[0184] After summing up the second comparison adjustment results corresponding to at least two second modal feature representations, a second comparison adjustment sum is obtained; after summing up the second alignment adjustment results corresponding to at least two second modal feature representations, a second alignment adjustment sum is obtained; and the second target loss value is determined by the second comparison adjustment sum and the second alignment adjustment sum.

[0185] Optionally, based on the second comparison adjustment result and the second alignment adjustment result, when determining the second target loss value corresponding to the second modal characteristic representation, the above-mentioned calculation formula for the first target loss value can be used to change the modal data m corresponding to the first target loss value to the modal data n (second modal data) to obtain the second target loss value, so it will not be repeated here.

[0186] Step 470: train the alignment model with the first target loss value and the second target loss value to obtain a target alignment model.

[0187] Illustratively, after obtaining the first target loss value and the second target loss value, the sum of the first target loss value and the second target loss value is taken as the target loss value; the alignment model is trained with the target loss value; in response to the alignment model training reaching the training target, the target alignment model is obtained.

[0188] In summary, the intra-modal loss is obtained by comparative analysis within different modal feature representations, and the inter-modal loss is obtained by alignment analysis between different modalities. The alignment model is trained with the intra-modal loss and the inter-modal loss to obtain the target alignment model. The above method is conducive to fully capturing the dynamic features within the modality, thereby obtaining a more discriminative and distinguishing modal feature representation, and making full use of the interaction between modalities, thereby obtaining a target alignment model with better alignment effect.

[0189] In an embodiment of the present application, the inter-modal alignment loss and the process of training the alignment model through the target loss value are introduced. After obtaining the first modal feature representation and the second modal feature representation, the first modal feature representation and the second modal feature representation are weighted fused to obtain a fused feature; based on the fused feature and the first modal feature representation corresponding to the node, the first inter-modal loss is determined; based on the fused feature and the second modal feature representation corresponding to the node, the second inter-modal loss is determined, the inter-modal loss is determined by the first inter-modal loss and the second inter-modal loss, the target loss values ​​corresponding to different modal feature representations are determined according to the intra-modal loss and the inter-modal loss, and the alignment model is trained with the loss value until the training effect is achieved, and the target alignment model is obtained. Through the above method, the fused features covering different modal feature representations are aligned and analyzed with different types of modal feature representations, the interaction between different types of modalities is fully utilized, and the differences between the modalities of the same node are minimized, so as to obtain a target alignment model with better alignment effect.

[0190] In an optional embodiment, the above alignment model training method is used to map different modal data into a vector space using a node corresponding to five modal data. Schematically, the alignment model training method includes the following three parts: (i) multimodal embedding representation process; (ii) contrast representation learning process; and (iii) target optimization process.

[0191] 1. Multimodal Embedding Representation Process

[0192] Schematically, a multimodal knowledge graph is defined as G = (E, R, A, V, T), where E, R, A, V, T represent entity sets, relationship sets, attribute sets, image sets, and triple sets, respectively. Given two sample knowledge graphs, they are represented as G1 = (E1, R1, A1, V1, T1) and G2 = (E2, R2, A2, V2, T2).

[0193] Optionally, if the sample knowledge graph G1 and the sample knowledge graph G2 are the knowledge graphs to be aligned, the goal of knowledge graph alignment (entity alignment) is to use G1 as the target knowledge graph (G2 can also be the target knowledge graph, and G1 is used as the target knowledge graph for example here), and find an entity e2∈E2 in G2 that represents the same object for each entity e1∈E1 in G1. Schematically, the training method of the above alignment model is called "Multimodal Entity Alignment Method Based on Intra-modal and Inter-modal Contrast Loss Entity Alignment" (MCLEA).

[0194] Multimodal knowledge graphs usually use multiple modalities (also called multiple perspectives) to describe information of different dimensions of entities, and this information is presented as a complementary relationship. Schematically, the sample knowledge graph obtained includes 5 types of modal data, namely entity neighborhood structure data, entity relationship data, entity attribute data, entity name data, and entity image data. Optionally, each modal data is processed using an adapted encoder network to obtain an embedded representation corresponding to each modal data. In addition, the embedded representations corresponding to the above single modal data are fused using a simple weighting mechanism to form a joint entity embedding representation.

[0195] Optionally, the process of processing the above five modal data through an encoder network to obtain an embedded representation includes the following parts.

[0196] (1) Map the entity neighborhood structure data to the vector space to obtain the neighborhood structure embedding representation

[0197] Neighborhood structure embeddings are used to indicate the embedding representation of entity neighborhood structure data.

[0198] Optionally, a graph attention network (GAT) is used to map the above two sample knowledge graphs into the same vector space for encoding, such as Figure 5 As shown in the neighborhood structure data encoding layer 511. For each entity e i , by weighted fusion of the entity e i The entity neighbor of the entity e i The semantic features of h i Schematically, the characterization formula is shown below.

[0199]

[0200] Among them, h j Used to indicate entity e j The feature representation of ; σ represents the activation function (ReLU, LinearREctification function); Used to indicate entity e i Including its own one-hop neighbor set, that is, the entity e i A set of entities with direct connections; ij Used to indicate entity e j For entity e i The importance of is calculated using the following attention mechanism algorithm.

[0201]

[0202] Among them, W is used to indicate the weight matrix that can be learned; It is used to indicate the splicing operation; η is used to indicate the activation function LeakyReLU; h i Used to indicate entity e i Characteristic representation of h j Used to indicate the entity i Entity with direct connection j Characteristic representation of h u Used to indicate the entity i Entity with direct connection u The characteristic representation of h j and h u The calculation method of is shown in the above characterization formula.

[0203] (2) Map entity relationship data, entity attribute data, and entity name data to the vector space to obtain entity Relation embedding representation, entity attribute embedding representation, and entity name embedding representation

[0204] Entity relationship embedding representation is used to indicate the embedding representation of entity relationship data; entity attribute embedding representation is used to indicate the embedding representation of entity attribute data; entity name embedding representation is used to indicate the embedding representation of entity name data.

[0205] Alternatively, the traditional GAT network is encoded as an unlabeled graph, so this method cannot correctly model relational information in a multimodal knowledge graph with multiple relations. Schematically, the entity relationship data is regarded as a bag-of-words feature, and a simple feedforward neural network is used to map the entity relationship data into a low-dimensional space to obtain the entity relationship embedding representation corresponding to the entity relationship data.

[0206] Optionally, based on the simplicity and consistency of model training, the same method as that for obtaining entity relationship embedding representation is used to map entity attribute data and entity name data to obtain entity attribute embedding representation corresponding to the entity attribute data and entity name embedding representation corresponding to the entity name data.

[0207] Schematically, the above-mentioned entity relationship embedding representation, entity attribute embedding representation and entity name embedding representation processes are uniformly expressed in the following form.

[0208]

[0209] Where W l and b l Used to indicate learnable parameters; respectively indicating bag-of-words features of entity relationship data and entity relationship embedding representations corresponding to the entity relationship data; bag-of-words features indicating entity attribute data and entity attribute embedding representations corresponding to the entity attribute data; The word vectors indicating the entity name data and the entity name embedding representation corresponding to the entity name data respectively. It is obtained by averaging the pre-trained feature vectors of the global word frequency statistics (GLoVe, Global Vectors for Word Representation) of the words contained in the entity name. Optionally, in order to avoid the out-of-vocabulary problem (OOV, Out-Of-Vocabulary) caused by the limited vocabulary of proper nouns (e.g., place names) and word vectors, the bigram features of the entity name are further used as auxiliary features for the entity name embedding representation.

[0210] The above are merely illustrative examples, and the embodiments of the present application are not limited thereto.

[0211] (3) Map the entity image data to the vector space to obtain the visual embedding representation

[0212] Visual embedding representation is used to indicate the embedding representation of entity image data.

[0213] Optionally, a pre-trained visual model is used as the feature encoder of the image, such as Figure 5As shown in the image data encoding layer 512 (Visual encoder) in the figure. Schematically, for each entity image (each entity image data), the entity image is input into the pre-trained visual model, and after multiple layers of convolution and pooling operations, the result of the previous pooling layer of the last fully connected layer is taken as the feature vector of the entity image data, and then the feature vector is input into a feedforward neural network layer to obtain the final feature representation of the image.

[0214]

[0215] Among them, v i Used to indicate entity e i The corresponding entity image data; PVM is used to indicate the pre-trained visual model used to process the entity image data; W v ,b v Used to indicate trainable parameters.

[0216] (4) Joint Embedding Representation

[0217] Optionally, the above multimodal feature representations corresponding to the entity (neighborhood structure embedding representation, entity relationship embedding representation, entity attribute embedding representation, entity name embedding representation and visual embedding representation) are integrated by a simple weighted concatenation method to obtain a joint embedding representation. Schematically, before weighted concatenation, each input embedding representation is L2 normalized.

[0218] 2. Contrastive Representation Learning Process

[0219] The current joint embedding representation is coarse-grained, and there is no interaction between different modal data. Schematically, two training strategies are used to learn the dynamic characteristics within the mode and the interaction between the modes. The two training strategies are: (1) intra-modality contrast loss; (2) inter-modality alignment loss.

[0220] (1) Intra-modal contrast loss

[0221] The goal of intra-modal contrast loss ICL is to make the distance between the positive sample pairs of each modal data in the embedding space closer and the distance between the negative sample pairs in the embedding space farther, that is, to retain the similarity of aligned entities in the embedding space and to have a greater degree of distinction from non-aligned entities. Among them, the positive sample pairs are used to indicate aligned sample nodes; the negative sample pairs are used to indicate non-aligned sample nodes.

[0222] Indicatively, based on the alignment relationship of nodes in the sample knowledge graph, the qualified positive sample pairs and negative sample pairs are determined. Based on the assumption that entity alignment usually has a one-to-one mapping, any two non-aligned entity pairs can constitute negative samples for learning.

[0223] Schematically, from the entity set of the sample knowledge graph G1, multiple entities are randomly obtained as small batch data That is: small batches of data Entities in With entity The entities with alignment relationships are located in the sample knowledge graph G2, so the positive sample set is defined as For example: It is used to indicate a positive sample pair, that is, two aligned entities. The negative sample set contains two types: intra-graph non-aligned entity pairs from the source knowledge graph G1 and cross-graph non-aligned entity pairs from the target knowledge graph G2, which are defined as as well as Indicative, and All entities come from small batches of data The above two types of negative samples can constrain semantically similar entities in the same knowledge graph to remain near adjacent points, and the aligned entities across the knowledge graph are mapped to adjacent points. Alignment probability distribution for mode m Defined as:

[0224]

[0225] Among them, m is used to indicate the modal data; i is used to indicate the alignment state; j is used to indicate the non-alignment state; Used to indicate the alignment probability of the second alignment entity pair; Used to indicate the set of entities in the non-aligned entity pairs in the first sample knowledge graph, It is used to indicate the set of entities in the non-aligned entity pairs in the second sample knowledge graph, δ m Used to indicate the encoding function mentioned above.

[0226] Optionally, the input feature embedding representation is L2 normalized before calculating the inner product. In addition, based on the above alignment distribution is directed and asymmetric, therefore, the distribution in the other direction Also has a similar definition.

[0227] The intra-modal contrast loss ICL can be defined as follows:

[0228]

[0229] in, is used to indicate the intra-modal loss of modal data m (first modal data); i is used to indicate the alignment state; is the batch training data extracted from several nodes; Used to indicate a first probability distribution of a first aligned entity pair under a first modal feature representation; It is used to indicate the second probability distribution of the second aligned entity pair under the first modal feature representation, that is: Used to indicate the first probability distribution under the first modal feature representation.

[0230] ICL works on the embedding representation of each modality separately as well as the joint embedding representation. As a comparative supervised approach, ICL learns spatial representations within the modality to obtain more discriminative boundaries for each modality in the embedding space.

[0231] (2) Inter-modal alignment loss

[0232] Since ICL is trained separately for the embedded representation of each modality, and the representations between different modalities are not aligned, it is difficult to model the complex interactions between modalities by simple fusion. To alleviate this problem, the inter-modal alignment loss IAL is further introduced. IAL reduces the gap between the output distributions under different modalities, thereby enabling the model to model cross-modal relationships and obtain more meaningful representations.

[0233] Schematically, the inter-modal alignment process is realized by using the embedding representations corresponding to the different modal data and the above-mentioned joint embedding representation, wherein the multimodal feature representation is fused based on the weighted concatenation of the joint embedding representation, so it has a richer representation. Optionally, the knowledge of the joint embedding representation is transferred to the embedding representation of the unimodal, so that the unimodal embedding representation can better utilize the complementary information from other modalities. Schematically, IAL uses minimizing the bidirectional KL divergence of the joint embedding representation and the unimodal embedding representation on the output distribution as the training goal:

[0234]

[0235] Among them, KL is used to indicate the relative entropy divergence (Kullback-Leibler), Used to indicate the alignment distribution corresponding to the first alignment entity pair under the fusion feature; Used to indicate the alignment distribution corresponding to the first alignment entity pair under the first modal feature representation (the modal feature representation of the modal data m); Used to indicate the alignment distribution corresponding to the second alignment entity pair under the fusion feature; Used to indicate the alignment distribution corresponding to the second alignment entity pair under the first modal feature representation (modal feature representation of the modal data m); A first inter-modal loss between the modal feature representations of the modal data m corresponding to the node and the fused feature; Used to indicate a collection of nodes.

[0236] in, The calculation method is the same as defined in ICL The calculation formula is the same, but different temperature parameters τ2 are used. The gradient of is back-propagated, while the fixed Therefore, modality m can take the output of the joint embedding representation as a learning target to model the interaction relationship between modalities.

[0237] (III) Optimizing the target process

[0238] In summary, the method proposed in the present invention can achieve the multimodal contrastive representation learning process by minimizing the following objective losses:

[0239]

[0240] in, ICL loss for indicating joint embedding representation; Respectively represent the ICL and IAL losses of mode m; α m and β m is a hyperparameter that balances the importance of each loss. Due to the large number of losses, manually adjusting these parameters is very time-consuming, so homoscedastic uncertainty is used to automatically learn the weight of each loss. Therefore, the above loss can be rewritten as:

[0241]

[0242] Among them, α m and β m It is learned together with the model instead of being set manually, thus reducing the difficulty of tuning parameters caused by hyperparameter setting.

[0243] In order to overcome the problem of insufficient training data, the present invention adopts a bidirectional iterative strategy to enhance the training data and iteratively add new alignment seeds during the training process. Specifically, if two entities are nearest neighbors to each other in T time steps, they are added to the training set for the next iterative training. In reasoning, the cosine similarity metric between the joint embedding representations of the entities is used to determine the alignment relationship of the entities.

[0244] Optionally, the above method can also be extended to an unsupervised entity alignment setting, using the similarity of entity name features or entity image features to mine pseudo-alignment seeds as training data.

[0245] Indicatively, Figure 5As shown, the processing process of the above five modal data is as follows.

[0246] Sample knowledge graph 1 and sample knowledge graph 2 are obtained. There are alignment seeds between sample knowledge graph 1 and sample knowledge graph 2. When analyzing data of different modalities, some nodes in sample knowledge graph 1 and sample knowledge graph 2 are intercepted for analysis.

[0247] Schematically, when analyzing neighborhood structure data, the neighborhood structure data is input into the neighborhood structure data encoding layer 511 to obtain a structured embedding representation; similarly, when analyzing entity attribute data, the entity attribute data is input into the entity attribute data encoding layer to obtain an entity attribute embedding representation, and the entity relationship data and entity name data are input into their respective encoding layers to obtain an entity relationship embedding representation and an entity name embedding representation; when analyzing entity image data, the entity image data is input into the image data encoding layer 512 to obtain a visual embedding representation.

[0248] The structured embedding representation, entity attribute embedding representation, entity relationship embedding representation, entity name embedding representation and visual embedding representation corresponding to the five modal data are concatenated to obtain the fused feature 520. In the same modality, the modal embedding representation corresponding to each modal data is used for comparative analysis to obtain the intra-modal loss (contrastive loss, ICL); between different modalities, the fused feature 520 and the modal embedding representation corresponding to each modal data are aligned to obtain the inter-modal loss (alignment loss, IAL), and the alignment model is trained with the intra-modal loss and inter-modal loss.

[0249] Schematically, in order to verify the training method of the above alignment model, three data sets were selected for experiments, namely FR-EN (French-English), JA-EN (Japanese-English), and ZH-EN (Chinese-English) of DBP15K. That is, the data set includes 15K (i.e., 15,000) entities to be aligned, and knowledge graphs represented by 4 different languages ​​(English, French, Japanese and Chinese). At the same time, a total of 10 baseline comparison models were selected for comparison. The experimental results are shown in Table 1 below.

[0250]

[0251] Table 1

[0252] As can be seen from Table 1, both in supervised scenarios (shown in the second row) and unsupervised scenarios (shown in the third row), the above methods are better than the baselines, and the H@1 index reaches more than 95% on all data sets. The performance of the unsupervised version of MCLEA is even comparable to that of the supervised version, which shows that MCLEA has good generalization performance. Compared with the multimodal alignment method EVA of the same type, the H@1 index of MCLEA on the three data sets is improved by 27.7%, 29.4%, and 25.7%, respectively, which shows that the proposed multimodal contrast representation learning method can not only effectively learn the information of the entity modality, but also significantly improve the alignment effect. Among them, Hits@1 and Hits@10 are the recommendation system ranking indicators obtained by the link analysis algorithm (Hit, Hypertext-Induced Topic Search).

[0253] Optionally, to further verify that MCLEA can learn highly discriminative entity representations, visualize the top-10 entity similarity distributions predicted by MCLEA on the ZH-EN dataset when ICL / IAL(-) is removed and ICL / IAL(+) is added. In each modality, especially the neighborhood structure and entity name, when adding ICL / IAL loss, not only can the top-1 similarity be kept high, but the variance of the top-10 similarity is increased, which shows that the learning strategy of the above method can achieve more discriminative entity learning in joint representation and improve the generalization performance of the model.

[0254] In summary, the first modal feature representation corresponding to the first modal data in the node and the second modal feature representation corresponding to the second modal data in the node are extracted, and the intra-modal loss is obtained by comparative analysis within different modal features, and the inter-modal loss is obtained by alignment analysis between different modalities; the alignment model is trained based on the intra-modal loss and the inter-modal loss to obtain the target alignment model. Through the above method, the different modal data corresponding to the node are mapped to a unified vector space to obtain different modal feature representations corresponding to different modal data, and the modal feature representations corresponding to different nodes are compared and analyzed within the modality to fully capture the dynamic features within the modality, thereby obtaining a more discriminative and higher distinguishing modal feature representation; in addition, between different modalities, the modal feature representations corresponding to different nodes are aligned and analyzed to make full use of the interactive relationship between modalities, improve the alignment effect in the alignment model training process, and minimize the differences between modalities of the same node while maintaining the semantic proximity between the aligned nodes, thereby achieving better training effects and obtaining a target alignment model with better alignment effects.

[0255] Figure 6 is a structural block diagram of a training device for an alignment model provided by an exemplary embodiment of the present application, such as Figure 6 As shown, the device includes the following parts:

[0256] An acquisition module 610 is used to acquire at least two sample knowledge graphs, where nodes in the at least two sample knowledge graphs correspond to first modal data and second modal data;

[0257] A mapping module 620, configured to map the first modality data and the second modality data corresponding to the nodes in the at least two sample knowledge graphs to a vector space through an alignment model, to obtain a first modality feature representation corresponding to the first modality data and a second modality feature representation corresponding to the second modality data;

[0258] A comparison module 630 is used to compare and analyze the first modal feature representation corresponding to the node and the second modal feature representation corresponding to the node to obtain intra-modal loss;

[0259] An alignment module 640 is used to perform alignment analysis on the first modal feature representation and the second modal feature representation corresponding to the node to obtain an inter-modal loss;

[0260] The training module 650 is used to train the alignment model based on the intra-modality loss and the inter-modality loss to obtain a target alignment model, and the target alignment model is used to perform alignment analysis on at least two knowledge graphs to obtain an alignment result.

[0261] In an optional embodiment, the at least two sample knowledge graphs are annotated with an alignment relationship;

[0262] The comparison module 630 is also used to determine an aligned entity pair having the alignment relationship based on the alignment relationship corresponding to the at least two sample knowledge graphs; determine a first probability distribution of the aligned entity pair under the first modal feature representation, and a second probability distribution of the aligned entity pair under the second modal feature representation, the first probability distribution being used to indicate the alignment probability of the aligned entity pair under the first modal feature representation, and the second probability distribution being used to indicate the alignment probability of the aligned entity pair under the second modal feature representation; determine a first intra-modal loss corresponding to the first modal feature representation based on the first probability distribution, and determine a second intra-modal loss corresponding to the second modal feature representation based on the second probability distribution; and obtain the intra-modal loss by combining the first intra-modal loss and the second intra-modal loss.

[0263] In an optional embodiment, the at least two sample knowledge graphs include a first entity node and a second entity node distributed in different sample knowledge graphs, and the aligned entity pairs include a first aligned entity pair in which the first entity node is aligned to the second entity node, and a second aligned entity pair in which the second entity node is aligned to the first entity node;

[0264] The comparison module 630 is also used to determine a first probability distribution of the first aligned entity pair under the first modal feature representation; determine a second probability distribution of the second aligned entity pair under the first modal feature representation; and obtain the first probability distribution by combining the first probability distribution and the second probability distribution.

[0265] In an optional embodiment, the comparison module 630 is further configured to perform a logarithmic operation on the sum of the first probability distribution and the second probability distribution to determine the first modal intra-loss corresponding to the first modal feature representation.

[0266] like Figure 7 As shown, in an optional embodiment, the alignment module 640 includes:

[0267] A fusion unit 641 performs weighted fusion on the first modal feature representation and the second modal feature representation to obtain a fusion feature;

[0268] The analyzing unit 642 performs alignment analysis on the fused feature, the first modal feature representation corresponding to the node, and the second modal feature representation corresponding to the node to obtain an inter-modal loss.

[0269] In an optional embodiment, the analysis unit 642 is also used to determine a first inter-modal loss based on the fused features and the first modal feature representation corresponding to the node; determine a second inter-modal loss based on the fused features and the second modal feature representation corresponding to the node; and obtain the inter-modal loss by combining the first inter-modal loss and the second inter-modal loss.

[0270] In an optional embodiment, the analysis unit 642 is also used to perform divergence solution on the fused feature and the first modal feature representation corresponding to the node to obtain a first divergence value between the fused feature and the first modal feature representation corresponding to the node; and determine the first inter-modal loss corresponding to the first modal feature representation by minimizing the first divergence value as a training goal.

[0271] In an optional embodiment, the analysis unit 642 is also used to perform divergence solution on the fused feature and the second modal feature representation corresponding to the node to obtain a second divergence value between the fused feature and the second modal feature representation corresponding to the node; and determine the second inter-modal loss corresponding to the second modal feature representation by minimizing the second divergence value as a training goal.

[0272] In an optional embodiment, the training module 650 is also used to determine a first target loss value corresponding to the first modal feature representation based on the intra-modal loss and the inter-modal loss; determine a second target loss value corresponding to the second modal feature representation based on the intra-modal loss and the inter-modal loss; and train the alignment model with the first target loss value and the second target loss value to obtain a target alignment model.

[0273] In an optional embodiment, the training module 650 is also used to determine the first intra-modal loss corresponding to the first modal feature representation in the intra-modal loss, and the first inter-modal loss corresponding to the first modal feature representation in the inter-modal loss; adjust the first intra-modal loss with a first hyperparameter to determine a first comparison adjustment result; adjust the first inter-modal loss with a second hyperparameter to determine a first alignment adjustment result; and determine a first target loss value corresponding to the first modal feature representation based on the first comparison adjustment result and the first alignment adjustment result.

[0274] In an optional embodiment, the training module 650 is also used to obtain a first comparison adjustment sum after summing up the first comparison adjustment results corresponding to at least two of the first modal feature representations; obtain a first alignment adjustment sum after summing up the first alignment adjustment results corresponding to at least two of the first modal feature representations; and determine the first target loss value using the first comparison adjustment sum and the first alignment adjustment sum.

[0275] In an optional embodiment, the training module 650 is also used to take the sum of the first target loss value and the second target loss value as the target loss value; train the alignment model with the target loss value; and obtain the target alignment model in response to the training of the alignment model reaching the training target.

[0276] In summary, the first modal feature representation corresponding to the first modal data in the node and the second modal feature representation corresponding to the second modal data in the node are extracted, and the intra-modal loss is obtained by comparative analysis within different modal features, and the inter-modal loss is obtained by alignment analysis between different modalities; the alignment model is trained based on the intra-modal loss and the inter-modal loss to obtain the target alignment model. Through the above device, the different modal data corresponding to the node are mapped to a unified vector space to obtain different modal feature representations corresponding to different modal data, and the modal feature representations corresponding to different nodes are compared and analyzed within the modality to fully capture the dynamic features within the modality, thereby obtaining a more discriminative and distinguishable modal feature representation; in addition, the modal feature representations corresponding to different nodes are aligned and analyzed between different modalities to make full use of the interactive relationship between modalities, improve the alignment effect during the alignment model training process, and minimize the differences between modalities of the same node while maintaining the semantic proximity between the aligned nodes, thereby achieving better training effects and obtaining a target alignment model with better alignment effects.

[0277] It should be noted that the training device for the alignment model provided in the above embodiment is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the training device for the alignment model provided in the above embodiment and the training method embodiment of the alignment model belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0278] Figure 8 The schematic diagram of the structure of a server provided by an exemplary embodiment of the present application is shown. The server 800 includes a central processing unit (CPU) 801, a system memory 804 including a random access memory (RAM) 802 and a read-only memory (ROM) 803, and a system bus 805 connecting the system memory 804 and the central processing unit 801. The server 800 also includes a mass storage device 806 for storing an operating system 813, an application program 814, and other program modules 815.

[0279] The mass storage device 806 is connected to the central processing unit 801 through a mass storage controller (not shown) connected to the system bus 805. The mass storage device 806 and its associated computer readable media provide non-volatile storage for the server 800. That is, the mass storage device 806 may include a computer readable medium (not shown) such as a hard disk or a compact disc read only memory (CD-ROM) drive.

[0280] Without loss of generality, computer-readable media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that computer storage media are not limited to the above. The above-mentioned system memory 804 and mass storage device 806 can be collectively referred to as memory.

[0281] According to various embodiments of the present application, the server 800 can also be connected to a remote computer on the network through a network such as the Internet. That is, the server 800 can be connected to the network 812 through the network interface unit 811 connected to the system bus 805, or the network interface unit 811 can be used to connect to other types of networks or remote computer systems (not shown).

[0282] The above-mentioned memory also includes one or more programs, and the one or more programs are stored in the memory and configured to be executed by the CPU.

[0283] An embodiment of the present application also provides a computer device, which includes a processor and a memory, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the training method of the alignment model provided in the above-mentioned method embodiments.

[0284] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the training method of the alignment model provided in the above-mentioned method embodiments.

[0285] The embodiments of the present application also provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the training method of the alignment model described in any of the above embodiments.

[0286] Optionally, the computer readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a solid state drive (SSD), or an optical disk. Among them, the random access memory may include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0287] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0288] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A training method for an alignment model, It is characterized in that The method comprises: Obtain at least two sample knowledge graphs, wherein nodes in the at least two sample knowledge graphs correspond to first modal data and second modal data; the modal data includes at least one of the following: text data, image data, video data, and auditory data; and the at least two sample knowledge graphs are annotated with an alignment relationship; Mapping the first modality data and the second modality data corresponding to the nodes in the at least two sample knowledge graphs into a vector space through an alignment model to obtain a first modality feature representation corresponding to the first modality data and a second modality feature representation corresponding to the second modality data; Based on the alignment relationship corresponding to the at least two sample knowledge graphs, determining an aligned entity pair having the alignment relationship; the at least two sample knowledge graphs include a first entity node and a second entity node distributed in different sample knowledge graphs, and the aligned entity pair includes a first aligned entity pair in which the first entity node is aligned to the second entity node, and a second aligned entity pair in which the second entity node is aligned to the first entity node; Determine a first probability distribution of the first aligned entity pair under the first modal feature representation; determine a second probability distribution of the second aligned entity pair under the first modal feature representation; combine the first probability distribution and the second probability distribution to obtain a first probability distribution of the aligned entity pair under the first modal feature representation; determine a second probability distribution of the aligned entity pair under the second modal feature representation; the first probability distribution is used to indicate the alignment probability of the aligned entity pair under the first modal feature representation, and the second probability distribution is used to indicate the alignment probability of the aligned entity pair under the second modal feature representation; Performing a logarithmic operation on the sum of the first probability distribution and the second probability distribution to determine a first intra-modal loss corresponding to the first modal feature representation; and determining a second intra-modal loss corresponding to the second modal feature representation based on the second probability distribution; Combining the first intra-modal loss and the second intra-modal loss to obtain an intra-modal loss; Perform alignment analysis on the first modal feature representation and the second modal feature representation corresponding to the node to obtain the inter-modal loss; The alignment model is trained based on the intra-modality loss and the inter-modality loss to obtain a target alignment model, and the target alignment model is used to perform alignment analysis on at least two knowledge graphs to obtain an alignment result.

2. The method according to claim 1, It is characterized in that The step of performing alignment analysis on the first modal feature representation and the second modal feature representation corresponding to the node to obtain the inter-modal loss includes: After weighted fusion of the first modal feature representation and the second modal feature representation, a fused feature is obtained; The fusion feature, the first modal feature representation corresponding to the node, and the second modal feature representation corresponding to the node are aligned and analyzed to obtain the inter-modal loss.

3. The method according to claim 2, It is characterized in that The aligning analysis of the fusion feature, the first modal feature representation corresponding to the node, and the second modal feature representation corresponding to the node to obtain the inter-modal loss includes: Determining a first inter-modal loss based on the fused feature and the first modal feature representation corresponding to the node; Determining a second inter-modality loss based on the fused feature and the second modality feature representation corresponding to the node; The first inter-modal loss and the second inter-modal loss are combined to obtain the inter-modal loss.

4. The method according to claim 3, It is characterized in that The determining the first inter-modal loss based on the fused feature and the first modal feature representation corresponding to the node includes: Performing divergence calculation on the fused feature and the first modal feature representation corresponding to the node to obtain a first divergence value between the fused feature and the first modal feature representation corresponding to the node; taking minimizing the first divergence value as a training target, determining a first inter-modal loss corresponding to the first modal feature representation; The determining the second inter-modality loss based on the fused feature and the second modality feature representation corresponding to the node includes: The divergence of the fused feature and the second modal feature representation corresponding to the node is solved to obtain a second divergence value between the fused feature and the second modal feature representation corresponding to the node; minimizing the second divergence value is used as a training goal to determine the second inter-modal loss corresponding to the second modal feature representation.

5. The method according to claim 1, It is characterized in that The step of training the alignment model based on the intra-modality loss and the inter-modality loss to obtain a target alignment model includes: Determining a first target loss value corresponding to the first modal feature representation according to the intra-modal loss and the inter-modal loss; Determining a second target loss value corresponding to the second modal feature representation according to the intra-modal loss and the inter-modal loss; The alignment model is trained with the first target loss value and the second target loss value to obtain the target alignment model.

6. The method according to claim 5, It is characterized in that The determining, according to the intra-modal loss and the inter-modal loss, a first target loss value corresponding to the first modal feature representation comprises: Determine a first intra-modal loss corresponding to the first modal feature representation in the intra-modal loss, and a first inter-modal loss corresponding to the first modal feature representation in the inter-modal loss; Adjusting the first intra-modal loss with a first hyperparameter to determine a first comparison adjustment result; Adjusting the first inter-modal loss using a second hyperparameter to determine a first alignment adjustment result; Based on the first comparison adjustment result and the first alignment adjustment result, a first target loss value corresponding to the first modal feature representation is determined.

7. The method according to claim 6, It is characterized in that The determining, based on the first comparison adjustment result and the first alignment adjustment result, a first target loss value corresponding to the first modal feature representation includes: After performing a sum operation on the first comparison adjustment results respectively corresponding to at least two of the first modal feature representations, a first comparison adjustment sum is obtained; After performing a sum operation on the first alignment adjustment results respectively corresponding to at least two of the first modal feature representations, a first alignment adjustment sum is obtained; The first target loss value is determined using the first comparison adjustment and the first alignment adjustment.

8. The method according to claim 5, It is characterized in that The step of training the alignment model with the first target loss value and the second target loss value to obtain the target alignment model includes: taking the sum of the first target loss value and the second target loss value as the target loss value; Training the alignment model with the target loss value; In response to the training of the alignment model reaching a training target, the target alignment model is obtained.

9. A training device for an alignment model, It is characterized in that The device comprises: An acquisition module is used to acquire at least two sample knowledge graphs, wherein the nodes in the at least two sample knowledge graphs correspond to first modal data and second modal data; the modal data includes at least one of the following: text data, image data, video data, and auditory data; and the at least two sample knowledge graphs are annotated with an alignment relationship; A mapping module, used to map the first modality data and the second modality data corresponding to the nodes in the at least two sample knowledge graphs into a vector space through an alignment model to obtain a first modality feature representation corresponding to the first modality data and a second modality feature representation corresponding to the second modality data; A comparison module is used to determine an aligned entity pair having the alignment relationship based on the alignment relationship corresponding to the at least two sample knowledge graphs; the at least two sample knowledge graphs include a first entity node and a second entity node distributed in different sample knowledge graphs, and the aligned entity pair includes a first aligned entity pair in which the first entity node is aligned to the second entity node, and a second aligned entity pair in which the second entity node is aligned to the first entity node; determine a first probability distribution of the first aligned entity pair under the first modal feature representation; determine a second probability distribution of the second aligned entity pair under the first modal feature representation; combine the first probability distribution and the second probability distribution to obtain determining a first probability distribution of the aligned entity pair under the first modal feature representation; determining a second probability distribution of the aligned entity pair under the second modal feature representation; the first probability distribution is used to indicate the alignment probability of the aligned entity pair under the first modal feature representation, and the second probability distribution is used to indicate the alignment probability of the aligned entity pair under the second modal feature representation; performing a logarithmic operation on the sum of the first probability distribution and the second probability distribution to determine a first intra-modal loss corresponding to the first modal feature representation; and determining a second intra-modal loss corresponding to the second modal feature representation based on the second probability distribution; combining the first intra-modal loss and the second intra-modal loss to obtain an intra-modal loss; An alignment module, used for performing alignment analysis on the first modal feature representation and the second modal feature representation corresponding to the node to obtain an inter-modal loss; A training module is used to train the alignment model based on the intra-modality loss and the inter-modality loss to obtain a target alignment model, and the target alignment model is used to perform alignment analysis on at least two knowledge graphs to obtain an alignment result.

10. The device according to claim 9, It is characterized in that The alignment module comprises: A fusion unit, configured to perform weighted fusion on the first modal feature representation and the second modal feature representation to obtain a fused feature; An analysis unit is used to perform alignment analysis on the fusion feature, the first modal feature representation corresponding to the node, and the second modal feature representation corresponding to the node to obtain the inter-modal loss.

11. The device according to claim 10, It is characterized in that The analysis unit is further used for: Determining a first inter-modal loss based on the fused feature and the first modal feature representation corresponding to the node; Determining a second inter-modality loss based on the fused feature and the second modality feature representation corresponding to the node; The first inter-modal loss and the second inter-modal loss are combined to obtain the inter-modal loss.

12. The device according to claim 11, It is characterized in that The analysis unit is further used for: Performing divergence calculation on the fused feature and the first modal feature representation corresponding to the node to obtain a first divergence value between the fused feature and the first modal feature representation corresponding to the node; taking minimizing the first divergence value as a training target, determining a first inter-modal loss corresponding to the first modal feature representation; The analysis unit is further used for: The divergence of the fused feature and the second modal feature representation corresponding to the node is solved to obtain a second divergence value between the fused feature and the second modal feature representation corresponding to the node; minimizing the second divergence value is used as a training goal to determine the second inter-modal loss corresponding to the second modal feature representation.

13. The device according to claim 9, It is characterized in that The training module is also used for: Determining a first target loss value corresponding to the first modal feature representation according to the intra-modal loss and the inter-modal loss; Determining a second target loss value corresponding to the second modal feature representation according to the intra-modal loss and the inter-modal loss; The alignment model is trained with the first target loss value and the second target loss value to obtain the target alignment model.

14. The device according to claim 13, It is characterized in that The training module is also used for: Determine a first intra-modal loss corresponding to the first modal feature representation in the intra-modal loss, and a first inter-modal loss corresponding to the first modal feature representation in the inter-modal loss; Adjusting the first intra-modal loss with a first hyperparameter to determine a first comparison adjustment result; Adjusting the first inter-modal loss using a second hyperparameter to determine a first alignment adjustment result; Based on the first comparison adjustment result and the first alignment adjustment result, a first target loss value corresponding to the first modal feature representation is determined.

15. The device according to claim 14, It is characterized in that The training module is also used for: After performing a sum operation on the first comparison adjustment results respectively corresponding to at least two of the first modal feature representations, a first comparison adjustment sum is obtained; After performing a sum operation on the first alignment adjustment results respectively corresponding to at least two of the first modal feature representations, a first alignment adjustment sum is obtained; The first target loss value is determined using the first comparison adjustment and the first alignment adjustment.

16. The device according to claim 13, It is characterized in that The training module is also used for: taking the sum of the first target loss value and the second target loss value as the target loss value; Training the alignment model with the target loss value; In response to the training of the alignment model reaching a training target, the target alignment model is obtained.

17. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the training method of the alignment model as described in any one of claims 1 to 8.

18. A computer-readable storage medium, It is characterized in that The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the training method of the alignment model as described in any one of claims 1 to 8.

19. A computer program product, It is characterized in that It comprises a computer program or an instruction, which, when executed by a processor, implements the training method of the alignment model as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Knowledge graph entity alignment method and device, equipment and storage medium

    CN111046186A

  • Iterative knowledge graph entity alignment method based on dynamic threshold

    CN112131395A

  • Knowledge graph alignment model training method, alignment method, device and equipment

    CN112966124A

  • Medical ontology alignment method based on Point Set Registration

    CN113139067A

  • Task prediction method and device, equipment and storage medium

    CN113822439A