Vector retrieval method, system and equipment based on vector ID and storage medium
By integrating vector metadata to vector ID in vector retrieval, and quickly filtering vectors with vector filters, the inefficiency problem in the prior art is solved, and efficient vector retrieval and recall improvement are achieved.
Patent Information
- Application Number
- CN202510747759.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-07-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art requires quadratic query of metadata of similar vectors when searching vectors, resulting in low system processing efficiency, especially in high concurrency and massive request scenarios.
By constructing vector IDs, integrating vector metadata into vector IDs, using vector filters to quickly filter vectors that meet the conditions, reducing unnecessary calculations, and avoiding library-wide retrieval.
Retrieval efficiency is significantly improved, recall rate is improved, and the returned results contain more vectors that meet the criteria.
Smart Images

Figure CN120277248A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of vector retrieval, and particularly relates to a vector retrieval method, system, device and storage medium based on vector IDs. Background Art
[0002] Currently, the vector representation technology for data such as text, images, audio and video has been widely applied. Generally, vector data itself only contains feature information, while the metadata (such as date, institution, etc.) corresponding to each vector is stored elsewhere. When querying vector data, according to the additional query conditions input by the user (such as date range, institution number, etc.), the metadata of the vectors is filtered again during the retrieval process to remove the results that do not meet the query conditions.
[0003] For example, when a user conducts a similar text retrieval and only hopes to return the results after a specified date, and also limits the source of the literature. To meet the needs of this user, the prior art usually creates a database for storing fusion information outside the vector retrieval system. After retrieving similar vectors through the vector retrieval system, the metadata corresponding to the similar vectors is then queried, and finally, it is determined whether to retain this similar vector based on the queried metadata.
[0004] However, since the above solution requires querying the metadata of similar vectors again after the retrieval is completed, and the retrieval process needs to process all vectors within the entire comparison range, in the scenario of high concurrency and a large number of requests, it has a greater impact on the overall processing efficiency of the system. Summary of the Invention
[0005] To solve the above problems in the prior art, that is, when performing vector retrieval in the prior art, it is necessary to query the metadata of similar vectors twice, and all vectors need to be processed during the retrieval process, resulting in insufficient overall processing efficiency of the system. In a first aspect, the present invention proposes a vector retrieval method based on vector IDs, and the method includes: Obtain the retrieval information input by the user; According to the retrieval information, determine the feature vectors to be retrieved and the filtering conditions for restricting vector metadata; According to the filtering conditions, determine a vector filter, and through the vector filter, extract target vectors from a pre-constructed vector library; the vector library stores multiple vectors and the vector IDs corresponding to each vector, and the vector ID corresponding to each vector is composed of the mapping values of the vector metadata corresponding to each vector. The vector filter is used to determine, according to the filtering conditions and the mapping values of the vector metadata in the vector ID, the vectors that meet the filtering conditions in the vector library as the target vectors; Determine a similar vector in the target vector according to the feature vector, where the similarity between the similar vector and the feature vector is higher than a preset threshold; Return a retrieval result to the user according to the similar vector.
[0006] In some preferred embodiments, the determining the feature vector to be retrieved according to the retrieval information includes: Determine the text content to be retrieved according to the retrieval information; Use a preset statement segmentation algorithm to segment the text content into multiple semantic segments; Convert each semantic segment into a floating-point representation according to a preset vector conversion rule; Determine the feature vector according to the floating-point representations corresponding to the respective semantic segments.
[0007] In some preferred embodiments, the vector ID is an N-bit character, and the N-bit character is composed of n binary numbers, and each binary number is used to indicate a mapping value of a kind of vector metadata.
[0008] In some preferred embodiments, the number of bits N of the vector ID satisfies: ; where n is the number of binary numbers in the vector ID, satisfying 1 ≤ n ≤ N, X i is the number of bits of the i-th binary number, satisfying .
[0009] In some preferred embodiments, the retrieving the target vector in the pre-constructed vector library through the vector filter includes: Determine the current vector to be retrieved and the vector ID of the current vector, where the current vector is any vector in the pre-constructed vector library; Judge whether the vector ID of the current vector meets the filtering condition through the vector filter; If so, determine the current vector as the target vector, and update the next vector in the vector library as the current vector; If not, determine that the current vector is not the target vector, and update another vector in the vector library as the current vector.
[0010] In some preferred embodiments, the vector filter is a mask filter, and the mask filter is composed of multiple sub-filters, and the multiple sub-filters correspond to the filtering conditions one by one.
[0011] In some preferred embodiments, determining whether the vector ID of the current vector meets the filtering condition through the vector filter includes: Determining each sub-filter in the vector filter; Determining each sub-segment in the vector ID; Sequentially comparing whether each sub-segment in the vector ID conforms to each sub-filter of the vector filter; If it conforms, it is determined that the vector ID of the current vector meets the filtering condition.
[0012] In a second aspect of the present invention, a vector retrieval system based on vector ID is proposed. The system includes: A data acquisition module for acquiring retrieval information input by a user; A data extraction module for determining a feature vector to be retrieved according to the retrieval information, and a filtering condition for limiting vector metadata; A data filtering module for determining a vector filter according to the filtering condition, and extracting a target vector from a pre-constructed vector library through the vector filter; multiple vectors and vector IDs corresponding to each vector are stored in the vector library, the vector ID includes a mapping value of vector metadata corresponding to each vector, and the vector filter is used to determine, according to the filtering condition, the mapping value of vector metadata in the vector ID, and determine the vector that meets the filtering condition in the vector library as the target vector; A data comparison module for determining a similar vector among the target vectors according to the feature vector, and the similarity between the similar vector and the feature vector is higher than a preset threshold; A data output module for returning a retrieval result to the user according to the similar vector.
[0013] In a third aspect of the present invention, an electronic device is proposed, including: At least one processor; and a memory communicatively connected to at least one of the processors; Wherein, the memory stores instructions executable by the processor, and the instructions are used to be executed by the processor to implement the method as described in the first aspect.
[0014] In a fourth aspect of the present invention, a computer-readable storage medium is proposed. The computer-readable storage medium stores computer instructions, and the computer instructions are used to be executed by the computer to implement the method as described in the first aspect.
[0015] Advantages of the present invention: (1) Based on the method of the present invention, by structurally segmenting and representing the vector ID, the vector metadata is integrated into the vector ID, making full use of the redundant space in the vector ID. Furthermore, when retrieving vectors, the constructed vector filter can quickly exclude vectors outside the filtering conditions and ignore vectors that do not meet the conditions. At the same time, since the calculation time for determining whether a vector meets the filtering conditions is much less than the calculation time of the vector, this method can reduce unnecessary computational effort, avoid full-library range retrieval, and significantly improve the overall retrieval efficiency.
[0016] (2) Currently, common similar vector retrieval usually returns TOPK results and then performs a filtering operation. In this way, it is easy to cause some vectors that meet the conditions not to be returned as the final results. However, since this method ignores vectors that do not meet the conditions before calculating the similarity of vectors, among the returned results, more vectors that meet the conditions can be included. Therefore, this method can also improve the recall rate. Brief Description of the Drawings
[0017] By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, objectives, and advantages of the present application will become more apparent: Figure 1 is a schematic flowchart of a vector retrieval method based on vector ID proposed by an embodiment of the present invention; Figure 2 is a schematic diagram of a vector ID proposed by an embodiment of the present invention; Figure 3 is another schematic diagram of a vector ID proposed by an embodiment of the present invention; Figure 4 is a schematic diagram of a mask filter proposed by an embodiment of the present invention; Figure 5 is a schematic diagram of a sub-filter of the mask filter proposed by an embodiment of the present invention; Figure 6 is a schematic diagram of the structure of a computer system proposed by an embodiment of the present invention. Detailed Embodiments
[0018] The following further elaborates on the present application in conjunction with the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the relevant invention and are not intended to limit the invention. Additionally, it should be noted that for the sake of description, only parts related to the relevant invention are shown in the drawings.
[0019] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the drawings and embodiments.
[0020] Please refer to Figure 1 , the first embodiment of this application provides a vector retrieval method based on vector IDs, and the method includes: Step S10, obtaining the retrieval information input by the user; Specifically, when the user uses the retrieval system, the content that the user wants to retrieve is input through the input interface provided by the retrieval system. This part of the input content is the retrieval information, which can be transmitted to the retrieval system through the network (in the form of http, rpc, etc.) or local call. For example, when the user inputs "application cases of artificial intelligence in medical diagnosis" in a knowledge graph retrieval system, the input text is the retrieval information, and the retrieval system will receive and preliminarily process this information for subsequent retrieval.
[0021] More specifically, the retrieval information input by the user usually also includes filtering conditions for restricting the retrieval scope. Taking the above example, when the user retrieves "application cases of artificial intelligence in medical diagnosis", the time of the specific application cases and the case type, etc. are restricted. For example, the time is restricted between 2020 and 2022, and the case type is restricted to "journals", etc. Then, in addition to meeting the semantics of "application cases of artificial intelligence in medical diagnosis", the retrieval results finally output by the retrieval system should also meet the publication date between 2020 and 2022 and the type is "journals".
[0022] Step S20, determining the feature vectors to be retrieved and the filtering conditions for restricting the vector metadata according to the retrieval information; It is easy to understand that since the retrieval information input by the user is usually in text form, the retrieval system needs to convert it into feature vectors for comparison and retrieval in the vector space. Specifically, the specific process of feature vector conversion is not limited in this embodiment, and those skilled in the art can select different means to obtain feature vectors according to different forms of retrieval information.
[0023] Specifically, taking the user input text as an example, natural language processing techniques such as word embedding (such as Word2Vec, GloVe, etc.) techniques or more complex pre-trained language models (such as BERT, etc.) can be used for processing. After the processing is completed, the input text will be mapped to a vector in a high-dimensional space, and this vector contains the semantic features of the input text. For example, converting "application cases of artificial intelligence in medical diagnosis" into a feature vector, and the values of this feature vector reflect the semantic information of the words in the text and their mutual relationships.
[0024] Meanwhile, based on the retrieval information, the retrieval system will determine filtering conditions to limit the scope of the retrieval. These filtering conditions are related to vector metadata. Vector metadata is additional information that describes a vector, such as the category of the document represented by the vector (e.g., academic papers, news reports, blog posts, etc.), the publication time, the author, etc. For example, if the user's retrieval information implies that only relevant content within a specific time period needs to be found, then the filtering condition may include a limitation on the publication time, such as "content published after 2020"; or if the user is only interested in academic papers, then the filtering condition may be "document type is academic paper".
[0025] More specifically, the filtering conditions finally determined by the retrieval system can be stored or represented in the corresponding device in the form of a Boolean expression, etc. When the user inputs multiple filtering conditions simultaneously, the multiple filtering conditions can be combined through logical operators (such as AND, OR, NOT) to form more complex filtering rules. No more examples will be given in this embodiment.
[0026] Step S30: Determine a vector filter according to the filtering conditions, and extract a target vector from the pre-constructed vector library through the vector filter; the vector library stores multiple vectors and the vector ID corresponding to each vector, and the vector ID includes the mapping value of the vector metadata corresponding to each vector. The vector filter is used to determine, according to the filtering conditions and the mapping value of the vector metadata in the vector ID, that the vector satisfying the filtering conditions in the vector library is the target vector; In this embodiment, the retrieval system will construct a vector filter according to the foregoing filtering conditions. Specifically speaking, this filter is essentially a set of rules used to determine whether each vector in the vector library meets the filtering conditions. For example, if the filtering condition is "document type is academic paper and published after 2020", then this vector filter will make a judgment based on the mapping values of the document type and the publication time included in the vector ID.
[0027] In this embodiment, the vector library is a pre-constructed storage structure that stores multiple vectors and the vector ID corresponding to each vector one by one.
[0028] In this embodiment, the vector ID is mainly composed of the mapping values of the vector metadata corresponding to each vector. That is to say, according to the established metadata mapping rules, the vector ID can indicate the information of the vector metadata.
[0029] Specifically, the above metadata mapping rule refers to the specific method of converting various vector metadata corresponding to a vector into its ID code. For example, a hash mapping method can be adopted. By performing a hash operation on the value of the metadata, it is converted into a hash value with a fixed length. For example, for the string of the author's name of a document, a specific hash value can be calculated using a hash function as the mapping value of this item of metadata in the vector ID. A numerical mapping method can also be adopted, that is, for categorical metadata (such as document type, subject category, etc.), an encoding method is used for mapping. For example, "academic paper" is encoded as 0, "news report" is encoded as 1, "blog article" is encoded as 2, and so on. Of course, in addition to this, those skilled in the art can also adopt various feasible means such as numerical mapping, string mapping, etc. to implement the above metadata mapping rule, and this embodiment does not make any limitations in this regard.
[0030] In this embodiment, the vector filter traverses the vector IDs of each vector in the vector library, and screens out the vectors that meet the filtering conditions. These screened vectors are the target vectors. For example, in a vector library containing a large number of document vectors, through the screening of the vector filter, the vectors corresponding to the documents that finally meet the conditions of "document type is academic paper and the publication time is after 2020" are the target vectors.
[0031] More specifically, please refer to Figure 2 , Figure 2 which gives an example of a vector ID. In this example, the date occupies 16 bits, representing the number of days passed since January 1, 1900, and the maximum support is up to June 6, 2079; the institution ID occupies 22 bits, with a maximum support of 4,194,303 institutions, and 0 is used as a reservation; the author ID occupies 30 bits, with a maximum support of 1,073,741,823 authors, and 0 is used as a reservation; the table ID occupies 16 bits, with a maximum support of 65,535 tables, and 0 is used as a reservation; the document ID occupies 28 bits, with a maximum support of 268,435,455 documents in a single table, and 0 is used as a reservation; the in-document vector ID occupies 16 bits, with a maximum support of generating 65,536 vectors for a single document.
[0032] Compared with the prior art, the vector ID proposed in this embodiment, in addition to the unique identifier of the vector itself, also integrates the information of the metadata corresponding to the vector.
[0033] Step S40, determine a similar vector in the target vectors according to the feature vector, where the similarity between the similar vector and the feature vector is higher than a preset threshold; Specifically, after obtaining the target vectors, the retrieval system compares the feature vectors generated previously according to the retrieval information with all the target vectors one by one. In this embodiment, the method for comparing the target vectors is to calculate the similarity between the feature vectors and the target vectors. Common similarity calculation methods in the art include cosine similarity, Euclidean distance, etc., and this embodiment does not limit this.
[0034] It is easy to understand that a preset threshold is stored in the retrieval system. Only when the similarity between the target vector and the feature vector is higher than this threshold, will the target vector be recognized as a similar vector. For example, the preset threshold for cosine similarity is 0.8, then only the target vectors with a cosine similarity greater than 0.8 to the feature vector will be determined as similar vectors.
[0035] Step S50, according to the similar vectors, return the retrieval results to the user.
[0036] Specifically, after determining the similar vectors, the retrieval system will determine the corresponding original information (such as document content, web page link, etc.) according to the similar vectors, and then organize the original information into a suitable format and return it to the user as the retrieval result. For example, if the similar vector corresponds to the vector of an academic paper, the retrieval system will present the title, abstract, author, etc. of the academic paper to the user, so that the user can quickly understand the content related to their retrieval information.
[0037] Further, in this embodiment, the determining the feature vectors to be retrieved according to the retrieval information includes: determining the text content to be retrieved according to the retrieval information; using a preset sentence segmentation algorithm to segment the text content into multiple semantic segments; according to the preset vector conversion rule, converting each semantic segment into a floating-point representation; and determining the feature vector according to the floating-point representations corresponding to each semantic segment.
[0038] After the user inputs the retrieval information, the retrieval system first needs to extract the specific text therefrom for subsequent analysis and processing, and further process it using a preset sentence segmentation algorithm. The role of the sentence segmentation algorithm is to reasonably segment the continuous text content into smaller segments according to semantics, so as to extract the most semantic-compliant feature vectors therefrom; then, represent it in the floating-point form that can be read by the computer according to the established vector conversion rule, and finally splice or combine the floating-point representations corresponding to each semantic segment to form the final feature vector.
[0039] As an example, the above-mentioned statement segmentation algorithm can be a syntactic analysis segmentation algorithm based on natural language processing technology, which uses grammar rules and semantic understanding to determine appropriate segmentation points; the above-mentioned vector transformation rule can be a method of mapping semantic segments to a low-dimensional vector space by using a specific word vector model (such as Word2Vec). Of course, in addition to this, those skilled in the art can also adopt any feasible solution to implement the above-mentioned statement segmentation algorithm and vector transformation rule, and this embodiment does not make any limitations in this regard.
[0040] Further, in this embodiment, the vector ID is an N-bit character segment, and the N-bit character segment is composed of n binary numbers, and each binary number is used to indicate a mapping value of a kind of vector metadata.
[0041] Further, in this embodiment, the number of bits N of the vector ID satisfies: ; where n is the number of binary numbers in the vector ID, satisfying 1≤n≤N, and X i is the number of bits of the i-th binary number, satisfying .
[0042] Specifically, please refer to Figure 3 , Figure 3 which gives an example of a vector ID, where the information 1, information 2... information n are respectively represented by their corresponding binary numbers, and the number of bits and order of each binary number can be adjusted according to actual needs.
[0043] Further, in this embodiment, the retrieving in the pre-constructed vector library through the vector filter to obtain a target vector includes: determining a current vector to be retrieved and the vector ID of the current vector, where the current vector is any vector in the pre-constructed vector library; judging, through the vector filter, whether the vector ID of the current vector meets the filtering condition; if so, determining the current vector as the target vector and updating the next vector in the vector library as the current vector; if not, determining that the current vector is not the target vector and updating another vector in the vector library as the current vector.
[0044] Specifically, in this embodiment, the vector IDs of each vector in the entire vector library are traversed in sequence, and the target vectors that meet the vector filter are extracted therefrom. Taking the above-mentioned mask filter as an example, the mask filter is used to discriminate a vector ID in the vector library. If the vector ID meets the mask condition indicated by the mask filter, it is determined that the vector corresponding to the vector ID is the target vector. At the same time, another undiscriminated vector ID is selected in the vector library for comparison. Similarly, after the comparison is completed, another undiscriminated vector ID is selected in the vector library for comparison... until all vector IDs in the vector library have been discriminated with this mask filter.
[0045] Further, in this embodiment, the vector filter is a mask filter, and the mask filter is composed of a plurality of sub-filters, and the plurality of sub-filters correspond to the filtering conditions one by one.
[0046] Please refer to Figure 4 , Figure 4 which gives an example of a mask filter. The illustrated mask filter is composed of several sub-filters, and each filter represents a limiting condition. Users can make arbitrary combinations of the limiting conditions to meet various service requirements.
[0047] Further, in this embodiment, determining whether the vector ID of the current vector meets the filtering condition through the vector filter includes: determining each sub-filter in the vector filter; determining each binary number in the vector ID; sequentially determining whether each binary number in the vector ID all conforms to each sub-filter of the vector filter; if so, determining that the vector ID of the current vector meets the filtering condition.
[0048] Specifically, please refer to Figure 5 , Figure 5 which gives an example of a sub-filter in a vector filter. The sub-filter of the illustrated vector filter is 16 bits in total, and its meaning is to return similar results after January 1, 2024.
[0049] Based on this embodiment, in the process of retrieving similar vectors, the date information of the vector ID is compared and judged with the filter. If it meets the requirements, the similarity of this vector is calculated, otherwise this vector is ignored, thus avoiding the calculation in the entire library range.
[0050] The second embodiment of the present application provides a vector retrieval system based on vector ID, including: A data acquisition module for acquiring the retrieval information input by the user; A data extraction module for determining the feature vectors to be retrieved according to the retrieval information, and the filtering conditions for limiting the vector metadata; A data filtering module, configured to determine a vector filter according to the filtering condition, and extract a target vector from a pre-constructed vector library through the vector filter; multiple vectors and vector IDs corresponding to each vector are stored in the vector library, and the vector ID includes a mapping value of vector metadata corresponding to each vector, and the vector filter is configured to determine, according to the filtering condition and the mapping value of the vector metadata in the vector ID, a vector that meets the filtering condition in the vector library as the target vector; A data comparison module, configured to determine a similar vector in the target vector according to the feature vector, and the similarity between the similar vector and the feature vector is higher than a preset threshold; A data output module, configured to return a retrieval result to a user according to the similar vector.
[0051] A third embodiment of the present application further provides an electronic device, including: At least one processor; and a memory communicatively connected to at least one of the processors; wherein, the memory stores instructions executable by the processor, and the instructions are used to be executed by the processor to implement the method as described in the first embodiment.
[0052] A fourth embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores computer instructions, and the computer instructions are used to be executed by the computer to implement the method as described in the first embodiment.
[0053] Reference is made below to Figure 6 , which shows a schematic structural diagram of a computer system of a server suitable for implementing the method, system, and device embodiments of the present application. Figure 6 The server shown is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present application.
[0054] As Figure 6 shown, the computer system includes a central processing unit (CPU, Central Processing Unit) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM, Read Only Memory) 302 or a program loaded from a storage part 308 into a random access memory (RAM, Random Access Memory) 303. In the RAM 303, various programs and data required for system operation are also stored. The CPU 301, ROM 302, and RAM 303 are connected to each other through a bus 304. An input / output (I / O, Input / Output) interface 305 is also connected to the bus 304.
[0055] The following components are connected to the I / O interface 305: an input part 306 including a keyboard, a mouse, etc.; an output part 307 including such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage part 308 including a hard disk, etc.; and a communication part 309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as required. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as required so that a computer program read from it can be installed into the storage part 308 as required.
[0056] Specifically, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program code for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 309, and / or installed from the removable medium 311. When the computer program is executed by a central processing unit (CPU) 301, the above functions defined in the method of the present application are executed. It should be noted that the above computer-readable medium in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above.
[0057] More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in the present application, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0058] The computer program code for performing the operations of the present application may be written in one or more programming languages or combinations thereof. The foregoing programming languages include object-oriented programming languages - such as Java, Smalltalk, C++, and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network - including a local area network (LAN) or a wide area network (WAN) - or, alternatively, may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0059] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions denoted in the blocks may occur in a different order than that denoted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0060] The terms "first", "second", etc. are used to distinguish similar objects and not to describe or indicate a particular order or sequence.
[0061] The term "comprising" or any other similar term is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus / device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements that are inherent to such process, method, article, or apparatus / device.
[0062] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings.
[0063] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A vector retrieval method based on vector ID, characterized in that The method includes: Obtain the retrieval information input by the user; According to the retrieval information, determine the feature vector to be retrieved and the filtering conditions for limiting the vector metadata; According to the filtering conditions, determine a vector filter, and through the vector filter, extract a target vector from a pre-constructed vector library; the vector library stores multiple vectors and the vector IDs corresponding to each vector, and the vector ID includes the mapping value of the vector metadata corresponding to each vector. The vector filter is used to determine the vector that meets the filtering conditions in the vector library as the target vector according to the filtering conditions and the mapping value of the vector metadata in the vector ID; According to the feature vector, determine a similar vector in the target vector, and the similarity between the similar vector and the feature vector is higher than a preset threshold; According to the similar vector, return a retrieval result to the user.
2. The vector retrieval method based on vector ID according to claim 1, characterized in that, The determining the feature vector to be retrieved according to the retrieval information includes: According to the retrieval information, determine the text content to be retrieved; Adopt a preset statement segmentation algorithm to segment the text content into multiple semantic segments; According to a preset vector conversion rule, convert each semantic segment into a floating-point representation; According to the floating-point representation corresponding to each semantic segment, determine the feature vector.
3. The vector retrieval method based on vector ID according to claim 1, wherein The vector ID is an N-bit character, and the N-bit character is composed of n binary numbers, and each binary number is used to indicate the mapping value of a kind of vector metadata.
4. The vector retrieval method based on vector ID according to claim 3, characterized in that, The number of bits N of the vector ID satisfies: ; Wherein, n is the number of binary digits in the vector ID, satisfying 1 ≤ n ≤ N, and X i is the number of digits of the i-th binary digit, satisfying .
5. The vector retrieval method based on vector ID according to claim 1, wherein The retrieving a target vector from a pre-constructed vector library through the vector filter includes: Determine the current vector to be retrieved and the vector ID of the current vector, and the current vector is any vector in the pre-constructed vector library; Through the vector filter, determine whether the vector ID of the current vector meets the filtering conditions; If so, determine the current vector as the target vector and update the next vector in the vector library as the current vector; If not, determine that the current vector is not the target vector and update another vector in the vector library as the current vector.
6. The vector retrieval method based on vector ID according to claim 5, wherein The vector filter is a mask filter, and the mask filter is composed of multiple sub-filters, and the multiple sub-filters correspond to the filtering conditions one by one.
7. The vector retrieval method based on vector ID according to claim 6, wherein The determining whether the vector ID of the current vector meets the filtering conditions through the vector filter includes: Determine each sub-filter in the vector filter; Determine each sub-segment in the vector ID; Sequentially determine whether each sub-segment in the vector ID fully conforms to each sub-filter of the vector filter; If so, determine that the vector ID of the current vector meets the filtering conditions.
8. A vector retrieval system based on vector IDs, characterized in that, The system includes: A data acquisition module for acquiring the retrieval information input by the user; A data extraction module for determining the feature vector to be retrieved and the filtering conditions for limiting the vector metadata according to the retrieval information; A data filtering module, configured to determine a vector filter according to the filtering condition, and extract a target vector from a pre-constructed vector library through the vector filter; multiple vectors and vector IDs corresponding to each vector are stored in the vector library, and the vector ID includes a mapping value of vector metadata corresponding to each vector, and the vector filter is configured to determine a vector that meets the filtering condition in the vector library as the target vector according to the filtering condition and the mapping value of vector metadata in the vector ID; A data comparison module, configured to determine a similar vector from the target vectors according to the feature vector, and the similarity between the similar vector and the feature vector is higher than a preset threshold; A data output module, configured to return a retrieval result to a user according to the similar vector.
9. An electronic device, characterized in that, Comprising: At least one processor; And A memory communicatively connected to at least one of the processors; wherein, The memory stores instructions executable by the processor, and the instructions are used to be executed by the processor to implement the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and the computer instructions are used to be executed by the computer to implement the method according to any one of claims 1-7.
Citation Information
Patent Citations
Method and device for carrying out pre-filtering retrieval on vector database
CN119848316A
Unique Identification Management
US20230244647A1