Information search method and device and computing device cluster
By encoding the query statement using the elastic dimensional semantic model, a slicing elastic dimensional vector is obtained, which solves the problem of high resource consumption of information search technology based on deep learning, and realizes efficient and accurate information search.
Patent Information
- Application Number
- CN202311191661.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-14
- Publication Date
- 2025-03-14
AI Technical Summary
Information search technology based on deep learning has problems such as high consumption of inference resources, long time consumption and large storage resources requirements.
The elastic dimension semantic model is used to encode the query statement input by the user to obtain the elastic dimension vector, which can directly split the sub-vectors as effective dimensions to reduce the consumption of storage and computing resources. The calculation is performed using low-dimensional vectors during the recall phase and the accuracy of search results is improved through multi-layer filtering.
It effectively reduces the consumption of inference resources, inference time and demand for storage resources, and improves the efficiency and accuracy of information search.
Smart Images

Figure CN119622054A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence (AI) technology, and in particular to an information search method, device and computing device cluster. Background Art
[0002] At present, vector representation technology based on deep learning has been widely used in information search fields such as search, advertising, and recommendation. The goal of these scenarios is to solve the problem of information overload and retrieve valuable data from massive data. According to the different stage goals in the scenario process, the different stages in these scenarios can be abstractly divided into two categories: recall and sorting. The goal of the recall stage is to select a small part of the candidate set from a large-scale database based on the query statement. The goal of the sorting stage is to reorder the data in the candidate set and output the results according to the semantic similarity between the query statement and the candidate data. In the early stage, experts are often required to collect and construct features to recall and sort the data. Nowadays, with the rapid development of deep learning, vector representation technology based on deep learning can automatically generate high-quality features, improve recall and sorting accuracy, and reduce manual input. However, the current information search technology based on deep learning consumes more reasoning resources, takes a long time to reason, and requires more storage resources. Summary of the invention
[0003] The present application provides an information search method, apparatus, computing device cluster, computer storage medium and computer product, which can reduce reasoning resource consumption, reasoning time and demand for storage resources.
[0004] In a first aspect, the present application provides an information search method, comprising: encoding a query statement input by a user through an elastic dimension semantic model to obtain a first vector representation, wherein the vector encoded through the elastic dimension semantic model is an elastic dimension vector, and the elastic dimension vector is a vector that can directly cut out a part of sub-vectors as a valid dimension; based on the similarity between a first sub-vector of a first dimension and multiple second sub-vectors of the first dimension, screening the second vector representation of data in a database to obtain M second vector representations, wherein M≥1, the first sub-vector is obtained by cutting from the first vector representation, a second sub-vector is obtained by cutting from a second vector representation, a second vector representation is obtained by encoding a data in the database through the elastic dimension semantic model, and the first dimension is smaller than the dimension of the first vector representation; based on the similarity between a third sub-vector of the second dimension and M fourth sub-vectors of the second dimension, determining search results from the data associated with the M second vector representations, wherein the third sub-vector is obtained by cutting from the first vector representation, a fourth sub-vector is obtained by cutting from a vector representation included in the M second vector representations, the second dimension is greater than the first dimension, and the second dimension is less than or equal to the dimension of the first vector representation. Among them, being able to directly cut out a part of sub-vectors as vectors of valid dimensions can be understood as being able to directly obtain a vector fragment of a certain dimension without calculation, and the dimension is valid.
[0005] In this way, the elastic dimension vector is obtained by encoding the elastic dimension semantic model, so that only one type of vector can be stored instead of multiple vectors, saving storage resources. In addition, the elastic dimension semantic model only needs to be encoded once, saving computing resources. At the same time, the elastic dimension vector can be split, so in the recall stage, the recall calculation can be performed by using a low-dimensional vector, which further saves computing resources.
[0006] In a possible implementation, based on the similarity between the third subvector of the second dimension and the M fourth subvectors of the second dimension, determining the search results from the data associated with the M second vector representations includes: based on the similarity between the third subvector of the second dimension and the M fourth subvectors of the second dimension, screening the data associated with the M second vector representations to obtain N second vector representations, N≤M; based on the similarity between the fifth subvector of the third dimension and the N sixth subvectors of the third dimension, determining the search results from the data associated with the N second vector representations, wherein the fifth subvector is obtained by segmenting the first vector representation, a sixth subvector is obtained by segmenting a vector representation included in the N second vector representations, the third dimension is greater than the second dimension, and the third dimension is less than or equal to the dimension of the first vector representation. Thus, the accuracy of the search results is improved through multi-layer screening.
[0007] In a possible implementation, based on the similarity between the fifth subvector of the third dimension and the N sixth subvectors of the third dimension, a search result is determined from the data associated with the N second vector representations, including: sorting the N second vector representations based on the similarity between the fifth subvector of the third dimension and the N sixth subvectors of the third dimension; and using the obtained sorting result as the search result. Sorting the filtered order in this way allows the user to observe the data he expects to see in the first place, thereby improving the user experience.
[0008] In a possible implementation, the second vector representation of the data in the database is obtained by encoding the data in the database in advance through the elastic dimension semantic model, so that the data in the database does not need to be encoded during reasoning, saving reasoning time.
[0009] In a possible implementation, before encoding the query statement input by the user through the elastic dimension semantic model, it also includes: obtaining a training sample set, the training sample set includes the first data and the second data; encoding the first data and the second data respectively through the elastic dimension semantic model to be trained to obtain a third vector representation and a fourth vector representation; based on the number and dimension values of the dimensions that can be segmented by the preset elastic dimension vector, segmenting the third vector representation to obtain K seventh sub-vectors, and segmenting the fourth vector representation to obtain K eighth sub-vectors; sequentially combining the K seventh sub-vectors to obtain K ninth sub-vectors of different dimensions, and sequentially combining the K eighth sub-vectors to obtain K tenth sub-vectors of different dimensions, wherein the ninth sub-vector of the i-th dimension and the tenth sub-vector of the i-th dimension have the same dimension, 1≤i≤K; respectively calculating the similarity between the ninth sub-vector and the tenth sub-vector of the same dimension to obtain K similarities; and training the elastic dimension semantic model based on the K similarities. In this way, the training of the elastic dimension semantic model can be completed.
[0010] In a possible implementation, training the elastic dimension semantic model based on K similarities includes: dividing the training process of the elastic dimension semantic model into K training stages, wherein in the i-th training stage, the elastic dimension semantic model is trained based on the similarity associated with the first dimension to the similarity associated with the i-th dimension. In this way, the training of the elastic dimension semantic model can be performed in stages to improve the training effect.
[0011] In a second aspect, the present application provides an information search device, including: an encoding module, a recall module and a sorting module. Among them, the encoding module is used to encode the query statement input by the user through the elastic dimension semantic model to obtain a first vector representation, wherein the vector encoded by the elastic dimension semantic model is an elastic dimension vector, and the elastic dimension vector is a vector that can directly cut out a part of the sub-vector as a valid dimension. The recall module is used to screen the second vector representation of the data in the database based on the similarity between the first sub-vector of the first dimension and multiple second sub-vectors of the first dimension to obtain M second vector representations, wherein M≥1, the first sub-vector is obtained by cutting from the first vector representation, a second sub-vector is obtained by cutting from a second vector representation, and a second vector representation is obtained by encoding a data in the database through the elastic dimension semantic model, and the first dimension is smaller than the dimension of the first vector representation. A sorting module is used to determine search results from data associated with the M second vector representations based on the similarity between a third subvector of the second dimension and M fourth subvectors of the second dimensions, wherein the third subvector is obtained by segmenting the first vector representation, a fourth subvector is obtained by segmenting a vector representation included in the M second vector representations, the second dimension is greater than the first dimension, and the second dimension is less than or equal to the dimension of the first vector representation.
[0012] In a possible implementation, the recall module is further used to: based on the similarity between the third subvector of the second dimension and the M fourth subvectors of the second dimensions, screen the data associated with the M second vector representations to obtain N second vector representations, N≤M. The sorting module is further used to: based on the similarity between the fifth subvector of the third dimension and the N sixth subvectors of the third dimension, determine the search results from the data associated with the N second vector representations, wherein the fifth subvector is obtained by segmenting the first vector representation, a sixth subvector is obtained by segmenting a vector representation included in the N second vector representations, the third dimension is greater than the second dimension, and the third dimension is less than or equal to the dimension of the first vector representation.
[0013] In a possible implementation, the sorting module is further used to: sort the N second vector representations based on the similarity between the fifth sub-vector of the third dimension and the N sixth sub-vectors of the third dimension; and use the obtained sorting result as the search result.
[0014] In a possible implementation, the second vector representation of the data in the database is obtained by pre-encoding the data in the database through an elastic dimension semantic model.
[0015] In a possible implementation, the information search device further includes: a model training module. The model training module is used to: obtain a training sample set, the training sample set includes first data and second data; encode the first data and second data respectively through the elastic dimension semantic model to be trained to obtain a third vector representation and a fourth vector representation; based on the number and dimension values of the dimensions that can be segmented by the preset elastic dimension vector, segment the third vector representation to obtain K seventh sub-vectors, and segment the fourth vector representation to obtain K eighth sub-vectors; sequentially combine the K seventh sub-vectors to obtain K ninth sub-vectors of different dimensions, and sequentially combine the K eighth sub-vectors to obtain K tenth sub-vectors of different dimensions, wherein the ninth sub-vector of the i-th dimension and the tenth sub-vector of the i-th dimension have the same dimension, 1≤i≤K; respectively calculate the similarity between the ninth sub-vector and the tenth sub-vector of the same dimension to obtain K similarities; and train the elastic dimension semantic model based on the K similarities. In this way, the training of the elastic dimension semantic model can be completed.
[0016] In a possible implementation, when the model training module trains the elastic dimension semantic model based on K similarities, it is specifically used to: divide the training process of the elastic dimension semantic model into K training stages, wherein in the i-th training stage, the elastic dimension semantic model is trained based on the similarity associated with the first dimension to the similarity associated with the i-th dimension. .
[0017] In a third aspect, the present application provides a model training method, the method comprising: obtaining a training sample set, the training sample set comprising first data and second data; encoding the first data and the second data respectively through the elastic dimension semantic model to be trained to obtain a first vector representation and a second vector representation; based on the number and dimension values of dimensions that can be divided by the preset elastic dimension vector, dividing the first vector representation to obtain N first sub-vectors, and dividing the second vector representation to obtain N second sub-vectors; combining the N first sub-vectors in sequence to obtain N third sub-vectors of different dimensions, and combining the N second sub-vectors in sequence to obtain N fourth sub-vectors of different dimensions, wherein the third sub-vector of the i-th dimension and the fourth sub-vector of the i-th dimension have the same dimension, 1≤i≤N; respectively calculating the similarity between the third sub-vector and the fourth sub-vector of the same dimension to obtain N similarities; obtaining N losses based on each of the N similarities; training the elastic dimension semantic model based on the target loss, wherein the target loss is obtained based on the N losses.
[0018] In a fourth aspect, the present application provides a model training device, comprising: an acquisition module, used to acquire a training sample set, the training sample set including first data and second data; an encoding module, used to encode the first data and the second data respectively through an elastic dimension semantic model to be trained to obtain a first vector representation and a second vector representation; a segmentation module, used to segment the first vector representation based on the number and dimension values of dimensions that can be segmented by a preset elastic dimension vector to obtain N first sub-vectors, and to segment the second vector representation to obtain N second sub-vectors; a combination module, used to sequentially N first sub-vectors are combined to obtain N third sub-vectors of different dimensions, and N second sub-vectors are combined in sequence to obtain N fourth sub-vectors of different dimensions, wherein the third sub-vector of the i-th dimension and the fourth sub-vector of the i-th dimension have the same dimension, 1≤i≤N; a processing module is used to respectively calculate the similarity between the third sub-vector and the fourth sub-vector of the same dimension to obtain N similarities, and obtain N losses based on each of the N similarities, and train the elastic dimension semantic model based on the target loss, wherein the target loss is obtained based on the N losses.
[0019] In a fifth aspect, the present application provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the method described in the first aspect or any possible implementation of the first aspect, or executes the method described in the second aspect.
[0020] In a sixth aspect, the present application provides a computer-readable storage medium, including computer program instructions, when the computer program instructions are executed by a computing device, the computing device executes the method described in the first aspect or any possible implementation of the first aspect; or, when the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect or any possible implementation of the first aspect, or executes the method described in the second aspect. Exemplarily, the computing device cluster may include one or more computing devices.
[0021] In a seventh aspect, the present application provides a computer program product comprising instructions, which, when executed by a computing device, causes the computing device to execute the method described in the first aspect or any possible implementation of the first aspect, or, when executed by a computing device cluster, causes the computing device cluster to execute the method described in the first aspect or any possible implementation of the first aspect, or execute the method described in the second aspect. Exemplarily, the computing device cluster may include one or more computing devices.
[0022] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a schematic diagram of the architecture of an information search system provided by an embodiment of the present application;
[0024] Figure 2 is a schematic diagram of the architecture of another information search system provided in an embodiment of the present application;
[0025] Figure 3 It is a schematic diagram of the architecture of another information search system provided in an embodiment of the present application;
[0026] Figure 4 It is a schematic diagram of the steps of a method for training an elastic dimension semantic model provided in an embodiment of the present application;
[0027] Figure 5 This is a schematic diagram of a process of vector segmentation, combination and loss calculation provided by an embodiment of the present application;
[0028] Figure 6 It is a flowchart of an information search method provided by an embodiment of the present application;
[0029] Figure 7 is a structural schematic diagram of an information search device provided in an embodiment of the present application;
[0030] Figure 8 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0031] Fig. 9 is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0032] Fig.10 It is a structural diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.
[0034] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first response message and a second response message are used to distinguish different response messages rather than to describe a specific order of the response messages.
[0035] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0036] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.
[0037] First, some technical terms involved in this application are introduced.
[0038] (1) Semantic Model
[0039] The semantic model is a deep learning-based model whose main function is to obtain vector representations of various types of data.
[0040] (2) Elastic Dimension Vector
[0041] An elastic dimension vector is a vector that can directly split some sub-vectors in a vector as valid low-dimensional vectors. In the process of splitting the elastic dimension vector, it is only necessary to directly obtain a vector fragment of a certain dimension (and the dimension is valid) without calculating the original vector.
[0042] (3) Elastic Dimension Semantic Model
[0043] The elastic dimension semantic model is a semantic model that can output elastic vectors.
[0044] Next, the technical solution provided by this application is introduced.
[0045] Generally speaking, the implementation and application of deep learning-based vector representation technology in recall and sorting can be as follows: Figure 1 As shown, it can generally be divided into three stages: vector reasoning, recall, and sorting. In the vector reasoning stage, it can be divided into offline reasoning process and online reasoning process: the offline reasoning process is to use the semantic model to infer all large-scale data into vectors, and save them to form a large-scale vector library; the online reasoning process infers the query input by the user once into a vector in real time. In the recall stage, a low-complexity algorithm is used to calculate the similarity between the query vector and each data in the vector library, and some candidate sets are selected. In the sorting stage, the query vector, the vectors in the candidate set and other features are combined, and a more complex algorithm is used to re-sort the data in the candidate set to finally obtain relevant results. Figure 1 In order to improve system accuracy, higher-dimensional vector representations are generally used. However, high-dimensional vectors also mean higher consumption of computing resources, especially in the recall phase. High-dimensional vectors will bring high computing latency, affecting user experience.
[0046] To solve Figure 1 The problem with the system shown in is that vectors of different dimensions can be used in different stages. In the recall stage, a semantic model can be used to obtain low-dimensional vectors, and in the sorting stage, another semantic model can be used to obtain high-dimensional vectors. However, this approach requires the configuration of multiple semantic models, which occupies reasoning resources, and requires multiple reasoning on the query and data in the database, which increases the online computing latency and offline reasoning time. In addition, it also needs to save the low-dimensional vectors and high-dimensional vectors of the data in the database obtained by offline calculation at the same time, which increases the consumption of storage resources.
[0047] In view of this, an embodiment of the present application provides a schematic diagram of the architecture of an information search system. Figure 2 As shown, the information search system 200 may include: an elastic dimension semantic model 210 , an offline vector library 220 , a vector segmentation module 230 , a recall module 240 and a sorting module 250 .
[0048] The elastic dimension semantic model 210 is mainly used to encode the query statement (query) input by the user into an elastic dimension query vector (i.e., elastic dimension vector) online in the vector reasoning stage, and to encode each data in the large-scale database into an elastic dimension vector offline. Exemplarily, the data in the large-scale database can be web page data, advertising data, or other data, which can be determined according to the actual situation and is not limited here.
[0049] The offline vector library 220 is mainly used to store the elastic dimension vectors obtained by respectively encoding each data in the large-scale database by the elastic dimension semantic model 210 .
[0050] The vector segmentation module 230 is mainly used to segment the elastic dimension vectors encoded by the elastic dimension semantic model 210 to obtain at least one low-dimensional vector of each elastic dimension vector.
[0051] The recall module 240 is mainly used to perform recall calculation based on the low-dimensional query vector obtained by the vector segmentation module 230 and the low-dimensional vector set obtained by segmentation from the offline vector library, through algorithms such as pre-cosine similarity, to obtain a low-dimensional vector candidate set containing low-dimensional vectors. Among them, the low-dimensional vector candidate set contains low-dimensional vectors of the elastic dimension vector stored in the offline vector library 220.
[0052] The sorting module 250 is mainly used to filter out high-dimensional vectors corresponding to each low-dimensional vector contained in the low-dimensional vector candidate set from the offline vector library 220 to obtain a high-dimensional vector set; and, through algorithms such as pre-cosine similarity, sort and calculate the high-dimensional query vector and the high-dimensional vectors in the high-dimensional vector set to obtain a sorting result, and output the sorting result. The sorting result can be used as the search result of the user.
[0053] exist Figure 2 In the information search system 200 shown, the elastic dimension vector can be encoded by the elastic dimension semantic model 210, so that only one type of vector can be stored instead of storing multiple vectors, saving storage resources. In addition, the elastic dimension semantic model 210 only needs to be encoded once, saving computing resources. At the same time, the elastic dimension vector can be directly segmented, so in the recall stage, the recall calculation can be performed by using the low-dimensional vector, and the low-dimensional vector can be obtained without calculation, which further saves computing resources.
[0054] In addition, in order to improve the accuracy of the information search system, multiple vector segmentation modules and multiple recall modules can be configured. Figure 3 As shown. Figure 3 In the above, a vector segmentation module 230 and a recall module 240 are a combination, and these combinations are connected in series, that is, the output of the recall module in one combination is the input of the vector segmentation module 230 in another combination. The vector segmentation module 230 in the nth combination is mainly used to segment the vectors in the offline vector library 220 to obtain a vector with a higher dimension than each vector in the vector candidate set based on the vector candidate set output by the recall module 240 in the n-1th combination, and to segment the query vector of the elastic dimension to obtain a query vector with a higher dimension. Among them, the dimension segmented by the vector segmentation module 230 in a certain combination can be preset. The recall module in a combination is mainly used to calculate the similarity between the query vector segmented by the vector segmentation module 230 in the combination and other vectors, so as to recall a suitable low-dimensional vector candidate set. The number of vectors required to be recalled by the recall module in a certain combination can be preset. In the above, the vector segmentation module 230 in the nth combination is mainly used to segment the query vector and other vectors, and to obtain a suitable low-dimensional vector candidate set. The number of vectors required to be recalled by the recall module in a certain combination can be preset. Figure 3 In the information search system 300 shown, more accurate vectors can be screened out through multi-level screening in the recall stage, so that the obtained ranking results can be made more accurate.
[0055] From the above introduction to the information search systems 200 and 300, it can be seen that the key to the operation of the two information search systems lies in the elastic dimension semantic model 210. Therefore, how to obtain the elastic dimension semantic model 210 is the top priority of the two information search systems. The following describes how to obtain the elastic dimension semantic model 210.
[0056] For example, Figure 4 The following is a schematic diagram showing the steps of a method for training an elastic dimension semantic model provided by an embodiment of the present application. It can be understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. Figure 4 As shown, the elastic dimension semantic model training method may include the following steps:
[0057] S401: Acquire a training sample set, where the training sample set includes a first sample, and the first sample includes first data and second data.
[0058] In this embodiment, the training sample set may be, but is not limited to, pre-set. The training sample set may include a first sample, and the first sample includes first data and second data.
[0059] S402 . Encode the first data and the second data respectively through the elastic dimensional semantic model to be trained to obtain a first vector representation and a second vector representation.
[0060] In this embodiment, the first data and the second data can be respectively input into the elastic dimension semantic model to be trained, so that the first data and the second data can be respectively encoded by the elastic dimension semantic model to be trained, thereby obtaining a first vector representation related to the first data and a second vector representation related to the second data.
[0061] S403. Based on the number and dimension values of the preset elastic dimensional vector that can be divided, the first vector representation is divided to obtain N first sub-vectors, and the second vector representation is divided to obtain N second sub-vectors.
[0062] In this embodiment, the number of dimensions and the values of each dimension that the elastic dimension vector output by the elastic dimension semantic model can be pre-set. Then, based on the number of dimensions and the values of the dimensions that the preset elastic dimension vector can be split into, the first vector representation can be split to obtain N first sub-vectors, and the second vector representation can be split to obtain N second sub-vectors. It should be understood that N can also be replaced by other letters, such as K, as long as it can represent the quantity.
[0063] For example, taking the first vector representation as an example, if the dimension of the first vector representation is D E, we need N sub-vectors of different dimensions E0, E1, ..., E n , and the dimensions are D0, D1, ..., D n , the dimension of the N sub-vectors obtained by splitting the first vector representation is in, And so on. And D n ≤D E For a more vivid understanding, please refer to Figure 5 , n sub-vectors can be obtained by splitting the first vector representation, sub-vector 1 can be the sub-vector of the first dimension, the combination of sub-vectors 1 and 2 can be the sub-vector of the second dimension, the combination of sub-vectors 1, 2 and 3 can be the sub-vector of the third dimension, and so on. The sub-vector of the nth dimension is the combination of sub-vectors 1 to n, that is, the first vector representation.
[0064] S404. Combine the N first sub-vectors in sequence to obtain N third sub-vectors of different dimensions, and combine the N second sub-vectors in sequence to obtain N fourth sub-vectors of different dimensions, wherein the third sub-vector of the i-th dimension and the fourth sub-vector of the i-th dimension have the same dimension, 1≤i≤N.
[0065] In this embodiment, after obtaining N first sub-vectors, the N first sub-vectors may be combined in sequence to obtain N third sub-vectors of different dimensions. Figure 5 , subvector 1 can be a subvector of the first dimension, the combination of subvectors 1 and 2 can be a subvector of the second dimension, the combination of subvectors 1, 2, and 3 can be a subvector of the third dimension, and so on. The subvector of the Nth dimension is the combination of subvectors 1 to n, that is, the first vector representation. Similarly, the N second subvectors can be combined in sequence to obtain N fourth subvectors of different dimensions. Among them, the third subvector of the i-th dimension and the fourth subvector of the i-th dimension have the same dimension, 1≤i≤N.
[0066] S405 . Calculate the similarities between the third sub-vector and the fourth sub-vector of the same dimension respectively to obtain N similarities.
[0067] In this embodiment, the similarities between the third sub-vector and the fourth sub-vector of the same dimension may be calculated respectively by using an algorithm such as cosine similarity to obtain N similarities.
[0068] S406: Based on the N similarities, train an elastic dimension semantic model.
[0069] In this embodiment, after N similarities are obtained, the elastic dimension semantic model can be trained based on the N similarities.
[0070] As a possible implementation method, N losses can be obtained based on each of the N similarities. Then, the elastic dimension semantic model is trained based on the target loss, wherein the target loss is obtained based on the N losses. Specifically, the loss function can be used to calculate the label of the first sample and each of the N similarities, respectively, to obtain N losses. Among them, for any one of the N losses, the similarity associated with the arbitrary loss and the label of the first sample can be calculated by the loss function to obtain the difference between the two, thereby obtaining the value of the arbitrary loss. Of course, in addition to the loss calculation methods listed here, other methods can also be used to calculate the loss to obtain N losses. The specific loss calculation method can be selected according to the actual situation and is not limited here. For example, continue to refer to Figure 5 , the loss calculated by the sub-vector of the first dimension is Loss1, the loss calculated by the sub-vector of the second dimension is Loss2, the loss calculated by the sub-vector of the third dimension is Loss3, and the loss calculated by the sub-vector of the nth dimension is Loss n. After obtaining these losses, N losses are obtained. After obtaining N losses, the target loss can be obtained by summing the N losses. Then, with the goal of minimizing the target loss, the elastic dimension semantic model is trained to obtain the required elastic dimension semantic model.
[0071] As another possible implementation, the elastic dimension semantic model can be trained in stages. Specifically, in the first stage, the elastic dimension semantic model can be trained using the similarity between the third subvector and the fourth subvector of the first dimension. In the second stage, the elastic dimension semantic model can be trained using the similarity between the third subvector and the fourth subvector of the first dimension and the similarity between the third subvector and the fourth subvector of the second dimension. Similarly, in the Nth stage, the elastic dimension semantic model can be trained using the similarity between the third subvector and the fourth subvector of the first dimension to the similarity between the third subvector and the fourth subvector of the Nth dimension. Exemplarily, when the elastic dimension semantic model is trained using the similarity between the third subvector and the fourth subvector of the first dimension to the similarity between the third subvector and the fourth subvector of the i-th dimension, the loss function can be used to calculate these similarities and the label of the first sample respectively to obtain i losses; then, the elastic dimension semantic model is trained with the goal of minimizing a loss obtained based on the i losses. For example, when N=3, the divided training stages can be 3 stages. In the first stage, the similarity related to the first dimension can be used for training; in the second stage, the similarity related to the first dimension and the similarity related to the second dimension can be used for training; in the third stage, the similarity related to the first dimension, the similarity related to the second dimension, and the similarity related to the third dimension can be used for training.
[0072] In this way, the training of the elastic dimension semantic model is realized. By encoding a certain data with the elastic dimension semantic model obtained through the training, the elastic dimension vector related to the data can be obtained.
[0073] After the training of the elastic dimension semantic model is completed, the trained elastic dimension semantic model can be used to search for information. The following describes the process of using the trained elastic dimension semantic model to search for information.
[0074] For example, Figure 6 FIG. 1 is a flow chart of an information search method provided by an embodiment of the present application. It is understood that the method can be executed by any device, equipment, platform, or equipment cluster with computing and processing capabilities. Figure 6 As shown, the information search method may include the following steps:
[0075] S601: Encode a query statement input by a user through an elastic dimension semantic model to obtain a first vector representation.
[0076] In this embodiment, when a user performs an information query, the query statement input by the user may be encoded using the elastic dimension semantic model to obtain a first vector representation of an elastic dimension.
[0077] S602: Split the first vector representation to obtain a first sub-vector of a first dimension, where the first dimension is smaller than a dimension of the first vector representation.
[0078] In this embodiment, after obtaining the first vector representation, the first vector representation may be segmented to obtain a first subvector of a first dimension. The first dimension is smaller than the dimension of the first vector representation. That is, by segmenting the first vector representation, a low-dimensional vector representation is obtained.
[0079] S603. Based on the similarity between the first sub-vector of the first dimension and the multiple second sub-vectors of the first dimension, screen the vector representation of the data in the database to obtain M second vector representations, wherein the dimension of the second vector representation is the same as the dimension of the first vector representation, and a second sub-vector is obtained by segmenting the second vector representation of a data in the database.
[0080] In this embodiment, after obtaining the first sub-vector of the first dimension, the second vector representation of the data in the database can be segmented to obtain the second sub-vector of the first dimension associated with each data in the database. Among them, the dimension of the second vector representation is the same as the dimension of the first vector representation, and the second vector representation of a data is obtained by pre-encoding the data through the elastic dimension semantic model. Then, the similarity between the first sub-vector of the first dimension and the second sub-vectors of each first dimension can be calculated by algorithms such as cosine similarity. Then, the calculated similarities are sorted from large to small, and the top M second sub-vectors are selected. Finally, after the vector representation of the data associated with these M second sub-vectors is selected, M second vector representations can be obtained.
[0081] S604: Split the first vector representation to obtain a third sub-vector of a second dimension, where the second dimension is greater than the first dimension and less than or equal to the dimension of the first vector representation.
[0082] In this embodiment, after the M second vector representations are screened out, the first vector representation may be segmented to obtain a third subvector of a second dimension, wherein the second dimension is greater than the first dimension and less than or equal to the dimension of the first vector representation.
[0083] S605 . Determine a search result based on the similarity between the third sub-vector of the second dimension and M fourth sub-vectors of the second dimension, wherein a fourth sub-vector of the second dimension is obtained by segmenting a second vector representation.
[0084] In this embodiment, after obtaining M second vector representations, each vector representation in the M second vector representations can be segmented to obtain M fourth sub-vectors of the second dimension. Finally, based on the similarity between the third sub-vector of the second dimension and the fourth sub-vectors of each second dimension, the search result is determined. For example, based on the calculated similarity, the data associated with the M second vector representations can be sorted, and the sorting result can be used as the search result. In some embodiments, in order to improve the accuracy of the search results, the data associated with the M second vector representations can be screened through a sub-vector of one dimension. Specifically, first, the data associated with the M second vector representations are screened through the similarity between the calculated third sub-vector and the fourth sub-vector of each second dimension to obtain N second vector representations, N≤M. For example, the calculated similarities can be sorted from large to small, and the first N can be selected. Then, a fifth sub-vector of the third dimension can be segmented from the first vector representation, and a sixth sub-vector of the third dimension can be segmented from each vector representation contained in the N second vector representations. The third dimension is greater than the second dimension and less than or equal to the dimension represented by the first vector. Finally, the search result is determined based on the similarity between the fifth subvector of the third dimension and the N sixth subvectors of the third dimension. For example, the data associated with the N second vector representations can be sorted based on the calculated similarity, and the sorting result is used as the search result.
[0085] In this way, the elastic dimension vector is obtained by encoding the elastic dimension semantic model, so that only one type of vector can be stored instead of multiple vectors, saving storage resources. In addition, the elastic dimension semantic model only needs to be encoded once, saving computing resources. At the same time, the elastic dimension vector can be split, so in the recall stage, the recall calculation can be performed by using a low-dimensional vector, which further saves computing resources.
[0086] It is understandable that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0087] The above is an introduction to the information search method provided by the embodiment of the present application. Next, based on the method in the above embodiment, an information search device provided by the embodiment of the present application is introduced.
[0088] For example, Figure 7 FIG. 1 is a schematic diagram showing the structure of an information search device provided by an embodiment of the present application. Figure 7As shown, the information search device 700 may include: an encoding module 701, a recall module 702 and a sorting module 703. The encoding module 701 is used to encode the query statement input by the user through the elastic dimension semantic model to obtain a first vector representation, wherein the vector obtained by encoding the elastic dimension semantic model is an elastic dimension vector, and the elastic dimension vector is a vector that can cut out a part of sub-vectors as valid dimensions. The recall module 702 is used to screen the second vector representation of the data in the database based on the similarity between the first sub-vector of the first dimension and multiple second sub-vectors of the first dimension to obtain M second vector representations, wherein M≥1, the first sub-vector is obtained by cutting from the first vector representation, a second sub-vector is obtained by cutting from a second vector representation, a second vector representation is obtained by encoding a data in the database through the elastic dimension semantic model, and the first dimension is smaller than the dimension of the first vector representation. The sorting module 703 is used to determine the search results from the data associated with the M second vector representations based on the similarity between the third subvector of the second dimension and the M fourth subvectors of the second dimension, wherein the third subvector is obtained by segmenting the first vector representation, a fourth subvector is obtained by segmenting a vector representation included in the M second vector representations, the second dimension is greater than the first dimension, and the second dimension is less than or equal to the dimension of the first vector representation. Exemplarily, the encoding module 701 can be the aforementioned Figure 2 The elastic dimension semantic model 210 described above; the recall module 702 can be the aforementioned Figure 2 The recall module 240 described above; the sorting module 703 can be the aforementioned Figure 2 The sorting module 250 is described.
[0089] In some embodiments, the recall module 702 is further used to: based on the similarity between the third subvector of the second dimension and the M fourth subvectors of the second dimensions, screen the data associated with the M second vector representations to obtain N second vector representations, N ≤ M. The sorting module 703 is further used to: based on the similarity between the fifth subvector of the third dimension and the N sixth subvectors of the third dimension, determine the search results from the data associated with the N second vector representations, wherein the fifth subvector is obtained by segmenting the first vector representation, a sixth subvector is obtained by segmenting a vector representation included in the N second vector representations, the third dimension is greater than the second dimension, and the third dimension is less than or equal to the dimension of the first vector representation.
[0090] In some embodiments, the sorting module 703 is further used to: sort the N second vector representations based on the similarity between the fifth sub-vector of the third dimension and the N sixth sub-vectors of the third dimension; and use the obtained sorting result as the search result.
[0091] In some embodiments, the second vector representation of the data in the database is obtained by pre-encoding the data in the database through an elastic dimension semantic model.
[0092] In some embodiments, the information search device 700 further includes: a model training module (not shown in the figure). The model training module is used to: obtain a training sample set, the training sample set includes first data and second data; encode the first data and second data respectively through the elastic dimension semantic model to be trained to obtain a third vector representation and a fourth vector representation; based on the number and dimension values of the dimensions that can be segmented by the preset elastic dimension vector, the third vector representation is segmented to obtain K seventh sub-vectors, and the fourth vector representation is segmented to obtain K eighth sub-vectors; the K seventh sub-vectors are sequentially combined to obtain K ninth sub-vectors of different dimensions, and the K eighth sub-vectors are sequentially combined to obtain K tenth sub-vectors of different dimensions, wherein the ninth sub-vector of the i-th dimension and the tenth sub-vector of the i-th dimension have the same dimension, 1≤i≤N; respectively calculate the similarity between the ninth sub-vector and the tenth sub-vector of the same dimension to obtain K similarities; based on the K similarities, the elastic dimension semantic model is trained. In this way, the training of the elastic dimension semantic model can be completed.
[0093] In some embodiments, when the model training module trains the elastic dimension semantic model based on K similarities, it is specifically used to: divide the training process of the elastic dimension semantic model into K training stages, wherein in the i-th training stage, the elastic dimension semantic model is trained based on the similarity associated with the first dimension to the similarity associated with the i-th dimension. .
[0094] In some embodiments, Figure 7 The encoding module 701, the recall module 702, and the sorting module 703 shown in the figure can be implemented by software or by hardware. Exemplarily, the implementation of the encoding module 701 is introduced below by taking the encoding module 701 as an example. Similarly, the implementation of the recall module 702 and the sorting module 703 can refer to the implementation of the encoding module 701.
[0095] As an example of a software functional unit, the coding module 701 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the coding module 701 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.
[0096] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0097] As an example of a hardware functional unit, the encoding module 701 may include at least one computing device, such as a server, etc. Alternatively, the encoding module 701 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0098] The multiple computing devices included in the encoding module 701 can be distributed in the same region or in different regions. The multiple computing devices included in the encoding module 701 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the encoding module 701 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0099] It should be noted that, in other embodiments, the encoding module 701 can be used to execute any step in the information search method described in the above embodiment, and the recall module 702 and / or the sorting module 703 can also be used to execute any step in the information search method described in the above embodiment. The steps implemented by the encoding module 701, the recall module 702 and the sorting module 703 can be specified as needed, and the encoding module 701, the recall module 702 and the sorting module 703 can respectively implement different steps in the information search method described in the above embodiment to achieve Figure 7 The entire functionality of the information search device 700 is shown.
[0100] The present application also provides a computing device 800. Figure 8 As shown, the computing device 800 includes: a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 communicate through the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 800.
[0101] The bus 802 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 804 is represented by only one line, but does not mean that there is only one bus or one type of bus. The bus 804 may include a path for transmitting information between various components of the computing device 800 (eg, the memory 806, the processor 804, and the communication interface 808).
[0102] The processor 804 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0103] The memory 806 may include a volatile memory, such as a random access memory (RAM). The processor 804 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0104] The memory 806 stores executable program codes, and the processor 804 executes the executable program codes to respectively implement the aforementioned Figure 7 The functions of the encoding module 701, the recall module 702 and the sorting module 703 shown in the above embodiment are implemented to realize the information search method described in the above embodiment. That is, the memory 806 stores instructions for executing the information search method described in the above embodiment.
[0105] Alternatively, the memory 806 stores executable codes, and the processor 804 executes the executable codes to respectively implement the aforementioned Figure 7 The functions of the information search device 700 shown in the figure are implemented to realize the information search method described in the above embodiment. That is, the memory 806 stores instructions for executing the information search method described in the above embodiment.
[0106] The communication interface 803 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or a communication network.
[0107] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0108] like Fig. 9As shown, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the information search method described in the above embodiment.
[0109] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also respectively store some instructions for executing the information search method described in the above embodiment. In other words, the combination of one or more computing devices 800 may jointly execute the instructions for executing the information search method described in the above embodiment.
[0110] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster may store different instructions, which are respectively used to execute the aforementioned Figure 7 The information search apparatus 700 shown in FIG. 8 is a partial function. That is, the instructions stored in the memory 806 in different computing devices 800 can implement the functions of one or more modules among the encoding module 701 , the recall module 702 and the sorting module 703 .
[0111] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.10 A possible implementation is shown. Fig.10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the functions of the encoding module 701. At the same time, the memory 806 in the computing device 800B stores instructions for executing the functions of the recall module 702 and the sorting module 703.
[0112] It should be understood that Fig.10 The functions of the computing device 800A shown in FIG. 8 may also be completed by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be completed by multiple computing devices 800.
[0113] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Fig. 9 and Fig.10 The connection mode of the computing device cluster is different in that the memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the method in the above embodiment.
[0114] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store some instructions for executing the aforementioned data processing method. In other words, the combination of one or more computing devices 800 may jointly execute instructions for executing the aforementioned data processing method.
[0115] Based on the method in the above embodiment, the embodiment of the present application provides a computer-readable storage medium, including computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the method in the above embodiment; or, when the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method in the above embodiment. Exemplarily, the computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0116] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product containing instructions, which, when executed by a computing device, enables the computing device to execute the method in the above embodiment, or, when executed by a computing device cluster, enables the computing device cluster to execute the method in the above embodiment.
[0117] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0118] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0119] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. 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 through the computer-readable storage medium. The computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. 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. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0120] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.
[0121] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present application.
Claims
1. An information search method, characterized in that: The method comprises: Encoding the query statement input by the user through the elastic dimension semantic model to obtain a first vector representation, wherein the vector obtained by encoding the elastic dimension semantic model is an elastic dimension vector, and the elastic dimension vector is a vector that can directly split a part of sub-vectors as valid dimensions; Based on the similarity between the first subvector of the first dimension and the second subvectors of the multiple first dimensions, the second vector representations of the data in the database are screened to obtain M second vector representations, where M≥1, the first subvector is obtained by segmenting the first vector representation, one second subvector is obtained by segmenting one second vector representation, one second vector representation is obtained by encoding one data in the database through the elastic dimensional semantic model, and the first dimension is smaller than the dimension of the first vector representation; Based on the similarity between the third sub-vector of the second dimension and the M fourth sub-vectors of the second dimensions, a search result is determined from the data associated with the M second vector representations, wherein the third sub-vector is obtained by segmenting the first vector representation, one of the fourth sub-vectors is obtained by segmenting a vector representation included in the M second vector representations, and the second dimension is greater than the first dimension, and the second dimension is less than or equal to the dimension of the first vector representation.
2. The method according to claim 1, characterized in that The determining of search results from data associated with the M second vector representations based on the similarity between the third sub-vector of the second dimension and the M fourth sub-vectors of the second dimension comprises: Based on the similarity between the third subvector of the second dimension and the M fourth subvectors of the second dimensions, screening the data associated with the M second vector representations to obtain N second vector representations, N≤M; The search result is determined from data associated with the N second vector representations based on a similarity between a fifth sub-vector of the third dimension and N sixth sub-vectors of the third dimension, wherein the fifth sub-vector is obtained by segmenting the first vector representation, one sixth sub-vector is obtained by segmenting a vector representation included in the N second vector representations, the third dimension is greater than the second dimension, and the third dimension is less than or equal to the dimension of the first vector representation.
3. The method according to claim 2, characterized in that The step of determining the search result from the data associated with the N second vector representations based on the similarity between the fifth sub-vector of the third dimension and the N sixth sub-vectors of the third dimension comprises: sorting the N second vector representations based on the similarity between the fifth sub-vector of the third dimension and the N sixth sub-vectors of the third dimension; The obtained ranking result is used as the search result.
4. The method according to any one of claims 1 to 3, characterized in that: The second vector representation of the data in the database is obtained by pre-encoding the data in the database through the elastic dimension semantic model.
5. The method according to any one of claims 1 to 4, characterized in that: Before encoding the query statement input by the user through the elastic dimension semantic model, it also includes: Acquire a training sample set, where the training sample set includes first data and second data; Encoding the first data and the second data respectively through the elastic dimension semantic model to be trained to obtain a third vector representation and a fourth vector representation; Based on the number and dimension values of the dimensions that can be divided by the preset elastic dimension vector, the third vector representation is divided to obtain K seventh sub-vectors, and the fourth vector representation is divided to obtain K eighth sub-vectors; The K seventh sub-vectors are combined in sequence to obtain K ninth sub-vectors of different dimensions, and the K eighth sub-vectors are combined in sequence to obtain K tenth sub-vectors of different dimensions, wherein the ninth sub-vector of the i-th dimension and the tenth sub-vector of the i-th dimension have the same dimension, 1≤i≤K; Respectively calculating the similarity between the ninth sub-vector and the tenth sub-vector of the same dimension to obtain K similarities; The elastic dimension semantic model is trained based on the K similarities.
6. The method according to claim 5, characterized in that The step of training the elastic dimension semantic model based on the K similarities includes: The training process of the elastic dimension semantic model is divided into K training stages, wherein in the i-th training stage, the elastic dimension semantic model is trained based on the similarity associated with the first dimension to the similarity associated with the i-th dimension.
7. An information search device, characterized in that: include: An encoding module, used for encoding the query statement input by the user through the elastic dimension semantic model to obtain a first vector representation, wherein the vector obtained by encoding the elastic dimension semantic model is an elastic dimension vector, and the elastic dimension vector is a vector that can directly cut out a part of sub-vectors as effective dimensions; A recall module, configured to screen the second vector representations of data in the database based on the similarity between the first subvector of the first dimension and the second subvectors of the plurality of first dimensions, so as to obtain M second vector representations, wherein M≥1, the first subvector is obtained by segmenting the first vector representation, a second subvector is obtained by segmenting a second vector representation, a second vector representation is obtained by encoding a piece of data in the database through the elastic dimension semantic model, and the first dimension is smaller than the dimension of the first vector representation; A sorting module is used to determine search results from data associated with the M second vector representations based on the similarity between a third subvector of the second dimension and M fourth subvectors of the second dimensions, wherein the third subvector is obtained by segmenting the first vector representation, one of the fourth subvectors is obtained by segmenting a vector representation included in the M second vector representations, and the second dimension is greater than the first dimension, and the second dimension is less than or equal to the dimension of the first vector representation.
8. The device according to claim 7, characterized in that The recall module is further used to: based on the similarity between the third subvector of the second dimension and the fourth subvectors of the M second dimensions, screen the data associated with the M second vector representations to obtain N second vector representations, N≤M; The sorting module is further used to determine the search result from the data associated with the N second vector representations based on the similarity between the fifth sub-vector of the third dimension and N sixth sub-vectors of the third dimension, wherein the fifth sub-vector is obtained by segmenting the first vector representation, one sixth sub-vector is obtained by segmenting a vector representation included in the N second vector representations, the third dimension is greater than the second dimension, and the third dimension is less than or equal to the dimension of the first vector representation.
9. The device according to claim 8, characterized in that The sorting module is further used for: sorting the N second vector representations based on the similarity between the fifth sub-vector of the third dimension and the N sixth sub-vectors of the third dimension; The obtained ranking result is used as the search result.
10. The device according to any one of claims 7 to 9, characterized in that: The second vector representation of the data in the database is obtained by pre-encoding the data in the database through the elastic dimension semantic model.
11. The device according to any one of claims 7 to 10, characterized in that: Also includes: Model training module; Wherein, the model training module is used to: Acquire a training sample set, where the training sample set includes first data and second data; Encoding the first data and the second data respectively through the elastic dimension semantic model to be trained to obtain a third vector representation and a fourth vector representation; Based on the number and dimension values of the dimensions that can be divided by the preset elastic dimension vector, the third vector representation is divided to obtain K seventh sub-vectors, and the fourth vector representation is divided to obtain K eighth sub-vectors; Sequentially combine the K seventh sub-vectors to obtain K ninth sub-vectors of different dimensions, and sequentially combine the K eighth sub-vectors to obtain K tenth sub-vectors of different dimensions, wherein the ninth sub-vector of the i-th dimension and the tenth sub-vector of the i-th dimension have the same dimension, 1≤i≤N; Respectively calculating the similarity between the ninth sub-vector and the tenth sub-vector of the same dimension to obtain K similarities; The elastic dimension semantic model is trained based on the K similarities.
12. The device according to claim 11, characterized in that When the model training module trains the elastic dimension semantic model based on the K similarities, it is specifically used to: The training process of the elastic dimension semantic model is divided into K training stages, wherein in the i-th training stage, the elastic dimension semantic model is trained based on the similarity associated with the first dimension to the similarity associated with the i-th dimension. .
13. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1-6.
14. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the instructions are executed by a computing device cluster, the computing device cluster enables the computing device cluster to perform the method according to any one of claims 1 to 6, wherein the computing device cluster comprises at least one computing device.
15. A computer program product comprising instructions, characterized in that When the instruction is executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 6, wherein the computing device cluster includes at least one computing device.
Citation Information
Cited By
Vector retrieval-based industrial chain data semantic matching method and related equipment
CN121210642A