Embedded table query method, system and device
By storing the fusion embedding vector in the query device and directly querying the target fusion embedding vector using the embedding vector identification, the problem of reduced query efficiency of embedding tables is solved, and more efficient embedding table query is achieved.
Patent Information
- Application Number
- CN202311283490.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-03-28
AI Technical Summary
As the data scale and machine learning model complexity increase, the dimensions of embedded vectors and the size of embedded tables also increase, resulting in reduced query efficiency of embedded tables.
By storing the fusion embedding vector in the query device, the target fusion embedding vector is directly queried using the embedding vector carried in the query request, avoiding multiple query of the embedding table. If the target fusion embedding vector is not queried, the query device can obtain the candidate fusion embedding vector.
It improves the query efficiency of embedded tables, reduces multiple queries of embedded tables, and improves the performance of the system.
Smart Images

Figure CN119719160A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to an embedded table query method, system and device. Background Art
[0002] Embedding Vector is a data representation method commonly used in the field of artificial intelligence. Any entity, such as animals, plants, humans, objects, and text, can be represented by an embedding vector. In the field of artificial intelligence, subsequent operations can only be performed after the entity is converted into an embedding vector, such as training a machine learning model, such as inputting the embedding vector into a trained machine learning model to obtain the corresponding output. Therefore, in order to facilitate the rapid query of the embedding vector of the entity, the embedding vectors representing different entities can be collected to form an "embedding table", and the embedding vector representing the entity can be queried from the embedding table using the identifier of the embedding vector. Among them, the identifier of the embedding vector is the information that uniquely identifies the embedding vector set in advance for the embedding vector.
[0003] However, as the size of data grows and the complexity of machine learning models increases, the dimension of the embedding vector and the size of the embedding table will also increase. For example, when processing large-scale text data, the vocabulary involved in such large-scale text data may reach millions or even tens of millions. If the dimension of the embedding vector of each word reaches hundreds of dimensions, then the embedding table will also become very large. The difficulty of querying the embedding vector in such an embedding table will also increase. Summary of the invention
[0004] The embodiments of the present application provide an embedded table query method, system and device for improving the query efficiency of the embedded table.
[0005] In a first aspect, an embodiment of the present application provides an embedding table query method, which can be executed by a query device, which can obtain a fused embedding vector from a first memory, wherein the first memory stores at least one fused embedding vector, and any fused embedding vector is generated based on multiple embedding vectors in the embedding table.
[0006] First, the query device can receive a query request sent by a device outside the query device (such as a processor in the computing device where the query device is located, or a computing device outside the computing device where the query device is located), and the query request is used to request a query target fused embedding vector, and the target fused embedding vector is generated based on multiple embedding vectors in the embedding table.
[0007] After receiving the query request, the query device queries the target fused embedding vector from the first memory according to the identifiers of the multiple embedding vectors carried in the query request, wherein the identifiers of the multiple embedding vectors carried in the query request are the identifiers of the multiple embedding vectors based on which the target fused embedding vector is generated.
[0008] The query device searches for the target fusion embedding vector in the first memory, and the query device can feed back the target fusion embedding vector to the device that initiated the query request. If the query device does not search for the target fusion embedding vector in the first memory, the query device can notify the device that initiated the query request that the query failed, or the query device can also obtain a candidate fusion embedding vector close to the target fusion embedding vector from the first memory, and feed back the candidate fusion embedding vector to the device that initiated the query request (the query method of the candidate embedding vector will be described below).
[0009] Through the above method, since the first memory stores a fused embedding vector generated based on multiple embedding vectors, the query device can directly obtain the target fused embedding vector from the first memory using the identifiers of the multiple embedding vectors carried in the query request. There is no need to query multiple embedding vectors from the embedding table multiple times and then generate the target fused embedding vector based on the multiple embedding vectors, which ensures that the target fused embedding vector can be quickly obtained, thereby improving the query efficiency of the embedding table.
[0010] In a possible implementation, when the multiple fused embedded vectors stored in the first memory include a target fused embedded vector, when the query device queries the target fused embedded vector from the first memory according to the identifiers of the multiple embedded vectors carried in the query request, the fusion identifier of the target fused embedded vector can be first determined according to the identifiers of the multiple embedded vectors carried in the query request; then, according to the fusion identifier of the target fused embedded vector, the storage address of the target fused embedded vector in the first memory is determined from the mapping information recorded by the query device, wherein the mapping information indicates the mapping relationship between the storage addresses of the multiple fused embedded vectors in the first memory and the fusion identifiers of the multiple fused embedded vectors. After determining the storage address of the target fused embedded vector in the first memory, the query device obtains the target fused embedded vector from the first memory according to the storage address of the target fused embedded vector.
[0011] Through the above method, the query device stores the mapping relationship between the storage addresses of multiple fused embedded vectors in the first memory and the fusion identifiers of multiple fused embedded vectors, so that the query device can quickly determine whether the target fused embedded vector is stored in the first memory with the help of the fusion identifier of the target fused embedded vector, and can also more conveniently determine the storage address of the target fused embedded vector, so that the target fused embedded vector can be obtained from the first memory later.
[0012] In a possible implementation, regardless of whether the target fusion embedding vector is included in the multiple fusion embedding vectors stored in the first memory, the query device can obtain a candidate fusion embedding vector close to the target fusion embedding vector from the first memory. The following is an explanation of the way in which the query device obtains the candidate fusion embedding vector: the query device can first determine the fusion identifier of the target fusion embedding vector based on the identifiers of the multiple embedding vectors; then, determine the fusion identifier of the candidate fusion embedding vector based on the fusion identifier of the target fusion embedding vector, and the difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is within a preset range, and the difference represents the degree of difference between the multiple embedding vectors based on which the target fusion embedding vector is generated and the multiple embedding vectors based on which the candidate fusion embedding vector is generated.
[0013] In the embodiments of the present application, the fusion identifier of any fused embedding vector (such as the fusion identifier of the candidate fused embedding vector and the fusion identifier of the target fused embedding vector) not only has the function of identifying the fused embedding vector, but also can characterize the multiple embedding vectors based on which the fused embedding vector is generated to a certain extent. There are the same embedding vectors between the multiple embedding vectors based on which the candidate fused embedding vector is generated and the multiple embedding vectors based on which the target fused embedding vector is generated, that is, the smaller the difference between the multiple embedding vectors based on which the candidate fused embedding vector is generated and the multiple embedding vectors based on which the target fused embedding vector is generated, the closer the candidate fused embedding vector is to the target fused embedding vector.
[0014] After determining the fusion identifier of the candidate fusion embedding vector, the query device obtains the candidate fusion embedding vector from multiple fusion embedding vectors in the first memory according to the fusion identifier of the candidate fusion embedding vector. The query device can query the mapping information according to the fusion identifier of the candidate fusion embedding vector, determine the storage address of the candidate fusion embedding vector in the first memory, and then obtain the candidate fusion embedding vector according to the storage address of the candidate fusion embedding vector. The query device can feed back the candidate fusion embedding vector to the device that initiated the query request.
[0015] After obtaining the candidate fused embedding vector, the device that initiates the query request can determine the target fused embedding vector based on the candidate fused embedding vector.
[0016] Through the above method, the query device can obtain a candidate fusion embedding vector from the first memory and feed the candidate fusion embedding vector back to the device that initiates the query request, ensuring that the device can use the candidate fusion embedding vector to generate a target fusion embedding vector, and can also avoid the device from querying the embedding table multiple times.
[0017] In a possible implementation, there are the same embedding vectors between the multiple embedding vectors based on which the candidate fusion embedding vector is generated and the multiple embedding vectors based on which the target fusion embedding vector is generated, and there are also different embedding vectors. The different embedding vectors may be of two types: one is an embedding vector that does not exist in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and exists in the multiple embedding vectors based on which the target fusion embedding vector is generated. For the convenience of explanation, this type of embedding vector is called a first-class embedding vector. The other is an embedding vector that exists in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and does not exist in the multiple embedding vectors based on which the target fusion embedding vector is generated. For the convenience of explanation, this type of embedding vector is called a second-class embedding vector.
[0018] The different embedding vectors between the multiple embedding vectors based on which the candidate fused embedding vector is generated and the multiple embedding vectors based on which the target fused embedding vector is generated may include only one type of embedding vectors, or only two types of embedding vectors, or one type of embedding vectors and two types of embedding vectors.
[0019] The query device may determine the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector according to the fusion identifier of the candidate fused embedding vector.
[0020] After determining the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector, the query device may feed back the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector to the device that initiated the query request.
[0021] After obtaining the identification of the first type of embedding vector and / or the identification of the second type of embedding vector, the device that initiates the query request can obtain the first type of embedding vector and / or the second type of embedding vector based on the identification of the first type of embedding vector and / or the identification of the second type of embedding vector, and determine the target fused embedding vector based on the candidate fused embedding vector and the first type of embedding vector and / or the second type of embedding vector.
[0022] Through the above method, the query device can determine the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector, and can provide the different embedding vectors between the candidate fusion embedding vector and the target fusion embedding vector to the device that initiates the query request, so that the device that initiates the query request can use the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector to obtain the first type of embedding vector and / or the second type of embedding vector, and then generate the target fusion embedding vector.
[0023] In a possible implementation, the query device has the ability to generate a fusion identifier and also has the ability to decode the fusion identifier. When the fusion identifier is generated based on the identifiers of multiple embedded vectors, the query device can determine the identifiers of the multiple embedded vectors based on which the candidate fusion embedded vector is generated according to the fusion identifier of the candidate fusion embedded vector; then, by comparing the identifiers of the multiple embedded vectors based on which the candidate fusion embedded vector is generated with the identifiers of the multiple embedded vectors carried in the query request, the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector is determined.
[0024] Through the above method, the query device can decode the identifiers of multiple embedded vectors based on which the candidate fused embedded vector is generated from the fusion identifier of the candidate fused embedded vector. Subsequently, it only needs to compare with the identifiers of multiple embedded vectors carried in the query request to quickly determine the identifier of the first category of embedded vectors and / or the identifier of the second category of embedded vectors.
[0025] In a possible implementation, the fusion identifier is generated based on the identifiers of multiple embedded vectors. For example, each bit in the fusion identifier corresponds to an embedded vector or a combination of multiple embedded vectors. When determining the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector, the query device can determine the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector based on the different bits in the fusion identifier of the candidate fusion embedded vector and the fusion identifier of the target fusion embedded vector.
[0026] Through the above method, by comparing the fusion identifier of the candidate fusion embedding vector with the fusion identifier of the target fusion embedding vector, the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector can be easily determined, which is simpler.
[0027] In a possible implementation, the first memory stores a candidate fusion embedding vector and identifiers of multiple embedding vectors based on which the candidate fusion embedding vector is generated. The candidate fusion embedding vector and the identifiers of multiple embedding vectors based on which the candidate fusion embedding vector is generated can be stored at a location indicated by a storage address of the candidate fusion embedding vector. When determining the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector, the query device obtains the identifiers of multiple embedding vectors based on which the candidate fusion embedding vector is generated from the first memory; thereafter, the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector is determined by comparing the identifiers of the multiple embedding vectors based on which the candidate fusion embedding vector is generated with the identifiers of the multiple embedding vectors carried in the query request.
[0028] Through the above method, the first memory stores the identifiers of multiple embedded vectors based on which the candidate fusion embedded vector is generated. When the query device obtains the candidate embedded vector from the first memory, it can also conveniently obtain the identifiers of multiple embedded vectors based on which the candidate fusion embedded vector is generated, thereby ensuring that the identifier of one type of embedded vector and / or the identifier of the second type of embedded vector can be quickly determined by comparing the identifiers of the multiple embedded vectors based on which the candidate fusion embedded vector is generated with the identifiers of the multiple embedded vectors carried in the query request.
[0029] In one possible implementation, the query device includes a CAM, and the CAM stores mapping information. When the query device determines the storage address of the target fusion embedded vector in the first memory from the mapping information recorded by the query device according to the fusion identifier of the target fusion embedded vector, the fusion identifier of the target fusion embedded vector can be input into the CAM, and the storage address of the target fusion embedded vector can be determined according to the CAM output.
[0030] Through the above method, the way in which the CAM stores mapping information can ensure that the query device can quickly determine the storage address of the target fused embedded vector using the fusion identifier of the target fused embedded vector.
[0031] In a possible implementation, the query device may also perform preliminary filtering before querying the target fused embedded vector from the first memory according to the identifiers of the multiple embedded vectors carried in the query request. For example, the query device may first determine whether the identifiers of the multiple embedded vectors carried in the query request belong to an identifier set, and the identifier set includes the identifiers of all embedded vectors based on which the multiple fused embedded vectors in the first memory are generated. When it is determined that the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set, the target fused embedded vector is queried from the first memory. When it is determined that the identifiers of the multiple embedded vectors carried in the query request do not belong to the identifier set, the query request may be rejected.
[0032] Through the above method, the query device can timely determine whether the target fused embedding vector is likely to be stored in the first memory through preliminary filtering.
[0033] In one possible implementation, a Bloom filter or a cuckoo filter is provided inside the query device, and the Bloom filter or the cuckoo filter records an identifier set. When the query device determines that the identifiers of multiple embedded vectors carried in the query request belong to the identifier set, the Bloom filter or the cuckoo filter can be called to determine that the identifiers of multiple embedded vectors carried in the query request belong to the identifier set.
[0034] Through the above method, preliminary filtering is achieved using a Bloom filter or a Cuckoo filter, which is relatively simple and easy to implement.
[0035] In a second aspect, an embodiment of the present application provides an embedded table query system, the system comprising at least one first memory and at least one query device, each first memory corresponding to a query device. The beneficial effects can be found in the relevant description of the first aspect, which will not be repeated here.
[0036] For any first memory, the first memory stores a plurality of fused embedding vectors, each fused embedding vector being generated based on an embedding vector in the embedding table.
[0037] For the query device corresponding to the first memory, the query device can receive a query request, the query request is used to request a query target fusion embedding vector, the target fusion embedding vector is generated based on multiple embedding vectors in the embedding table; according to the identifiers of the multiple embedding vectors carried in the query request, the target fusion embedding vector is queried from the corresponding first memory.
[0038] When the query device queries the target fusion embedding vector from the corresponding first memory, the target fusion embedding vector can be fed back to the device that initiated the query request. When the query device does not query the target fusion embedding vector from the corresponding first memory, it can notify the device that initiated the query request that the target fusion embedding vector is not found; or the query device can query the candidate fusion embedding vector from the first memory and feed back the candidate fusion embedding vector to the device that initiated the query request (the way in which the query device queries the candidate fusion embedding vector will be described below).
[0039] In a possible implementation, for any first memory, when the multiple fused embedded vectors stored in the first memory include a target fused embedded vector, the query device corresponding to the first memory determines the fusion identifier of the target fused embedded vector based on the identifiers of the multiple embedded vectors; then, according to the fusion identifier of the target fused embedded vector, the storage address of the target fused embedded vector in the first memory is determined from the mapping information recorded by the query device, wherein the mapping information indicates the mapping relationship between the storage addresses of the multiple fused embedded vectors in the first memory and the fusion identifiers of the multiple fused embedded vectors; then, according to the storage address of the target fused embedded vector, the target fused embedded vector is obtained from the first memory.
[0040] In a possible implementation, for any first memory, regardless of whether the multiple fusion embedding vectors stored in the first memory include the target fusion embedding vector, the query device can determine the fusion identifier of the target fusion embedding vector based on the identifiers of the multiple embedding vectors; then, determine the fusion identifier of the candidate fusion embedding vector based on the fusion identifier of the target fusion embedding vector, and the difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is within a preset range, and the difference represents the degree of difference between the multiple embedding vectors based on which the target fusion embedding vector is generated and the multiple embedding vectors based on which the candidate fusion embedding vector is generated.
[0041] After determining the fusion identifier of the candidate fusion embedding vector, the query device obtains the candidate fusion embedding vector from the multiple fusion embedding vectors in the first memory according to the fusion identifier of the candidate fusion embedding vector. The query device can feed back the candidate fusion embedding vector to the device that initiated the query request.
[0042] In a possible implementation, the query device can also determine the identifier of a first type of embedding vector and / or the identifier of a second type of embedding vector based on the fusion identifier of the candidate fusion embedding vector, where the first type of embedding vector is an embedding vector that does not exist in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and exists in the multiple embedding vectors based on which the target fusion embedding vector is generated, and the second type of embedding vector is an embedding vector that exists in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and does not exist in the multiple embedding vectors based on which the target fusion embedding vector is generated.
[0043] After determining the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector, the query device may also feed back the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector to the device that initiated the query request.
[0044] In a possible implementation, when the query device determines the identifier of the first category of embedded vectors and / or the identifier of the second category of embedded vectors based on the fusion identifier of the candidate fused embedded vector, it can determine the identifiers of multiple embedded vectors based on which the candidate fused embedded vector is generated based on the fusion identifier of the candidate fused embedded vector; thereafter, the identifier of the first category of embedded vectors and / or the identifier of the second category of embedded vectors is determined by comparing the identifiers of the multiple embedded vectors based on which the candidate fused embedded vector is generated with the identifiers of the multiple embedded vectors carried in the query request.
[0045] In one possible implementation, when the query device determines the identifier of the first category of embedded vectors and / or the identifier of the second category of embedded vectors based on the fusion identifier of the candidate fused embedded vector, the identifier of the first category of embedded vectors and / or the identifier of the second category of embedded vectors can be determined based on the bits with different values in the fusion identifier of the candidate fused embedded vector and the fusion identifier of the target fused embedded vector.
[0046] In one possible implementation, a first memory stores a candidate fusion embedding vector and identifiers of multiple embedding vectors based on which the candidate fusion embedding vector is generated. When the query device determines the identifier of a first type of embedding vector and / or the identifier of a second type of embedding vector based on the fusion identifier of the candidate fusion embedding vector, the identifiers of the multiple embedding vectors based on which the candidate fusion embedding vector is generated can be obtained from the first memory; thereafter, the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector is determined by comparing the identifiers of the multiple embedding vectors based on which the candidate fusion embedding vector is generated with the identifiers of the multiple embedding vectors carried in the query request.
[0047] In one possible implementation, the query device includes a CAM, and the CAM stores mapping information. When the query device determines the storage address of the target fusion embedded vector in the first memory from the mapping information recorded by the query device according to the fusion identifier of the target fusion embedded vector, the fusion identifier of the target fusion embedded vector can be input into the CAM, and the storage address of the target fusion embedded vector can be determined according to the CAM output.
[0048] In one possible implementation, before the query device queries the target fused embedding vector from the first memory according to the identifiers of the multiple embedded vectors carried in the query request, it can also determine that the identifiers of the multiple embedded vectors carried in the query request belong to an identifier set, and the identifier set includes the identifiers of all embedded vectors based on which the multiple fused embedded vectors in the first memory are generated.
[0049] In one possible implementation, a Bloom filter or a cuckoo filter is provided inside the query device, and the Bloom filter or the cuckoo filter records an identifier set. When the query device determines that the identifiers of multiple embedded vectors carried in the query request belong to the identifier set, the Bloom filter or the cuckoo filter can be called to determine that the identifiers of multiple embedded vectors carried in the query request belong to the identifier set.
[0050] In a possible implementation, the system includes a plurality of first memories, and the plurality of first memories constitute a multi-level storage in a computing device, wherein each first memory corresponds to a first-level storage in the multi-level storage.
[0051] In a possible implementation, the system further includes a processor in the computing device; the processor may serve as a device for initiating a query request, and the processor may send the query request to at least one query device sequentially or synchronously.
[0052] As a device for initiating a query request, the processor can receive the target fusion embedding vector and / or the candidate fusion embedding vector fed back by the query device, and can also receive the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector fed back by the query device.
[0053] In one possible implementation, the system also includes a second memory in the computing device, and the second memory stores an embedding table. When the processor does not receive the target fusion embedding vector fed back by the query device, the processor queries the embedding table in the second memory respectively through the identifiers of the multiple embedding vectors, obtains the multiple embedding vectors, and generates a target fusion embedding vector based on the multiple embedding vectors.
[0054] When the processor receives the candidate fused embedding vector fed back by the query device, and receives the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector fed back by the query device, the processor queries the embedding table in the second memory through the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector respectively, obtains the first type of embedding vector and / or the second type of embedding vector, and then generates a target fused embedding vector based on the candidate fused embedding vector, and the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector.
[0055] In the third aspect, the embodiment of the present application further provides a query device, which has the function of implementing the query device behavior in the method example of the first aspect above. The beneficial effects can be found in the description of the first aspect and will not be repeated here. The function can be implemented by hardware, or by hardware executing the corresponding software implementation. The hardware or software includes one or more modules corresponding to the above functions. In one possible design, the structure of the device includes an identification filtering module, an identification fusion module, and an address query module, which can execute the corresponding functions in the method example of the first aspect above. The beneficial effects can be found in the relevant description of the first aspect and will not be repeated here.
[0056] An address query module is used to receive a query request, the query request is used to request a query for a target fused embedding vector, the target fused embedding vector is generated based on multiple embedding vectors in an embedding table; according to the identifiers of the multiple embedding vectors carried in the query request, the target fused embedding vector is queried from a first memory, wherein the first memory includes multiple fused embedding vectors, each fused embedding vector is generated based on an embedding vector in the embedding table.
[0057] The address query module queries the target fusion embedding vector from the first memory, and feeds back the target fusion embedding vector to the device that initiated the query request. When the address query module fails to query the target fusion embedding vector from the corresponding first memory, it can notify the device that initiated the query request that the target fusion embedding vector is not queried; or when the address query module queries the candidate fusion embedding vector from the first memory, it can feed back the candidate fusion embedding vector to the device that initiated the query request (the manner in which the address query module queries the candidate fusion embedding vector will be described below).
[0058] In a possible implementation, the multiple fused embedded vectors stored in the first memory include a target fused embedded vector, and the identification fusion module can determine the fusion identification of the target fused embedded vector based on the identifications of the multiple embedded vectors; the address query module determines the storage address of the target fused embedded vector in the first memory from the mapping information recorded by the query device based on the fusion identification of the target fused embedded vector, wherein the mapping information indicates the mapping relationship between the storage addresses of the multiple fused embedded vectors in the first memory and the fusion identifications of the multiple fused embedded vectors; the target fused embedded vector is obtained from the first memory according to the storage address of the target fused embedded vector.
[0059] In a possible implementation, the identification fusion module can determine the fusion identification of the target fusion embedded vector based on the identifications of multiple embedded vectors; the address query module determines the fusion identification of the candidate fusion embedded vector based on the fusion identification of the target fusion embedded vector, and the difference between the fusion identification of the candidate fusion embedded vector and the fusion identification of the target fusion embedded vector is within a preset range, and the difference represents the degree of difference between the multiple embedded vectors based on which the target fusion embedded vector is generated and the multiple embedded vectors based on which the candidate fusion embedded vector is generated; the candidate fusion embedded vector is obtained from the multiple fusion embedded vectors in the first memory according to the fusion identification of the candidate fusion embedded vector.
[0060] In a possible implementation, the address query module can also determine the identifier of a first type of embedding vector and / or the identifier of a second type of embedding vector based on the fusion identifier of the candidate fusion embedding vector, where the first type of embedding vector is an embedding vector that does not exist in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and exists in the multiple embedding vectors based on which the target fusion embedding vector is generated; the second type of embedding vector is an embedding vector that exists in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and does not exist in the multiple embedding vectors based on which the target fusion embedding vector is generated.
[0061] In one possible implementation, when determining the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector, the address query module determines the identifiers of multiple embedded vectors based on which the candidate fused embedded vector is generated according to the fusion identifier of the candidate fused embedded vector; and determines the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector by comparing the identifiers of the multiple embedded vectors based on which the candidate fused embedded vector is generated with the identifiers of the multiple embedded vectors carried in the query request.
[0062] In one possible implementation, when determining the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector, the address query module determines the identifier of the first type of embedded vector and / or the identifier of the second type of embedded vector based on the bits with different values in the fusion identifier of the candidate fusion embedded vector and the fusion identifier of the target fusion embedded vector.
[0063] In one possible implementation, the first memory stores a candidate fusion embedding vector and identifiers of multiple embedding vectors based on which the candidate fusion embedding vector is generated. When determining the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector, the address query module obtains the identifiers of the multiple embedding vectors based on which the candidate fusion embedding vector is generated from the first memory; and determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector by comparing the identifiers of the multiple embedding vectors based on which the candidate fusion embedding vector is generated with the identifiers of the multiple embedding vectors carried in the query request.
[0064] In one possible implementation, the address query module includes a CAM, in which mapping information is stored. When the address query module determines the storage address of the target fusion embedded vector in the first memory from the mapping information recorded by the query device according to the fusion identifier of the target fusion embedded vector, the fusion identifier of the target fusion embedded vector is input into the CAM, and the storage address of the target fusion embedded vector is determined according to the CAM output.
[0065] In one possible implementation, the device also includes an identification filtering module, which determines that the identifiers of the multiple embedded vectors carried in the query request belong to an identification set before the address query module queries the target fused embedded vector from the first memory according to the identifiers of the multiple embedded vectors carried in the query request, and the identification set includes the identifiers of all embedded vectors based on which the multiple fused embedded vectors in the first memory are generated.
[0066] In one possible implementation, a Bloom filter or a cuckoo filter is provided inside the identification filtering module, and the Bloom filter or the cuckoo filter records an identification set. The identification filtering module determines that the identifications of multiple embedded vectors carried in the query request belong to the identification set, and calls the Bloom filter or the cuckoo filter to determine that the identifications of multiple embedded vectors carried in the query request belong to the identification set.
[0067] In a fourth aspect, the present application further provides a computing device, comprising a query device and a first memory, and further comprising a processor and a second memory, wherein the query device executes the method provided in the first aspect or any possible implementation of the first aspect. The query device may call computer program instructions burned on the query device to execute the method provided in the first aspect or any possible implementation of the first aspect. The first memory may also store computer program instructions and data necessary for the embedded table query process. The query device executes the method provided in the first aspect or any possible implementation of the first aspect by calling the computer program instructions stored in the first memory. The query device may also call computer program instructions necessary for the embedded table query process stored in other memories to execute the method provided in the first aspect or any possible implementation of the first aspect.
[0068] In a fifth aspect, the present application provides a computing device cluster, which includes at least one computing device. Each computing device includes a memory and a processor. The processor of at least one computing device is used to access the code in the memory to execute the method provided by the first aspect or any possible implementation of the first aspect.
[0069] In a sixth aspect, the present application provides a computer-readable storage medium. When the computer-readable storage medium is executed by a computing device, the computing device executes the method provided in the aforementioned first aspect or any possible implementation of the first aspect. The storage medium stores a program. The storage medium includes but is not limited to a volatile memory, such as a random access memory, a non-volatile memory, such as a flash memory, a hard disk drive (HDD), and a solid state drive (SSD).
[0070] In a seventh aspect, the present application provides a computing device program product, the computing device program product includes computer instructions, and when executed by a computing device, the computing device performs the method provided in the aforementioned first aspect or any possible implementation of the first aspect. The computer program product can be a software installation package, and when it is necessary to use the method provided in the aforementioned first aspect or any possible implementation of the first aspect, the computer program product can be downloaded and executed on a computing device.
[0071] In an eighth aspect, the present application also provides a computer chip, which is connected to a memory, and the chip is used to read and execute a software program stored in the memory, and to execute the methods in the above-mentioned first aspect and various possible implementation methods of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 It is a schematic diagram of the structure of Bloom filter;
[0073] Figure 2 A schematic diagram of the structure of an embedded table query system provided in an embodiment of the present application;
[0074] Figure 3 A schematic diagram of the structure of a query device provided in an embodiment of the present application;
[0075] Figure 4A A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0076] Figure 4B A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0077] Figure 5 A schematic diagram of an embedded table query method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0078] Before describing the embedded table query method provided in the embodiment of the present application, some concepts involved in the embodiment of the present application are described first:
[0079] (1) Embedding vector and embedding table.
[0080] An embedding vector is a representation of an entity, and can also be understood as a "feature" of an entity. For any entity, the entity has multiple different features, each of which corresponds to an embedding vector. Therefore, an entity can be represented by multiple embedding vectors.
[0081] For example, for entities such as company employees, the characteristics of company employees include but are not limited to: gender, hobbies, work department, years of work experience, place of origin, and rank.
[0082] For any company employee, the employee's gender, hobbies, work department, years of work experience, place of origin, and rank can be represented by embedding vectors. For example, if the gender is female, the embedding vector representing "female" can be used to represent the gender feature of the company employee.
[0083] For example, if the hobbies are badminton and table tennis, the embedding vector representing "badminton" and the embedding vector representing "table tennis" can be used to represent the feature of the company's employees' hobbies, or the embedding vector representing "badminton and table tennis" can be used to represent the feature of the company's employees' hobbies. The former uses two embedding vectors to represent the feature of the company's employees' hobbies, and the latter uses one embedding vector to represent the feature of the company's employees' hobbies. The embedding vector representing "badminton and table tennis" can be generated based on the embedding vector representing "badminton" and the embedding vector representing "table tennis".
[0084] The embedding table is a collection of embedding vectors. The embedding table can be abstractly understood as a "table", and each row is an embedding vector. Each embedding vector has its unique identifier. The identifier of the embedding vector represents the position of the embedding vector in the embedding table. When querying the embedding table, the position of the embedded vector in the embedding table can be located by using the identifier of the embedded vector to be queried, and then the embedded vector can be obtained.
[0085] There are many ways to construct an embedding table, and the present application embodiment does not limit the way to construct the embedding table. For example, according to the characteristics of the entity, all possible embedding vectors in each feature can be collected together to form an embedding table corresponding to the feature.
[0086] Taking company employees as an example, we can construct embedding tables corresponding to gender, hobbies, work department, years of work experience, place of origin, and job level. The embedding table corresponding to gender includes embedding vectors representing "male" and "female". The embedding table corresponding to hobbies includes embedding vectors representing "badminton", "table tennis", "basketball", "swimming", and other embedding vectors.
[0087] (2) Fusion embedding vector and fusion identifier.
[0088] In the embodiment of the present application, the vector recorded in the embedding table is called an embedding vector, and the vector generated based on multiple embedding vectors in the embedding table is called a fused embedding vector. The fused embedding vector is a special kind of "embedding vector". The fused embedding vector represents the combination of the features represented by the multiple embedding vectors. As mentioned above, the embedding vector representing "badminton and table tennis" can be understood as a fused embedding vector, which can be generated based on the embedding vector representing "badminton" and the embedding vector representing "table tennis".
[0089] There are many ways to generate a fused embedding vector based on multiple embedding vectors, for example, summing the multiple embedding vectors, and using the summed vector as the fused embedding vector. For another example, averaging the multiple embedding vectors (that is, averaging the elements at the same position in multiple embedding vectors, and multiple means will constitute a new vector), and using the vector obtained after averaging as the fused embedding vector. For another example, dot products are calculated for the multiple embedding vectors, and the vector obtained after the dot product is used as the fused embedding vector. The embodiments of the present application do not limit the method for generating the fused embedding vector, and any method for generating a fused embedding vector using multiple embedding vectors is applicable to the embodiments of the present application.
[0090] In order to identify each different fused embedding vector, an identifier is configured for the fused embedding vector. In order to distinguish it from the identifier of the embedding vector, in the embodiment of the present application, the identifier configured for the fused embedding vector is called a fusion identifier. The generation method of the fusion identifier will be described by example in the following text.
[0091] In the embodiments of the present application, the target fusion embedding vector and the candidate fusion embedding vector mentioned are both fusion embedding vectors. Among them, the target fusion embedding vector is the fusion embedding vector requested by the query request. The candidate fusion embedding vector is a fusion embedding vector close to the target fusion embedding vector. The "closeness" between the candidate fusion embedding vector and the target fusion embedding vector is reflected in the fact that the multiple embedding vectors based on which the candidate fusion embedding vector is generated are similar to the multiple embedding vectors based on which the target fusion embedding vector is generated, such as the same embedding vector.
[0092] (3) Bloom filter (BF) and cuckoo filter.
[0093] The implementation principle of Bloom filter is similar to that of Cuckoo filter, but the difference is that Cuckoo filter supports the scenario of dynamically adding or deleting elements in the collection. The following takes Bloom filter as an example to illustrate.
[0094] A Bloom filter consists of a binary vector and a series of random mapping functions (usually hash functions) that can be used to retrieve whether an element is in a set.
[0095] Figure 1 It is a schematic diagram of the structure of a Bloom filter. In the initial state, the Bloom filter includes an array of m = n*L bits, and each bit is set to 0. In order to express S = {x1, x2, ..., x n For a set of n elements, L is the space corresponding to each element (here L can also be understood as the number of bits or digits corresponding to the data), Bloom Filter can call k independent hash functions, each of which can map each element in the set to a bit in the bit array that includes m bits. When mapped to a bit, the value of the bit is set to 1. For the same element in the data set, any two of the k hash functions can map to the same or different bits. For different elements in the data set, the different elements can be mapped to the same bit or to different bits through different hash functions.
[0096] Usually, the false alarm rate of a Bloom filter (ie, the error rate of a Bloom filter) cannot be zero. The larger the number of bit groups, the lower the false alarm rate. However, the larger the number of bit groups, the larger the storage space required by the Bloom filter.
[0097] When retrieving whether an element is in a set, Bloom Filter calls the k independent hash functions to map the element to the array of m bits (the array is the binary vector of the aforementioned volume). If the values of the bits in the m-bit array to which the element is mapped are all 1, it means that the element has a high probability of belonging to the set, otherwise, it does not belong to the set.
[0098] like Figure 2 , which is a schematic diagram of the structure of a query system provided in an embodiment of the present application, wherein the query system includes a query device 100 and a first memory 200 .
[0099] The query device 100 has a query function for a fused embedding vector, wherein the fused embedding vector is generated based on multiple embedding vectors in the embedding table. The query device 100 can process a query request for requesting a target fused embedding vector, wherein the query request carries identifiers of multiple embedding vectors, wherein the target fused embedding vector is generated based on the multiple embedding vectors. The query device 100 can query the target fused embedding vector from each fused embedding vector stored in the first memory 200 based on the identifiers of the multiple embedding vectors.
[0100] In the embodiment of the present application, the query device 100 can query the target fusion embedding vector in the following two ways:
[0101] Method 1: Accurate query.
[0102] When the query device 100 uses the identifiers of multiple embedding vectors to query the target fused embedding vector from the first memory 200, the query device 100 can generate a fusion identifier of the target fused embedding vector using the identifiers of the multiple embedding vectors.
[0103] The query device 100 records the mapping relationship between the storage address of each fused embedding vector stored in the first memory 200 and the fusion identifier of each fused embedding vector.
[0104] In this manner, if the fusion identifier of the target fused embedding vector requested by the query request is recorded in the mapping relationship, the query device 100 can use the fusion identifier of the target fused embedding vector to determine the storage address of the target fused embedding vector in the first memory 200 from the mapping relationship. After determining the storage address of the target fused embedding vector in the first memory 200, the query device 100 obtains the target fused embedding vector from the first memory 200 according to the storage address, and the query device 100 feeds back the target fused embedding vector to the device that initiated the query request.
[0105] In addition, due to certain ways of generating fusion identifiers, the fusion identifiers may not be unique, that is, there may be two different fusion embedding vectors with the same fusion identifier. Therefore, during precise query, even if the fusion identifier of the target fusion embedding vector requested by the query request is recorded in the mapping relationship, it may be because the mapping relationship records the storage address of the fusion embedding vector with the same fusion identifier as the target fusion embedding vector and the mapping relationship with its fusion identifier, while recording the mapping relationship between the storage address of the non-target fusion embedding vector and the fusion identifier of the target fusion embedding vector. Based on this possibility, when the query device 100 determines that the fusion identifier of the target fusion embedding vector requested by the query request is recorded in the mapping relationship, in addition to obtaining the fusion embedding vector stored at the storage address recorded in the mapping relationship and having a mapping relationship with the fusion identifier of the target fusion embedding vector (the fusion embedding vector stored at the storage address may be the target fusion embedding vector, or may be a fusion embedding vector with the same fusion identifier as the target fusion embedding vector), the query device 100 may also use the fusion identifier of the target fusion embedding vector to determine the storage address of the candidate fusion embedding vector in the first memory 200 from the mapping relationship, and then obtain the candidate fusion embedding vector from the first memory 200 according to the storage address. In addition to feeding back the storage address having a mapping relationship with the fusion identifier of the target fusion embedding vector to obtain the fusion embedding vector stored at the storage address, the query device 100 may also feed back the candidate fusion embedding vector to the device that initiated the query request.
[0106] If the fusion identifier of the target fusion embedding vector requested by the query request is not recorded in the mapping relationship, it means that the target fusion embedding vector is not stored in the first memory 200. The query device 100 notifies the device that initiated the query request that the target fusion embedding vector was not found.
[0107] Method 2: Fuzzy query.
[0108] Similar to the first method, the query device 100 can generate the fusion identifier of the fused embedded vector using the identifiers of the multiple embedded vectors. The query device 100 records the mapping relationship between the storage address of each fused embedded vector stored in the first memory 200 and the fusion identifier of each fused embedded vector.
[0109] In this manner, if the fusion identifier of the target fusion embedding vector requested by the query request is not recorded in the mapping relationship, that is, the first memory 200 does not store the target fusion embedding vector.
[0110] The query device 100 uses the fusion identifier of the target fusion embedding vector to determine the storage address of the candidate fusion embedding vector in the first memory 200 from the mapping relationship, and then obtains the candidate fusion embedding vector from the first memory 200 according to the storage address, wherein the candidate fusion embedding vector is a fusion embedding vector whose fusion identifier is different from the fusion identifier of the target fusion embedding vector within a preset range. Alternatively, a fusion embedding vector in which the number of the same embedding vectors among the multiple embedding vectors based on which the candidate fusion embedding vector is generated and the number of the same embedding vectors among the multiple embedding vectors based on which the target fusion embedding vector is generated is greater than a data threshold. The query device 100 feeds back the candidate fusion embedding vector to the device that initiates the query request.
[0111] If the fusion identifier of the target fusion embedding vector requested by the query request is recorded in the mapping relationship, that is, the first memory 200 stores the target fusion embedding vector.
[0112] The query device 100 uses the fusion identifier of the target fusion embedding vector to determine the storage address of the target fusion embedding vector in the first memory 200 from the mapping relationship, and the query device 100 uses the fusion identifier of the target fusion embedding vector to determine the candidate fusion embedding vector from the mapping relationship. The query device 100 feeds back the target fusion embedding vector to the device that initiated the query request, and the query device 100 can also feed back the candidate fusion embedding vector to the device that initiated the query request. In this case, the query device 100 simultaneously queries the target fusion embedding vector and the candidate fusion embedding vector, which also takes into account the possibility that the fusion identifier is not unique.
[0113] In the embodiment of the present application, the specific form of the query device 100 is not limited. The query device 100 can be a hardware device, such as the query device 100 can be a processor 300, such as a central processing unit (CPU), a data processing unit (DPU), a graphics processing unit (GPU), a tensor processing unit (TPU) or a neural network processing unit (NPU) and other processors; the query device 100 can also be other general processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. For example, the query device 100 can also be an independent computing device, such as a server deployed in the cloud, a computing device cluster, a mobile terminal, etc. The query device 100 can also be a software module, such as a software module running on a processor 300 or a computing instance, and the computing instance can be a virtual machine or a container.
[0114] The first memory 200 has a storage function. In the embodiment of the present application, the first memory 200 is used to store at least one fused embedding vector. The first memory 200 can also store identifiers of multiple embedding vectors based on which each fused embedding vector is generated in the at least one fused embedding vector.
[0115] The fused embedded vector stored in the first memory 200 may be determined after analyzing the historical access to the embedded table. For example, the historical access to the embedded table is analyzed to determine at least one group of embedded vectors extracted from the embedded table whose access frequency is greater than a frequency threshold, or whose joint access times are greater than a times threshold, and each group of embedded vectors includes multiple embedded vectors. Among them, joint access to a group of embedded vectors means that when querying the embedded vector from the embedded table, the multiple embedded vectors included in the group of embedded vectors are always queried together. Then, the fused embedded vector generated based on the multiple embedded vectors in the group of embedded vectors can be stored in the first memory 200. The specific implementation method of determining the fused embedded vector stored in the first memory 200 based on the analysis of the historical access to the embedded table is not limited here.
[0116] The fused embedding vector stored in the first memory 200 may be updated. For example, the historical access to the embedding table is analyzed in real time, and the fused embedding vector generated based on one or more sets of embedding vectors with an access frequency greater than a frequency threshold or a number of joint accesses greater than a number threshold stored in the first memory 200 is deleted, and the fused embedding vector generated based on one or more sets of embedding vectors with an access frequency greater than a frequency threshold or a number of joint accesses greater than a number threshold not stored in the first memory 200 is stored in the first memory 200. For another example, when the embedding table is part of a machine learning model, during the training process of the machine learning model, the embedding table can be adjusted with the gradient output during the training process of the machine learning model. The fused embedding vector stored in the first memory 200 can also be adjusted with the gradient output during the training process of the machine learning model. In practical applications, the fused embedding vector stored in the first memory 200 can be adjusted according to the gradient output during the training process of the machine learning model, and the embedded vector in the embedding table can be temporarily not adjusted, or the embedded vector in the embedding table can be adjusted later. The embodiment of the present application does not limit the way in which the fused embedding vector stored in the first memory 200 is sent and updated.
[0117] In the embodiment of the present application, the specific type of the first memory 200 is not limited. The first memory 200 can be a high bandwidth memory (HBM) or a dynamic random access memory (DRAM). The first memory 200 can also be other random access memories, such as static random access memory (SRAM), storage class memory (SCM), etc. In addition, the first memory 200 can also be a read-only memory (ROM), such as a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), etc. The first memory 200 can also be a dual in-line memory module or a dual-line memory module (DIMM), a flash memory medium (FLASH), a hard disk drive (HDD) or a solid state drive (SSD), etc.
[0118] The structure of the query device 100 is described below from a functional perspective. Figure 3 , which is a schematic diagram of the structure of a query device 100 provided in an embodiment of the present application. The query device 100 includes an identification fusion module 110 and an address query module 120 . Optionally, the query device 100 may also include an identification filtering module 130 .
[0119] The identifier fusion module 110 is used to generate a fusion identifier of the fused embedded vector. In an embodiment of the present application, the identifier fusion module 110 can process the identifiers of multiple embedded vectors carried in the query request, and generate a fusion identifier of the target fused embedded vector based on the multiple identifiers. The generation method of the fusion identifier of the target fused embedded vector by the identifier fusion module 110 is consistent with the generation method of the fusion identifier of the fused embedded vector in the first memory 200.
[0120] The embodiment of the present application does not limit the method for generating the fusion identifier of the fusion embedding vector, and several methods for generating the fusion identifier are listed below.
[0121] Generation method 1: The fusion identifier includes multiple bits, each bit corresponds to an embedding vector. When the bit is a first value, the multiple embedding vectors based on which the fusion embedding vector is generated include the embedding vector corresponding to the bit. When the bit is a second value, the multiple embedding vectors based on which the fusion embedding vector is generated do not include the embedding vector corresponding to the bit.
[0122] For example, if there are 16 embedding vectors in the embedding table whose access frequency is greater than the frequency threshold, then the fusion identifier may include 16 bits. Each bit corresponds to one of the 16 embedding vectors. When any bit is 1, it indicates that the multiple embedding vectors based on which the fused embedding vector is generated include the embedding vector corresponding to the bit. When any bit is 0, it indicates that the multiple embedding vectors based on which the fused embedding vector is generated do not include the embedding vector corresponding to the bit.
[0123] Generation method 2: Generate a fusion identifier of the fused embedding vector by using a one-hot encoding method. The fusion includes multiple bits, and only one bit among the multiple bits is the first value. Each bit corresponds to a combination method of multiple embedding vectors.
[0124] One-hot encoding can convert discrete classification labels into binary vectors. In the embodiment of the present application, the discrete classification labels are multiple embedding vectors based on which the fused embedding vector is generated, and the binary vector generated by one-hot encoding is the fusion identifier of the fused embedding vector.
[0125] For example, the embedding table includes three embedding vectors whose access frequencies are greater than the access threshold, which are identified as vector A, vector B and vector C respectively. Then, the fusion identifier may include 4 bits. Each bit corresponds to a combination of some or all of the three embedded vectors. For example, when the first bit in the fusion identifier is 1, it indicates that the multiple embedded vectors based on which the fused embedded vector is generated are vector A and vector B, when the second bit in the fusion identifier is 1, it indicates that the multiple embedded vectors based on which the fused embedded vector is generated are vector A and vector C, when the third bit in the fusion identifier is 1, it indicates that the multiple embedded vectors based on which the fused embedded vector is generated are vector B and vector C, and when the fourth bit in the fusion identifier is 1, it indicates that the multiple embedded vectors based on which the fused embedded vector is generated are vector A, vector B and vector C.
[0126] Generation method 2: Generate a fusion identifier of the fused embedding vector using a hash function.
[0127] The hash function can be used to map the identifier of the embedded vector to a group of bits with a fixed number of bits. The specific value of each bit in the group of bits is related to the specific position of the embedded vector identifier mapped to the group of bits. For any fused embedded vector, a hash function is applied to the identifiers of multiple embedded vectors based on which the fused embedded vector is generated. The identifier of each embedded vector in the multiple embedded vectors will be mapped to a group of bits with a fixed number of bits. The bit to which the identifier of each embedded vector in the group of bits is mapped is 1. The group of bits formed after the hash function is applied is used as the fused identifier of the fused embedded vector.
[0128] The embodiment of the present application does not limit the type of the hash function. The hash functions that can be used in the embodiment of the present application include but are not limited to: Locality Sensitive Hashing (LSH), additive hashing, and multiplicative hashing.
[0129] In order to reduce the probability of hash collision when generating the fusion identifier of the fused embedded vector by means of a hash function (that is, the collision caused by the hash function mapping the identifiers of different embedded vectors to the same position on the group of bits), a specific mapping method can also be designed when generating the fusion identifier of the fused embedded vector by means of a hash function. For example, LSH is used to implement group mapping, that is, the fusion identifier may include multiple bit subgroups, each bit subgroup includes multiple bits. Each bit subgroup corresponds to a part of the embedded vectors in the multiple embedded vectors, and the part of the embedded vector is mapped to the corresponding bit subgroup using LSH.
[0130] In this generation method, the fusion identifier of the fused embedding vector can be generated by means of a Bloom filter. That is, the identifiers of the respective embedding vectors based on which the fused embedding vector is generated are mapped to an array of fixed bits by means of a Bloom filter, and the mapped array is the fusion identifier of the fused embedding vector.
[0131] When generating a fusion identifier of a fused embedded vector with the help of a Bloom filter, in order to speed up the generation efficiency of the fusion identifier, a "distributed Bloom filter" method can be adopted, that is, multiple Bloom filters are set, and the multiple Bloom filters can work synchronously. Each Bloom filter can map the identifiers of each embedded vector based on which the fused embedded vector is generated to an array of a fixed number of bits to obtain the fusion identifier of the fused embedded vector.
[0132] The embodiment of the present application does not limit the specific implementation process of the generation method. Any method of generating a fusion identifier of a fusion embedded vector using a hash function is applicable to the embodiment of the present application.
[0133] From the above-listed methods of generating fusion identifiers, it can be seen that the fusion identifier can identify the fusion embedded vector, and the fusion identifier is also generated based on multiple embedded vectors on which the fusion embedded vector is generated (such as the embedded vector itself or the identifier of the embedded vector). The fusion identifier can represent the multiple embedded vectors on which the fusion embedded vector is generated (such as the embedded vector itself or the identifier of the embedded vector). The above only lists several possible methods of generating fusion identifiers. Any method that can generate the fusion identifier of the fusion embedded vector based on multiple embedded vectors on which the fusion embedded vector is generated is applicable to the embodiments of the present application.
[0134] The address query module 120 is capable of obtaining the fusion identifier of the target fusion embedding vector generated by the identifier fusion module 110, determining the storage address of the target fusion embedding vector and / or the storage address of the candidate fusion embedding vector according to the fusion identifier, and reading the target fusion embedding vector and / or the candidate fusion embedding vector from the first memory 200 according to the storage address of the target fusion embedding vector and / or the storage address of the candidate fusion embedding vector.
[0135] The address query module 120 records the mapping relationship between the storage address of each fused embedding vector and the fusion identifier of each fused embedding vector stored in the first memory 200. After obtaining the fusion identifier of the target fused embedding vector, the address lookup module determines the storage address of the target fused embedding vector and / or the storage address of the candidate fused embedding vector from the mapping relationship.
[0136] In the embodiment of the present application, the address query module 120 has the following functions:
[0137] Function 1: Address search function.
[0138] After obtaining the fusion identifier of any fused embedded vector, the address query module 120 can determine from the mapping relationship whether the storage address of the fused embedded vector in the first memory 200 is recorded. If the storage address of the fused embedded vector in the first memory 200 is recorded in the mapping relationship, the address query module 120 obtains the storage address of the fused embedded vector from the mapping relationship.
[0139] In the embodiment of the present application, after obtaining the fusion identifier of the target fusion embedded vector, the address query module 120 determines from the mapping relationship whether the storage address of the target fusion embedded vector in the first memory 200 is recorded. If the storage address of the fusion embedded vector in the first memory 200 is recorded in the mapping relationship, the address query module 120 obtains the storage address of the target fusion embedded vector from the mapping relationship. After obtaining the fusion identifier of the candidate fusion embedded vector, the address query module 120 determines from the mapping relationship whether the storage address of the candidate fusion embedded vector in the first memory 200 is recorded. If the storage address of the candidate embedded vector in the first memory 200 is recorded in the mapping relationship, the address query module 120 obtains the storage address of the candidate fusion embedded vector from the mapping relationship.
[0140] In the address query module 120, a content-addressable memory (CAM) may be used to store a mapping relationship between the storage address of each fused embedding vector in the first memory 200 and the fusion identifier of each fused embedding vector.
[0141] Among them, CAM is a special RAM, which is a content-addressable memory. The working mechanism of CAM is as follows: when a data item is input into CAM, CAM will match it with all the data items stored in CAM, and determine whether there is a data item in the stored data items that is consistent with the input data item. If there is a data item in the stored data items that is consistent with the input data item, CAM will output the information corresponding to the data item.
[0142] In an embodiment of the present application, the CAM stores a mapping relationship between the storage address of each fused embedded vector in the first memory 200 and the fusion identifier of each fused embedded vector. When the fusion identifier of any fused embedded vector (such as the fusion identifier of the target fused embedded vector or the fusion identifier of the candidate fused embedded vector) is input to the CAM, the CAM will determine from the stored mapping relationship whether there is a storage address of the fused embedded vector mapped to the fusion identifier. If it exists, the storage address of the fused embedded vector mapped to the fusion identifier (such as the storage address of the target fused embedded vector or the storage address of the candidate fused embedded vector) is output. If it does not exist, the CAM does not output information, or outputs an indication message indicating that the query was not found.
[0143] Function 2: Candidate fusion embedding vector search function.
[0144] After obtaining the fusion identifier of the target fused embedding vector, the address query module 120 may further determine the fusion identifier of the candidate fused embedding vector.
[0145] The address query module 120 can take the fusion embedding vector identified by the fusion identifier whose difference with the fusion identifier of the target fusion embedding vector is within a preset range as a candidate fusion embedding vector. Correspondingly, the fusion identifier whose difference with the fusion identifier of the target fusion embedding vector is within a preset range is the candidate fusion embedding vector.
[0146] From the perspective of the fusion identifier of the fused embedding vector, the difference between the fusion identifiers of any two fused embedding vectors represents the degree of difference between the fusion identifiers of the two fused embedding vectors, such as the number of bits with different values in the fusion identifiers of the two fused embedding vectors.
[0147] From the perspective of the embedding vector based on which the fused embedding vector is generated, the difference between the fusion identifiers of any two fused embedding vectors represents the degree of difference between the multiple embedding vectors based on which one fused embedding vector is generated and the multiple embedding vectors based on which another fused embedding vector is generated in the two fused embedding vectors.
[0148] The calculation method of the difference between the fusion identifiers of any two fused embedding vectors is related to the generation method of the fusion identifier of the fused embedding vectors. Correspondingly, the preset range is also related to the generation method of the fusion identifier of the fused embedding vectors.
[0149] When the fusion identifier of the fusion embedded vector is generated using the aforementioned generation method 1, then the difference between the fusion identifiers of any two fusion embedded vectors can be determined based on the bits with different values in the fusion identifiers of the two fusion embedded vectors. For example, the difference between the fusion identifiers of any two fusion embedded vectors is defined as being equal to the number of bits with different values in the fusion identifiers of the two fusion embedded vectors; when calculating the difference between the fusion identifiers of the two fusion embedded vectors, the fusion identifiers of the two fusion embedded vectors are XORed, and the result after XOR is the difference between the fusion identifiers of the two fusion embedded vectors. The preset range can be defined as the maximum number and minimum number of bits with different values in the fusion identifiers of the two fusion embedded vectors. When the difference between the fusion identifiers of any two fusion embedded vectors is within the preset range, when the fusion identifier of one of the two fusion embedded vectors is the fusion identifier of the target fusion embedded vector, then the other fusion embedded vector is a candidate fusion embedded vector, and its fusion identifier is the fusion identifier of the candidate fusion embedded vector.
[0150] When the fusion identifier of the fused embedded vector is generated by the aforementioned generation method 2, then the difference between the fusion identifiers of any two fused embedded vectors can be determined according to the combination of one or more embedded vectors corresponding to the bit with the first value in the fusion identifier of the two fused embedded vectors. For example, when defining a combination of one or more embedded vectors corresponding to each bit of the fusion identifier in the unique hot encoding, only one embedded vector is different in the combination of two or more embedded vectors corresponding to two adjacent bits. Taking the aforementioned case where the fusion identifier includes 4 bits as an example, the first bit corresponds to the combination of vector A and vector B, the second bit corresponds to vector A and vector C, and the third bit corresponds to vector B and vector C. The combination of embedded vectors corresponding to the first bit is different from the combination of embedded vectors corresponding to the second bit by one embedded vector. The combination of embedded vectors corresponding to the second bit is also different from the combination of embedded vectors corresponding to the third bit by one embedded vector. The combination of embedded vectors corresponding to the first bit and the combination of embedded vectors corresponding to the third bit are different in two embedded vectors. It can be seen that under this definition, the more bits are spaced between the bits whose values are the first value in the fusion identifiers of the two fused embedding vectors, the more embedded vectors that are different between the multiple embedded vectors based on which one fused embedding vector is generated and the multiple embedded vectors based on which another fused embedding vector is generated in the two fused embedding vectors, that is, the greater the degree of difference between the multiple embedded vectors based on which one fused embedding vector is generated and the multiple embedded vectors based on which another fused embedding vector is generated in the two fused embedding vectors. The preset range that needs to be satisfied by the difference involved in determining the candidate fused embedding vector can be defined as the maximum number and minimum number of bits spaced between the bits whose values are the first value in the fusion identifiers of the two fused embedding vectors. When the difference between the fusion identifiers of any two fused embedding vectors is within the preset range, then when the fusion identifier of one of the two fused embedding vectors is the fusion identifier of the target fused embedding vector, then the other fused embedding vector is the candidate fused embedding vector, and its fusion identifier is the fusion identifier of the candidate fused embedding vector.
[0151] When the fusion identifier of the fusion embedded vector is generated by the aforementioned generation method three, then the difference between the fusion identifiers of any two fusion embedded vectors can be determined according to the bits with different values in the fusion identifiers of the two fusion embedded vectors. For example, the difference between the fusion identifiers of any two fusion embedded vectors is defined as being equal to the number of bits with different values in the fusion identifiers of the two fusion embedded vectors; when calculating the difference between the fusion identifiers of the two fusion embedded vectors, the fusion identifiers of the two fusion embedded vectors are XORed, and the result after XOR is the difference between the fusion identifiers of the two fusion embedded vectors. The preset range that the difference involved in determining the candidate fusion embedded vector needs to meet can be defined as the maximum number and minimum number of bits with different values in the fusion identifiers of the two fusion embedded vectors. When the difference between the fusion identifiers of any two fusion embedded vectors is within the preset range, when the fusion identifier of one of the two fusion embedded vectors is the fusion identifier of the target fusion embedded vector, then the other fusion embedded vector is the candidate fusion embedded vector, and its fusion identifier is the fusion identifier of the candidate fusion embedded vector.
[0152] It can be seen that after the address query module 120 obtains the fusion identifier of the target fusion embedded vector, it can determine the fusion identifier of the candidate fusion embedded vector with the help of the fusion identifier of the target fusion embedded vector and the preset range to realize the candidate fusion embedded vector search. After that, with the help of function one, the storage address of the candidate fusion embedded vector is determined. In the embodiment of the present application, the number of candidate fusion embedded vectors is not limited, and the number of candidate fusion embedded vectors is related to the specific value of the preset range and the fusion identifier of the target fusion embedded vector.
[0153] Function three: Logo disassembly function.
[0154] The “identity disassembly” here refers to determining the identifiers of the embedding vectors that are different from the multiple embedding vectors based on which the target fused embedding vector is generated and the multiple embedding vectors based on which the candidate fused embedding vector is generated.
[0155] From the above description of the target fusion embedding vector and the candidate fusion embedding vector, it can be seen that among the multiple embedding vectors based on which the target fusion embedding vector is generated and the multiple embedding vectors based on which the candidate fusion embedding vector is generated, there are the same embedding vectors and different embedding vectors.
[0156] For the sake of convenience, the multiple embedding vectors based on which the target fusion embedding vector is generated are constituted as a set called a target embedding vector set, and the multiple embedding vectors based on which the candidate fusion embedding vector is generated are constituted as a set called a candidate embedding vector set.
[0157] After the address query module 120 determines the fusion identifier of the candidate fused embedding vector, the address query module 120 can also determine the identifiers of the embedding vectors that are different from the target embedding vector set and the candidate embedding vector set based on the fusion identifier of the target fused embedding vector and the fusion identifier of the candidate fused embedding vector.
[0158] Considering the composition of the target embedding vector set and the embedding vectors in the candidate embedding vector set, there may be two types of embedding vectors in the target embedding vector set and the different embedding vectors in the candidate embedding vector set. One embedding vector is the embedding vector that exists in the target embedding vector set and does not exist in the candidate embedding vector set. The other embedding vector is the embedding vector that does not exist in the target embedding vector set and exists in the candidate embedding vector set. In order to simplify the description, the embedding vector that exists in the target embedding vector set and does not exist in the candidate embedding vector set is described as a first type of embedding vector, and the embedding vector that does not exist in the target embedding vector set and exists in the candidate embedding vector set is described as a second type of embedding vector.
[0159] Therefore, in practical applications, considering the possible combinations of embedding vectors in the target embedding vector set and the candidate embedding vector set, the different embedding vectors in the target embedding vector set and the candidate embedding vector set may include only one type of embedding vectors, or only two types of embedding vectors, or both one type of embedding vectors and two types of embedding vectors.
[0160] In an embodiment of the present application, after the address query module 120 obtains the fusion identifier of the target fusion embedded vector, if the fusion identifier of the candidate target fusion embedded vector is determined based on the fusion identifier of the target fusion embedded vector and a preset range, in addition to the function one of obtaining the storage address of the candidate target fusion embedded vector, the address query module 120 can also determine the identifier of the first category of embedded vectors and / or the identifier of the second category of embedded vectors based on the fusion identifier of the candidate fusion embedded vector. When the address query module 120 feeds back the candidate fusion embedded vector to the device that initiates the query request, it can also feed back the determined identifier of the first category of embedded vectors and / or the identifier of the second category of embedded vectors.
[0161] The identification filtering module 130 may be arranged before the identification fusion module 110. Inside the query device 100, the query request received by the query device 100 will first reach the identification filtering module 130. The identification filtering module 130 may obtain the identifications of the multiple embedded vectors carried in the query request, and determine whether the target fused embedded vector generated based on the multiple embedded vectors is stored in the first memory 200 according to the identifications of the multiple embedded vectors, or determine whether there is a possibility of obtaining the target fused embedded vector generated based on the multiple embedded vectors from the first memory 200.
[0162] The identification filtering module 130 records the identifications of multiple embedding vectors based on which each fused embedding vector is generated in the first memory 200. The identification filtering module 130 uses the identifications of the multiple embedding vectors carried in the query request to query the identifications of the multiple embedding vectors based on which each fused embedding vector is generated in the recorded first memory 200 to determine whether the target fused embedding vector is stored in the first memory 200, or to determine whether there is a possibility of obtaining the target fused embedding vector from the first memory 200.
[0163] The identification filtering module 130 determines whether there is a possibility of obtaining a target fused embedding vector from the first memory 200 or whether there is a target fused embedding vector in the first memory 200 from the perspective of the identifications of the plurality of embedding vectors.
[0164] In the embodiment of the present application, two filtering modes are provided for the identification filtering module 130, and the identification filtering module 130 can adopt part or all of the two filtering modes;
[0165] Filtering mode 1: Precise filtering.
[0166] In this filtering mode, the identification filtering module 130 obtains two judgment results based on the identifications of the multiple embedded vectors carried in the query request, namely: the target fused embedded vector generated based on the multiple embedded vectors is stored in the first memory 200, and the target fused embedded vector generated based on the multiple embedded vectors is not stored in the first memory 200. In other words, the identification filtering module 130 can accurately determine whether the target fused embedded vector is stored in the first memory 200 through the identifications of the multiple embedded vectors carried in the query request.
[0167] The identifier filtering module 130 uses the identifiers of the multiple embedded vectors carried in the query request to query the identifiers of the multiple embedded vectors based on which each fused embedded vector is generated in the first memory 200. If the identifiers of the multiple embedded vectors carried in the query request are consistent with the multiple embedded vectors based on which a certain fused embedded vector is generated in the first memory 200, it means that the target fused embedded vector is stored in the first memory 200. In this case, the identifier filtering module 130 transmits the identifiers of the multiple embedded vectors carried in the query request to the address query module 120.
[0168] If the identifiers of the multiple embedding vectors carried in the query request do not belong to the recorded identifiers of the multiple embedding vectors based on which any fused embedding vector is generated in the first memory 200, that is, the recorded identifiers of the multiple embedding vectors based on which each fused embedding vector is generated in the first memory 200 do not include the identifiers of the multiple embedding vectors carried in the query request, it means that the target fused embedding vector is not stored in the first memory 200. In this case, the identifier filtering module 130 can directly discard the query request and notify the device that initiated the query request that the target fused embedding vector was not found.
[0169] In this filtering mode, the identification filtering module 130 needs to compare the identifications of the multiple embedded vectors carried in the query request with the identifications of the multiple embedded vectors based on which each fused embedded vector is generated in the recorded first memory 200, so as to determine whether the identifications of the multiple embedded vectors carried in the query request are consistent with the identifications of the multiple embedded vectors based on which a certain fused embedded vector is generated in the recorded first memory 200. In this way, the identification filtering module 130 can accurately determine whether the target fused embedded vector is stored in the first memory 200. The identification filtering module 130 adopts this filtering mode to ensure that the query device 100 can achieve accurate query.
[0170] In practical applications, in order to adapt to the fuzzy query method adopted by the query device 100, in the filtering mode, if only some of the identifiers of the multiple embedded vectors carried in the query request are consistent with the multiple embedded vectors based on which one or more fused embedded vectors in the first memory 200 are generated, it means that the target fused embedded vector is not stored in the first memory 200, but the candidate fused embedded vector is stored in the first memory 200. In this case, the identifier filtering module 130 may not discard the query request, but transmit the identifiers of the multiple embedded vectors carried in the query request to the address query module 120. This can ensure that the address query module 120 can subsequently obtain the candidate fused embedded vector.
[0171] For the case where only some of the identifiers of the multiple embedded vectors carried in the query request are consistent with the multiple embedded vectors based on which one or more fused embedded vectors in the first memory 200 are generated, the identifier filtering module 130 may set a first filtering threshold. If the number of identifiers of the multiple embedded vectors carried in the query request that are consistent with the multiple embedded vectors based on which one fused embedded vector in the first memory 200 is generated and the number of identifiers of the multiple embedded vectors carried in the query request are greater than the first filtering threshold, the identifiers of the multiple embedded vectors carried in the query request may be transmitted to the address query module 120. If the number of identifiers of the multiple embedded vectors carried in the query request that are consistent with the multiple embedded vectors based on which one fused embedded vector in the first memory 200 is generated and the number of identifiers of the multiple embedded vectors carried in the query request are not greater than the first filtering threshold, the identifier filtering module 130 may directly discard the query request and notify the device that initiated the query request that no target fused embedded vector was found.
[0172] Filter module 2: Rough filtering.
[0173] In this filtering mode, the identification filtering module 130 obtains two judgment results based on the identifications of the multiple embedded vectors carried in the query request, namely: the target fused embedded vector may be stored in the first memory 200, and the target fused embedded vector is not stored in the first memory 200. In other words, the identification filtering module 130 can judge the possibility that the target fused embedded vector is stored in the first memory 200 through the identifications of the multiple embedded vectors carried in the query request, but cannot accurately judge whether the target fused embedded vector is stored in the first memory 200.
[0174] The identifier filtering module 130 uses the identifiers of the multiple embedded vectors carried in the query request to query the identifiers of the multiple embedded vectors recorded on which each fused embedded vector in the first memory 200 is based. If the identifiers of the multiple embedded vectors carried in the query request belong to the identifiers of the multiple embedded vectors recorded on which each fused embedded vector in the first memory 200 is based, it indicates that the target fused embedded vector may be stored in the first memory 200. In this case, the identifier filtering module 130 transmits the identifiers of the multiple embedded vectors carried in the query request to the address query module 120.
[0175] If the identifiers of the multiple embedding vectors carried in the query request do not belong to the identifiers of the multiple embedding vectors based on which the various fused embedding vectors in the first memory 200 are recorded, that is, the identifiers of the multiple embedding vectors based on which the various fused embedding vectors in the first memory 200 are recorded do not include the identifiers of the multiple embedding vectors carried in the query request, it means that the target fused embedding vector is not stored in the first memory 200. In this case, the identifier filtering module 130 can directly discard the query request and notify the device that initiated the query request that no target fused embedding vector was found. If there are identifiers of the multiple embedding vectors carried in the query request that do not belong to the identifiers of the multiple embedding vectors based on which the various fused embedding vectors in the first memory 200 are recorded, that is, the identifiers of the multiple embedding vectors based on which the various fused embedding vectors in the first memory 200 are recorded include some of the identifiers of the multiple embedding vectors carried in the query request, it means that the target fused embedding vector is not stored in the first memory 200. In this case, the identifier filtering module 130 may directly discard the query request and notify the device initiating the query request that the target fused embedding vector has not been found, or may transmit the identifiers of the multiple embedding vectors carried in the query request to the address query module 120 .
[0176] In this filtering mode, the identifier filtering module 130 does not need to compare the identifiers of the multiple embedded vectors carried in the query request with the identifiers of the multiple embedded vectors based on which each fused embedded vector in the first memory 200 is generated. The identifier filtering module 130 only needs to regard the identifiers of the multiple embedded vectors based on which each fused embedded vector in the first memory 200 is generated as an identifier set, and determine whether the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set. If they belong to the identifier set, it means that the target fused embedded vector may be stored in the first memory 200. In fact, there are two situations in which the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set, one is that the target fused embedded vector is stored in the first memory 200, and the other is that the target fused embedded vector is not stored in the first memory 200, but the candidate fused embedded vector is stored in the first memory 200. In this way, it can be ensured that the address query module 120 can subsequently obtain the target fused embedded vector and / or the candidate fused embedded vector, and further ensure that the query device 100 uses a fuzzy query method to query the target fused embedded vector from the first memory 200.
[0177] In addition, in order to be more suitable for the fuzzy query method adopted by the query device 100, in the filtering mode, if only some of the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set, it means that the target fused embedded vector is not stored in the first memory 200, and the candidate fused embedded vector may be stored in the first memory 200. In this case, the identifier filtering module 130 may not discard the query request, but transmit the identifiers of the multiple embedded vectors carried in the query request to the address query module 120. This can ensure that the address query module 120 can subsequently obtain the candidate fused embedded vector.
[0178] In the case where only some of the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set, the identifier filtering module 130 may set a second filtering threshold, and if the number of identifiers belonging to the identifier set among the multiple embedded vector identifiers carried in the query request and the number of multiple embedded vector identifiers carried in the query request are greater than the second filtering threshold, the identifiers of the multiple embedded vectors carried in the query request may be transmitted to the address query module 120. If the number of identifiers belonging to the identifier set among the multiple embedded vector identifiers carried in the query request and the number of multiple embedded vector identifiers carried in the query request are not greater than the second filtering threshold, the identifier filtering module 130 may directly discard the query request and notify the device that initiated the query request that no target fused embedded vector was found.
[0179] In a specific implementation, the identifier filtering module 130 can use the CAM to record the identifiers of the multiple embedded vectors based on which each fused embedded vector in the first memory 200 is generated, that is, the CAM records the identifier set. The information in the CAM that matches the identifiers of the multiple embedded vectors based on which each fused embedded vector in the first memory 200 is the preset information indicating a successful match.
[0180] The identifier filtering module inputs the identifiers of the multiple embedded vectors carried in the query request to the CAM. For any identifier of the embedded vector carried in the query request, the identifier of the embedded vector is input to the CAM. If the identifier of the embedded vector belongs to the identifier set, the CAM outputs information indicating successful matching. If the identifier of the embedded vector does not belong to the identifier set, the CAM outputs information indicating failed matching. If the identifier filtering module 130 outputs information indicating successful matching after inputting the identifiers of the multiple embedded vectors carried in the query request to the CAM, then the identifier filtering module 130 transmits the identifiers of the multiple embedded vectors carried in the query request to the address query module 120. If the identifier filtering module 130 inputs the identifiers of the multiple embedded vectors carried in the query request to the CAM, and the ratio of the number of identifiers of the multiple embedded vectors (that is, the identifier output indicates successful matching after inputting the identifiers to the CAM) to the number of identifiers of the multiple embedded vectors is greater than the second filtering threshold, the identifiers of the multiple embedded vectors carried in the query request are transmitted to the address query module 120. Otherwise, the query request is directly discarded, and the device initiating the query request is notified that no target fused embedded vector is found.
[0181] In a specific implementation, the identifier filtering module 130 may use a Bloom filter or a cuckoo filter to implement a filtering function. The Bloom filter or the cuckoo filter may record the identifiers of the multiple embedded vectors based on which each fused embedded vector in the first memory 200 is generated, that is, the Bloom filter or the cuckoo filter is used to record the identifier set. The Bloom filter or the cuckoo filter processes the identifiers of the multiple embedded vectors carried in the query request, and can determine whether the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set.
[0182] In addition, the identification filtering module 130 can also filter the query request from the granularity of the embedding table. In practical applications, there may be multiple embedding tables, and the fused embedding vector stored in the first memory 200 is only related to some of the embedding tables. That is, the embedding vector based on which the fused embedding vector in the first memory 200 is generated only comes from some of the embedding tables. The identification filtering module 130 can filter based on the granularity of the embedding table, process the query request carrying the identification of the embedded vector belonging to the part of the embedding table, and reject the query request carrying the identification of the embedded vector that does not belong to the part of the embedding table. Exemplarily, in the case of multiple embedding tables, the query request will carry the table name of the embedded table to which the embedded vector belongs, and the identification filtering module 130 records the table name of the embedded table to which the embedded vector based on which the fused embedding vector in the first memory 200 is generated belongs. The identification filtering module 130 can determine whether the table name of the embedded table carried in the query request is consistent with the table name of the recorded embedded table, and if consistent, further filter the identification of the embedded vector carried in the query request. Otherwise, reject the query request.
[0183] Optionally, the identification filtering module 130 can also filter the embedded vectors within the specified range of the embedding table. In practical applications, the fused embedded vectors stored in the first memory 200 are only related to the embedded vectors within the specified range of the embedding table. That is, the embedded vectors based on which the fused embedded vectors in the first memory 200 are generated only come from the embedded vectors within the specified range of the embedding table. The identification filtering module 130 can filter based on the granularity of the embedded vectors within the specified range, process query requests carrying the identification of the embedded vectors within the specified range, and reject query requests carrying the identification of the embedded vectors that do not belong to the specified range. Exemplarily, the identification filtering module 130 records the identification range of the embedded vectors within the specified range, and the identification filtering module 130 can determine whether it belongs to the identification range based on the identification of the embedded vector carried in the query request. If it does, the identification of the embedded vector carried in the query request is further filtered. Otherwise, the query request is rejected.
[0184] The division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present application may be integrated into a processor 300, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0185] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a terminal device (which can be a personal computer, a mobile phone, or a network device, etc.) or a processor 300 (processor) to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0186] The above describes the internal structure of the query system and the query device 100. The following describes the deployment of the query system. In the embodiment of the present application, the query system can be deployed inside the computing device 10. The query system can also be deployed in a computing device cluster including multiple computing devices 20.
[0187] Deployment method 1: The query system is deployed inside the computing device 10.
[0188] In this deployment mode, the query device 100 and the first memory 200 are components of the computing device 10. The following is an exemplary display of a deployment mode of the query system inside the computing device 10.
[0189] like Figure 4A , which is a schematic diagram of the structure of a computing device 10 provided in an embodiment of the present application, the computing device 10 includes a processor 300, at least one first memory 200, at least one query device 100 and a second memory 400. The second memory 400 is used to store an embedded table.
[0190] A corresponding query device 100 is configured for each first memory 200. Each query device 100 is used to query the target fusion embedding vector from the corresponding first memory 200 according to the received query request. The embodiment of the present application does not limit the specific position of the query device 100 inside the computing device 10. For example, the query device 100 is arranged inside the corresponding first memory 200. This setting can be understood as in-memory computing, and the query device 100 is the computing circuit logic arranged inside the first memory 200 or the software running on the computing circuit logic. For another example, the query device 100 is arranged at a position close to the corresponding first memory 200. This setting can be understood as near-memory computing. The query device 100 is the computing circuit logic arranged around the first memory 200 or the software running on the computing circuit logic.
[0191] When the computing device 10 includes a first memory 200, the processor 300 may initiate a query request for querying a target fusion embedding vector to the first memory 200, and the query device 100 corresponding to the first memory 200 receives the query request and queries the target fusion embedding vector from the first memory 200 according to the identifiers of the multiple embedding vectors carried by the query request. If the query device 100 uses an accurate query method to query the target fusion embedding vector from the first memory 200; when the query device 100 queries the target fusion embedding vector from the first memory 200, the query device 100 feeds back the target fusion embedding vector to the processor 300; when the query device 100 does not query the target fusion embedding vector, the query device 100 notifies the processor 300 that the target fusion embedding vector is not queried. The processor 300 may use the identifiers of the multiple embedding vectors to obtain the multiple embedding vectors from the second memory 400 respectively, and then generate a target fusion vector based on the multiple embedding vectors.
[0192] Among them, the way in which the processor 300 uses the identifiers of the multiple embedded vectors to obtain the multiple embedded vectors from the second memory 400 in multiple times belongs to the query method of the embedded table that has been used. This query method requires multiple queries to the embedded table. In the embodiment of the present application, this query method is only used when the target fused embedded vector is not stored in the first memory 200. In the embodiment of the present application, the fused embedded vector is directly stored in the first memory 200. When the first memory 200 stores the target fused embedded vector, the target fused embedded vector can be obtained faster from the first memory 200. This query method is more efficient and fast.
[0193] If the query device 100 uses a fuzzy query method to query the target fusion embedding vector from the first memory 200; when the query device 100 queries the target fusion embedding vector from the first memory 200, the query device 100 feeds back the target fusion embedding vector to the processor 300; when the query device 100 does not query the target fusion embedding vector, but finds a candidate fusion embedding vector, the query device 100 can feed back the candidate fusion embedding vector to the processor 300, and the query device 100 can also feed back the target embedding vector set and the embedding vectors that are different from the candidate embedding vector set to the processor 300, that is, feed back the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector to the processor 300. The processor 300 uses the identifier of the first type of embedding vector to obtain the first type of embedding vector from the second memory 400 respectively, and the processor 300 uses the identifier of the second type of embedding vector to obtain the second type of embedding vector from the second memory 400 respectively, and then generates the target fusion embedding vector based on the candidate fusion embedding vector, the first type of embedding vector and / or the second type of embedding vector. When the query device 100 does not query the target fused embedding vector or the candidate embedding vector set, the query device 100 notifies the processor 300 that the target fused embedding vector has not been queried. The processor 300 can use the identifiers of the multiple embedding vectors to obtain the multiple embedding vectors from the second memory 400 respectively, and then generate the target fused vector based on the multiple embedding vectors.
[0194] In this query mode, the processor 300 will obtain the multiple embedding vectors from the second memory 400 in multiple times only when the target fusion embedding vector and the candidate fusion embedding vector are not stored in the first memory 200. In the embodiment of the present application, when the target fusion embedding vector is stored in the first memory 200, the processor 300 can obtain the target fusion embedding vector from the first memory 200 more quickly. In the embodiment of the present application, when the candidate fusion embedding vector is stored in the first memory 200, the processor 300 can obtain the candidate fusion embedding vector close to the target fusion embedding vector from the first memory 200 more quickly, and obtain the first type of embedding vector and / or the second type of embedding vector by accessing the second memory 400, and then generate the target fusion embedding vector based on the candidate fusion embedding vector, the first type of embedding vector and / or the second type of embedding vector. Although the second memory 400 still needs to be accessed, compared with the query mode in which the processor 300 obtains the multiple embedding vectors from the second memory 400 in multiple times, the number of times the processor 300 accesses the second memory 400 will be reduced, which can also improve the query efficiency of the embedding table.
[0195] When the computing device 10 includes multiple first memories 200, the multiple first memories 200 construct a multi-level storage architecture within the computing device 10. In the multi-level storage architecture, the multiple first memories 200 can be defined as the first-level storage, second-level storage, third-level storage, etc. of the multi-level storage architecture in order of the data read and write speed or bandwidth of the multiple first memories 200 from large to small. The processor 300 can preferentially access the first-level storage with the largest data read and write speed or bandwidth, and then access the second-level storage, and so on.
[0196] In this multi-level storage architecture, the processor 300 can serially access the multiple first memories 200 to obtain the target fusion embedding vector. The processor 300 can send query requests for querying the target fusion embedding vector to each first memory 200 in turn. The query device 100 corresponding to each first memory 200 processes the query request in a manner similar to the manner in which the query device 100 processes the query request when only one first memory 200 is included in the computing device 100. For details, please refer to the above description, which will not be repeated here. Until the target fusion embedding vector or candidate fusion embedding vector is fed back from the query device 100 corresponding to one of the first memories 200. The operations performed by the processor 300 after receiving the candidate fusion embedding vector fed back from the query device 100 can be referred to the above content, which will not be repeated here.
[0197] If the query device 100 corresponding to the multiple first memories 200 has neither fed back the target fusion embedding vector nor the candidate fusion embedding vector, the processor 300 can use the identifiers of the multiple embedding vectors to access the second memory 400 multiple times to obtain multiple embedding vectors, and then obtain the target fusion embedding vector based on the multiple embedding vectors.
[0198] In this multi-level storage, the processor 300 can also access the multiple first memories 200 in parallel to obtain the target fusion embedding vector. The processor 300 can synchronously send a query request for querying the target fusion embedding vector to each first memory 200. The query device 100 corresponding to each first memory 200 processes the query request in a manner similar to the query device 100 processing the query request when the computing device 100 includes only one first memory 200. For details, please refer to the above description, which will not be repeated here. Until the target fusion embedding vector or candidate fusion embedding vector is fed back from the query device 100 corresponding to one of the first memories 200. The operations performed by the processor 300 after receiving the candidate fusion embedding vector fed back from the query device 100 can be referred to the above content, which will not be repeated here.
[0199] If the query device 100 corresponding to the multiple first memories 200 has neither fed back the target fusion embedding vector nor the candidate fusion embedding vector, the processor 300 can use the identifiers of the multiple embedding vectors to access the second memory 400 multiple times to obtain multiple embedding vectors, and then obtain the target fusion embedding vector based on the multiple embedding vectors.
[0200] Of course, when the processor 300 accesses the multiple first memories 200 in parallel to obtain the target fused embedding vector, it can also synchronously access the second memory 400 to obtain multiple embedding vectors.
[0201] Deployment method two: the query system is deployed in a computing device cluster including multiple computing devices 20.
[0202] In this deployment mode, the functions of the query device 100 can be executed by the multiple computing devices 20. For example, the various modules (such as the identification filtering module 130, the address query module 120, and the candidate fusion vector search module) included in the query device 100 can be distributed in each computing device 20, and the various modules included in the query device 100 can communicate with each other through the network connection between the various computing devices 20. The first memory 200 can be located in one of the multiple computing devices 20. For example, the first memory 200 can be located in the same computing device 20 as the address query module 120. For example, part or all of the storage space of the memory in the multiple computing devices 20 can be constructed into a new storage space, and the new storage space is used to store the fusion embedding vector, that is, the first memory 200 can be logically distributed in the multiple computing devices 20, and the computing device 20 where the address query module 120 is located can access the new storage space.
[0203] The following takes the example that the identification filtering module 130 , the address query module 120 , and the candidate fusion vector module included in the query device 100 are distributed in different computing devices 20 to illustrate the manner in which the query system is deployed in a computing device cluster including multiple computing devices 20 .
[0204] like Figure 4B As shown, it is a schematic diagram of the structure of a computing device 20 cluster provided in an embodiment of the present application, and the computing device 20 cluster includes three computing devices 20, namely, computing device 20A, computing device 20B and computing device 20C. Among them, the computing device 20A is deployed with an identification filtering module 130, the computing device 20B is deployed with an address query module 120 and a first memory 200, and the computing device 20C is deployed with an identification fusion module 110.
[0205] The computing device 20A where the identification filtering module 130 is located may receive a query request sent by other devices outside the computing device 20A. The identification filtering module 130 determines that the target fusion embedded vector is stored or may be stored in the first memory 200 based on the identifiers of the multiple embedded vectors carried in the query request. The identification filtering module 130 may send the identifiers of the multiple embedded vectors to the computing device 20C where the identification fusion module 110 is located.
[0206] The computing device 20C where the identification fusion module 110 is located generates a fusion identification of a target fused embedding vector based on the identifications of the multiple embedding vectors. The computing device 20C where the identification fusion module 110 is located sends the fusion identification of the target fused embedding vector to the computing device 20B where the address query module 120 is located. The computing device 20B where the address query module 120 is located can determine the fusion identification of the candidate fused embedding vector based on the fusion identification of the target fused embedding vector.
[0207] Inside the computing device 20B where the address query module 120 is located, the address lookup module queries the target fusion embedding vector from the first memory 200 according to the fusion identifier of the target fusion embedding vector. If the target fusion embedding vector is found, the computing device 20B where the address query module 120 is located feeds back the target fusion embedding vector to the device that initiated the query request. If the target fusion embedding vector is not found, the address lookup module queries the candidate fusion embedding vector from the first memory 200 according to the fusion identifier of the candidate fusion embedding vector, and feeds back the candidate fusion embedding vector to the device that initiated the query request.
[0208] The above deployment method is only an example. This application is an embodiment and does not limit the specific method of deploying the query system in a computing device cluster including multiple computing devices. Any deployment method that completes the function of the query device 100 through the cooperation of multiple computing devices is applicable to the embodiments of this application.
[0209] The following is based on Figure 4A Taking the computing device 10 shown as an example, the embedded table query method provided in the embodiment of the present application is explained. It should be understood that the embedded table query provided in the embodiment of the present application is also applicable to a computing device cluster, and the implementation process of the embedded table query method in the computing device cluster is similar to the implementation process of the embedded table query method inside the computing device 10. The difference lies in the specific entities of the two devices that need to interact during the implementation of the embedded table query method. Inside the computing device 10, the interacting device is a component of the computing device 10. In the computing device cluster, the two interacting devices can be two computing devices 20. The implementation process of the embedded table query method in the computing device cluster will not be repeated here. For details, please refer to the implementation process of the embedded table query method inside the computing device 10. See. Figure 5 , the method comprising:
[0210] Step 501: The processor 300 sends a query request to the query device 100, where the query request is used to request a target fused embedding vector. The query request carries identifiers of multiple embedding vectors, and the target fused embedding vector is generated based on the multiple embedding vectors.
[0211] Step 502: The query device 100 receives the query request and determines whether the first memory 200 may store the target fused embedding vector according to the identifiers of the multiple embedding vectors carried in the query request. If the query device adopts a fuzzy filtering method, when it is determined that the target fused embedding vector or the candidate fused embedding vector may be stored in the first memory 200, step 503 is executed, otherwise step 512 is executed. If the query device adopts a precise filtering method, when it is determined that the target fused embedding vector or the candidate fused embedding vector is stored in the first memory 200, step 503 is executed, otherwise step 512 is executed. This step can be executed by the identifier filtering module 130 in the query device 100.
[0212] The query device 100 internally records the identifiers of multiple embedding vectors based on which each fused embedding vector in the first memory 200 is generated. In this step 502, the query device 100 can use the precise filtering mode to determine whether the target fused embedding vector is stored in the first memory 200. Specifically, the query device 100 can use the identifiers of the multiple embedding vectors carried in the query request to query the recorded identifiers of the multiple embedding vectors based on which each fused embedding vector in the first memory 200 is generated, and compare them with the recorded identifiers of the multiple embedding vectors based on which each fused embedding vector in the first memory 200 is generated, to determine whether in each fused embedding vector in the first memory 200, the identifiers of the multiple embedding vectors based on which a fused embedding vector is generated are consistent with the identifiers of the multiple embedding vectors carried in the query request.
[0213] If the identifiers of multiple embedding vectors based on which a fused embedding vector is generated are consistent with the identifiers of multiple embedding vectors carried in the query request, it means that the target fused embedding vector is stored in the first memory 200.
[0214] If there are no identifiers of the multiple embedding vectors based on which the fused embedding vector is generated that are consistent with the identifiers of the multiple embedding vectors carried in the query request, it means that the target fused embedding vector is not stored in the first memory 200.
[0215] If only some of the identifiers of the multiple embedding vectors carried in the query request are consistent with the multiple embedding vectors recorded as the basis for generating one or more fused embedding vectors in the first memory 200 (for example, the number of identifiers of the multiple embedding vectors carried in the query request that are consistent with the multiple embedding vectors recorded as the basis for generating a certain fused embedding vector in the first memory 200 and the number of identifiers of the multiple embedding vectors carried in the query request are greater than the first filtering threshold), it means that the candidate fused embedding vector is stored in the first memory 200.
[0216] In step 502, the query device 100 may also use a fuzzy filtering mode to determine whether the target fused embedding vector may be stored in the first memory 200. Specifically, the query device 100 uses the identifiers of the multiple embedding vectors carried in the query request to query the identifiers of the multiple embedding vectors recorded to generate each fused embedding vector in the first memory 200.
[0217] If the identifiers of the multiple embedding vectors carried in the query request belong to the recorded identifiers of the multiple embedding vectors based on which the various fused embedding vectors in the first memory 200 are generated, it means that the target fused embedding vector may be stored in the first memory 200.
[0218] If the identifiers of the multiple embedding vectors carried in the query request do not belong to the recorded identifiers of the multiple embedding vectors based on which the various fused embedding vectors in the first memory 200 are generated, it means that the target fused embedding vector is not stored in the first memory 200.
[0219] If only some of the identifiers of the multiple embedding vectors carried in the query request belong to the identifiers of the multiple embedding vectors recorded for generating each fused embedding vector in the first memory 200, it means that the target fused embedding vector is not stored in the first memory 200, but the candidate fused embedding vector may be stored in the first memory 200.
[0220] In addition, if the query device 100 determines, based on the identifiers of the multiple embedded vectors carried in the query request, that the first memory 200 may store a fused embedded vector generated based on some of the multiple embedded vectors, that is, only some of the identifiers of the multiple embedded vectors carried in the query request are consistent with the identifiers of the multiple embedded vectors based on which the various fused embedded vectors in the first memory 200 are generated, which are recorded inside the query device 100, for example, the partially consistent identifiers satisfy the first filtering threshold or the second filtering threshold mentioned above, the query device 100 can still continue to execute step 502.
[0221] Step 502 is an optional step. In practical applications, the query device 100 may not execute step 502 but directly execute step 503.
[0222] Step 503: The query device 100 generates a fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors carried in the query request. This step can be performed by the identifier fusion module 110 in the query device 100. The manner in which the query device 100 generates the fusion identifier of the target fused embedding vector can refer to the relevant description of the manner in which the identifier fusion module 110 generates the fusion identifier of the fused embedding vector mentioned above, which will not be repeated here.
[0223] Step 504: The query device 100 determines whether the first memory 200 stores the target fused embedded vector according to the fusion identifier of the target fused embedded vector from the mapping relationship between the storage addresses of each fused embedded vector in the first memory 200 and the fusion identifier of the fused embedded vector. If it is determined that the first memory 200 stores the target fused embedded vector, step 505 is executed; otherwise, step 506 is executed. This step can be executed by the address query module 120 in the query device 100.
[0224] After generating the fusion identifier of the target fusion embedded vector, the query device 100 can query the mapping relationship between the storage address of each fusion embedded vector in the first memory 200 recorded in the query device 100 and the fusion identifier of the fusion embedded vector. If the fusion identifier of the target fusion embedded vector is queried in the mapping relationship, it means that the first memory 200 stores the target fusion embedded vector. Otherwise, the first memory 200 does not store the target fusion embedded vector.
[0225] For example, the query device 100 stores the mapping relationship between the storage address of each fused embedding vector in the first memory 200 and the fusion identifier of each fused embedding vector through the CAM inside, and the query device 100 inputs the fusion identifier of the target fused embedding vector into the CAM, and determines whether the first memory 200 stores the target fused embedding vector according to the output of the CAM. If the CAM outputs the storage address of the target fused embedding vector, it means that the target fused embedding vector is stored in the first memory 200. If the CAM does not output any information or outputs an indication message indicating that the query is not found, it means that the first memory 200 does not store the target fused embedding vector.
[0226] Step 505: the query device 100 determines the storage address of the target fused embedded vector from the mapping relationship, accesses the first memory 200 according to the storage address of the target fused embedded vector, and obtains the target fused embedded vector from the first memory 200. This step can be performed by the address query module 120 in the query device 100.
[0227] The query device 100 queries the identifier of the target fused embedded vector in the mapping relationship, and can then determine the storage address of the target fused embedded vector from the mapping relationship.
[0228] When accessing the first memory 200, the query device 100 can send a read instruction carrying the storage address of the target fusion embedded vector to the first memory 200. After receiving the read instruction, the first memory 200 reads the target fusion embedded vector from the position indicated by the storage address of the target fusion embedded vector and feeds the target fusion embedded vector back to the query device 100.
[0229] Step 506: The query device 100 feeds back the target fused embedding vector to the processor 300.
[0230] Step 507: the query device 100 generates a fusion identifier of the candidate fusion embedding vector according to the fusion identifier of the target fusion embedding vector, wherein the difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is within a preset range.
[0231] If the query device 100 does not find the fusion identifier of the target fusion embedding vector in the mapping relationship, the query device 100 may further query the candidate fusion embedding vector that is close to the target fusion embedding vector from the first memory 200. In order to find the candidate fusion embedding vector, the query device needs to first obtain the fusion identifier of the candidate fusion embedding vector. Of course, if the query device 100 finds the fusion identifier of the target fusion embedding vector in the mapping relationship, the query device 100 may further query and feedback the candidate fusion embedding vector that is close to the target fusion embedding vector, as well as the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector from the first memory 200 (that is, execute steps 508 to 510).
[0232] The query device 100 can determine the fusion identifier of the candidate fusion embedding vector according to the fusion identifier of the target fusion embedding vector and the preset range. In the above content, regarding the description of the candidate fusion embedding vector search function, it can be seen that the specific value of the preset range is related to the generation method of the fusion identifier of the fusion embedding vector.
[0233] Here we only list several possible ways to determine the fusion identity of the candidate fusion embedding vector.
[0234] 1. The fusion identifier of the fusion embedding vector is generated using the aforementioned generation method 1. The difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is the number of bits with different values between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector. The preset range indicates the maximum number and minimum number of bits with different values in the fusion identifiers of the two fusion embedding vectors.
[0235] The query device 100 can change the value of the bit in the fusion identifier of the target fusion embedded vector, and use the fusion identifier whose number of bits different from the value of the fusion identifier of the target fusion embedded vector is between the maximum number and the minimum number indicated by the preset range as the fusion identifier of the candidate fusion embedded vector. In view of the specific value of the preset range, the fusion identifier of the candidate fusion embedded vector determined by the query device 100 can be one or more.
[0236] 2. The fusion identifier of the fusion embedded vector is generated using the second generation method mentioned above. The difference between the fusion identifier of the candidate fusion embedded vector and the fusion identifier of the target fusion embedded vector is the number of bits between the bits whose values are the first value in the fusion identifier of the candidate fusion embedded vector and the fusion identifier of the target fusion embedded vector. The preset range indicates the maximum number and minimum number of bits between the bits whose values are the first value in the fusion identifiers of the two fusion embedded vectors.
[0237] The query device 100 can change the value of the bit in the fusion identifier of the target fusion embedded vector, and use the fusion identifier whose data of the bits spaced between the bits whose value in the fusion identifier of the target fusion embedded vector is the first value is between the maximum number and the minimum number indicated by the preset range as the fusion identifier of the candidate fusion embedded vector. In view of the specific value of the preset range, the fusion identifier of the candidate fusion embedded vector determined by the query device 100 can be one or more.
[0238] 3. The fusion identifier of the fusion embedding vector is generated using the third generation method mentioned above. The difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is the number of bits with different values between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector. The preset range indicates the maximum and minimum number of bits with different values in the fusion identifiers of the two fusion embedding vectors.
[0239] The query device 100 can change the value of the bit in the fusion identifier of the target fusion embedded vector, and use the fusion identifier whose number of bits different from the value of the fusion identifier of the target fusion embedded vector is between the maximum number and the minimum number indicated by the preset range as the fusion identifier of the candidate fusion embedded vector. In view of the specific value of the preset range, the fusion identifier of the candidate fusion embedded vector determined by the query device 100 can be one or more.
[0240] Step 508: The query device 100 determines the storage address of the candidate fusion embedding vector from the mapping relationship according to the fusion identifier of the candidate fusion embedding vector, accesses the first memory 200 according to the determined storage address of the candidate fusion embedding vector, and obtains the target fusion embedding vector from the first memory 200. The query device 100 performs step 508 in a similar manner to the query device 100 performs step 505, except that the storage address obtained and the fusion embedding vector obtained are different. For details, please refer to the above description, which will not be repeated here. This step can be performed by the address query module 120 in the query device 100.
[0241] Step 509: The query device 100 determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector according to the fusion identifier of the candidate fusion embedding vector. The first type of embedding vector is an embedding vector that exists in the multiple embedding vectors based on which the target fusion embedding vector is generated and does not exist in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and the second type of embedding vector is an embedding vector that does not exist in the multiple embedding vectors based on which the target fusion embedding vector is generated and exists in the multiple embedding vectors based on which the candidate fusion embedding vector is generated.
[0242] For any candidate fused embedding vector, the query device 100 may further determine an identifier of a type one embedding vector and / or an identifier of a type two embedding vector related to the candidate fused embedding vector.
[0243] Three ways in which the query device 100 determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector are listed below.
[0244] 1) The query device 100 determines the identifiers of the multiple embedding vectors based on which the candidate fused embedding vector is generated according to the fusion identifier of the candidate fused embedding vector, that is, determines the identifiers of each embedding vector in the candidate embedding vector set. The identifiers of the multiple embedding vectors carried in the query request are the identifiers of the multiple embedding vectors based on which the target fused embedding vector is generated, that is, the identifiers of each embedding vector in the target embedding vector set.
[0245] The query device 100 determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector by comparing the identifier of each embedding vector in the candidate embedding vector set and the identifier of each embedding vector in the target embedding vector set.
[0246] 2) The query device 100 compares the fusion identifier of the candidate fused embedding vector and the fusion identifier of the target fused embedding vector, and determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector according to the comparison result.
[0247] The way in which the query device 100 compares the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is related to the way in which the fusion identifier of the fusion embedding vector is generated.
[0248] When the fusion identifier of the fusion embedding vector is generated using the aforementioned generation method 1, the embedded vectors corresponding to the bits with different values in the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector are first-class embedded vectors and / or second-class embedded vectors. For example, the embedded vector corresponding to the bits with the first value in the fusion identifier of the candidate fusion embedding vector and the bits with the second value at the same position in the fusion identifier of the target fusion embedding vector is a second-class embedded vector, and the embedded vector corresponding to the bits with the second value in the fusion identifier of the candidate fusion embedding vector and the bits with the first value at the same position in the fusion identifier of the target fusion embedding vector is a first-class embedded vector.
[0249] 3) The first memory 200 stores the fused embedding vector and the identifiers of the multiple embedding vectors based on which the fused embedding vector is generated. The query device 100 can read the fused embedding vector and the identifiers of the multiple embedding vectors based on which the fused embedding vector is generated through the storage address of the fused embedding vector.
[0250] After the query device 100 determines the storage address of the candidate fused embedding vector according to the fusion identifier and mapping relationship of the candidate fused embedding vector, the candidate fused embedding vector and the identifiers of the multiple embedding vectors based on which the candidate fused embedding vector is generated can be read through the storage address of the candidate fused embedding vector, that is, the identifiers of each embedding vector in the candidate embedding vector set are determined. The identifiers of the multiple embedding vectors carried in the query request are the identifiers of the multiple embedding vectors based on which the target fused embedding vector is generated, that is, the identifiers of each embedding vector in the target embedding vector set.
[0251] The query device 100 determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector by comparing the identifier of each embedding vector in the candidate embedding vector set and the identifier of each embedding vector in the target embedding vector set.
[0252] It can be seen that there is an association between the candidate fusion embedding vector and the determined first-class embedding vector and / or second-class embedding vector. The identifier of the first-class embedding vector and / or the second-class embedding vector associated with the candidate fusion embedding vector is the different embedding vectors in the candidate embedding vector set and the target embedding vector set based on which the candidate fusion embedding vector is generated.
[0253] Step 510: the query device 100 feeds back the candidate fused embedding vector, and the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector to the processor 300.
[0254] After determining any candidate fused embedding vector and the identifier of its associated first-class embedding vector and / or the identifier of its associated second-class embedding vector, the query device 100 can feed back the candidate fused embedding vector and the identifier of its associated first-class embedding vector and / or the identifier of its associated second-class embedding vector to the processor 300.
[0255] Step 511: the processor 300 accesses the second memory 400 according to the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector, and obtains the first type of embedding vector and / or the second type of embedding vector from the second memory 400.
[0256] For a class of embedded vectors, the processor 300 can send a read request carrying an identifier of a class of embedded vectors to the second memory 400. After receiving the read request, the second memory 400 queries the embedding table according to the identifier of the class of embedded vectors, reads the class of embedded vectors, and feeds back the class of embedded vectors to the processor 300.
[0257] For the second type of embedded vector, the processor 300 can send a read request carrying the identifier of the second type of embedded vector to the second memory 400. After receiving the read request, the second memory 400 queries the embedding table according to the identifier of the second type of embedded vector, reads the second type of embedded vector, and feeds back the second type of embedded vector to the processor 300.
[0258] Step 512: The processor 300 generates a target fused embedding vector according to the candidate fused embedding vectors, and the first-class embedding vectors and / or the second-class embedding vectors.
[0259] The processor 300 generates a target fused embedding vector based on the candidate fused embedding vector, the first type of embedding vector and / or the second type of embedding vector, which is related to the specific generation method of the fused embedding vector.
[0260] For example, when the fused embedding vector is obtained by summing multiple embedding vectors, then, after obtaining the first-category embedding vector and / or the second-category embedding vector, the processor 300 can subtract the candidate fused embedding vector from the second-category embedding vector, and then sum the vector after the difference with the first-category embedding vector. The vector obtained after the summation is the target fused embedding vector.
[0261] When the fused embedding vector is obtained by averaging multiple embedding vectors, the processor 300 may first perform a multiplication on the candidate fused embedding vector (i.e., multiply the candidate fused embedding vector by a number), and the "number" used in the multiplication is the number of the multiple embedding vectors. After that, the vector obtained after the multiplication is subtracted from the two types of embedding vectors, and then the vector after the difference is summed with the one type of embedding vector, and the vector obtained after the sum is multiplied (i.e., the candidate fused embedding vector is multiplied by a number), and the "number" used in the multiplication is the reciprocal of the number of the multiple embedding vectors, and the vector obtained after the multiplication is finally the target fused embedding vector.
[0262] Step 513: The processor 300 obtains the multiple embedding vectors from the second memory 400 in multiple times according to the identifiers of the multiple embedding vectors, and generates a target fused embedding vector according to the multiple embedding vectors.
[0263] For any embedded vector, the processor 300 may send a read request carrying the identifier of the embedded vector to the second memory 400. After receiving the read request, the second memory 400 queries the embedding table according to the identifier of the embedded vector, reads the embedded vector, and feeds back the embedded vector to the processor 300.
[0264] Step 513 can be understood as a method in which the processor 300 directly obtains the target fused embedding vector from the embedding table. It can be seen that the processor 300 needs to interact with the second memory 400 multiple times to obtain the multiple embedding vectors. In the aforementioned method in which the processor 300 obtains the target fused embedding vector from the first memory 200, the processor 300 only needs to interact with the query device 100 once to obtain the target fused embedding vector. Even in the method in which the processor 300 needs to obtain the candidate fused embedding vector from the first memory 200 and the identifier of the first type of embedding vector and / or the second type of embedding vector from the second memory 400, the number of interactions between the processor 300 and the query device 100 and the number of interactions between the processor 300 and the second memory will be less than the number of interactions between the processor 300 and the second memory 400 in step 5132, and the query efficiency of the embedding table can still be improved.
[0265] The descriptions of the processes corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process, please refer to the relevant descriptions of other processes.
[0266] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes computer program instructions, which, when loaded and executed on a computer, generate all or part of the embodiments according to the present invention. Figure 3 The process or function described.
[0267] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line, or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD).
[0268] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An embedded table query method, characterized in that: The method is applied to a query device, comprising: receiving a query request, the query request being used to request a query for a target fused embedding vector, the target fused embedding vector being generated based on a plurality of embedding vectors in an embedding table; The target fused embedding vector is queried from a first memory according to identifiers of the multiple embedding vectors carried in the query request, wherein the first memory includes multiple fused embedding vectors, each of which is generated based on an embedding vector in the embedding table.
2. The method according to claim 1, characterized in that The multiple fused embedding vectors include the target fused embedding vector, and querying the target fused embedding vector from the first memory according to the identifiers of the multiple embedding vectors carried in the query request includes: Determining a fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors; Determining a storage address of the target fused embedded vector in the first memory from mapping information recorded by the query device according to the fusion identifier of the target fused embedded vector, wherein the mapping information indicates a mapping relationship between the storage addresses of the multiple fused embedded vectors in the first memory and the fusion identifiers of the multiple fused embedded vectors; The target fused embedding vector is obtained from the first memory according to the storage address of the target fused embedding vector.
3. The method according to claim 1 or 2, characterized in that The querying the target fused embedding vector from the first memory according to the identifiers of the multiple embedding vectors carried in the query request includes: Determining a fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors; Determining a fusion identifier of a candidate fusion embedding vector according to the fusion identifier of the target fusion embedding vector, wherein the difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is within a preset range, and the difference represents the degree of difference between a plurality of embedding vectors based on which the target fusion embedding vector is generated and a plurality of embedding vectors based on which the candidate fusion embedding vector is generated; The candidate fused embedding vector is obtained from the multiple fused embedding vectors in the first memory according to the fusion identifier of the candidate fused embedding vector.
4. The method according to claim 3, characterized in that The method further comprises: According to the fusion identifier of the candidate fusion embedding vector, the identifier of one type of embedding vector and / or the identifier of the second type of embedding vector are determined, wherein the first type of embedding vector is an embedding vector that does not exist in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and exists in the multiple embedding vectors based on which the target fusion embedding vector is generated, and the second type of embedding vector is an embedding vector that exists in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and does not exist in the multiple embedding vectors based on which the target fusion embedding vector is generated.
5. The method according to claim 4, characterized in that The determining, according to the fusion identifier of the candidate fused embedding vector, an identifier of the first type of embedding vector and / or an identifier of the second type of embedding vector comprises: Determining, according to the fusion identifier of the candidate fused embedding vector, identifiers of a plurality of embedding vectors based on which the candidate fused embedding vector is generated; The identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector are determined by comparing the identifiers of the multiple embedding vectors based on which the candidate fused embedding vector is generated with the identifiers of the multiple embedding vectors carried in the query request.
6. The method according to claim 4, characterized in that The determining, according to the fusion identifier of the candidate fused embedding vector, an identifier of the first type of embedding vector and / or an identifier of the second type of embedding vector comprises: The identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector are determined according to bits having different values in the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector.
7. The method according to claim 4, characterized in that The first memory stores the candidate fused embedding vector and identifiers of multiple embedding vectors based on which the candidate fused embedding vector is generated, and determining the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector according to the fusion identifier of the candidate fused embedding vector includes: Obtaining from the first memory the identifiers of the plurality of embedding vectors on which the generation of the candidate fused embedding vector is based; The identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector are determined by comparing the identifiers of the multiple embedding vectors based on which the candidate fused embedding vector is generated with the identifiers of the multiple embedding vectors carried in the query request.
8. The method according to claim 2, characterized in that The query device includes a content addressable memory CAM, the CAM stores the mapping information, and the storage address of the target fused embedding vector in the first memory is determined from the mapping information recorded by the query device according to the fusion identifier of the target fused embedding vector, including: A fusion identifier of the target fusion embedding vector is input into the CAM, and a storage address of the target fusion embedding vector is determined according to the CAM output.
9. The method according to any one of claims 1 to 8, characterized in that: Before querying the target fused embedding vector from the first memory according to the identifiers of the multiple embedding vectors carried in the query request, the method further includes: It is determined that the identifiers of the multiple embedding vectors carried in the query request belong to an identifier set, where the identifier set includes identifiers of all embedding vectors based on which the multiple fused embedding vectors in the first memory are generated.
10. The method according to any one of claims 1 to 9, characterized in that: The query device is internally provided with a Bloom filter or a Cuckoo filter, the Bloom filter or the Cuckoo filter records the identifier set, and the determining that the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set includes: The Bloom filter or the Cuckoo filter is called to determine that the identifiers of the multiple embedding vectors carried in the query request belong to an identifier set.
11. An embedded table query system, characterized in that: The system includes at least one first memory and at least one query device, each first memory corresponds to a query device, including: Any one of the first memories is used to store a plurality of fused embedding vectors, each fused embedding vector is generated based on an embedding vector in the embedding table; Any of the query devices is used to receive a query request, wherein the query request is used to request a query for a target fusion embedding vector, wherein the target fusion embedding vector is generated based on multiple embedding vectors in an embedding table; and query the target fusion embedding vector from the corresponding first memory according to the identifiers of the multiple embedding vectors carried in the query request.
12. The system according to claim 11, characterized in that The multiple fused embedding vectors include the target fused embedding vector, and the query device is used to: Determining a fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors; Determining a storage address of the target fused embedded vector in the first memory from mapping information recorded by the query device according to the fusion identifier of the target fused embedded vector, wherein the mapping information indicates a mapping relationship between the storage addresses of the multiple fused embedded vectors in the first memory and the fusion identifiers of the multiple fused embedded vectors; The target fused embedding vector is obtained from the first memory according to the storage address of the target fused embedding vector.
13. The system according to claim 11 or 12, characterized in that The query device is used for: Determining a fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors; Determining a fusion identifier of a candidate fusion embedding vector according to the fusion identifier of the target fusion embedding vector, wherein the difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is within a preset range, and the difference represents the degree of difference between a plurality of embedding vectors based on which the target fusion embedding vector is generated and a plurality of embedding vectors based on which the candidate fusion embedding vector is generated; The candidate fused embedding vector is obtained from the multiple fused embedding vectors in the first memory according to the fusion identifier of the candidate fused embedding vector.
14. The system of claim 13, wherein: The query device is further used for: According to the fusion identifier of the candidate fusion embedding vector, the identifier of one type of embedding vector and / or the identifier of the second type of embedding vector are determined, wherein the first type of embedding vector is an embedding vector that does not exist in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and exists in the multiple embedding vectors based on which the target fusion embedding vector is generated, and the second type of embedding vector is an embedding vector that exists in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and does not exist in the multiple embedding vectors based on which the target fusion embedding vector is generated.
15. The system of claim 14, wherein: When the query device determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector according to the fusion identifier of the candidate fused embedding vector, it is used to: Determining, according to the fusion identifier of the candidate fused embedding vector, identifiers of a plurality of embedding vectors based on which the candidate fused embedding vector is generated; The identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector are determined by comparing the identifiers of the multiple embedding vectors based on which the candidate fused embedding vector is generated with the identifiers of the multiple embedding vectors carried in the query request.
16. The system of claim 14, wherein: The query device determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector according to the fusion identifier of the candidate fused embedding vector, and is used to: The identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector are determined according to bits having different values in the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector.
17. The system of claim 14, wherein: The first memory stores the candidate fused embedding vector and the identifiers of multiple embedding vectors based on which the candidate fused embedding vector is generated, and the query device determines the identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector according to the fusion identifier of the candidate fused embedding vector, for: Obtaining from the first memory the identifiers of the plurality of embedding vectors on which the generation of the candidate fused embedding vector is based; The identifier of the first type of embedding vector and / or the identifier of the second type of embedding vector are determined by comparing the identifiers of the multiple embedding vectors based on which the candidate fused embedding vector is generated with the identifiers of the multiple embedding vectors carried in the query request.
18. The system of claim 12, wherein: The query device includes a content addressable memory CAM, the mapping information is stored in the CAM, and the query device determines the storage address of the target fused embedding vector in the first memory from the mapping information recorded by the query device according to the fusion identifier of the target fused embedding vector, and is used to: A fusion identifier of the target fusion embedding vector is input into the CAM, and a storage address of the target fusion embedding vector is determined according to the CAM output.
19. The system according to any one of claims 11 to 18, characterized in that: Before the querying device queries the target fused embedding vector from the first memory according to the identifiers of the multiple embedding vectors carried in the query request, the querying device is further configured to: It is determined that the identifiers of the multiple embedding vectors carried in the query request belong to an identifier set, where the identifier set includes identifiers of all embedding vectors based on which the multiple fused embedding vectors in the first memory are generated.
20. The system according to any one of claims 11 to 19, characterized in that: The query device is internally provided with a Bloom filter or a Cuckoo filter, and the Bloom filter or the Cuckoo filter records the identifier set. When the query device determines that the identifiers of the multiple embedded vectors carried in the query request belong to the identifier set, the query device is used to: The Bloom filter or the Cuckoo filter is called to determine that the identifiers of the multiple embedding vectors carried in the query request belong to an identifier set.
21. The system according to any one of claims 11 to 20, characterized in that: The system includes a plurality of the first memories, which constitute a multi-level storage in a computing device, wherein each first memory corresponds to a first-level storage in the multi-level storage.
22. The system of claim 21, wherein: The system also includes a processor in the computing device; The processor is configured to send the query request to the at least one query device in sequence, or send the query request to the at least one query device synchronously.
23. A query device, characterized in that: The device comprises: An address query module is configured to receive a query request, wherein the query request is used to request a query for a target fused embedding vector, wherein the target fused embedding vector is generated based on a plurality of embedding vectors in an embedding table; and query the target fused embedding vector from a first memory according to identifiers of the plurality of embedding vectors carried in the query request, wherein the first memory includes a plurality of fused embedding vectors, each of which is generated based on an embedding vector in the embedding table.
24. The device according to claim 23, characterized in that The multiple fused embedding vectors include the target fused embedding vector, and the device also includes a marker fusion module; The identifier fusion module is used to determine the fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors; The address query module is used to determine the storage address of the target fused embedded vector in the first memory from the mapping information recorded by the query device according to the fusion identifier of the target fused embedded vector, wherein the mapping information indicates the mapping relationship between the storage addresses of the multiple fused embedded vectors in the first memory and the fusion identifiers of the multiple fused embedded vectors; and obtain the target fused embedded vector from the first memory according to the storage address of the target fused embedded vector.
25. The device according to claim 23 or 24, characterized in that The device also includes a marker fusion module; The identifier fusion module is used to determine the fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors; The address query module is used to determine the fusion identifier of the target fused embedding vector according to the identifiers of the multiple embedding vectors; Determining a fusion identifier of a candidate fusion embedding vector according to the fusion identifier of the target fusion embedding vector, wherein the difference between the fusion identifier of the candidate fusion embedding vector and the fusion identifier of the target fusion embedding vector is within a preset range, and the difference represents the degree of difference between a plurality of embedding vectors based on which the target fusion embedding vector is generated and a plurality of embedding vectors based on which the candidate fusion embedding vector is generated; The candidate fused embedding vector is obtained from the multiple fused embedding vectors in the first memory according to the fusion identifier of the candidate fused embedding vector.
26. The device according to claim 25, characterized in that The address query module is also used for: According to the fusion identifier of the candidate fusion embedding vector, the identifier of one type of embedding vector and / or the identifier of the second type of embedding vector are determined, wherein the first type of embedding vector is an embedding vector that does not exist in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and exists in the multiple embedding vectors based on which the target fusion embedding vector is generated, and the second type of embedding vector is an embedding vector that exists in the multiple embedding vectors based on which the candidate fusion embedding vector is generated, and does not exist in the multiple embedding vectors based on which the target fusion embedding vector is generated.
27. The device according to any one of claims 23 to 26, characterized in that The device comprises an identification filtering module, and the identification filtering module is used before the address query module queries the target fused embedding vector from the first memory according to the identifiers of the multiple embedding vectors carried in the query request: It is determined that the identifiers of the multiple embedding vectors carried in the query request belong to an identifier set, where the identifier set includes identifiers of all embedding vectors based on which the multiple fused embedding vectors in the first memory are generated.
28. A computer-readable storage medium, characterized in that: When the computer-readable storage medium is executed by a computing device, the computing device executes the method according to any one of claims 1 to 10.