Entity recall method and entity query system

By mapping the floating-point vectors of the entity retrieval system to binary vectors, the problems of large storage space occupation and low computational efficiency caused by high-dimensional floating-point vectors are solved, and efficient entity retrieval on low-computing-power devices is realized.

CN115577068BActive Publication Date: 2026-04-07INST OF COMPUTING TECH CHINESE ACAD OF SCI
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-15
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing entity retrieval systems use high-dimensional floating-point vectors, resulting in large storage space consumption and low computational efficiency, making them difficult to deploy on devices with low computing power and low storage space, thus increasing costs.

Method used

By mapping multidimensional floating-point query vectors and entity vectors to multidimensional binary vectors, candidate entities are recalled through Hamming distance calculation, reducing storage space usage and computational load.

Benefits of technology

It reduces storage space usage, improves retrieval efficiency, and lowers costs, making it suitable for devices with low computing power and low storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115577068B_ABST
    Figure CN115577068B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides an entity recall method, comprising: S1, obtaining a to-be-queried entity, encoding the to-be-queried entity by using a pre-trained first encoding neural network, and obtaining a multi-dimensional floating-point value query vector of the to-be-queried entity; S2, mapping floating-point values of each dimension in the multi-dimensional floating-point value query vector into non-floating-point first values or second values according to a preset rule, and obtaining a multi-dimensional binary query vector; S3, generating a candidate entity set of recall according to the multi-dimensional binary query vector of the to-be-queried entity in an entity knowledge base, wherein the entity knowledge base comprises a plurality of canonical entities with canonical names and a multi-dimensional binary entity vector corresponding to each canonical entity. The present application converts the vector in the form of floating-point values into the vector in the form of binary values, reduces the storage space occupation, and improves the calculation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, in particular to the technical field of entity retrieval, and more particularly to an entity recall method and an entity query system. BACKGROUND

[0002] Entity retrieval refers to returning an entity corresponding to a natural language query from an entity knowledge base. Existing entity retrieval techniques generally use multi-stage retrieval, which usually includes a recall stage and at least one re-ranking stage. The recall stage refers to screening tens of candidate entities from a complete entity knowledge base (usually including millions of entities), and the re-ranking stage refers to selecting the correct entity from the candidate entities. For the recall stage, the entity retrieval system first encodes the query and the entity into high-dimensional floating-point value semantic vectors using a neural network, and then uses a nearest neighbor algorithm to recall a set of candidate entity vectors closest to the query vector through a simple similarity function (such as Euclidean distance, dot product, and cosine). The existing technology generally uses a neural network-based double tower model. Such a model benefits from the powerful semantic matching capability of neural networks, making it highly recallable and widely used.

[0003] However, in order to achieve real-time retrieval, the double tower model for entity retrieval usually calculates the entity vector of each entity in the entity knowledge base offline and stores it. During online retrieval, only the query vector and its similarity with all entity vectors need to be calculated. In order to capture more semantics to improve matching capability, the query vector and the entity vector in the double tower model generally use high-dimensional floating-point value vectors, but high-dimensional floating-point value vectors bring space and time complexity problems.

[0004] Therefore, in the existing entity retrieval system, the entities to be queried and the entities in the entity knowledge base are respectively encoded into high-dimensional floating-point value semantic vectors. On the one hand, storing the high-dimensional floating-point value entity vectors corresponding to the entities in the entity knowledge base consumes a large amount of space. On the other hand, calculating the similarity between the query entities and the entity vectors in the entity knowledge base requires intensive floating-point value operations, which is very inefficient. These two shortcomings further result in the need to deploy the entity retrieval system based on high-dimensional floating-point value semantic vectors on expensive high-memory GPU servers, making it difficult to deploy on devices with low computing power and low storage space, increasing the cost. SUMMARY

[0005] Therefore, the purpose of the present application is to overcome the defects of the prior art and provide an entity recall method and an entity query system.

[0006] The purpose of the present application is achieved by the following technical solutions:

[0007] According to a first aspect of the present invention, an entity recall method is provided, comprising: S1, encoding the entity to be queried using a pre-trained first encoding neural network to obtain a multidimensional floating-point query vector of the entity to be queried; S2, mapping the floating-point value of each dimension in the multidimensional floating-point query vector of the entity to be queried to a non-floating-point first value or a second value according to a preset rule to obtain a multidimensional binary query vector; S3, selecting a portion of standardized entities from an entity knowledge base based on the multidimensional binary query vector of the entity to be queried to generate a candidate entity set for recall, wherein the entity knowledge base includes a plurality of standardized entities with standardized names and a multidimensional binary entity vector corresponding to each standardized entity.

[0008] In some embodiments of the present invention, the multidimensional binary entity vector of each canonical entity in the entity knowledge base is predetermined in the following manner: the canonical entity is encoded using a pre-trained second encoding neural network to obtain a multidimensional floating-point entity vector of the canonical entity; the floating-point value of each dimension in the multidimensional floating-point entity vector of the canonical entity is mapped to a non-floating-point first value or a second value according to a preset rule to obtain the multidimensional binary entity vector of the canonical entity.

[0009] In some embodiments of the present invention, the preset rule is as follows: based on the sign of each dimension of the floating-point value of the multidimensional floating-point query vector or the multidimensional floating-point entity vector, the positive floating-point value is mapped to a first value, and the negative floating-point value is mapped to a second value, so as to obtain the multidimensional binary query vector or the multidimensional binary entity vector.

[0010] In some embodiments of the present invention, the multidimensional floating-point query vector or the multidimensional floating-point entity vector is processed according to preset rules as follows: the multidimensional floating-point query vector is subjected to dimensionality-up transformation to obtain a transformed floating-point query vector, or the multidimensional floating-point entity vector is subjected to dimensionality-up transformation to obtain a transformed floating-point entity vector, wherein the transformed floating-point query vector and the transformed floating-point entity vector have the same dimension; according to the sign of each dimension of the floating-point value in the transformed floating-point query vector or the transformed floating-point entity vector, the positive floating-point value is mapped to a first value, and the negative floating-point value is mapped to a second value, so as to obtain a multidimensional binary query vector or a multidimensional binary entity vector.

[0011] In some embodiments of the present invention, the method of performing dimensionality-up transformation on a multidimensional floating-point query vector or a multidimensional floating-point entity vector includes: obtaining a rotation matrix for dimensionality up transformation, multiplying the multidimensional floating-point query vector by the rotation matrix to obtain a transformed floating-point query vector with added dimensions; or obtaining a rotation matrix for dimensionality up transformation, multiplying the multidimensional floating-point entity vector by the rotation matrix to obtain a transformed floating-point entity vector with added dimensions.

[0012] In some embodiments of the present invention, the rotation matrix is ​​obtained by: sampling an n×m dimensional random matrix from normally distributed random numbers that satisfy a predetermined mean and variance, where n is the dimension of a multidimensional floating-point query vector or a multidimensional floating-point entity vector, m is the dimension of a transformed floating-point query vector or a transformed floating-point entity vector, and m≥n; performing singular value decomposition on the random matrix to obtain an n×m dimensional rotation matrix.

[0013] In some embodiments of the present invention, in step S3, a candidate entity set is generated in the following manner: calculating the Hamming distance between the multidimensional binary query vector of the entity to be queried and the multidimensional binary entity vector of each canonical entity in the entity knowledge base; selecting a predetermined number of canonical entities in ascending order of Hamming distance to generate a candidate entity set; or selecting canonical entities with Hamming distance less than or equal to a preset threshold to generate a candidate entity set.

[0014] In some embodiments of the present invention, the first encoding neural network is a query encoding module in a dual-tower model, and the second encoding neural network is an entity encoding module in a dual-tower model.

[0015] In some embodiments of the present invention, the first value is +1 and the second value is -1; or the first value is 1 and the second value is 0. According to a second aspect of the present invention, an entity query method is provided, comprising: obtaining an entity to be queried; recalling a set of candidate entities of the entity to be queried using the method described in the first aspect of the present invention; calculating the similarity between the entity to be queried and each canonical entity in the candidate entity set; obtaining a query result based on the similarity; and, based on the query result, returning information about the relevant canonical entities from an entity knowledge base, the information including the name of the canonical entity and / or the descriptive text of the canonical entity.

[0016] According to a third aspect of the present invention, an entity query system based on the method described in the first or second aspect of the present invention is provided, comprising: a query encoding module, configured to encode the entity to be queried according to the entity to be queried, to obtain a multidimensional floating-point value query vector of the entity to be queried; a query binary mapping module, configured to map the floating-point value of each dimension in the multidimensional floating-point value query vector to a non-floating-point first value or a second value according to a preset rule, to obtain a multidimensional binary query vector; an entity recall module, configured to select a portion of standardized entities in an entity knowledge base according to the multidimensional binary query vector of the entity to be queried to generate a recall candidate entity set, wherein the entity knowledge base includes a plurality of standardized entities with standardized names and a multidimensional binary entity vector corresponding to each standardized entity; and an entity query module, configured to calculate the similarity between the entity to be queried and each standardized entity in the candidate entity set, and return information of the relevant standardized entities from the entity knowledge base according to the similarity, the information including the name of the standardized entity and / or the descriptive text of the standardized entity.

[0017] In some embodiments of the present invention, the system further includes: an entity encoding module, used to encode a canonical entity to obtain a multidimensional floating-point entity vector of the canonical entity; and an entity binary mapping module, used to map the floating-point value of each dimension in the multidimensional floating-point entity vector of the canonical entity to a non-floating-point first value or a second value according to a preset rule to obtain the multidimensional binary entity vector of the canonical entity.

[0018] According to a fourth aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a memory for storing executable instructions; wherein the one or more processors are configured to implement the steps of the method described in the first or second aspect of the present invention by executing the executable instructions.

[0019] Compared with the prior art, the advantages of the present invention are as follows:

[0020] 1. This invention maps the floating-point values ​​in the multidimensional floating-point query vector obtained by encoding the entity to be queried to two non-floating-point values ​​according to a preset rule, thereby obtaining a multidimensional binary query vector. The multidimensional binary entity vector of each standardized entity in the entity knowledge base is pre-determined according to the preset rule, thereby reducing the storage space occupation. Finally, the Hamming distance between the multidimensional binary query vector of the entity to be queried and the multidimensional binary entity vector of each standardized entity is calculated to replace the dense floating-point value operation, thereby recalling the candidate entity set, realizing computational acceleration, improving retrieval efficiency and reducing costs.

[0021] 2. This invention maps the floating-point values ​​in multidimensional floating-point query vectors and multidimensional floating-point entity vectors to non-floating-point values ​​according to preset rules. The preset rules can be to directly map the floating-point values ​​in multidimensional floating-point query vectors and multidimensional floating-point entity vectors to non-floating-point values ​​for entity recall, or to increase the dimension of multidimensional floating-point query vectors and multidimensional floating-point entity vectors before mapping their floating-point values ​​to two types of non-floating-point values, thereby ensuring the recall accuracy of individual models. Attached Figure Description

[0022] The embodiments of the present invention will be further described below with reference to the accompanying drawings, wherein:

[0023] Figure 1 This is a flowchart of an entity recall method according to an embodiment of the present invention;

[0024] Figure 2 This is a schematic diagram illustrating encoding using a first encoding neural network employing the BERT model according to an embodiment of the present invention;

[0025] Figure 3 This is a schematic diagram of a model for calculating similarity scores according to an embodiment of the present invention;

[0026] Figure 4 This is a schematic diagram of document aggregation including canonical entities returned by a query, according to an embodiment of the present invention;

[0027] Figure 5 This is a schematic diagram of the structure of an entity query system according to an embodiment of the present invention. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the invention.

[0029] As mentioned in the background section, the query vectors and entity vectors in the entity knowledge base in the prior art are usually stored and operated using high-dimensional floating-point vectors, which requires a large amount of storage space to store entity vectors. In addition, the intensive floating-point operations also lead to problems such as low entity retrieval efficiency and high cost.

[0030] To address the issues of high computational cost, low recall efficiency, and excessive storage space requirements for calculating semantic similarity (typically represented by cosine distance) between the multidimensional floating-point query vectors of the query entity and the multidimensional floating-point entity vectors of the canonical entity output by the neural network model during the recall phase of entity retrieval, this invention proposes a scheme to further process the floating-point vectors. This reduces the computational cost of using floating-point values ​​in the recall phase, improves recall efficiency, and reduces space consumption.

[0031] To better understand this invention, we first introduce the basic model structure in the field of entity retrieval. In entity retrieval, the commonly used model is the dual-tower model, which includes two encoding networks. One encoding network (often referred to in some literature as the encoding network corresponding to the user-side tower; for distinction, it is referred to as the pre-trained first encoding neural network in this embodiment) encodes the user's query entities and outputs a multi-dimensional floating-point query vector. The other encoding network (often referred to in some literature as the encoding network corresponding to the item-side tower; for distinction, it is referred to as the pre-trained second encoding neural network in this embodiment; the structure of the second encoding neural network can be the same as or different from the first encoding neural network, and this invention does not impose any restrictions on this) encodes the canonical entities to be matched in the database (this invention stores multiple canonical entities in the database, with each canonical entity serving as a canonical entity to be matched), outputting multi-dimensional floating-point entity vectors of all canonical entities and storing them to avoid recalculation for each subsequent retrieval. Then, semantic similarity is calculated based on the multi-dimensional floating-point query vector and the stored multi-dimensional floating-point entity vector of each canonical entity, and some entities are selected as candidate entities based on the semantic similarity. However, as described earlier, storing multidimensional floating-point entity vectors of massive (hundreds of thousands, millions, or even tens of millions) canonical entities requires a large amount of storage space, and calculating the similarity between each query entity and each canonical entity in the massive canonical entities based on the floating-point vectors is computationally intensive. Therefore, this invention proposes a scheme to further process the floating-point vectors into non-floating-point binary vectors and recall candidate entities based on the binary vectors, in order to reduce the storage space occupied by the vectors stored in the recall stage, reduce the amount of computation, and improve recall efficiency.

[0032] In other words, based on the basic model used in the field of entity retrieval, this invention provides a new entity recall method. It further processes the encoded information of the entity to be queried (referred to as a multidimensional floating-point query vector in this embodiment for distinction) and the encoded information of the canonical entities (referred to as a multidimensional floating-point entity vector in this embodiment for distinction). This includes mapping the floating-point values ​​in the encoded information of the entity to be queried and the canonical entities to two types of non-floating-point values ​​according to a preset rule (referred to as a first non-floating-point value or a second non-floating-point value in this embodiment for distinction), obtaining a multidimensional binary query vector for the entity to be queried and a multidimensional binary entity vector for each canonical entity. This reduces storage space usage. By replacing intensive floating-point operations with two types of non-floating-point numerical operations, the method recalls the candidate entity set, accelerating computation, improving retrieval efficiency, and reducing costs.

[0033] It should be understood that the aforementioned dual-tower model is not a specific model structure, but rather a general term for a class of model framework structures. This invention can employ any existing dual-tower model capable of encoding entities to obtain multi-dimensional floating-point value vectors. Typical dual-tower models include Siamese Networks, DSSM (Deep Structured Semantic Model), etc. The encoding network in the dual-tower model can be a DNN (Deep Neural Networks), an RNN (Recurrent Neural Network), a Transformer model, or a BERT (Bidirectional Encoder Representation from Transformers) network. During training, a simple vector similarity function (e.g., dot product, Euclidean distance, cosine distance) is used to measure the similarity between the encoded information of the query entity and the encoded information of the canonical entity, thereby narrowing the distance between the query entity and similar canonical entities in the encoding space. In addition, non-double-tower models can be used in the field of entity retrieval, such as Language Understanding with Knowledge-based Embeddings (LUKE). For example, when using the LUKE model, there is only one encoding neural network used to encode the query entity, obtaining the encoded information of the query entity. The encoded information of the canonical entities is obtained by training the LUKE encoding neural network after random initialization. For example, with five million canonical entities, the LUKE encoder outputs encoded information with a dimension of 256. Then, the entity vector of all canonical entities in the entity knowledge base is a matrix of five million rows * 256 columns, where each row represents the encoded information of a canonical entity. During the training of the LUKE encoding neural network, the parameters of the encoding neural network and the randomly initialized encoded information of the canonical entities are updated. After training, the encoded information of the canonical entities is stored in the entity knowledge base. When performing entity retrieval, the query entity is also input into the encoding neural network to obtain the encoded information for entity retrieval. The output encoded information is a vector in the form of multi-dimensional floating-point values.

[0034] To better understand the present invention, the entity recall method will be described in detail below based on the dual-tower model and in conjunction with the accompanying drawings and specific embodiments.

[0035] According to one embodiment of the present invention, an entity recall method is provided, see [link to relevant documentation]. Figure 1The process includes steps S1, S2, and S3, and each step of this embodiment will be described in detail below.

[0036] Step S1: Based on the entity to be queried, use a pre-trained first encoding neural network to encode the entity to be queried, and obtain the multi-dimensional floating-point value query vector of the entity to be queried.

[0037] According to one embodiment of the present invention, the entity to be queried can be directly input or marked from the input text. For example, the user directly inputs "Chinese Academy of Sciences" as the entity to be queried. Another example is that, for an input text, the entity to be queried is marked after manual or automatic identification of the input text. Specifically, when marking the input text: the symbol [CLS] marks the start position of the input text, the symbol [SEP] marks the end position of the input text, the symbol [ENT_START] marks the start position of the entity to be queried in the input text, and the symbol [ENT_END] marks the end position of the entity to be queried in the input text. To better understand the present invention, the process of obtaining the entity to be queried is illustrated below with an example: Example 1: When an entity is directly input, for example: Omecron, the entity is marked as: [CLS][ENT_START]Omecron[ENT_END][SEP], obtaining the entity to be queried and inputting it into a pre-trained first encoding neural network. Example 2: When a direct entity is input, such as "Washington," the entity is labeled as: [CLS][ENT_START]Washington[ENT_END][SEP], obtaining the query entity and inputting it into the pre-trained first encoding neural network. Example 3: When a direct text is input, such as "Monoclonal antibody F61 can cope with Omeprone variants," using Omeprone in this text as the query entity, the text is labeled as: [CLS]Monoclonal antibody F61 can cope with [ENT_START]Omeprone[ENT_END]variant[SEP]. Then, the text excluding the query entity is segmented, and the labeled and segmented text is input into the pre-trained first encoding neural network. Example 4: When directly inputting text, such as: "A lightning strike occurred on the evening of the 4th at Lafayette Square, north of the White House in Washington, D.C., USA," and using "Washington" as the query entity, the text would be tagged as: "[CLS]U.S. Capital[ENT_START]Washington[ENT_END]A lightning strike occurred on the evening of the 4th at Lafayette Square, north of the White House[SEP]." Then, the text excluding the query entity is segmented into tokens. The entire text, including the tagged and segmented tokens, is input into a pre-trained first encoding neural network. Tokenization can be performed using tools of the Transformers.Tokenizer type, such as the BertTokenizer tokenizer.

[0038] According to one embodiment of the present invention, see Figure 2 The first pre-trained encoding neural network uses the BERT model. Taking the query entity obtained from Example 2 above, [CLS][ENT_START]Washington[ENT_END][SEP], as an example, it is input into the BERT model. The BERT model encodes the query entity and takes the vector corresponding to the [CLS] symbol as the multi-dimensional floating-point query vector of the query entity, denoted as vector a. The value of each dimension of vector a is in floating-point form.

[0039] Step S2: Map the floating-point value of each dimension in the multidimensional floating-point value query vector of the entity to be queried to a non-floating first value or a second value according to a preset rule to obtain a multidimensional binary query vector.

[0040] According to one embodiment of the present invention, the preset rule is as follows: based on the sign of each dimension of the floating-point value in the multi-dimensional floating-point query vector, positive floating-point values ​​are mapped to a first value, and negative floating-point values ​​are mapped to a second value, to obtain a multi-dimensional binary query vector, denoted as vector u, where the value of each dimension in vector u is in non-floating-point form. The mapping of floating-point values ​​can be performed in the following manner:

[0041]

[0042] Where sign(x) is the sign function, x is the floating-point value of the corresponding dimension, +1 is the first value indicating that the sign of the floating-point value of the corresponding dimension is positive, and -1 is the second value indicating that the sign of the floating-point value of the corresponding dimension is negative. Thus, the multidimensional binary query vector u = (+1, -1, +1, ..., +1, -1) is obtained. It should be understood that in actual calculations, the first or second value may also be replaced by other non-floating-point values. For example, the first value +1 may be replaced by 1, and the second value -1 may be replaced by 0. This invention does not limit this.

[0043] Step S3: Select a subset of canonical entities from the entity knowledge base based on the multidimensional binary query vector of the entity to be queried to generate a set of candidate entities for recall. The entity knowledge base includes multiple canonical entities with normalized names and multidimensional binary entity vectors corresponding to each canonical entity.

[0044] According to an embodiment of the present invention, the multidimensional binary entity vector of each canonical entity in step S3 is predetermined according to the following steps S31 and S32:

[0045] Step S31: Encode the canonical entity using a pre-trained second encoding neural network to obtain the multidimensional floating-point value entity vector of the canonical entity.

[0046] According to one embodiment of the present invention, the BERT model is used to encode canonical entities. Before the canonical entity is input into the BERT model for encoding, it is first concatenated with its descriptive text. Then, the start position of the concatenated text is marked with [CLS], the end position with [SEP], and the cutoff position with [ENT_TITLE]. For example, if the canonical entity is Omegavirus and its descriptive text is: "is a variant of SARS-CoV-2", then the output is: [CLS] Omegavirus [ENT_TITLE] is a variant of SARS-CoV-2 [SEP]. Finally, the descriptive text in the concatenated text is segmented. The canonical entity obtained in this way is input into the BERT model for encoding, resulting in a multidimensional floating-point entity vector, denoted as b.

[0047] Step S32: Map the floating-point value of each dimension in the multidimensional floating-point entity vector of the normalized entity to a non-floating-point first or second value according to a preset rule to obtain the multidimensional binary entity vector of the normalized entity.

[0048] According to an embodiment of the present invention, the preset rule is as follows: based on the sign of each floating-point value of the multidimensional floating-point entity vector, the positive floating-point value is mapped to a first value, and the negative floating-point value is mapped to a second value to obtain a multidimensional binary entity vector. The floating-point value mapping method adopts the same method as the sign function in the above embodiment. The final multidimensional binary entity vector is denoted as v, for example, the multidimensional binary entity vector v = (+1, +1, -1...+1, -1).

[0049] According to one embodiment of the present invention, the first encoding neural network in the above embodiment adopts the query encoding module in the dual-tower model, and the second encoding neural network adopts the entity encoding module in the dual-tower model. According to one embodiment of the present invention, in step S3, a candidate entity set is generated according to the following steps S33 and S34:

[0050] Step S33: Calculate the Hamming distance between the multidimensional binary query vector of the entity to be queried and the multidimensional binary entity vector of each canonical entity in the entity knowledge base.

[0051] According to one embodiment of the present invention, for an n-dimensional binary query vector u composed of +1 and -1 and an n-dimensional binary entity vector v composed of +1 and -1, the Hamming distance is the number of numerically different dimensions between vector u and vector v. An example is given to illustrate how to calculate the Hamming distance between two vectors. For example: a five-dimensional binary query vector u = (+1, -1, +1, +1, -1) composed of +1 and -1, and a five-dimensional binary entity vector v = (-1, -1, +1, -1, +1). By comparing whether each dimension of the two vectors is the same, it can be seen that there are three numerically different dimensions, namely the first dimension, the fourth dimension, and the fifth dimension, thus the Hamming distance is 3.

[0052] According to another embodiment of the present invention, 1 can be used as the first value to replace +1, and 0 can be used as the second value to replace -1, to obtain an n-dimensional binary query vector u composed of 1 and 0 and an n-dimensional binary entity vector v composed of 1 and 0. The Hamming distance between vector u and vector v can be calculated as follows:

[0053] L(u, v) = POPCONT(u XOR v)

[0054] Where L(u, v) is the Hamming distance between vectors u and v, XOR is the exclusive OR operation, which compares whether the values ​​of vectors u and v in the same dimension are the same. If they are the same, it is set to 0, and if they are different, it is set to 1. POPCOUNT(x) counts the number of 1s in x. For example, a five-dimensional binary query vector u = (0, 1, 0, 0, 1) composed of 1s and 0s, and a five-dimensional binary entity vector v = (1, 1, 0, 1, 0) composed of 1s and 0s, perform the XOR operation 01001XOR 11010 to get 10011. Then use POPCOUNT(x) to count POPCOUNT(10011) to get the Hamming distance of 3. The operation is simple and fast. When applied to electronic components such as computers, it is efficient and low cost.

[0055] Step S34: Select a subset of canonical entities from the entity knowledge base based on the Hamming distance to generate a recall candidate entity set. The selection of a subset of canonical entities from the entity knowledge base includes either method one or method two:

[0056] Method 1: Select a predetermined number of canonical entities in ascending order of Hamming distance to generate a candidate entity set. For example, sort the canonical entities in ascending order of Hamming distance, with a predetermined number of K. Select the top K canonical entities as candidate entities (it should be understood that the candidate entities in this embodiment are all canonical entities) to generate a recall candidate entity set. K is usually set manually based on experience, such as 10, 30, or 100. The K value can also be set according to the method of calculating recall. For example, calculate the recall R@K for K = 10, 20, 30…100, and select the smallest K value that allows the recall R@K to reach a preset threshold range (e.g., R@K between 99.5 and 100). Taking the entity to be queried in Example 2 above, Washington, as an example, the recalled candidate entity set, in ascending order of Hamming distance, includes candidate entity 1: George Washington, with the corresponding description text: American politician, military leader, revolutionary, first president, and one of the founding fathers of the United States; candidate entity 2: Washington, D.C., with the corresponding description text: the capital of the United States; candidate entity 3: Washington State, with the corresponding description text: it is a state located in the northwestern United States, and so on, K candidate entities and their description texts.

[0057] Method 2: Select canonical entities with a Hamming distance less than or equal to a preset threshold to generate a candidate entity set. For example, if the preset threshold is 10, then all canonical entities with a Hamming distance less than or equal to 10 will be recalled to generate a candidate entity set.

[0058] Furthermore, to avoid the problem that the multidimensional binary query vector and multidimensional binary entity vector obtained by some models according to the preset rules in the above embodiments may lead to a decrease in entity recall retrieval capability, according to another embodiment of the present invention, based on the above embodiments, the preset rules are replaced with another preset rule to obtain the multidimensional binary query vector of the entity to be queried and the multidimensional binary entity vector of the standardized entity, and entity recall is performed.

[0059] According to another embodiment of the present invention, the multidimensional floating-point query vector of the entity to be queried or the multidimensional floating-point entity vector corresponding to each canonical entity is processed using another preset rule as follows, including steps A1 and A2:

[0060] Step A1: Perform a dimensionality upscaling transformation on the multidimensional floating-point query vector to obtain a transformed floating-point query vector. Similarly, perform a dimensionality upscaling transformation on the multidimensional floating-point entity vector to obtain a transformed floating-point entity vector. The transformed floating-point query vector and the transformed floating-point entity vector have the same dimension. This preset rule, by increasing the dimensionality of the multidimensional floating-point query vector and the multidimensional floating-point entity vector to a certain extent, and then mapping the transformed vectors to multidimensional binary query vectors and multidimensional binary entity vectors, can ensure the recall accuracy of some models.

[0061] According to another embodiment of the present invention, the dimensionality increase transformation includes the following steps: obtaining a rotation matrix for dimensionality increase; multiplying the multidimensional floating-point query vector by the rotation matrix to obtain a transformed floating-point query vector with increased dimensions; and obtaining a rotation matrix for dimensionality increase; multiplying the multidimensional floating-point entity vector by the rotation matrix to obtain a transformed floating-point entity vector with increased dimensions. The obtaining of the rotation matrix for dimensionality increase includes: sampling an n×m dimensional random matrix from normally distributed random numbers satisfying predetermined mean and variance, where n is the dimension of the multidimensional floating-point query vector or multidimensional floating-point entity vector, m is the dimension of the transformed floating-point query vector or transformed floating-point entity vector, and m ≥ n; performing singular value decomposition on the random matrix to obtain an n×m dimensional rotation matrix; and setting m according to the required number of dimensionality increases, such as setting m to n+4 if the multidimensional floating-point query vector and multidimensional floating-point entity vector need to increase by 4 dimensions.

[0062] According to another embodiment of the present invention, an example is now given to illustrate the process of obtaining the transformed floating-point query vector and the transformed floating-point entity vector:

[0063] First, a random matrix M, M∈R, is obtained by sampling from a standard normal distribution of random numbers with a mean of 0 and a variance of 1. n×m Let M be n×m dimensional, where m≥n, and the rank of M be n.

[0064] Secondly, the matrix M is decomposed into three matrices U, S, and V using the singular value decomposition algorithm, where U∈R n×n , S∈R n×n , V∈R n ×m The product of the three matrices is USV = M. Here, the columns of U are orthogonal to each other, the rows of V are orthogonal to each other and form a rotation matrix, and S is a diagonal matrix where only the diagonal elements are non-zero, and all other off-diagonal elements are zero. The rows of V are orthogonal to each other, such as v... i v j ∈R 1×m Let i and j be the i-th and j-th rows of V, respectively. Then each row has a length of 1, i.e., v i T v i=1, the dot product of the two rows is 0, that is, v i T v j =0. Similarly, the columns of U are orthogonal to each other, meaning each column has a length of 1, and the dot product of two columns is 0.

[0065] Finally, the matrix V obtained from the singular value decomposition is used as the n×m dimensional rotation matrix, and the n-dimensional floating-point query vector is denoted as a. n ∈R n×1 Multiply the n-dimensional floating-point query vector by the rotation matrix V∈R n×m This yields an m-dimensional transformed floating-point value lookup vector q. m =Vq n , where q m ∈R m×1 Alternatively, matrix V can be used as an n×m dimensional rotation matrix, and the n-dimensional floating-point entity vector can be denoted as b. n ∈R n ×1 Multiply an n-dimensional floating-point entity vector by a rotation matrix V∈R n×m This yields an m-dimensional transformed floating-point entity vector b. m =Vp n , where b m ∈R m×1 .

[0066] Step A2: Based on the sign of each dimension of the floating-point value in the transformed floating-point query vector or the transformed floating-point entity vector, map the positive floating-point value to a first value and the negative floating-point value to a second value to obtain a multi-dimensional binary query vector or a multi-dimensional binary entity vector. The mapping method is the same as in the above embodiment. It should be understood that the first value +1 and the second value -1 can also be replaced by other non-floating-point values, such as replacing the first value +1 with 1 and the first value -1 with 0.

[0067] The candidate entity set obtained by the entity recall method in the above embodiments of the present invention is a preliminary screening. One or more standardized entities can be selected from the obtained candidate entity set as the final query result information to avoid the problem of excessive computation caused by directly querying the entity knowledge base. According to an embodiment of the present invention, an entity query method is provided, including steps B1, B2 and B3. Each step of this embodiment will be described below.

[0068] Step B1: Obtain the entity to be queried, and use the entity recall method as described in the above embodiments of the present invention to recall the candidate entity set of the entity to be queried.

[0069] Step B2: Calculate the similarity between the entity to be queried and each canonical entity in the candidate entity set, and obtain the query results based on the similarity.

[0070] According to one embodiment of the present invention, the similarity between the query entity and each canonical entity in the candidate entity set can be calculated using a simple vector similarity function (e.g., dot product, Euclidean distance, cosine distance, etc.) or by employing an existing similarity calculation model. For example, the BERT model can be used to encode the concatenated query entity and a canonical entity in the candidate entity set to obtain a high-dimensional vector. Then, a fully connected network is used to obtain the similarity score between the query entity and the canonical entities in the candidate entity set based on this high-dimensional vector. This similarity score is the semantic similarity score between the two entities. See also Figure 3 Taking the query entity "Washington" as an example, Washington is labeled with a recalled canonical entity "Washington, D.C." and its description text "U.S. capital" in the manner described in the above embodiment, respectively labeled as "[CLS][ENT_START]Washington[ENT_END][SEP]" and "[CLS]Washington, D.C.[ENT_TITLE]U.S. capital[SEP]". The labeled query entity and canonical entity and their description text are then concatenated to obtain "[CLS][ENT_START]Washington[ENT_END][SEP]Washington, D.C.[ENT_TITLE]U.S. capital[SEP]". After word segmentation of the description text, it is input into the BERT model to obtain a high-dimensional vector w. The high-dimensional vector w is then input into a fully connected network layer to obtain the similarity score between the query entity and the canonical entity. This is used to obtain the similarity between each canonical entity in the candidate entity set and the query entity, and the canonical entity with the highest similarity score is selected as the final query result.

[0071] Step B3: Based on the query results, return the relevant canonical entity information from the entity knowledge base, including the name of the canonical entity and / or the descriptive text of the canonical entity.

[0072] According to one embodiment of the present invention, after obtaining the returned canonical entity based on the query result, the entity to be queried is linked with the canonical entity so that the user can directly understand the meaning and other information of the entity to be queried through the entity knowledge base, or after linking to the canonical entity in the entity knowledge base, the information of the canonical entity can be used to assist other downstream tasks, such as answering user questions in a dialogue system based on the meaning and other information of the canonical entity.

[0073] According to one embodiment of the present invention, after obtaining the returned canonical entity based on the entity to be queried, several documents containing the canonical entity are aggregated for centralized analysis. See also Figure 4If the entity to be queried is Country A, and Country A itself is a canonical entity in the entity knowledge base, then documents containing Country A's documents will be aggregated together for review and analysis, such as: Document 1: Country A's Ministry of Defense announced on the 26th that an exercise will be held from August 30th to September 5th... and Document 2: The latest official data from Country A shows that XXX new cases of B virus infection have been added in the past 24 hours... Experts say that the increase in the incidence of B virus is mainly related to the spread of the C subtype of the mutated B virus. If the entity to be queried is Virus C, then documents such as: Document 2: The latest official data from Country A shows that 9027 new cases of B virus infection have been added in the past 24 hours... Experts say that the increase in the incidence of B virus is mainly related to the spread of the C subtype of the mutated B virus and Document 3: According to reports from news websites such as News Network 1 and News Network 2... Currently, the community infection of the C variant is expanding... will be aggregated together for review and analysis.

[0074] According to an embodiment of the present invention, an entity query system based on the entity query method described in the above embodiments is provided. See [link to relevant documentation]. Figure 5 The system includes: a query encoding module 1, used to encode the entity to be queried to obtain a multi-dimensional floating-point query vector of the entity to be queried; a query binary mapping module 2, used to map the floating-point value of each dimension in the multi-dimensional floating-point query vector to a non-floating-point first or second value according to a preset rule to obtain a multi-dimensional binary query vector u; an entity encoding module 3, used to encode a canonical entity to obtain a multi-dimensional floating-point entity vector of the canonical entity; and an entity binary mapping module 4, used to map the floating-point value of each dimension in the multi-dimensional floating-point entity vector of the canonical entity to a non-floating-point first value according to a preset rule. Alternatively, a second numerical value is used to obtain the multidimensional binary entity vector v of the standardized entity; the entity knowledge base 5 includes multiple standardized entities with standardized names and the multidimensional binary entity vector of each standardized entity predetermined according to preset rules; the entity recall module 6 is used to select a portion of standardized entities in the entity knowledge base based on the multidimensional binary query vector of the entity to be queried to generate a recall candidate entity set; the entity query module 7 calculates the similarity between the entity to be queried and each standardized entity in the candidate entity set, and returns the relevant standardized entity information from the entity knowledge base based on the similarity, which includes the name of the standardized entity and / or the description text of the standardized entity.

[0075] Finally, the simulation results of the recall performance obtained using the entity recall method of this invention are shown in Tables 1, 2, and 3 below:

[0076] Table 1: Comparison of Entity Recall Performance

[0077] Method R@30 R@100 BM25 68.7 75.6 BLINK 98.9 99.5 Binary BLINK 98.0 98.9 MGAD 99.8 99.8 Binary MGAD 99.2 99.7 LUKE 99.5 99.8 Binary LUKE 45.9 57.6

[0078] Table 1 compares the performance of various models using the above embodiments that directly map the floating-point values ​​in the multidimensional floating-point query vector and multidimensional floating-point entity vector to two non-floating-point numerical values ​​for entity recall, versus existing models that directly use floating-point values ​​for entity recall. This experiment was conducted on AIDA, a commonly used benchmark dataset for entity recall. The baseline models compared were the string exact matching method BM25, two dual-tower models BLINK and MGAD (Multi-Granularity Alignments based Distillation), and one non-dual-tower model LUKE (Language Understanding with Knowledge-based Embeddings). All three models used 32-bit floating-point numbers to represent the multidimensional floating-point query vector and multidimensional floating-point entity vector. The evaluation metric was recall R@K, calculated as: R@K = N K / N, where N is the number of canonical entities in the entity knowledge base related to the entity to be queried. K This represents the number of correctly regulated entities successfully recalled from K candidate entities. As shown in Table 1, applying the entity recall method of this invention to the BLINK and MGAD dual-tower models, denoted as binarized BLINK, binarized MGAD, and binarized LUKE, reveals that the vector dimensions obtained from BLINK and MGAD encoding are 1024-dimensional. The entity recall performance of binarized BLINK and binarized MGAD is significantly lower than that of the original BLINK and MGAD methods using floating-point values, and is superior to the BM25 baseline method. The vector dimension obtained from LUKE encoding is 256-dimensional, which is relatively low. Therefore, directly mapping its floating-point values ​​to non-floating-point values ​​results in a significant recall loss. The LUKE model requires an additional preset rule to increase the dimensionality of the multi-dimensional floating-point query vector and multi-dimensional floating-point entity vector before mapping and recall.

[0079] Table 2: Comparison of computation speed and storage space for entity recall

[0080] Hardware configuration and method Computational speed Storage space GPU + GPU memory + using float value vector recall 1 min 38 s 1.9 GB CPU + memory + using float value vector recall 2 min 5 s 1.9 GB CPU + memory + using binary vector recall 1 min 25 s 61.0 MB

[0081] Table 2 shows the simulation results comparing the computation speed and storage space of the binary MGAD model using the entity recall method of this invention and the original MGAD model using floating-point values ​​for entity recall. The hardware configuration used for this experiment is as follows: (1) Gold 5117 CPU@2.00GHz; (2) GPU: Tesla K80, memory size: 12GB. It can be seen that when using CPU + memory, the calculation speed is increased by about 1.5 times compared with the calculation based on floating-point vector. Therefore, the entity recall speed of the present invention can be increased by about 1.5 times, the storage space is compressed by 32 times, and the calculation speed is faster than the MGAD model that uses floating-point form for entity recall under the hardware configuration based on GPU + memory. That is, the present invention is easy to deploy in low-resource scenarios.

[0082] Table 3: Comparison of entity recall performance of LUKE model under different methods

[0083] R@30 LUKE 99.5 Binary LUKE -53.6 b-Rx1 Binary LUKE -17.1 b-Rx2 Binary LUKE -4.7 b-Rx4 Binary LUKE -0.8 b-Rx8 Binary LUKE -0.1 b-Rx16 Binary LUKE -0.0

[0084] Table 3 presents the recall performance simulation results of the LUKE model (using floating-point values ​​for recall), the binarized LUKE model (using the other preset rule mentioned above), and the binarized LUKE model (which upscales the multidimensional floating-point query vector and multidimensional floating-point entity vector, then maps their floating-point values ​​to non-floating-point values). Here, bR×k represents the vector dimension being k times the original after upscaling the multidimensional floating-point query vector and multidimensional floating-point entity vector, followed by mapping the upscaled vector's floating-point values ​​to non-floating-point values. If the multidimensional floating-point query vector and multidimensional floating-point entity vector obtained by LUKE encoding are up-dimensioned, and then the floating-point values ​​of the up-dimension vectors are mapped to non-floating-point values, if the vector dimension is 1 times the original, it is denoted as bR×1 binarized LUKE; if the vector dimension is 2, 4, 8, or 16 times the original, it is denoted as bR×2 binarized LUKE, bR×4 binarized LUKE, bR×8 binarized LUKE, and bR×16 binarized LUKE, respectively. Except for the first row in Table 3, which shows the entity recall based on floating-point values ​​using the LUKE model, the results in the other rows represent the performance loss compared to the LUKE model based on floating-point values. It can be observed that after up-dimensioning the multidimensional floating-point query vector and multidimensional floating-point entity vector, a 4-fold increase in dimension can maintain a small recall performance loss. Furthermore, since the binarized LUKE model without up-dimensioning can compress the original data by 32 times, a 4-fold increase in dimension still results in an 8-fold compression, reducing storage space usage and improving computational efficiency.

[0085] It should be noted that although the steps are described in a specific order above, it does not mean that the steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently, or even in a different order, as long as the required function can be achieved.

[0086] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.

[0087] Computer-readable storage media can be tangible devices that hold and store instructions for use by an instruction execution device. Computer-readable storage media can be, for example, including but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof.

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

Claims

1. A method for entity recall, characterized in that, include: S1. Based on the entity to be queried, the first pre-trained encoding neural network is used to encode the entity to be queried to obtain the multi-dimensional floating-point value query vector of the entity to be queried. S2. Map the floating-point value of each dimension in the multidimensional floating-point value query vector of the entity to be queried to a non-floating first value or a second value according to a preset rule to obtain a multidimensional binary query vector. S3. Based on the multidimensional binary query vector of the entity to be queried, select a portion of the canonical entities in the entity knowledge base to generate a candidate entity set for recall. The entity knowledge base includes multiple canonical entities with standardized names and a multidimensional binary entity vector corresponding to each canonical entity. The multidimensional binary entity vector of each canonical entity in the entity knowledge base is predetermined in the following manner: The pre-trained second encoding neural network is used to encode the normalized entity to obtain the multi-dimensional floating-point value entity vector of the normalized entity. The floating-point value of each dimension in the multi-dimensional floating-point value entity vector of the normalized entity is mapped to the first or second non-floating-point value according to the preset rules to obtain the multi-dimensional binary entity vector of the normalized entity. The multidimensional floating-point query vector or multidimensional floating-point entity vector is processed according to preset rules as follows: A multidimensional floating-point query vector can be upgraded to obtain a transformed floating-point query vector, or a multidimensional floating-point entity vector can be upgraded to obtain a transformed floating-point entity vector, wherein the transformed floating-point query vector and the transformed floating-point entity vector have the same dimension. Based on the sign of each floating-point value extracted from the transformed floating-point query vector or the transformed floating-point entity vector, the positive floating-point values ​​are mapped to a first value, and the negative floating-point values ​​are mapped to a second value, so as to obtain a multi-dimensional binary query vector or a multi-dimensional binary entity vector.

2. The method according to claim 1, characterized in that, The preset rule is as follows: Based on the sign of each floating-point value in the multidimensional floating-point query vector or the multidimensional floating-point entity vector, positive floating-point values ​​are mapped to a first value, and negative floating-point values ​​are mapped to a second value, in order to obtain a multidimensional binary query vector or a multidimensional binary entity vector.

3. The method according to claim 1, characterized in that, The methods for performing dimensionality upscaling on multidimensional floating-point query vectors or multidimensional floating-point entity vectors include: Obtain the rotation matrix used for dimensionality increase, multiply the multidimensional floating-point query vector by the rotation matrix to obtain the transformed floating-point query vector with increased dimensions; or Obtain the rotation matrix used for dimensionality increase. Multiply the multidimensional floating-point entity vector by the rotation matrix to obtain the transformed floating-point entity vector with increased dimensions.

4. The method according to claim 3, characterized in that, The rotation matrix is ​​obtained in the following ways: From a normally distributed random number that satisfies a predetermined mean and variance, sample an n×m dimensional random matrix, where n is the dimension of the multidimensional floating-point query vector or the multidimensional floating-point entity vector, m is the dimension of the transformed floating-point query vector or the transformed floating-point entity vector, and m≥n; Singular value decomposition is performed on the random matrix to obtain an n×m dimensional rotation matrix.

5. The method according to any one of claims 1-4, characterized in that, In step S3, a candidate entity set is generated as follows: Calculate the Hamming distance between the multidimensional binary query vector of the entity to be queried and the multidimensional binary entity vector of each canonical entity in the entity knowledge base; A candidate entity set is generated by selecting a predetermined number of canonical entities in ascending order of Hamming distance; or Candidate entity sets are generated by selecting canonical entities whose Hamming distance is less than or equal to a preset threshold.

6. The method according to any one of claims 1-4, characterized in that, The first encoding neural network is the query encoding module in the dual-tower model, and the second encoding neural network is the entity encoding module in the dual-tower model.

7. The method according to any one of claims 1-4, characterized in that, The first value is +1 and the second value is -1; or the first value is 1 and the second value is 0.

8. An entity query method, characterized in that, include: Obtain the entity to be queried, and recall the candidate entity set of the entity to be queried using the method described in any one of claims 1-7; Calculate the similarity between the entity to be queried and each canonical entity in the candidate entity set, and obtain the query results based on the similarity. Based on the query results, information about the relevant canonical entities is returned from the entity knowledge base, including the name of the canonical entity and / or the descriptive text of the canonical entity.

9. An entity query system based on the method of any one of claims 1-7 and 8, characterized in that, include: The query encoding module is used to encode the entity to be queried based on the entity to be queried, and obtain a multi-dimensional floating-point value query vector of the entity to be queried; The query binary mapping module is used to map the floating-point value of each dimension in the multidimensional floating-point value query vector to a non-floating-point first or second value according to a preset rule, so as to obtain a multidimensional binary query vector. The entity recall module is used to select a portion of the standardized entities in the entity knowledge base based on the multidimensional binary query vector of the entity to be queried to generate a set of candidate entities for recall. The entity knowledge base includes multiple standardized entities with standardized names and multidimensional binary entity vectors corresponding to each standardized entity. The entity query module calculates the similarity between the entity to be queried and each canonical entity in the candidate entity set, and returns information about the relevant canonical entities from the entity knowledge base based on the similarity. This information includes the name of the canonical entity and / or the descriptive text of the canonical entity.

10. The system according to claim 9, characterized in that, The system also includes: The entity encoding module is used to encode canonical entities to obtain multidimensional floating-point value entity vectors of the canonical entities; The entity binary mapping module is used to map the floating-point value of each dimension in the multidimensional floating-point entity vector of a standard entity to a non-floating-point first or second value according to a preset rule, so as to obtain the multidimensional binary entity vector of the standard entity.

11. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by a processor to implement the steps of the method according to any one of claims 1 to 7 and 8.

12. An electronic device, characterized in that, include: One or more processors; as well as Memory, wherein the memory is used to store executable instructions; The one or more processors are configured to implement the steps of the method according to any one of claims 1 to 7, 8 by executing the executable instructions.

Citation Information

Patent Citations

  • Quick retrieval method and device of face recognition

    CN105808709A