Vector retrieval adaptive optimization method and related device

By automatically adjusting the compression model by monitoring changes in key vector rankings, the performance degradation caused by changes in data distribution is solved, achieving efficient, accurate, and low-cost model optimization for vector retrieval.

CN120973992AActive Publication Date: 2025-11-18FLYING FOX INFORMATION TECH TIANJIN CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511503143.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-21
Publication Date
2025-11-18
Estimated Expiration
2045-10-21

AI Technical Summary

Technical Problem

Existing technologies cannot adjust in time when faced with the performance degradation of compression models caused by changes in data distribution, resulting in a decrease in vector retrieval accuracy, and the retraining method causes a waste of resources.

Method used

By monitoring the ranking changes of key vectors in the candidate set and retrieval set, the performance status of the compressed model is automatically determined, and retraining is performed when performance degrades, using incremental data to optimize the model.

Benefits of technology

It enables timely adjustment of the compression model when data distribution changes, ensuring the accuracy and efficiency of vector retrieval, reducing resource waste, and improving system stability and adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120973992A_ABST
    Figure CN120973992A_ABST
Patent Text Reader

Abstract

The invention provides a vector retrieval adaptive optimization method and a related device, and relates to the technical field of software, and the method comprises the following steps: responding to a query vector, and carrying out vector retrieval on the query vector to obtain a candidate set and a retrieval set; key vectors in the retrieval set are determined, and the performance state of the compression model is determined by comparing ranking changes of the key vectors in the candidate set and the retrieval set; and under the condition that the performance state is an attenuation state, retraining the compression model. According to the method, the performance state of the compression model can be determined by comparing the ranking changes of the key vectors in the candidate set and the retrieval set after vector retrieval is completed, so that the compression model is retrained in time when the model is attenuated, the compression model can be automatically optimized as required, and the detection precision can be ensured when concept drift occurs in data distribution.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the software technical field, and particularly to a vector retrieval adaptive optimization method and related device. BACKGROUND

[0002] With the development of artificial intelligence, vector retrieval has become a core technology in many fields such as image search, recommendation system, natural language processing, etc. In the face of millions or even hundreds of millions of massive vector data, the industry has developed a mature "approximate nearest neighbor" (ANN) retrieval scheme.

[0003] The above retrieval scheme mainly includes two stages: the first stage uses compressed (dimensionality reduction or quantization) vectors combined with an approximate nearest neighbor algorithm (such as HNSW) to quickly recall a smaller candidate set from massive data, and this stage mainly pursues speed; the second stage only targets the candidate set recalled in the first stage, and uses full-precision, high-dimensional original vectors to perform accurate similarity calculation, and reorders the candidate set according to the similarity, so as to obtain the final accurate retrieval set, and this stage pursues accuracy. The recall effect of the first stage is highly dependent on the consistency of the compression model (such as the PCA model) and the current data distribution, and as data continues to be generated in actual business, the underlying distribution of the data will inevitably drift over time, which leads to the gradual invalidation of the pre-trained compression model, and the compressed vectors cannot accurately express the relative relationship of the original vectors, thereby causing a serious decline in retrieval accuracy. SUMMARY

[0004] In view of the above problems, the present application provides a vector retrieval adaptive optimization method and related device to achieve the purpose of optimizing the compression model on demand. The specific scheme is as follows:

[0005] The first aspect of the present application provides a vector retrieval adaptive optimization method, which comprises:

[0006] In response to a query vector, performing vector retrieval on the query vector to obtain a candidate set and a retrieval set;

[0007] Determining a key vector, and determining the performance state of the compression model by comparing the ranking change of the key vector in the candidate set and the retrieval set;

[0008] In the case where the performance state is a decay state, retraining the compression model.

[0009] In one possible implementation, the determination of the key vector comprises:

[0010] Ranking the top vector in the retrieval set as the key vector.

[0011] In a possible implementation, the determining the performance state of the compression model by comparing the ranking change of the key vector in the candidate set and the search set comprises:

[0012] counting the ranking of the key vector in the candidate set to obtain a performance degradation value of the compression model;

[0013] determining whether the performance degradation value is greater than a corresponding degradation threshold value;

[0014] if yes, determining that the compression model is in a degradation state;

[0015] if no, determining that the compression model is in a normal state.

[0016] In a possible implementation, the counting the ranking of the key vector in the candidate set to obtain a performance degradation value of the compression model comprises:

[0017] obtaining a plurality of rankings counted in a sliding time window;

[0018] performing mean value processing on the plurality of rankings to obtain an actual ranking, and taking the actual ranking as the performance degradation value.

[0019] In a possible implementation, the retraining the compression model comprises:

[0020] collecting incremental vectors from a data source as a data set;

[0021] selecting part of the vectors in the data set as test cases, and dividing the vectors in the data set except the test cases into a training set and a test set;

[0022] training the compression model by using the training set, and verifying the trained compression model by using the test cases and taking the test set as a search range;

[0023] in a case where the trained compression model passes the verification, putting the trained compression model online.

[0024] In a possible implementation, the putting the trained compression model online comprises:

[0025] reconstructing vector indexes for all vectors in the data source by using the trained compression model;

[0026] smoothly switching query traffic to the vector indexes by using an alias mechanism.

[0027] The second aspect of the application provides a vector search adaptive optimization apparatus, which comprises:

[0028] a vector retrieval module, configured to perform vector retrieval on the query vector to obtain a candidate set and a retrieval set in response to the query vector;

[0029] a model performance determination module, configured to determine a key vector, and determine a performance state of the compressed model by comparing a ranking change of the key vector in the candidate set and the retrieval set;

[0030] a model retraining module, configured to retrain the compressed model in a case where the performance state is a decay state.

[0031] The third aspect of the present application provides a computer program product, comprising computer readable instructions, which, when executed on an electronic device, cause the electronic device to implement the vector retrieval adaptive optimization method of the first aspect or any implementation manner of the first aspect.

[0032] The fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0033] The memory is configured to store a computer program;

[0034] The processor is configured to execute the computer program, so that the electronic device can implement the vector retrieval adaptive optimization method of the first aspect or any implementation manner of the first aspect.

[0035] The fifth aspect of the present application provides a computer storage medium, the storage medium carries one or more computer programs, when the one or more computer programs are executed by an electronic device, the electronic device can implement the vector retrieval adaptive optimization method of the first aspect or any implementation manner of the first aspect.

[0036] By the above technical solution, the vector retrieval adaptive optimization method and related device provided by the present application comprises: in response to a query vector, performing vector retrieval on the query vector to obtain a candidate set and a retrieval set; determining a key vector in the retrieval set, and determining a performance state of the compressed model by comparing a ranking change of the key vector in the candidate set and the retrieval set; and in a case where the performance state is a decay state, retraining the compressed model. The present application can compare the ranking change of the key vector in the candidate set and the retrieval set after vector retrieval to determine the performance state of the compressed model, so that the model can be retrained in time when the model decays. This can automatically optimize the compressed model on demand, so as to ensure detection accuracy when data distribution occurs concept drift. BRIEF DESCRIPTION OF DRAWINGS

[0037] The above and other features, aspects and advantages of the present disclosure will become more apparent with reference to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, similar or same reference numerals are used to denote similar or same elements. It is to be understood that the drawings are schematic, and elements and features are not necessarily to scale.

[0038] Figure 1 A flowchart of a vector retrieval adaptive optimization method provided by an embodiment of the present application is shown in FIG. 1.

[0039] Figure 2 A partial flowchart of a vector retrieval adaptive optimization method provided by an embodiment of the present application is shown in FIG. 2.

[0040] Figure 3 Another partial flowchart of a vector retrieval adaptive optimization method provided by an embodiment of the present application is shown in FIG. 3.

[0041] Figure 4 Another partial flowchart of a vector retrieval adaptive optimization method provided by an embodiment of the present application is shown in FIG. 4.

[0042] Figure 5 Another partial flowchart of a vector retrieval adaptive optimization method provided by an embodiment of the present application is shown in FIG. 5.

[0043] Figure 6 A structural diagram of a vector retrieval adaptive optimization apparatus provided by an embodiment of the present application is shown in FIG. 6.

[0044] Figure 7 A structural diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 7. DETAILED DESCRIPTION

[0045] The embodiments of the present application are described below with reference to the accompanying drawings. The terms used in the embodiments section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0046] The embodiments of the present application are described below with reference to the accompanying drawings. It is known to those skilled in the art that, as technology develops and new scenarios appear, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0047] The terms "first", "second", and the like in the description and in the claims of the present application and above-described drawings are used to distinguish similar objects and are not necessarily used to describe a specific sequential or chronological order. It should be understood that terms so used are interchangeable under appropriate circumstances and are merely employed in the descriptions of embodiments of the present application for purposes of the description. Additionally, the terms "comprising", "having", "including", and "containing" are to be construed as open-ended terms (i.e., meaning "including, but not limited to") unless otherwise noted. It should be understood that terms so used are interchangeable under appropriate circumstances and are merely employed in the descriptions of embodiments of the present application for purposes of the description.

[0048] For the convenience of understanding the present application, the relevant concepts involved in the present application are first described as follows:

[0049] ES: Elasticsearch, a Lucence-based search server. It provides a distributed multi-user full-text search engine based on RESTful web interface. Elasticsearch 8.x version supports vector retrieval function natively, allowing users to build efficient KNN retrieval services.

[0050] Vector: a point in high-dimensional space, usually represented by an array of floating-point numbers, used to represent the semantic features of unstructured data such as text, images, and audio.

[0051] KNN: K-Nearest Neighbor algorithm, a method for finding the K closest data points to a query point in vector space.

[0052] HNSW: A graph algorithm and data structure for efficiently performing Approximate Nearest Neighbor (ANN) search, widely used in large-scale vector retrieval.

[0053] PCA: Principal Component Analysis, a classic statistical method for dimensionality reduction of high-dimensional data, which converts data to a new coordinate system through linear transformation, retaining the principal components with the largest variance.

[0054] Quantization: In the present application, it specifically refers to the process of converting high-precision floating-point numbers (such as Float32) to low-precision integers (such as Int8) to reduce memory usage and speed up calculations, usually with a small loss of precision.

[0055] Concept drift: In the field of machine learning, it refers to the phenomenon that the statistical properties of data change dynamically over time. In the present application, it refers to the shift in the distribution of new incoming data from the distribution of old data used to train the compressed model, resulting in a decrease in model performance.

[0056] In the large-scale vector retrieval scenario, in order to balance the query speed and resource consumption, dimension reduction or quantization means is usually used to compress the original vector, and an index is constructed in combination with an approximate neighbor algorithm such as HNSW. Although this mechanism can realize fast recall, its effectiveness is highly dependent on the consistency of the compression model (such as the PCA model) and the current data distribution. However, in actual business, data is continuously generated (such as new product pictures, new user behaviors), and the underlying distribution of data will change over time (concept drift), which will cause the pre-trained compression model to gradually fail, and the reduced vectors cannot accurately express the relative relationship of the original vectors. The direct consequence is that the first stage of the truly similar vectors are relatively far behind in the candidate set, or even cannot be recalled, resulting in a serious decline in the accuracy of the retrieval set output in the second stage.

[0057] The prior art usually adopts a periodic retraining method to deal with it, but this cannot solve the problem of performance degradation of the compression model in time, and may cause unnecessary waste of computing resources. To this end, the present application provides a vector retrieval adaptive optimization method, which can automatically and timely find the problem of performance degradation of the compression model caused by the change of data distribution (concept drift), and intelligently trigger the retraining of the compression model, to continuously ensure the speed and accuracy of vector retrieval.

[0058] Reference Figure 1 , Figure 1 A flowchart of a vector retrieval adaptive optimization method provided by an embodiment of the present application. As shown in Figure 1 , the vector retrieval adaptive optimization method provided by an embodiment of the present application can include steps S101 to S103, which will be described in detail below.

[0059] S101, in response to a query vector, performing vector retrieval on the query vector to obtain a candidate set and a retrieval set.

[0060] In the embodiment of the present application, initialization is required before responding to query traffic, including collecting initial representative original vectors (generally 512 dimensions) to form a vector data set, and then training an initial compression model on the vector data set by running a compression algorithm (such as the PCA algorithm), which can map the vector from 512 dimensions to 128 dimensions. Use the compression model obtained in the foregoing to reduce the 512-dimensional data in the data source (database or other storage) to 128 dimensions, and perform INT8 quantization on the 128-dimensional vector, and use the 128-dimensional quantized vector to construct an HNSW index in Elasticsearch.

[0061] Based on this, after obtaining the query vector (512 dimensions) input by the user, the query vector is converted into a 128-dimensional quantization vector through the loaded compressed model and quantization process in response to the query vector, and then the quantization vector is used to perform ANN query in the HNSW index of Elasticsearch to quickly recall TopK candidate results (for example, K = 20) to form a candidate set, and record the ID of the K vectors in the candidate set and the respective rankings.

[0062] Further, the 512-dimensional original vectors are taken out from the data source according to the ID of each vector in the candidate set, and the similarity scores (such as cosine similarity or Euclidean distance, etc.) are calculated between each original vector taken out and the query vector, and then the K vectors in the candidate set are reordered according to the similarity scores to obtain the final and most accurate retrieval set, and returned to the user.

[0063] S102, determine the key vector, and determine the performance state of the compressed model by comparing the ranking change of the key vector in the candidate set and the retrieval set.

[0064] In the embodiments of the present application, a vector with a high ranking in the candidate set or the retrieval set can be selected as the key vector. Assuming that the ranking of the key vector in the candidate set is ranking a and the ranking of the key vector in the retrieval set is ranking b, the difference between ranking a and ranking b can represent the retrieval error of the first stage of vector retrieval. The greater the difference between ranking a and ranking b, the greater the retrieval error of the first stage, and the closer the performance state of the compressed model to the decay state. For this purpose, a ranking difference threshold can be set. If the difference between ranking a and ranking b is greater than or equal to the ranking difference threshold, it is determined that the performance state of the compressed model is the decay state, otherwise, if the difference between ranking a and ranking b is less than the ranking difference threshold, it is determined that the performance state of the compressed model is the normal state.

[0065] In a possible implementation, since the retrieval set is the final and accurate retrieval result output by the vector retrieval, the higher the ranking of the vector in the retrieval set, the higher the similarity between the vector and the query vector, and the more likely it is to meet the user's demand. For this purpose, the embodiments of the present application provide a vector retrieval adaptive optimization method, wherein the step S102 of "determining the key vector" can include the following steps:

[0066] The vector with the highest ranking in the retrieval set is selected as the key vector.

[0067] In the embodiments of the present application, the vector with the highest ranking in the retrieval set is selected as the key vector according to the ranking of each vector in the retrieval set. The later the ranking of the key vector in the candidate set, the closer the performance state of the compressed model to the decay state.

[0068] On this basis, the application can take the ranking of the key vector in the candidate set as the performance attenuation value of the compression model, and then determine whether the compression model is in the attenuation state according to the performance attenuation value. Referring to Figure 2 , Figure 2 Part of the flow diagram of a vector retrieval adaptive optimization method provided by an embodiment of the application. As shown in Figure 2 The vector retrieval adaptive optimization method provided by an embodiment of the application can include steps S201 to S204, which are described in detail below.

[0069] S201, statistics the ranking of the key vector in the candidate set to obtain the performance attenuation value of the compression model.

[0070] In an embodiment of the application, an asynchronous monitoring task can be performed after the vector retrieval is completed, and the monitoring task can obtain the key vector in the retrieval set and determine the ranking of the key vector in the candidate set by matching the ID of the key vector, and then take the ranking as the performance attenuation value of the compression model. For example, if the ranking of the key vector in the candidate set is c, the performance attenuation value of the compression model is c.

[0071] In a possible implementation, to smooth the accidental fluctuation of the performance attenuation value in a single vector retrieval, a sliding window for the ranking of the key vector in the candidate set can be maintained to determine the performance attenuation value of the compression model. Referring to Figure 3 , Figure 3 Another part of the flow diagram of a vector retrieval adaptive optimization method provided by an embodiment of the application. As shown in Figure 3 The vector retrieval adaptive optimization method provided by an embodiment of the application can include steps S301 to S302, which are described in detail below.

[0072] S301, obtain a plurality of rankings that are counted in a sliding time window.

[0073] In an embodiment of the application, a sliding time window is set to store the rankings of the key vectors counted in the recent time, for example, the rankings of a plurality of continuous key vectors counted in the recent 1000 times can be counted.

[0074] S302, perform mean value processing on the plurality of rankings to obtain an actual ranking, and take the actual ranking as the performance attenuation value.

[0075] In the embodiments of the present application, all rankings under the sliding time window can be processed by mean value, such as directly calculating the average value or calculating the P90 quantile, to obtain the actual ranking under the sliding time window, and the actual ranking is taken as the performance decay value of the compression model.

[0076] In S202, it is judged whether the performance decay value is greater than the corresponding decay threshold. If yes, S203 is executed; if no, S204 is executed.

[0077] In the embodiments of the present application, by comparing the performance decay value of the compression model with the corresponding decay threshold, it can be determined that the compression model is in the decay state when the performance decay value exceeds the decay threshold.

[0078] In S203, it is determined that the compression model is in the decay state.

[0079] In the embodiments of the present application, if the performance decay value is greater than the decay threshold, it is determined that the compression model is in the decay state.

[0080] In S204, it is determined that the compression model is in the normal state.

[0081] In the embodiments of the present application, if the performance decay value is less than or equal to the decay threshold, it is determined that the compression model is in the normal state.

[0082] In S103, the compression model is retrained in the case that the performance state is the decay state.

[0083] In the embodiments of the present application, in the case that the performance state of the compression model is the decay state, the retraining process of the compression model is triggered.

[0084] In one possible implementation, the compression model can be retrained using incremental data to enable the compression model to quickly adapt to the current data distribution. Referring to Figure 4 , Figure 4 Another part of the flow diagram of the vector retrieval adaptive optimization method provided by the embodiments of the present application is shown. As shown in Figure 4 The vector retrieval adaptive optimization method provided by the embodiments of the present application can include steps S401 to S404 in the step of retraining the compression model in S103, which will be described in detail below.

[0085] In S401, incremental vectors are collected from the data source as a data set.

[0086] In the embodiments of the present application, by setting a marker point on the vector used for the last training in the data source, the incremental vectors in the data source can be quickly identified, and the incremental vectors are taken as the data set for the current training.

[0087] S402, select part of vectors in the dataset as test cases, and divide the vectors in the dataset except the test cases into a training set and a test set.

[0088] In the embodiments of the present application, part of the vectors (such as 1000 vectors) in the dataset can be randomly selected as test cases, and the remaining vectors in the dataset except the test cases can be divided into a training set and a test set, for example, the remaining vectors can be divided into a training set and a test set according to a ratio of 9:1.

[0089] S403, training the compressed model with the training set, and verifying the trained compressed model with the test set as the search range and using the test cases.

[0090] In the embodiments of the present application, the training set can be divided into K parts, and K-1 vectors are taken each time to train the compressed model, so that K trained compressed models can be obtained. The K trained compressed models can be verified in the test set, specifically, the original vector (512 dimensions) and the compressed quantized vector (128 dimensions) of the test case can be used to calculate the similarity in the test set. Among the K trained compressed models, which similarity calculation result is closer to the original vector, the trained compressed model whose similarity is closest to the original vector is used as the final compressed model, and the trained compressed model is verified.

[0091] S404, in the case that the trained compressed model passes the verification, the trained compressed model is put online.

[0092] In the embodiments of the present application, the trained compressed model that passes the verification is put online, and a mark point is set for the incremental data used for this training.

[0093] In one possible implementation, the compressed model before and after training can be smoothly switched using an alias. Referring to Figure 5 , Figure 5 Another part of the flow diagram of the vector retrieval adaptive optimization method provided by the embodiments of the present application is provided. As shown in Figure 5 , the vector retrieval adaptive optimization method provided by the embodiments of the present application, wherein the step S404 of "putting the trained compressed model online" can include steps S501 to S502, which will be described in detail below.

[0094] S501, using the trained compressed model to reconstruct the vector index for all vectors in the data source.

[0095] In the embodiments of the present application, all vectors in the data source are reduced from 512 dimensions to 128 dimensions using the trained compression model, and the 128-dimensional vectors are quantized by INT8, and the quantized 128-dimensional vectors are used to construct the HNSW index in Elasticsearch.

[0096] S502, the query traffic is smoothly switched to the vector index through the alias mechanism.

[0097] In the embodiments of the present application, the online query traffic can be switched to the latest HNSW index through the alias (Alias) mechanism, and the old compression model and HNSW index can be archived or deleted.

[0098] Through the above description, the vector retrieval adaptive optimization method provided by the embodiments of the present application can monitor the performance of the compression model in real time, and automatically trigger model updating according to the objective quantitative index of performance decay at the most needed time, thereby continuously guaranteeing the high precision and high efficiency of the vector retrieval service while minimizing the operation and maintenance cost and the consumption of computing resources. The present application can evaluate the effectiveness of the compression model in real time, and trigger retraining based on the actual performance of the compression model, realizing intelligent and efficient system maintenance. The present application has the following advantages:

[0099] 1) High efficiency and low cost: Since the retraining is triggered on demand, unnecessary and expensive computing and storage overheads are avoided when the model is still effective. Only when it is "needed" will resources be consumed for updating, greatly improving the operation and maintenance efficiency and economy.

[0100] 2) High timeliness and strong robustness: the performance decline caused by changes in data distribution can be perceived in near real time. Once the performance exceeds the red line, the repair process can be quickly started, greatly shortening the time window in which the service is in a low-precision state, and enhancing the stability and adaptability (robustness) of the entire vector retrieval system to business changes.

[0101] 3) Intelligence and automation: the decision-making process of "when to retrain", which depends on human experience and guesswork, is transformed into an automated process driven by objective data, reducing the dependence on experienced operation and maintenance personnel and reducing the risk of human error.

[0102] That is, the present application solves the core contradiction of the prior art in dealing with the "concept drift" problem, and realizes the continuous and automatic maintenance of the vector retrieval system in the dynamic data environment to achieve the best balance among speed, accuracy and cost.

[0103] The above describes a vector retrieval adaptive optimization method provided by the embodiments of the present application, and the following describes a device for executing the above-described vector retrieval adaptive optimization method.

[0104] Referring to Figure 6 , Figure 6 A structural schematic diagram of a vector retrieval adaptive optimization device provided by an embodiment of the present application. As shown in Figure 6 The vector retrieval adaptive optimization device provided by an embodiment of the present application comprises:

[0105] The vector retrieval module 601 is configured to perform vector retrieval on the query vector to obtain a candidate set and a retrieval set in response to the query vector.

[0106] The model performance determination module 602 is configured to determine a key vector and determine the performance state of the compressed model by comparing the ranking change of the key vector in the candidate set and the retrieval set.

[0107] The model retraining module 603 is configured to retrain the compressed model in the case of the performance state being the decay state.

[0108] In a possible implementation, the model performance determination module 602 for determining the key vector is specifically configured to:

[0109] The vector with the highest ranking in the retrieval set is taken as the key vector.

[0110] In a possible implementation, the model performance determination module 602 for determining the performance state of the compressed model by comparing the ranking change of the key vector in the candidate set and the retrieval set is specifically configured to:

[0111] The ranking of the key vector in the candidate set is counted to obtain a performance decay value of the compressed model; it is judged whether the performance decay value is greater than a corresponding decay threshold value; if yes, it is determined that the compressed model is in the decay state; if no, it is determined that the compressed model is in the normal state.

[0112] In a possible implementation, the model performance determination module 602 for counting the ranking of the key vector in the candidate set to obtain the performance decay value of the compressed model is specifically configured to:

[0113] A plurality of rankings counted under a sliding time window are obtained; the plurality of rankings are processed by mean value to obtain an actual ranking, and the actual ranking is taken as the performance decay value.

[0114] In a possible implementation, the model retraining module 603 for retraining the compressed model is specifically configured to:

[0115] Collect the incremental vectors as a dataset from the data source; select part of the vectors as test cases from the dataset, and divide the vectors other than the test cases in the dataset into a training set and a test set; train the compression model with the training set, and verify the trained compression model with the test cases, taking the test set as a search range; and in the case that the trained compression model passes the verification, put the trained compression model online.

[0116] In a possible implementation, the model retraining module 603 for putting the trained compression model online is specifically configured to:

[0117] reconstruct the vector index for all vectors in the data source using the trained compression model; and smoothly switch the query traffic to the vector index through an alias mechanism.

[0118] It should be noted that the detailed functions of the modules in the embodiments of the present application can be referred to the corresponding disclosure part of the vector retrieval adaptive optimization method embodiments described above, and will not be described here.

[0119] In the embodiments of the present application, an electronic device is also provided. Referring to Figure 7 , Figure 7 A structural schematic diagram of an electronic device provided in the embodiments of the present application. The electronic device in the embodiments of the present application can include, but is not limited to, fixed terminals such as mobile phones, notebook computers, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, and the like. Figure 7 The electronic device shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present application.

[0120] As shown in Figure 7 , the electronic device can include a processing device (for example, a central processor, a graphics processor, etc.) 701, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 702 or programs loaded from a storage device 708 into a random access memory (RAM) 703. In the state that the electronic device is powered on, the RAM 703 also stores various programs and data required for the operation of the electronic device. The processing device 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0121] In general, the following devices can be connected to the I / O interface 705: input devices 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, and the like; output devices 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, and the like; storage devices 708 including, for example, a memory card, a hard disk, and the like; and communication devices 709. The communication devices 709 can allow the electronic device to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device having various devices is shown, but it is understood that all of the shown devices are not required to be implemented or present. More or less devices can alternatively be implemented or present.

[0122] The embodiment of the present application further provides a computer program product comprising computer readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the vector retrieval adaptive optimization methods provided by the embodiments of the present application.

[0123] The embodiment of the present application further provides a computer readable storage medium, which carries one or more computer programs, when the one or more computer programs are executed by an electronic device, can cause the electronic device to implement any of the vector retrieval adaptive optimization methods provided by the embodiments of the present application.

[0124] In addition, it should be noted that the above-described device embodiments are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e. can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment scheme. In addition, the connection relationship between the modules in the device embodiment provided by the present application indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.

[0125] Those skilled in the art can clearly understand that the application can be implemented by means of software plus necessary universal hardware, and of course can also be implemented by means of dedicated hardware including special integrated circuit, special CPU, special memory, special component, etc. Generally, any function completed by computer program can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuit, digital circuit or special circuit, etc. However, for the application, software program implementation is a better embodiment. Based on such understanding, the technical solution of the application or the part of the application which makes contribution to the prior art can be embodied in the form of software product, which is stored in readable storage medium, such as computer floppy disk, U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a plurality of instructions for making a computer device (which can be personal computer, training device or network device, etc.) execute the method described in various embodiments of the application.

[0126] In the above embodiments, the implementation can be achieved by software, hardware, firmware or any combination thereof, entirely or partially. When implemented by software, the implementation can be achieved in the form of a computer program product, entirely or partially.

[0127] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the flow or function described in the embodiments of the application is generated entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another, for example, the computer instructions can be transmitted from one website, computer, training device or data center to another website, computer, training device or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be stored by a computer or a data storage device such as a training device, a data center, etc. integrated with one or more available media sets. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

Claims

1. An adaptive optimization method for vector retrieval, characterized in that, The vector retrieval adaptive optimization method includes: In response to the query vector, a vector retrieval is performed on the query vector to obtain a candidate set and a retrieval set; Determine key vectors and determine the performance status of the compression model by comparing the ranking changes of the key vectors in the candidate set and the retrieval set; When the performance is in a degraded state, the compressed model is retrained.

2. The vector retrieval adaptive optimization method according to claim 1, characterized in that, The determination of the key vector includes: The vector that ranks highest in the search set is taken as the key vector.

3. The vector retrieval adaptive optimization method according to claim 2, characterized in that, The step of determining the performance status of the compression model by comparing the ranking changes of the key vectors in the candidate set and the retrieval set includes: The ranking of the key vectors in the candidate set is calculated to obtain the performance degradation value of the compression model; Determine whether the performance degradation value is greater than the corresponding degradation threshold; If so, determine that the compression model is in a decay state; If not, it is determined that the compression model is in a normal state.

4. The vector retrieval adaptive optimization method according to claim 3, characterized in that, The process of ranking the key vectors in the candidate set to obtain the performance degradation value of the compression model includes: Retrieve multiple rankings compiled within a sliding time window; The average of the multiple rankings is used to obtain the actual ranking, and the actual ranking is used as the performance degradation value.

5. The vector retrieval adaptive optimization method according to claim 1, characterized in that, The retraining of the compressed model includes: Collect incremental vectors from the data source as a dataset; Select a subset of vectors from the dataset as test cases, and divide the other vectors in the dataset, excluding the test cases, into a training set and a test set; The compression model is trained using the training set, and the trained compression model is verified using the test set as the retrieval scope and the test cases. Once the trained compressed model passes validation, it will be deployed online.

6. The vector retrieval adaptive optimization method according to claim 5, characterized in that, The step of deploying the trained compressed model online includes: The trained compressed model is used to rebuild the vector index for all vectors in the data source; The alias mechanism smoothly switches query traffic to the vector index.

7. A vector retrieval adaptive optimization device, characterized in that, The vector retrieval adaptive optimization device includes: The vector retrieval module is used to respond to a query vector and perform vector retrieval on the query vector to obtain a candidate set and a retrieval set. The model performance determination module is used to determine key vectors and determine the performance status of the compressed model by comparing the ranking changes of the key vectors in the candidate set and the retrieval set. The model retraining module is used to retrain the compressed model when the performance state is in a degraded state.

8. A computer program product, characterized in that, Includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the vector retrieval adaptive optimization method as described in any one of claims 1 to 6.

9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the vector retrieval adaptive optimization method as described in any one of claims 1 to 6.

10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the vector retrieval adaptive optimization method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • NL2SQL modeling method and device, electronic equipment and storage medium

    CN115455156A

  • Deep learning model compression method and device based on LSMOF

    CN117313799A

  • Data retrieval method, device and system, electronic equipment and readable storage medium

    CN118093962A