Method, electronic device and computer program product for data indexing
Generating vectorized representations of data blocks through a neural network-based representation generation model solves the problem of low efficiency in fuzzy search of existing hash indexes, enables rapid location of similar data blocks, improves data access efficiency, and is compatible with hash indexes. compatible.
Patent Information
- Application Number
- CN202010479672.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-29
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-05-29
AI Technical Summary
Fuzzy search based on hash indexes in existing storage systems is inefficient and difficult to effectively locate similar data blocks. Especially when data block changes are scattered, it cannot meet the needs of fast random access and deduplication.
A neural network-based representation generation model is used to generate vectorized representations of data blocks, so that data blocks with higher similarity have smaller differences and data blocks with lower similarity have larger differences. Indexes are built through vectorized representations to support fuzzy search.
It achieves fast and accurate positioning of similar data blocks, improves data access efficiency, and is compatible with hash indexes to support more data access and search applications.
Smart Images

Figure CN113742288B
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate generally to storage systems, and more particularly, to a method, electronic device, and computer program product for data indexing. Background Art
[0002] In storage systems, such as file systems and backup systems, files and data are divided into fixed-length or variable-length data blocks for storage. In order to support fast random access and data deduplication, an index corresponding to the data block is usually constructed, and the index is used to find and locate the desired data block from a large number of stored data blocks. The construction of the index will affect the efficiency of data query and access and the applicability to different application scenarios. Summary of the invention
[0003] Embodiments of the present disclosure relate to an improved solution for data indexing.
[0004] In a first aspect of the present disclosure, a method for data indexing is provided. The method includes obtaining a plurality of data blocks for storage. The method also includes generating a plurality of vectorized representations of the plurality of data blocks, so that the difference between the vectorized representations of the data blocks with higher similarity in the plurality of data blocks is smaller. The method also includes storing the plurality of vectorized representations for respectively indexing the plurality of data blocks.
[0005] In a second aspect of the present disclosure, an electronic device is provided. The electronic device includes at least one processor; and at least one memory storing computer program instructions, wherein the at least one memory and the computer program instructions are configured to cause the electronic device to perform actions together with the at least one processor. The actions include: obtaining a plurality of data blocks for storage; generating a plurality of vectorized representations of the plurality of data blocks, so that the difference between the vectorized representations of the data blocks with higher similarity in the plurality of data blocks is smaller; and storing the plurality of vectorized representations for indexing the plurality of data blocks respectively.
[0006] In a third aspect of the present disclosure, a computer program product is provided. The computer program product is tangibly stored on a non-volatile computer-readable medium and includes computer executable instructions. When the computer executable instructions are executed, the device performs actions. The actions include: obtaining multiple data blocks for storage; generating multiple vectorized representations of the multiple data blocks, so that the differences between the vectorized representations of the data blocks with higher similarity in the multiple data blocks are smaller; and storing the multiple vectorized representations for indexing the multiple data blocks respectively.
[0007] It should be understood that the contents described in the summary of the invention are not intended to limit the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] The above and other purposes, features and advantages of the embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0009] Figure 1 A block diagram illustrating an example environment in which embodiments of the present disclosure may be implemented;
[0010] Figure 2 Shown in Figure 1 Examples of data queries in an environment with
[0011] Figure 3 A block diagram of a data management system according to some embodiments of the present disclosure is shown;
[0012] Figure 4 A block diagram of a system for training a representation generation model according to some embodiments of the present disclosure is shown;
[0013] Figure 5 A block diagram of a data management system according to other embodiments of the present disclosure is shown;
[0014] Figure 6 A schematic diagram showing a data structure for storing an index according to some embodiments of the present disclosure is shown;
[0015] Figure 7 A flowchart showing a process for data indexing according to some embodiments of the present disclosure; and
[0016] Figure 8 A schematic block diagram of a device that can be used to implement an embodiment of the present disclosure is shown.
[0017] The same or similar reference numerals are used throughout the drawings to designate the same or similar components. DETAILED DESCRIPTION
[0018] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments shown in the accompanying drawings. It should be understood that these specific embodiments are described only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way.
[0019] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example implementation" and "an implementation" mean "at least one example implementation". The term "another implementation" means "at least one additional implementation". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0020] As used herein, the term "model" can learn the association or functional relationship between the corresponding input and output from the training data, so that after the training is completed, the corresponding output can be generated for a given input using such an association or functional relationship. The generation of the model can be based on machine learning technology. Deep learning is a machine learning algorithm that processes inputs and provides corresponding outputs by using multi-layer processing units. A neural network model is an example of a model based on deep learning. In this article, "model" may also be referred to as "machine learning model", "learning model", "machine learning network" or "learning network", and these terms are used interchangeably in this article.
[0021] Machine learning generally includes at least two stages, namely the training stage and the use stage (also called the reasoning stage). In the training stage, a given model can be trained using a large amount of training data, and iterated continuously until the model can obtain consistent reasoning from the training data that is similar to the reasoning that human intelligence can make. Through training, the model can be considered to be able to learn the association between input and output (also called the functional relationship between input and output) from the training data. The parameter values of the trained model are determined. In other words, the model can be represented as a function that maps input to output. In the use stage, the model can be used to process the actual input based on the parameter values obtained through training to determine the corresponding output.
[0022] Figure 1 A schematic diagram of an exemplary environment 100 is shown in which embodiments of the present disclosure may be implemented. Figure 1 In the example of FIG. 1 , the data management system 110 is configured to control and manage the storage system 120, including storing data in the storage system 120, providing access to the data, and other data management operations. The data management system 110 can be implemented on various computing devices / servers. The storage system 120 can include various storage devices to provide storage space for data. The various storage devices can be concentrated in one site or distributed in different locations.
[0023] The data management system 110 can control and manage the storage system 120 based on various storage technologies. Generally, the data management system 110 divides the data to be stored (such as various files, data entries, etc.) into data blocks with fixed length or variable length for storage. For example, as shown in the figure, the file 140 is divided into data blocks 142-1, 142-2, ..., 140-M and stored in the storage system 120; the file 150 is divided into data blocks 152-1, 152-2, ..., 150-N and stored in the storage system 120; the file 160 is divided into data blocks 162-1, 162-2, ..., 160-P and stored in the storage system 120. Note that although shown collectively in the figure, the data blocks of each file can be distributed in any storage location of the storage system 120.
[0024] In order to support fast random access and deduplication of stored data, the data management system 110 also constructs an index corresponding to each data block, and stores the index of the data block in the index library 130 to support subsequent access to the data block.
[0025] Since data is one of the important assets in many activities or for many organizations, in some cases, it may be required to back up data to the storage system 120 multiple times on a periodic basis or triggered by an event (e.g., data update) to form different versions of the same data to achieve the purpose of data protection. In this case, the storage system 120 may include a primary storage system and one or more backup storage systems. In some data access applications, it may be desirable to access the same or similar data in the storage system 120. This may be achieved, for example, by providing query data 170 to the data management system 110. Figure 2 Two examples of data queries are shown.
[0026] exist Figure 2 In example (A), it is assumed that files 140, 150, ..., 160 stored in storage system 120 are different versions of the same file, such as versions V1, V2 to VK. The data in different versions may change slightly. For example, assuming that these files are used to store personal information of an account, file 140 of version V1 may store initial personal information such as user name, phone number, contact address, etc., file 150 of version V2 may have an area code for the phone number added to file 140, and file 160 of version VK may have an updated contact address.
[0027] In some cases, if the account is deleted or for other reasons, it may be desirable to delete the personal information that has been backed up multiple times from the storage system 120. This is more common in the storage systems of some companies / commercial organizations, mainly to meet the requirements for user privacy protection. For example, the EU's General Data Protection Regulation (GDPR) requires that websites provide an option to delete personal information. In order to delete different versions of the same file, the data management system 110 can search for data matching the file 170 from the storage system 120 based on the current version of the file or other available versions VN, such as file 170, for deletion.
[0028] exist Figure 2 In example (B), for the same file, in addition to being stored separately, a certain file may also be aggregated into a larger file and stored in the storage system 120. For example, version V2 of file 150 may be merged with version VM of another file 220 in the aggregate file 210. Therefore, when searching and deleting data, it is also required to be able to use file 170 to find the matching file 150 from the aggregate file 210.
[0029] certainly, Figure 2 Only some example scenarios that may occur in the data access process are shown. In other scenarios, other forms of data access, search and other operations may also exist.
[0030] It should be understood that Figure 1 The environment 100 is only schematically shown, and does not impose any limitation on the embodiments of the present disclosure. The various systems / devices in the environment 100 may be arranged in any other manner. For example, although shown as being separated from the storage system 120, the index library 130 may also be integrated in the storage system 120, and the storage system 120 provides storage space for indexes of data blocks.
[0031] In conventional storage systems, a hash function is usually used to calculate the hash value of a data block to construct an index of the data block. Such an index is also called a hash index. The hash value of a data block can be organized, for example, in a Merkle tree structure, which calculates the hash value layer by layer from the direct hash value of the data block until a single hash value is obtained as the root node.
[0032] Hierarchical hashing consisting of hash values can achieve very efficient data search based on exact matching. However, an important property of hash functions is that a small change in a data block (for example, even a change as small as a few bits) will result in a completely different hash value. This property helps to distribute each data block to all available space in the storage system, thereby preventing the original data block from being deduced from the hash value. However, in applications such as deduplication of data from the storage system, data search, etc. that require partial matching to achieve fuzzy search, hash value-based indexing will be difficult to implement.
[0033] For example, if a certain version of a file is used to search for all versions stored in the storage system, only some of the latest versions of the files may be obtained through the hash values of the data blocks of each file. Alternatively, when a file is divided into multiple data blocks, since the changes in the file are relatively concentrated, it may be possible to find completely unmodified data blocks through hash value matching, thereby locating similar files. However, this process requires sufficient luck. If the changes in the file are relatively scattered, similar files cannot be found, so it is not suitable for practical applications. In addition, this process usually leads to high computational complexity and time overhead.
[0034] In theory, it is possible to query directly using the original data, such as the data blocks of the original file, instead of using the hash index. For example, given a query data block, the similarity between the byte sequence of the given query data block and the byte sequence of the stored data block can be calculated to determine whether the two data blocks are similar. However, this process is obviously very inefficient. In practical applications, it is also difficult to find similar data blocks by polling all data blocks in the storage system.
[0035] Another solution to fuzzy matching is to use locality sensitive hashing (LSH). However, LSH has limitations because LSH only gives rough results in a given "bucket" (e.g., a given set of data blocks), that is, it can only achieve a rough estimate of similar content. LSH cannot give a measure of the similarity between any two input data blocks. The results of LSH are also based on probability, so there is no guarantee that all similar data blocks can be found in one call.
[0036] Considering the shortcomings of current hash indexes and the need to perform fuzzy searches from storage systems, it is desirable to provide an improved data indexing solution.
[0037] According to an example embodiment of the present disclosure, a scheme for data indexing is proposed. According to the scheme, a vectorized representation of a data block is generated for indexing the corresponding data block. The generated vectorized representation can be used to distinguish the similarity of different data blocks, so that among multiple data blocks, the difference between the vectorized representations of data blocks with higher similarity is smaller, while the difference between the vectorized representations of data blocks with lower similarity is larger. In some embodiments, a representation generation model based on a neural network can be used to generate the vectorized representation of the data block.
[0038] By using vectorized representation as the index of data blocks, the similarity of data blocks can be effectively measured with the help of vectorized representation, thereby providing the possibility of performing fuzzy search of data blocks based on similarity. In addition, the index based on vectorized representation can also be compatible with the current hash value-based index, jointly supporting more data access and search applications for data in the storage system.
[0039] Hereinafter, embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings.
[0040] Figure 2 A block diagram of a data management system according to some embodiments of the present disclosure is shown. Figure 1 The data management system according to some embodiments of the present disclosure is described in the environment 100, which is represented as data management system 110. Figure 2 In the example of , the data management system 110 is configured to generate corresponding indexes for data that has been stored or is to be stored in the storage system 120, such as the data 302, to facilitate subsequent search and access to the data blocks.
[0041] Specifically, the data management system 110 includes a data chunking module 310, which is configured to divide the data 302 into a plurality of data chunks, such as data chunks 304-1, 304-2, ..., 304-K (where K is an integer greater than 1). For ease of discussion, the data chunks 304-1, 304-2, ..., 304-K are sometimes collectively or individually referred to herein as data chunks 304.
[0042] Data 302 may include data in the form of one or more files, data entries, etc. The data type may be, for example, electronic documents, images, audio, video, etc. The embodiments of the present disclosure do not limit the types of data that can be stored and indexed.
[0043] The data chunking module 310 may be configured to divide the byte sequence of the data 302 by a fixed length or by a variable length. That is, the plurality of data chunks 304 may have the same size or different sizes. In some embodiments, when constructing the index proposed according to the embodiments of the present disclosure, the data 302 may have been divided into corresponding data chunks 304 and stored in the storage system 120. In some embodiments, the data 302 may be new data provided to the data management system 110.
[0044] The data management system 110 also includes a representation generation module 320, which is configured to generate vectorized representations 322-1, 322-2, ..., 322-K for each of the plurality of data blocks 304-1, 304-2, ..., 304-K. For ease of discussion, the vectorized representations 322-1, 322-2, ..., 322-K are sometimes collectively or individually referred to herein as vectorized representations 322. The vectorized representation of a data block can be considered as a short representation of the data block, which can usually be represented by a numerical vector of a certain dimension. The vectorized representation of a data block is sometimes also referred to as a feature representation, feature vector, or embedded vector of the data block.
[0045] According to an embodiment of the present disclosure, the representation generation module 320 is configured to be able to generate a vectorized representation in such a manner that the difference between the vectorized representations of data blocks with higher similarity is smaller (or the similarity between the vectorized representations is higher), and the difference between the vectorized representations of data blocks with lower similarity is larger (or the similarity between the vectorized representations is lower). Here, the similarity or difference between data blocks refers to the content similarity or difference of the data blocks. That is, the difference between the vectorized representations of two data blocks can be equal to or close to the difference between these two data blocks (for example, the difference between the original byte sequences of the data blocks). Thus, the similarity between different data blocks can be measured by the difference between the vectorized representations.
[0046] The vectorized representations 322 of different data blocks 304 may be represented as numerical vectors of the same dimension, so that the different vectorized representations 322 are comparable, so as to support determining the difference between the vectorized representations 322 by calculating the distance between the vectors. The difference between the vectorized representations 322 may be determined, for example, by any method for measuring the distance between vectors, such as based on Euclidean distance (i.e., L2 distance), cosine distance, etc. The embodiments of the present disclosure are not limited to this.
[0047] In some embodiments, in order to make it advantageous to measure the similarity between data blocks based on vectorized representation, when the vectorized representation 322 and the data block 304 are represented by the same data representation method such as binary or decimal, the dimension of the vectorized representation 322 is smaller than the dimension of the data block 304. In some embodiments, if the data block 304 has a variable size, the representation generation module 320 is configured to be able to map the variable size input (i.e., "data block") to the output of the same dimension (i.e., "vectorized representation"). Of course, the embodiments of the present disclosure do not limit the specific dimension of the vectorized representation 322. The selection of the specific dimension may depend on the actual application.
[0048] As an example, assume that the dimension of the vectorized representation 322 is 3. For a certain data block 304 and a data block 304 that is very similar to it, the vectorized representation 322 determined by the representation generation module 320 for the two data blocks 304 can be [1.0, 1.0, 1.0] and [1.1, 1.0, 0.9], respectively, and the similarity between the two vectorized representations 322 can reach 90%, indicating that the similarity of the corresponding data blocks 304 is very high. For the same data block 304 whose vectorized representation is [1.0, 1.0, 1.0], the vectorized representation 322 determined by the representation generation module 320 for the data block 304 that is not similar to it can be [0.5, 0.3, 2.1]. The similarity between the two vectorized representations 322 is 20%, indicating that the similarity of the corresponding two data blocks 304 is very low. It should be understood that the specific dimensions and vector values given here are for illustrative purposes only and do not impose any limitation on the embodiments of the present disclosure.
[0049] In some embodiments, the representation generation module 320 can be configured to utilize deep learning technology to implement the generation of the vectorized representation 322 of the data block 304. For example, the representation generation module 320 can be configured to utilize a neural network-based model (also referred to as a representation generation model) to generate the vectorized representation 322 of the data block 304. The representation generation model that can be utilized by the representation generation module 320 is trained with training data. An example training process of the representation generation model will be described below.
[0050] The representation generation model can receive a data block 304 (fixed size or variable size) as a model input, and by processing the model input, generate a corresponding vectorized representation 322 as a model output. The representation generation model can be configured as any form of neural network model. The representation generation model can be, for example, a recurrent neural network (RNN) model, a convolutional neural network (CNN), any of their variant models, or other types of models. The input of the representation generation model can be, for example, the original byte sequence of the data block 304, which is usually stored in the storage system 120.
[0051] In addition to the neural network-based model, the representation generation module 320 may also utilize any other technology capable of generating a vectorized representation of data, which is not limited in the embodiments of the present disclosure.
[0052] The vectorized representation 322 generated by the representation generation module 320 is provided to the storage execution module 330 in the data management system 110. The storage execution module 330 is configured to store the vectorized representation 322 of each of the plurality of data blocks 304 in the index library 130, so as to be used for respectively indexing the plurality of data blocks 304 stored in the storage system 120. In some embodiments, if the data block 304 is a data block of new data, the storage execution module 330 may also be configured to store the data block 304 in the storage system 120.
[0053] By establishing an index, the corresponding data block 304 stored in the storage system 120 can be found through the vectorized representation 322. Since different vectorized representations 322 can be used to measure the similarity between different data blocks, such vectorized representations 322 can also be called a “similarity index” of the data block 304.
[0054] In actual applications, the data management system 110 can continuously generate corresponding vectorized representations as similarity indexes for one or more data blocks of new data as new data is written to the storage system 120. The data management system 110 can also create vectorized representations 322 for existing data blocks in the storage system 120 as similarity indexes.
[0055] The similarity index served by the vectorized representation 322 can help to quickly and accurately locate similar data blocks from the storage system 120, which will be referred to below. Figure 5 Detailed description. Before that, we first describe how to train the representation generation module to generate vectorized representations of data blocks.
[0056] Figure 4 A schematic diagram of a model training system 400 representing a generation model 420 according to some embodiments of the present disclosure is shown. The trained representation generation model 420 can be provided to the representation generation module 320 of the data management system 110 for use. The model training system 400 can be implemented independently of the data management system 110. That is, the training and use of the representation generation model can be performed by different systems. For example, the model training system 400 can be implemented on another computing device or server. In other embodiments, the training of the representation generation model 420 can also be integrated into the data management system 110, for example, the functions of the model training system 400 can be implemented by the data management system 110.
[0057] Due to the above-mentioned requirements for the vectorized representation of data blocks, the training goal of the representation generation model 420 is to make the differences between the vectorized representations generated for similar data blocks smaller, while the differences between the vectorized representations generated for dissimilar data blocks larger. Figure 4 In the example embodiment, the representation generation model 420 is trained based on a triplet loss training technique.
[0058] Specifically, the model training system 400 includes a training triple determination module 410, which is configured to construct training samples for training the representation generation model 420, each training sample including three training data blocks, namely a first training data block (denoted as "P"), a second training data block similar to the first training data block (denoted as "S"), and a third training data block dissimilar to the first training data block (denoted as "N").
[0059] That is, the first training data block P and the second training data block S constitute a pair of similar data blocks, while the first training data block P and the third training data block S constitute a pair of dissimilar data blocks. The similarity or dissimilarity of data blocks can be distinguished by setting a similarity threshold. If the similarity between the original byte sequences of the two data blocks is greater than or equal to the similarity threshold, the two data blocks can be considered similar, otherwise the two data blocks are considered dissimilar. The similarity threshold can be set to 50%, for example, or any other appropriate value.
[0060] In some embodiments, the training triplet determination module 410 may select a first training data block P and a third training data block N from the data block set 402. The data block set 402 may include a plurality of training data blocks obtained from a data source such as various corpora. The training triplet determination module 410 may randomly select a first training data block P and a third training data block N from the data block set 402. Since the training data blocks in the data block set 402 may generally be different from each other, such a random selection may ensure to a certain extent that the first training data block P and the third training data block N are not similar. Of course, the training triplet determination module 410 may also ensure that the difference between the determined first training data block P and the third training data block N is large by specifically calculating the similarity between the selected training data blocks.
[0061] In some embodiments, the training triplet determination module 410 may generate the second training data block S by modifying a portion of the first training data block P. Such modification may be a random modification of any portion of the first training data block P. The modification amount of the first training data block P may be controlled to ensure that the second training data block S and the first training data block P have certain differences and relatively similar parts. By modifying the first training data block P to obtain the second training data block S, a second training data block S similar to the first training data block P may be obtained more quickly. Of course, the training triplet determination module 410 may also determine the second training data block S similar to the first training data block P by searching the data block set 402.
[0062] The training triples are constructed so that the training objective of the representation generation model 420 can be described as: making the difference between the vectorized representations generated by the trained representation generation model 420 for the first training data block P and the second training data block S smaller than the difference between the vectorized representations generated for the first training data block P and the third training data block N.
[0063] In some embodiments, the model training process can be guided based on triplet loss to meet the above training objectives. The triplet loss can be expressed as a loss function based on the following differences: the difference between the vectorized representation f(P) of the first training data block P and f(S) of the second training data block S and the difference between the vectorized representation f(P) of the first training data block P and f(N) of the third training data block N. The representation generation model 420 can determine the vectorized representation of each training data block separately based on the current parameter values.
[0064] In one example, the triplet loss (denoted as ) can determine:
[0065]
[0066] In the above formula (1), dist(X, Y) represents the difference or similarity between two vectorized representations X and Y. Since the vectorized representation can be understood as a multidimensional numerical vector, the similarity or difference between the two vectorized representations can be determined using any method suitable for measuring vector differences, such as Euclidean distance or cosine distance. In one example, if the difference between the two vectorized representations is determined based on the Euclidean distance, the larger the distance means the greater the difference between the two vectorized representations and the smaller the similarity.
[0067] In formula (1), α represents the minimum interval between the difference between the vectorized representations of the first training data block P and the second training data block S and the difference between the vectorized representations of the first training data block P and the third training data block N. α is a hyperparameter of the model and can be configured as a predetermined value based on experience or other possible methods.
[0068] If the training objective is based on the triplet loss, it can be seen from formula (1) that if the difference between f(P) and f(S) is greater than or equal to the sum of the difference between f(P) and f(N) and the interval α, the triplet loss If the difference between f(P) and f(S) is less than the sum of the difference between f(P) and f(N) and the margin α, the triplet loss is The value is zero.
[0069] During the training process, the model training module 430 in the model training system 400 determines the parameter update of the representation generation model 420 based on the loss value. The model training module 430 can determine the parameter value update for the model based on various appropriate model training methods, such as the stochastic gradient descent method and its various deformation algorithms. In order to achieve the training goal, the model training module 430 may need to continuously iterate the training of the representation generation model 420 based on multiple training triples, so that the triple loss becomes smaller and smaller in multiple iterations until convergence is reached. Each training triple used in the training process can be determined according to the embodiments discussed above. The convergence condition of the model training can be, for example, the minimum triple loss, for example, equal to zero or equal to other acceptable values.
[0070] It should be understood that the triple loss described above is still only an example. In the training method using training triples to perform model training, other loss functions can also be constructed to achieve the training goal. In addition to using training triples to perform model training, other methods can also be used to train the representation generation model 420. The embodiments of the present disclosure are not limited in this respect. After the training is completed, the parameter values of the representation generation model 420 are determined. The representation generation model 420 can be provided for generating a vectorized representation of a data block.
[0071] Next, we will discuss how to use the similarity index served by the vectorized representation 322 to quickly and accurately locate similar data blocks from the storage system 120. Figure 5 Such an example embodiment for performing a data block search is shown. Figure 3 In comparison, Figure 5 In the embodiment, the data management system 110 further includes a search execution module 540 for implementing a data block search based on vectorized representation.
[0072] Specifically, the data management system 110 can perform a data block search in response to a query. The data management system 110 can obtain a query for data 502. Data 502 can be a file or other form of data. Data 502 can be new data, or data stored in the storage system 120 specified by a user. In some embodiments, the data block module 310 can perform block cutting of data 502, for example, according to variable length or invariable length. The specific segmentation method is the same as the previous segmentation of the data 302 for storage. Data 502 can be divided into one or more data blocks 504-1, 504-2, ..., 504-J (for ease of discussion, collectively or individually referred to as data blocks 504), where J can be an integer greater than or equal to 1. Such data blocks 504 can also be referred to as query data blocks 504.
[0073] The representation generation module 320 of the data management system 110 is configured to generate vectorized representations (referred to as “query vectorized representations”) of the query data chunks 504, such as query vectorized representations 522-1, 522-2, . . . , 522-J, collectively or individually referred to as query vectorized representations 522. The generation of the query vectorized representations 522 of the query data chunks 504 is similar to the vectorized representations 322 of the data chunks 304. For example, the representation generation module 320 can generate the query vectorized representation 522 of each query data chunk 504 using the trained representation generation model 420.
[0074] The query vectorized representation 522 is provided to the search execution module 540 for performing a search for similar data blocks. Specifically, for the query vectorized representation 522 of each data block 504, the search execution module 540 is configured to search for at least one vectorized representation 322 whose difference with the query vectorized representation 522 is less than a difference threshold from the multiple vectorized representations 322 stored in the index library 130. The specific difference threshold can be set according to actual needs.
[0075] With the help of the vectorized representation of the data block (i.e., the similarity index), the search for similar data blocks can be converted into a search for similar vectorized representations. The search for similar vectorized representations can be considered as a problem of finding one or more nearest neighbors in the vector space. This can be achieved in a variety of ways. A simple and direct way is to poll the multiple vectorized representations 304 stored in the index library 130. Compared to directly calculating the similarity between the query data block 504 and the stored data block 304, the amount of calculation required to calculate the similarity of the vectorized representation will be lower because the dimension of the vectorized representation is smaller.
[0076] In some embodiments, in order to improve the efficiency of searching for similar vectorized representations of the query vectorized representation 504 from multiple vectorized representations 304, when storing the vectorized representation 322, the storage execution module 330 can determine a data structure suitable for neighbor search for storing the vectorized representation 322. An example data structure is a K-dimensional tree (KD) tree data structure. Such data results can reduce the search time from the time O(n) consumed by direct comparison query to O(long(n)), where n is the number of vectorized representations in the index library 130 to be compared with the query vectorized representation 522.
[0077] Figure 6 A schematic representation of a KD-tree data structure is shown. Figure 6 As shown, the KD tree data structure can sort and organize multiple vectorized representations 610, 620, 622, 630, 632, and 634 into a tree structure 601. These vectorized representations can also be mapped to two-dimensional space coordinates 602. Note that for the convenience of illustration, Figure 6 The vectorized representation is represented by a simple two-dimensional numerical vector. This example does not limit the scope of the embodiments of the present disclosure.
[0078] If the vectorized representations 322 in the index library 130 are also stored in the KD tree structure, when searching for vectorized representations similar to the query vectorized representation 522, the search execution module 540 can start from the root node of the tree structure and recursively search downward for vectorized representations 322 that are less different from the query vectorized representation 522. Those skilled in the art are clear about how to find similar vectorized representations based on the KD tree structure, so it will not be described in detail here.
[0079] Of course, in addition to the KD tree structure, the vectorized representation 322 can also be stored in other data structures suitable for neighbor search, and the embodiments of the present disclosure are not limited thereto.
[0080] After the search execution module 540 finds one or more vectorized representations 322 with small differences (e.g., less than a difference threshold) from the query vectorized representation 522 from the index library 130, the data blocks 304 to which they are directed can be determined based on these vectorized representations 322. The determined one or more data blocks 304 can be used as a response to the current query, or as a candidate for a response (e.g., can be further screened based on other criteria). For each query data block 504, similar data blocks 304 in the storage system 120 can be similarly determined. With the help of the similarity index served by the vectorized representation, the search execution module 540 can effectively and comprehensively locate similar data blocks in the storage system 130.
[0081] The data index of the exemplary embodiment of the present disclosure is mentioned above. Such a similarity index can be compatible with other indexes, such as a hash index for exact matching of data blocks, and can be used together to provide access to and search for data blocks in the storage system 120 .
[0082] It should be understood that the "module" used in this article can be implemented by software, hardware, firmware, or any combination thereof. One or more modules can be implemented on a single computing device, multiple computing devices, or in a cloud computing environment. The embodiments of the present disclosure are not limited in this respect.
[0083] Figure 7 FIG. 7 is a flowchart of a process 700 for data indexing according to some embodiments of the present disclosure. The process 700 may be implemented in Figure 2 For ease of discussion, process 700 is described from the perspective of data management system 110.
[0084] At block 710, the data management system 110 obtains a plurality of data blocks for storage. At block 720, the data management system 110 generates a plurality of vectorized representations of the plurality of data blocks, so that the difference between the vectorized representations of the data blocks with higher similarity among the plurality of data blocks is smaller. At block 730, the data management system 110 stores the plurality of vectorized representations for respectively indexing the plurality of data blocks.
[0085] In some embodiments, the multiple vectorized representations are represented by numerical vectors of the same dimension.
[0086] In some embodiments, when generating multiple vectorized representations of multiple data blocks, the data management system 110 may generate multiple vectorized representations of multiple data blocks using a trained representation generation model, such as a neural network model.
[0087] In some embodiments, the representation generation model is trained based on training triples, the training triples including a first training data block, a second training data block similar to the first training data block, and a third training data block dissimilar to the first training data block. In some embodiments, a training goal of the representation generation model is to make the difference between the vectorized representations generated by the representation generation model for the first training data block and the second training data block smaller than the difference between the vectorized representations generated for the first training data block and the third training data block.
[0088] In some embodiments, the first training data block and the third training data block are selected from a set of data blocks, and the second training data block is generated by modifying a portion of the first training data block.
[0089] In some embodiments, when storing multiple vectorized representations, the data management system 110 may determine a data structure suitable for neighbor search; and store the multiple vectorized representations in the selected data structure.
[0090] In some embodiments, the stored vectorized representations can be used to support queries for similar data blocks. Specifically, the data management system 110 can obtain a query associated with a query data block. The data management system 110 can generate a query vectorized representation of the query data block, and search for at least one vectorized representation whose difference with the query vectorized representation is less than a difference threshold from the stored multiple vectorized representations. The data management system 110 can then determine a response to the query based on at least one data block indexed by at least one vectorized representation in the multiple data blocks.
[0091] In some embodiments, when generating a query vectorized representation of a query data block, the data management system 110 may utilize a trained representation generation model to generate a query vectorized representation of the query data block. The representation generation model used here is also used to generate multiple vectorized representations of multiple data blocks.
[0092] Figure 8 Schematically shows a block diagram of a device 800 that can be used to implement an embodiment of the present disclosure. It should be understood that Figure 8 The device 800 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Figure 8 The device 800 shown may be used to implement Figure 7 Process 700. Figure 8 The device 800 shown may be implemented as or included in Figure 2 The data management system 110 is provided.
[0093] like Figure 8 As shown in FIG. 8 , the device 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only storage device (ROM) 802 or loaded from a storage unit 808 to a random access storage device (RAM) 803. In RAM 803, various programs and data required for the operation of the device 800 can also be stored. CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0094] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0095] The various processes and processing described above, such as process 700, may be performed by processing unit 801. For example, in some embodiments, process 700 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by CPU 801, one or more steps of process 700 described above may be performed.
[0096] The embodiments of the present disclosure may also provide a computer-readable storage medium having computer-executable instructions stored thereon, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0097] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, devices, equipment, computer-readable media, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0098] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0099] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0100] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0101] As used herein, the term "determine" encompasses a wide variety of actions. For example, "determine" may include computing, calculating, processing, deriving, investigating, searching (e.g., searching in a table, a database, or another data structure), ascertaining, etc. In addition, "determine" may include receiving (e.g., receiving information), accessing (e.g., accessing data in a memory), etc. In addition, "determine" may include resolving, selecting, choosing, establishing, etc.
[0102] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
Claims
1. A method for data indexing, include: obtaining a plurality of data blocks for storage; Generate multiple vectorized representations of the multiple data blocks using a representation generation model trained based on the training triples, so that differences between the vectorized representations of data blocks with higher similarity among the multiple data blocks are smaller; as well as storing the plurality of vectorized representations for respectively indexing the plurality of data blocks, wherein the training triplet comprises a first training data block, a second training data block and a third training data block, the first training data block and the third training data block are randomly selected from a data block set, and the second training data block is generated by modifying a random portion of the first training data block by a predetermined modification amount, and The training goal of the representation generation model is to make the difference between the vectorized representations generated by the representation generation model for the first training data block and the second training data block smaller than the difference between the vectorized representations generated for the first training data block and the third training data block.
2. The method according to claim 1, wherein the representation generation model is a neural network model. 3 . The method of claim 2 , wherein the second training data block is similar to the first training data block, and the third training data block is dissimilar to the first training data block.
4. The method according to claim 1, wherein the multiple vectorized representations are represented by numerical vectors of the same dimension.
5. The method according to claim 1, wherein storing the plurality of vectorized representations include: Choose a data structure suitable for nearest neighbor search; as well as The multiple vectorized representations are stored in a selected data structure.
6. The method according to claim 1, further comprising: include: obtaining a query associated with the query data block; Generating a query vectorized representation of the query data block; Finding at least one vectorized representation from the plurality of vectorized representations, the difference between which and the query vectorized representation is less than a difference threshold; as well as A response to the query is determined based on at least one data block among the plurality of data blocks indexed by the at least one vectorized representation.
7. The method according to claim 6, wherein the query vectorized representation of the query data block is generated include: The query vectorized representation of the query data block is generated using the representation generation model.
8. An electronic device, include: at least one processor; as well as At least one memory storing computer program instructions, wherein the at least one memory and the computer program instructions are configured to, together with the at least one processor, cause the electronic device to perform actions, the actions comprising: obtaining a plurality of data blocks for storage; Generate a plurality of vectorized representations of the plurality of data blocks using a representation generation model trained based on the training triples, so that differences between the vectorized representations of data blocks with higher similarity among the plurality of data blocks are smaller; and storing the plurality of vectorized representations for respectively indexing the plurality of data blocks, wherein the training triplet comprises a first training data block, a second training data block and a third training data block, the first training data block and the third training data block are randomly selected from a data block set, and the second training data block is generated by modifying a random portion of the first training data block by a predetermined modification amount, and The training goal of the representation generation model is to make the difference between the vectorized representations generated by the representation generation model for the first training data block and the second training data block smaller than the difference between the vectorized representations generated for the first training data block and the third training data block.
9. The apparatus of claim 8, wherein the representation generation model is a neural network model.
10. The apparatus of claim 8, wherein the second training data block is similar to the first training data block, and the third training data block is dissimilar to the first training data block.
11. The apparatus of claim 8, wherein the plurality of vectorized representations are represented by numerical vectors of the same dimension.
12. The apparatus according to claim 8, wherein the plurality of vectorized representations are stored include: Choose a data structure suitable for nearest neighbor search; as well as The multiple vectorized representations are stored in a selected data structure.
13. The apparatus of claim 8, wherein the action further include: obtaining a query associated with the query data block; Generating a query vectorized representation of the query data block; Finding at least one vectorized representation from the plurality of vectorized representations, the difference between which and the query vectorized representation is less than a difference threshold; as well as A response to the query is determined based on at least one data block among the plurality of data blocks indexed by the at least one vectorized representation.
14. The apparatus of claim 13, wherein generating the query vectorized representation of the query data block include: The query vectorized representation of the query data block is generated using the representation generation model.
15. A computer program product tangibly stored on a non-transitory computer readable medium and comprising computer executable instructions that, when executed, cause a device to perform actions, the actions include: obtaining a plurality of data blocks for storage; Generate multiple vectorized representations of the multiple data blocks using a representation generation model trained based on the training triples, so that differences between the vectorized representations of data blocks with higher similarity among the multiple data blocks are smaller; as well as storing the plurality of vectorized representations for respectively indexing the plurality of data blocks, wherein the training triplet comprises a first training data block, a second training data block and a third training data block, the first training data block and the third training data block are randomly selected from a data block set, and the second training data block is generated by modifying a random portion of the first training data block by a predetermined modification amount, and The training goal of the representation generation model is to make the difference between the vectorized representations generated by the representation generation model for the first training data block and the second training data block smaller than the difference between the vectorized representations generated for the first training data block and the third training data block.
16. The computer program product of claim 15, wherein the representation generation model is a neural network model.
17. The computer program product of claim 15, wherein the second block of training data is similar to the first block of training data and the third block of training data is dissimilar to the first block of training data.
18. The computer program product of claim 15, wherein the plurality of vectorized representations are represented by numerical vectors of the same dimension.
19. The computer program product of claim 15, wherein the plurality of vectorized representations are stored include: Choose a data structure suitable for nearest neighbor search; as well as The multiple vectorized representations are stored in a selected data structure.
20. The computer program product of claim 15, wherein the actions further include: obtaining a query associated with the query data block; Generating a query vectorized representation of the query data block; Finding at least one vectorized representation from the plurality of vectorized representations, the difference between which and the query vectorized representation is less than a difference threshold; as well as A response to the query is determined based on at least one data block among the plurality of data blocks indexed by the at least one vectorized representation.
21. The computer program product of claim 20, wherein generating the query vectorized representation of the query data block include: The query vectorized representation of the query data block is generated using the representation generation model.
