Multi-class vector batch retrieval method, device and medium based on offset parameter

By arranging vectors in category order during multi-class vector retrieval, generating an offset parameter array, and dynamically allocating tasks, the problem of low computational efficiency and resource waste caused by inconsistent numbers of multi-class vectors is solved, achieving efficient similarity calculation and improved hardware utilization.

CN123115488APending Publication Date: 2026-11-17SHANGHAI SUIYUAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611577040.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-13
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing multi-class vector retrieval methods suffer from low computational efficiency, low resource utilization, and load imbalance when faced with a large number of classes and inconsistent vector counts for each class. Their efficiency is particularly limited when zero padding and multiple kernel startups are involved.

Method used

By arranging the vectors in the multi-class vector library in order of category, recording the starting index to generate an offset parameter array, distributing tasks evenly according to the total number of vectors and the number of computing units, and dynamically determining the category through binary search or category caching, each computing unit can process similarity calculations within a continuous index range.

Benefits of technology

It reduces the number of operator startups, eliminates invalid computations caused by zero padding, improves computational efficiency and hardware utilization, and solves the problem of low computational efficiency when the number of vectors of different classes is not uniform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123115488A_ABST
    Figure CN123115488A_ABST
Patent Text Reader

Abstract

This invention discloses a method, device, and medium for batch retrieval of multi-class vectors based on offset parameters. The method includes: arranging vectors in a multi-class vector library to be retrieved continuously according to their class order, and recording the starting index of each class to obtain an offset parameter array; evenly distributing vector calculation tasks to each calculation unit according to the total number of vectors and the number of calculation units, so that each unit processes a continuous range of vector indices with a load difference not exceeding one; dynamically determining the class to which each vector index belongs based on the offset parameter array through binary search and / or class caching; each calculation unit selecting the query vector of the corresponding class for each vector index it is responsible for and calculating a similarity score; and summarizing and returning the scores by class. The technical solution of this invention can significantly improve the computational efficiency and hardware utilization of batch retrieval of multi-class vectors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method, device and medium for batch retrieval of multiple vectors based on offset parameters. Background Technology

[0002] With the rapid development of artificial intelligence applications such as recommender systems, image retrieval, and natural language processing, multi-class vector retrieval has become a core technology supporting real-time matching of massive amounts of data. In practical business scenarios, it is often necessary to simultaneously perform similarity retrieval in the vector spaces of multiple categories (such as product categories, image and text tags, user groups, etc.) to obtain the optimal matching results for each category. However, the number of vectors in different categories usually varies significantly. How to efficiently complete batch vector similarity calculations across categories while ensuring retrieval accuracy has become a key performance bottleneck restricting system throughput and response speed.

[0003] In existing technologies, batch retrieval of multi-class vectors mainly relies on the following methods: First, starting the computation kernel one by one according to the class. Although this method is simple to implement, it requires frequent kernel startup when there are many classes, resulting in significant scheduling overhead. Moreover, uneven distribution of vectors in each class can cause severe load imbalance and low utilization of computing resources. Second, zero-padding is used to align vectors of each class to the same length before performing batch matrix operations. Although this method can reduce the number of kernel startups, it introduces a large amount of invalid computation, especially when the number of vectors in each class varies greatly, the zero-padding ratio can reach more than 30%, seriously wasting computing power. Third, schemes based on sparse computing or dynamic scheduling can alleviate the above problems to some extent, but they have high implementation complexity and poor adaptability to hardware platforms, making them difficult to widely apply in practical deployments. Therefore, how to achieve efficient batch retrieval of multi-class vectors without introducing invalid computation is a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0004] This invention provides a method, device, and medium for batch retrieval of multiple types of vectors based on offset parameters, in order to solve the problem of low computational efficiency when the number of multiple types of vectors is not uniform.

[0005] According to one aspect of the present invention, a method for batch retrieval of multiple vectors based on offset parameters is provided, the method comprising: The vectors in the multi-class vector library to be batch searched are arranged continuously in order of category, and the starting index of the vector corresponding to each category in the vector library is recorded to obtain the offset parameter array. The length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library. Based on the total number of vectors and the number of available computing units, the computing tasks of all vectors are evenly distributed to each computing unit, so that each computing unit is responsible for processing a continuous range of vector indices, and the difference in the number of vectors processed by any two computing units is no greater than one. By using binary search and / or category caching, the category to which each vector index belongs within the vector index range that each computing unit is responsible for is dynamically determined based on the offset parameter array; Each computing unit selects a query vector corresponding to the category to which the vector index belongs for each vector index within its own vector index range, and calculates the similarity score between the query vector and the vector at that index in the vector library. The similarity scores calculated by each calculation unit are summarized by category, and the similarity calculation results between the query vector and the corresponding category vector for each category are returned.

[0006] According to another aspect of the present invention, a multi-class vector batch retrieval device based on offset parameters is provided, the device comprising: The offset parameter construction module is used to arrange the vectors in the multi-class vector library to be batch searched in order of category, and record the starting index of the vector corresponding to each category in the vector library to obtain the offset parameter array; wherein, the length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library; An adaptive data allocation module is used to evenly distribute the computation tasks of all vectors to each computing unit according to the total number of vectors and the number of available computing units, so that each computing unit is responsible for processing a continuous range of vector indices, and the difference in the number of vectors processed by any two computing units is no greater than one. The category dynamic determination module is used to dynamically determine the category of each vector index within the vector index range that each calculation unit is responsible for, based on the offset parameter array, through binary search and / or category caching. The similarity calculation module is used to select a query vector corresponding to the category to which the vector index belongs for each vector index within the vector index range that each calculation unit is responsible for, and to calculate the similarity score between the query vector and the vector at that index in the vector library. The results summary output module is used to summarize the similarity scores calculated by each calculation unit by category, and return the similarity calculation results between the query vector and the corresponding category vector for each category.

[0007] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform a multi-class vector batch retrieval method based on offset parameters as described in any embodiment of the present invention.

[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement a multi-class vector batch retrieval method based on offset parameters as described in any embodiment of the present invention.

[0009] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the method as described in any embodiment of the present invention.

[0010] The technical solution of this invention involves arranging vectors in a multi-class vector library to be retrieved continuously according to their class order and recording the starting index of each class to obtain an offset parameter array. Based on the total number of vectors and the number of computation units, the vector computation task is evenly distributed to each computation unit, ensuring that each unit processes a continuous range of vector indices with a load difference not exceeding one. Through binary search and / or class caching, the class to which each vector index belongs is dynamically determined based on the offset parameter array. Each computation unit selects the query vector of the corresponding class for each vector index it is responsible for and calculates a similarity score. The scores are then summarized and returned by class. This solution solves the problem of low computational efficiency when the number of vectors in multiple classes is not uniform, achieving beneficial effects such as reducing the number of operator startups, eliminating zero-padding for invalid computations, and improving computational efficiency and hardware utilization.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart of a multi-class vector batch retrieval method based on offset parameters according to Embodiment 1 of the present invention; Figure 2This is a flowchart of another multi-class vector batch retrieval method based on offset parameters provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of a multi-vector batch retrieval calculation based on offset parameters in a specific scenario applicable to an embodiment of the present invention; Figure 4 This is a schematic diagram of a multi-vector batch retrieval device based on offset parameters according to Embodiment 3 of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device that implements a multi-class vector batch retrieval method based on offset parameters according to an embodiment of the present invention. Detailed Implementation

[0014] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0015] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0016] Example 1 Figure 1 This is a flowchart of a multi-class vector batch retrieval method based on offset parameters provided in Embodiment 1 of the present invention. This embodiment is applicable to batch similarity retrieval when the number of vectors in each class is different. The method can be executed by a multi-class vector batch retrieval device based on offset parameters. The device can be implemented in hardware and / or software and is generally configured in an electronic device.

[0017] like Figure 1 As shown, the method includes: S110. Arrange the vectors in the multi-class vector library to be batch searched in order of category, and record the starting index of the vector corresponding to each category in the vector library to obtain an offset parameter array; wherein, the length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library.

[0018] In this embodiment, a multi-class vector library to be batch-searched is first obtained. This vector library contains multiple categories, and each category contains several vectors. These vectors are arranged sequentially according to their categories, that is, all vectors of the first category are placed consecutively, followed by all vectors of the second category, and so on, forming a continuously stored vector sequence. Then, the index position of the first vector in the vector sequence for each category is recorded as the starting index of that category. These starting indices are stored sequentially into an array according to their categories, and the total number of vectors in the vector sequence is appended to the end of the array as the last element, thereby constructing an offset parameter array. The difference between two adjacent elements in this array is the number of vectors in the corresponding category.

[0019] Optionally, based on the above embodiments, the vectors in the multi-class vector library to be batch-searched are arranged consecutively according to category order, and the starting index of the vector corresponding to each category in the vector library is recorded to obtain an offset parameter array, which may include: Obtain a multi-class vector library to be batch searched, wherein the multi-class vector library contains multiple categories; The vectors corresponding to each category are arranged sequentially according to the category order to form a continuously stored vector sequence; Record the index position of the first vector corresponding to each category in the vector sequence, which serves as the starting index for that category; The starting indices of each category are stored in the array in order of category number, and the total number of vectors in the vector sequence is stored in the array as the last element to obtain the offset parameter array.

[0020] Generally, a multi-category vector library stores vector data from different categories, with each category containing several vectors. These vectors can be product feature vectors, image feature vectors, or text feature vectors, etc., and different types of vectors belong to different category identifiers. Before performing batch retrieval, this multi-category vector library needs to be loaded into the computing environment as the processing object.

[0021] Generally, vectors originally scattered across various categories are reorganized according to category order. This involves placing all vectors from the first category consecutively in one storage area, followed by all vectors from the second category, and so on, until all categories have been filled. After this arrangement, all vectors form a continuous whole in storage space, eliminating storage gaps between categories and facilitating unified access via index positions later.

[0022] Generally, after the vector sequence is formed, the position number of the first vector in the entire sequence is recorded for each category; this position number is the starting index of that category. Since the vectors are arranged consecutively according to category order, the starting index of each category plus the number of vectors in that category equals the starting index of the next category. The starting index allows for precise location of the starting position of each category in the vector sequence, enabling quick determination of which category a given index position belongs to in subsequent calculations.

[0023] Generally, the starting indices of each category are written into an array in ascending order of category number. Then, an extra element is appended to the end of the array, with the value being the total number of vectors in the vector sequence. This results in an offset parameter array, the length of which is equal to the number of categories plus one. The difference between two adjacent elements in the array represents the number of vectors in the corresponding category, while the difference between the last element and the second-to-last element represents the number of vectors in the last category. In this way, the offset parameter array comprehensively describes the position range and length information of each category in the continuous vector sequence.

[0024] S120. Based on the total number of vectors and the number of available computing units, the computing tasks of all vectors are evenly distributed to each computing unit, so that each computing unit is responsible for processing a continuous range of vector indices, and the difference in the number of vectors processed by any two computing units is no greater than one.

[0025] In this embodiment, based on the total number of vectors in the vector library and the number of currently available computing units, the minimum number of vectors that each computing unit needs to process is calculated as the basic load, as well as the number of computing units that need to process one more vector. The first few computing units are each assigned the basic load plus one vector, and the remaining computing units are each assigned the basic load plus one vector. Simultaneously, the start and end indices of the vector index range that each computing unit is responsible for are calculated, ensuring that each computing unit obtains a continuous vector index range, and the number of vectors processed by each computing unit differs by at most one.

[0026] Optionally, based on the above embodiments, according to the total number of vectors and the number of available computing units, the computation tasks of all vectors are evenly distributed to each computing unit, so that each computing unit is responsible for processing a continuous range of vector indices. This may include: The base load of each computing unit is determined by the integer quotient obtained by dividing the total number of vectors by the number of available computing units. The number of computing units required to process one more vector is determined based on the remainder obtained by dividing the total number of vectors by the number of available computing units. The first few computing units are each assigned a basic load plus a vector, and the remaining computing units are each assigned a basic load vector. The start and end indices of the vector index range that each computing unit is responsible for are calculated, so that each computing unit obtains a continuous vector index range.

[0027] Generally, the first step is to calculate the integer division result between the total number of vectors and the number of available computing units. This integer division result represents the minimum number of vectors that each computing unit needs to process, and is called the base load. Since the total number of vectors is not necessarily divisible by the number of computing units, the base load is a rounded-down value, ensuring that all computing units are allocated at least this number of vectors.

[0028] Generally, after division, a certain number of vectors remain that cannot be evenly distributed; this remaining number is called the remainder. The size of the remainder determines how many computational units need to process one more vector than the base load. For example, if the remainder is three, the first three computational units will each be allocated one more vector, while the remaining computational units will only be allocated the base load of vectors.

[0029] Generally, based on the remainder, the first few computing units are each assigned a base load plus one vector, while the remaining computing units are each assigned only a base load vector. Then, based on the number of vectors assigned to each computing unit, the numbers are accumulated sequentially from zero to calculate the start and end indices of the vector index range that each computing unit is responsible for. The start index is the sum of the number of vectors assigned to all preceding computing units, and the end index is the start index plus the number of vectors assigned to that computing unit minus one. In this way, each computing unit obtains a continuous and non-overlapping vector index range, and the number of vectors processed by each computing unit differs by at most one.

[0030] S130. Using binary search and / or category caching, dynamically determine the category of each vector index within the vector index range that each calculation unit is responsible for, based on the offset parameter array.

[0031] In this embodiment, each computing unit, when processing each vector index within its assigned vector index range, dynamically determines the category to which the vector index belongs using either a binary search or a category caching method, leveraging the ordered nature of the offset parameter array. The binary search method quickly locates the category interval of the current vector index by performing a binary search on the offset parameter array; the category caching method utilizes the computing unit's ability to process consecutive indices, caching the category information after the initial category determination, allowing subsequent vector indices to be classified through simple comparisons without repeating the binary search. Both methods achieve efficient category determination based on the offset parameter array.

[0032] S140. For each vector index within the range of vector indexes it is responsible for, each computing unit selects a query vector corresponding to the category to which the vector index belongs, and calculates the similarity score between the query vector and the vector at that index in the vector library.

[0033] In this embodiment, each computing unit, for each vector index within its assigned vector index range, selects a query vector corresponding to the determined category from a pre-set set of query vectors for each category. Then, it performs a dot product operation between the selected query vector and the vector at the current index position in the vector library, multiplies the corresponding dimensions of the two vectors, and sums the results to obtain a similarity score.

[0034] S150. Summarize the similarity scores calculated by each calculation unit by category, and return the similarity calculation results between the query vector and the corresponding category vector for each category.

[0035] In this embodiment, after all computing units complete their respective similarity calculations, they aggregate and summarize the calculated similarity scores according to their respective categories. All similarity scores for each category are organized into a similarity score list for that category and mapped to the query vector for that category, returning it as the similarity calculation result between the query vector and the corresponding category vector for each category.

[0036] The technical solution of this invention involves arranging vectors in a multi-class vector library to be retrieved continuously according to their class order and recording the starting index of each class to obtain an offset parameter array. Based on the total number of vectors and the number of computation units, the vector computation task is evenly distributed to each computation unit, ensuring that each unit processes a continuous range of vector indices with a load difference not exceeding one. Through binary search and / or class caching, the class to which each vector index belongs is dynamically determined based on the offset parameter array. Each computation unit selects the query vector of the corresponding class for each vector index it is responsible for and calculates a similarity score. The scores are then summarized and returned by class. This solution solves the problem of low computational efficiency when the number of vectors in multiple classes is not uniform, achieving beneficial effects such as reducing the number of operator startups, eliminating zero-padding for invalid computations, and improving computational efficiency and hardware utilization.

[0037] Example 2 Figure 2 This is a flowchart of a multi-class vector batch retrieval method based on offset parameters provided in Embodiment 2 of the present invention. This embodiment is based on and optimized from the above embodiments. Specifically, the step of "each computing unit selects a query vector corresponding to the category to which the vector index belongs for each vector index within its own vector index range, and calculates the similarity score between the query vector and the vector at that index in the vector library" has been refined.

[0038] Correspondingly, such as Figure 2 As shown, the method includes: S210. Arrange the vectors in the multi-class vector library to be batch searched in order of category, and record the starting index of the vector corresponding to each category in the vector library to obtain an offset parameter array; wherein, the length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library.

[0039] S220. Based on the total number of vectors and the number of available computing units, the computing tasks of all vectors are evenly distributed to each computing unit, so that each computing unit is responsible for processing a continuous range of vector indices, and the difference in the number of vectors processed by any two computing units is no greater than one.

[0040] S230. Using binary search and / or category caching, dynamically determine the category of each vector index within the vector index range that each calculation unit is responsible for, based on the offset parameter array.

[0041] Optionally, based on the above embodiments, by using a binary search method to dynamically determine the category of each vector index within the vector index range handled by each calculation unit according to the offset parameter array, it may include: Get a current vector index from the vector index range that the current computing unit is responsible for; For the current vector index, initialize the lower bound of the binary search to zero, initialize the upper bound of the binary search to the total number of categories minus one, and initialize the current candidate category of the binary search to zero. Enter the loop search, calculate the average of the lower bound and the upper bound, round the average down to obtain the middle position, and obtain the starting index of the middle position from the offset parameter array as the middle starting index; If the starting index is not greater than the current vector index, then update the current candidate category to the middle position and update the lower bound to the middle position plus one. If the starting index is greater than the current vector index, then the upper bound is updated to the middle position minus one. When the lower bound is greater than the upper bound, the loop search is exited, and the current candidate category is determined as the category to which the current vector index belongs.

[0042] Generally, within its assigned range of consecutive vector indices, the computation unit sequentially retrieves an unprocessed vector index as the current processing target. This vector index is the position number of a vector in the vector library, and a binary search will be used to determine which category the vector at that index belongs to.

[0043] Generally, before starting a binary search, the boundaries of the search range need to be set. The starting position of the search range is set to the leftmost position, the ending position to the rightmost position, and the currently guessed category is set to the first category. These three initial values ​​mark the start of the binary search, and the search range covers all possible categories. In each round of the search, the midpoint between the lower and upper bounds of the current search range is calculated, and the integer part is taken as the midpoint. Then, the starting index of this midpoint is retrieved from the offset parameter array. This starting index represents the position number of the first vector of the corresponding category in the vector sequence, used for comparison with the current vector index.

[0044] Generally, the starting index is compared with the current vector index. If the starting index is less than or equal to the current vector index, it means that the current vector index is within the category corresponding to the middle position or the category to its right. In this case, the current candidate category is updated to the middle position, and the lower bound of the search range is moved to the right of the middle position to narrow the search range for the next round.

[0045] Generally, if the starting index of the middle position is greater than the current vector index, it means that the current vector index is within the left range of the category corresponding to the middle position. In this case, the upper bound of the search range is moved to the left of the middle position, narrowing the search range for the next round. After this adjustment, the search range is halved each time. This comparison and range adjustment process is repeated until the lower bound of the search range is greater than the upper bound, indicating that the search range has been narrowed to the point where it cannot be further divided. After exiting the loop, the last updated current candidate category is the category to which the current vector index belongs. The starting index of this category is not greater than the current vector index, and the starting index of the next category is greater than the current vector index.

[0046] Optionally, based on the above embodiments, by using binary search and category caching, dynamically determining the category of each vector index within the vector index range handled by each calculation unit according to the offset parameter array, may include: Get the range of vector indices that the current computing unit is responsible for; The category to which the first vector index in the current vector index range belongs is determined by binary search and is taken as the current cache category. The starting index of the next category of the current cache category is obtained from the offset parameter array and is taken as the upper bound of the current category. Within the current vector index range, each subsequent vector index other than the first vector index is determined as the current vector index, and it is determined in turn whether each current vector index is less than the upper bound of the current category. If the current vector index is less than the upper bound of the current category, then the current cache category is determined as the category to which the current vector index belongs, and the current cache category and the upper bound of the current category remain unchanged; If the current vector index is not less than the upper bound of the current category, then after updating the current cache category to the next category of the current cache category, the starting index of the next category of the updated current cache category is obtained from the offset parameter array as the new upper bound of the current category, and the updated current cache category is determined as the category to which the current vector index belongs.

[0047] Generally, the computation unit first determines which contiguous vector index range it has been assigned to. This range contains several position numbers to be processed, and all subsequent operations will be performed sequentially within this range. The computation unit first processes the first vector index within the range, quickly determining its category using a binary search and recording this category as the current cache category. Simultaneously, it retrieves the starting position of the next category from the offset parameter array and marks this starting position as the upper bound of the current category, used to mark the maximum index range that the current category can cover.

[0048] Generally, starting from the second vector index, each remaining vector index is retrieved one by one as the current processing object. For each retrieved vector index, instead of performing a complex search, it is directly compared with the upper bound of the previously cached category to see if the index is still within the range covered by the current cached category. If the current vector index is less than the upper bound of the cached category, it means that the index still falls within the vector interval corresponding to the current cached category and has not crossed into the next category. Therefore, the current cached category is directly used as the category to which this vector index belongs, and the category and upper bound in the cache do not need to be updated and can continue to be used.

[0049] Generally, if the current vector index is equal to or exceeds the upper bound of the cached category, it means that the index has entered the range of the next category. At this point, the cached category needs to be switched to the next category, and the starting position of the next category of this new category should be found from the offset parameter array as the new upper bound. Then, this new category is determined as the category to which the current vector index belongs, and the cache is updated to prepare for the rapid determination of subsequent vector indices.

[0050] S240. For each vector index within the range of vector indexes it is responsible for, each computing unit retrieves the query vector corresponding to the category from the preset query vector set for each category, based on the category to which the vector index belongs.

[0051] In this embodiment, after determining the category to which the current vector index belongs, each computing unit needs to find the query vector corresponding to that category. A dedicated query vector is prepared in advance for each category, and these query vectors are stored in a set, with one vector per category. Based on the category identifier determined in the previous steps, the computing unit retrieves the query vector corresponding to that category from this set, using it as input for subsequent similarity calculations.

[0052] S250. Perform a dot product operation between the obtained query vector and the vector at the vector index in the vector library to obtain the similarity score; wherein, the dot product operation is the sum of the products of the corresponding dimension elements of the two vectors.

[0053] In this embodiment, the calculation unit performs a dot product operation between the query vector obtained in the previous step and the vector at the current vector index position in the vector library. The dot product operation multiplies the values ​​of the corresponding dimensions of the two vectors separately, and then sums all the product results to obtain a single value as the similarity score. This score reflects the degree of similarity between the query vector and the vectors in the library; a higher score indicates greater similarity. The entire operation is completed continuously within the same calculation unit without interruption or context switching.

[0054] S260. Summarize the similarity scores calculated by each calculation unit by category, and return the similarity calculation results between the query vector and the corresponding category vector for each category.

[0055] Optionally, based on the above embodiments, the similarity scores calculated by each calculation unit are summarized by category, and the similarity calculation results between the query vector and the corresponding category vector for each category are returned. This may include: The similarity scores calculated by each calculation unit are combined with their corresponding categories. By aggregating similarity scores of the same category, similarity scores of the same category are grouped into the same storage area to form a set of similarity scores for each category; The set of similarity scores for each category is returned as the similarity calculation result for that category.

[0056] Generally, after each computational unit completes the similarity calculation within its assigned vector index range, it obtains a series of similarity scores. Simultaneously, since the category of each vector index has been determined beforehand, each similarity score corresponds to a specific category. The computational unit bundles these similarity scores with their respective category information and outputs them as a whole, so that the scores can be subsequently categorized and grouped according to category.

[0057] Generally, the similarity scores output by all computational units are grouped according to their bound categories. All similarity scores belonging to the same category are aggregated and placed in the storage area corresponding to that category. Each category has its own independent set of similarity scores, containing the similarity scores calculated by all computational units for all vectors within that category.

[0058] Generally, the set of similarity scores corresponding to each category is output as the final search result for that category. The result for each category includes the similarity score between the query vector of that category and all vectors under that category, which is used for subsequent sorting, filtering or other downstream processing.

[0059] The technical solution of this invention involves arranging vectors in a multi-class vector library to be retrieved continuously according to their class order and recording the starting index of each class to obtain an offset parameter array. Based on the total number of vectors and the number of computation units, the vector computation task is evenly distributed to each computation unit, ensuring that each unit processes a continuous range of vector indices with a load difference not exceeding one. The class of each vector index is dynamically determined based on the offset parameter array using binary search or class caching. Each computation unit, for each vector index it is responsible for, selects the corresponding query vector from a pre-set set of query vectors for each class according to its class, and performs a dot product operation with the vector at that index in the vector library to obtain a similarity score. The scores are then summarized and returned by class. This solves the problem of low computational efficiency when the number of vectors in multiple classes is not uniform. It achieves the beneficial effect of completing all class similarity calculations within a single operator call by dynamically selecting the corresponding query vector and performing the dot product operation, avoiding multiple independent kernel starts and zero-padding for invalid calculations, and significantly improving computational efficiency and hardware utilization.

[0060] In this specific embodiment, in order to solve the problems of existing multi-class vector retrieval methods when facing a large number of categories and inconsistent vector quantities, such as the large scheduling overhead caused by multiple independent startups of computing kernels, the waste of computing power due to the introduction of a large amount of invalid computation by zero padding, and the load imbalance caused by task allocation by category, thus limiting the overall throughput, this embodiment of the invention designs a complete multi-class vector batch retrieval method based on offset parameters.

[0061] Specifically, Figure 3 This is a schematic diagram of batch retrieval calculation of multi-class vectors based on offset parameters provided in an embodiment of the present invention, such as... Figure 3As shown, this process covers the entire chain from vector library arrangement to similarity score aggregation by category. First, query vectors (Q_A to Q_D) are prepared, and the vectors in the multi-class vector library are arranged consecutively in category order: Class A vectors (v0 to v3), Class B vectors (v4 to v6), Class C vectors (v7 to v10), and Class D vectors (v11 to v12). Simultaneously, an offset parameter array (offset) recording the starting index of each category is generated. Then, based on the total number of vectors and the number of available computing units, the computational tasks are adaptively and evenly distributed among the computing units (computing units 0 to 3), so that each unit is responsible for processing a continuous range of vector indices (e.g., computing unit 0 processes v0 to v3, computing unit 1 processes v4 to v6, etc.). Next, each computing unit, combined with the offset parameter array (offset), divides the computational region and dynamically determines the category of each vector index within its assigned range using binary search or category caching. Based on this, the corresponding query vector is retrieved from a pre-set set according to the determined category (e.g., Q_A for category A, Q_B for category B, Q_C for category C, and Q_D for category D), and a dot product operation is performed with the vector at the corresponding position in the vector library (e.g., Q_A with v0, v1, Q_B with v4, etc.) to obtain the similarity score. Finally, the similarity scores obtained from each calculation unit are combined with the corresponding category, aggregated and collected by category, and the similarity calculation results for each category (A-class, B-class, C-class, and D-class) are returned respectively.

[0062] Example 3 Figure 4 This is a schematic diagram of a multi-class vector batch retrieval device based on offset parameters provided in Embodiment 3 of the present invention. Figure 4 As shown, the device includes: The offset parameter construction module 410 is used to arrange the vectors in the multi-class vector library to be batch searched in order of category, and record the starting index of the vector corresponding to each category in the vector library to obtain the offset parameter array; wherein, the length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library; The adaptive data allocation module 420 is used to evenly distribute the calculation tasks of all vectors to each calculation unit according to the total number of vectors and the number of available calculation units, so that each calculation unit is responsible for processing a continuous range of vector indices, and the difference between the number of vectors processed by any two calculation units is no greater than one. The category dynamic determination module 430 is used to dynamically determine the category of each vector index within the vector index range of each calculation unit based on the offset parameter array through binary search and / or category caching. The similarity calculation module 440 is used to select a query vector corresponding to the category to which the vector index belongs for each vector index within the vector index range that each calculation unit is responsible for, and to calculate the similarity score between the query vector and the vector at that index in the vector library. The result summary output module 450 is used to summarize the similarity scores calculated by each calculation unit by category, and return the similarity calculation results between the query vector and the corresponding category vector for each category.

[0063] The technical solution of this invention involves arranging vectors in a multi-class vector library to be retrieved continuously according to their class order and recording the starting index of each class to obtain an offset parameter array. Based on the total number of vectors and the number of computation units, the vector computation task is evenly distributed to each computation unit, ensuring that each unit processes a continuous range of vector indices with a load difference not exceeding one. Through binary search and / or class caching, the class to which each vector index belongs is dynamically determined based on the offset parameter array. Each computation unit selects the query vector of the corresponding class for each vector index it is responsible for and calculates a similarity score. The scores are then summarized and returned by class. This solution solves the problem of low computational efficiency when the number of vectors in multiple classes is not uniform, achieving beneficial effects such as reducing the number of operator startups, eliminating zero-padding for invalid computations, and improving computational efficiency and hardware utilization.

[0064] Based on the above embodiments, the offset parameter construction module 410 is specifically used for: Obtain a multi-class vector library to be batch searched, wherein the multi-class vector library contains multiple categories; The vectors corresponding to each category are arranged sequentially according to the category order to form a continuously stored vector sequence; Record the index position of the first vector corresponding to each category in the vector sequence, which serves as the starting index for that category; The starting indices of each category are stored in the array in order of category number, and the total number of vectors in the vector sequence is stored in the array as the last element to obtain the offset parameter array.

[0065] Based on the above embodiments, the adaptive data allocation module 420 is specifically used for: The base load of each computing unit is determined by the integer quotient obtained by dividing the total number of vectors by the number of available computing units. The number of computing units required to process one more vector is determined based on the remainder obtained by dividing the total number of vectors by the number of available computing units. The first few computing units are each assigned a basic load plus a vector, and the remaining computing units are each assigned a basic load vector. The start and end indices of the vector index range that each computing unit is responsible for are calculated, so that each computing unit obtains a continuous vector index range.

[0066] Based on the above embodiments, the category dynamic determination module 430 is specifically used for: Get a current vector index from the vector index range that the current computing unit is responsible for; For the current vector index, initialize the lower bound of the binary search to zero, initialize the upper bound of the binary search to the total number of categories minus one, and initialize the current candidate category of the binary search to zero. Enter the loop search, calculate the average of the lower bound and the upper bound, round the average down to obtain the middle position, and obtain the starting index of the middle position from the offset parameter array as the middle starting index; If the starting index is not greater than the current vector index, then update the current candidate category to the middle position and update the lower bound to the middle position plus one. If the starting index is greater than the current vector index, then the upper bound is updated to the middle position minus one. When the lower bound is greater than the upper bound, the loop search is exited, and the current candidate category is determined as the category to which the current vector index belongs.

[0067] Based on the above embodiments, the category dynamic determination module 430 is specifically used for: Get the range of vector indices that the current computing unit is responsible for; The category to which the first vector index in the current vector index range belongs is determined by binary search and is taken as the current cache category. The starting index of the next category of the current cache category is obtained from the offset parameter array and is taken as the upper bound of the current category. Within the current vector index range, each subsequent vector index other than the first vector index is determined as the current vector index, and it is determined in turn whether each current vector index is less than the upper bound of the current category. If the current vector index is less than the upper bound of the current category, then the current cache category is determined as the category to which the current vector index belongs, and the current cache category and the upper bound of the current category remain unchanged; If the current vector index is not less than the upper bound of the current category, then after updating the current cache category to the next category of the current cache category, the starting index of the next category of the updated current cache category is obtained from the offset parameter array as the new upper bound of the current category, and the updated current cache category is determined as the category to which the current vector index belongs.

[0068] Based on the above embodiments, the similarity calculation module 440 is specifically used for: Each computing unit, for each vector index within its own vector index range, retrieves the query vector corresponding to that category from a pre-set set of query vectors for each category, based on the category to which that vector index belongs. The obtained query vector is multiplied by the vector at the index of the vector in the vector library to obtain the similarity score; wherein, the dot product operation is the sum of the products of the corresponding dimension elements of the two vectors.

[0069] Based on the above embodiments, the result summary output module 450 is specifically used for: The similarity scores calculated by each calculation unit are combined with their corresponding categories. By aggregating similarity scores of the same category, similarity scores of the same category are grouped into the same storage area to form a set of similarity scores for each category; The set of similarity scores for each category is returned as the similarity calculation result for that category.

[0070] The multi-class vector batch retrieval device based on offset parameters provided in the embodiments of the present invention can execute the multi-class vector batch retrieval method based on offset parameters provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0071] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0072] Example 4 Figure 5 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0073] As shown in Figure 5, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer programs stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0074] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0075] Processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing unit (CPU), graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as performing a multi-class vector batch retrieval method based on offset parameters as described in any embodiment of the present invention, i.e.: The vectors in the multi-class vector library to be batch searched are arranged continuously in order of category, and the starting index of the vector corresponding to each category in the vector library is recorded to obtain the offset parameter array. The length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library. Based on the total number of vectors and the number of available computing units, the computing tasks of all vectors are evenly distributed to each computing unit, so that each computing unit is responsible for processing a continuous range of vector indices, and the difference in the number of vectors processed by any two computing units is no greater than one. By using binary search and / or category caching, the category to which each vector index belongs within the vector index range that each computing unit is responsible for is dynamically determined based on the offset parameter array; Each computing unit selects a query vector corresponding to the category to which the vector index belongs for each vector index within its own vector index range, and calculates the similarity score between the query vector and the vector at that index in the vector library. The similarity scores calculated by each calculation unit are summarized by category, and the similarity calculation results between the query vector and the corresponding category vector for each category are returned.

[0076] In some embodiments, a multi-class vector batch retrieval method based on offset parameters as described in any one of the embodiments of the present invention can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the multi-class vector batch retrieval method based on offset parameters as described above can be performed. Alternatively, in other embodiments, processor 11 can be configured by any other suitable means (e.g., by means of firmware) to perform the multi-class vector batch retrieval method based on offset parameters as described in any one of the embodiments of the present invention.

[0077] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0078] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0079] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0080] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0081] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0082] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0083] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0084] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for batch retrieval of multiple vectors based on offset parameters, characterized in that, The method includes: The vectors in the multi-class vector library to be batch searched are arranged continuously in order of category, and the starting index of the vector corresponding to each category in the vector library is recorded to obtain the offset parameter array. The length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library. Based on the total number of vectors and the number of available computing units, the computing tasks of all vectors are evenly distributed to each computing unit, so that each computing unit is responsible for processing a continuous range of vector indices, and the difference in the number of vectors processed by any two computing units is no greater than one. By using binary search and / or category caching, the category to which each vector index belongs within the vector index range that each computing unit is responsible for is dynamically determined based on the offset parameter array; Each computing unit selects a query vector corresponding to the category to which the vector index belongs for each vector index within its own vector index range, and calculates the similarity score between the query vector and the vector at that index in the vector library. The similarity scores calculated by each calculation unit are summarized by category, and the similarity calculation results between the query vector and the corresponding category vector for each category are returned.

2. The method according to claim 1, characterized in that, The vectors in the multi-class vector library to be batch searched are arranged consecutively according to their categories, and the starting index of the vector corresponding to each category in the vector library is recorded to obtain an offset parameter array, including: Obtain a multi-class vector library to be batch searched, wherein the multi-class vector library contains multiple categories; The vectors corresponding to each category are arranged sequentially according to the category order to form a continuously stored vector sequence; Record the index position of the first vector corresponding to each category in the vector sequence, which serves as the starting index for that category; The starting indices of each category are stored in the array in order of category number, and the total number of vectors in the vector sequence is stored in the array as the last element to obtain the offset parameter array.

3. The method according to claim 1, characterized in that, Based on the total number of vectors and the number of available computing units, the computational tasks for all vectors are evenly distributed across the computing units, so that each computing unit is responsible for processing a continuous range of vector indices, including: The base load of each computing unit is determined by the integer quotient obtained by dividing the total number of vectors by the number of available computing units. The number of computing units required to process one more vector is determined based on the remainder obtained by dividing the total number of vectors by the number of available computing units. The first few computing units are each assigned a basic load plus a vector, and the remaining computing units are each assigned a basic load vector. The start and end indices of the vector index range that each computing unit is responsible for are calculated, so that each computing unit obtains a continuous vector index range.

4. The method according to claim 1, characterized in that, Using a binary search method, the category of each vector index within the vector index range handled by each calculation unit is dynamically determined based on the offset parameter array, including: Get a current vector index from the vector index range that the current computing unit is responsible for; For the current vector index, initialize the lower bound of the binary search to zero, initialize the upper bound of the binary search to the total number of categories minus one, and initialize the current candidate category of the binary search to zero. Enter the loop search, calculate the average of the lower bound and the upper bound, round the average down to obtain the middle position, and obtain the starting index of the middle position from the offset parameter array as the middle starting index; If the starting index is not greater than the current vector index, then update the current candidate category to the middle position and update the lower bound to the middle position plus one. If the starting index is greater than the current vector index, then the upper bound is updated to the middle position minus one. When the lower bound is greater than the upper bound, the loop search is exited, and the current candidate category is determined as the category to which the current vector index belongs.

5. The method according to claim 1, characterized in that, Using binary search and category caching, the category of each vector index within the vector index range handled by each computational unit is dynamically determined based on the offset parameter array, including: Get the range of vector indices that the current computing unit is responsible for; The category to which the first vector index in the current vector index range belongs is determined by binary search and is taken as the current cache category. The starting index of the next category of the current cache category is obtained from the offset parameter array and is taken as the upper bound of the current category. Within the current vector index range, each subsequent vector index other than the first vector index is determined as the current vector index, and it is determined in turn whether each current vector index is less than the upper bound of the current category. If the current vector index is less than the upper bound of the current category, then the current cache category is determined as the category to which the current vector index belongs, and the current cache category and the upper bound of the current category remain unchanged; If the current vector index is not less than the upper bound of the current category, then after updating the current cache category to the next category of the current cache category, the starting index of the next category of the updated current cache category is obtained from the offset parameter array as the new upper bound of the current category, and the updated current cache category is determined as the category to which the current vector index belongs.

6. The method according to claim 1, characterized in that, For each vector index within its assigned vector index range, each computing unit selects a query vector corresponding to the category of that index and calculates a similarity score between the query vector and the vector at that index in the vector database, including: Each computing unit, for each vector index within its own vector index range, retrieves the query vector corresponding to that category from a pre-set set of query vectors for each category, based on the category to which that vector index belongs. The obtained query vector is multiplied by the vector at the index of the vector in the vector library to obtain the similarity score; wherein, the dot product operation is the sum of the products of the corresponding dimension elements of the two vectors.

7. The method according to any one of claims 1-6, characterized in that, The similarity scores calculated by each calculation unit are summarized by category, and the similarity calculation results between the query vector and the corresponding category vector for each category are returned, including: The similarity scores calculated by each calculation unit are combined with their corresponding categories. By aggregating similarity scores of the same category, similarity scores of the same category are grouped into the same storage area to form a set of similarity scores for each category; The set of similarity scores for each category is returned as the similarity calculation result for that category.

8. A multi-class vector batch retrieval device based on offset parameters, characterized in that, include: The offset parameter construction module is used to arrange the vectors in the multi-class vector library to be batch searched in order of category, and record the starting index of the vector corresponding to each category in the vector library to obtain the offset parameter array; wherein, the length of the offset parameter array is the number of categories plus one, and the last element is the total number of vectors in the vector library; An adaptive data allocation module is used to evenly distribute the computation tasks of all vectors to each computing unit according to the total number of vectors and the number of available computing units, so that each computing unit is responsible for processing a continuous range of vector indices, and the difference in the number of vectors processed by any two computing units is no greater than one. The category dynamic determination module is used to dynamically determine the category of each vector index within the vector index range that each calculation unit is responsible for, based on the offset parameter array, through binary search and / or category caching. The similarity calculation module is used to select a query vector corresponding to the category to which the vector index belongs for each vector index within the vector index range that each calculation unit is responsible for, and to calculate the similarity score between the query vector and the vector at that index in the vector library. The results summary output module is used to summarize the similarity scores calculated by each calculation unit by category, and return the similarity calculation results between the query vector and the corresponding category vector for each category.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the multi-class vector batch retrieval method based on offset parameters 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 that cause a processor to execute the multi-class vector batch retrieval method based on offset parameters as described in any one of claims 1-7.

11. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the multi-class vector batch retrieval method based on offset parameters according to any one of claims 1-7.