Retrieval method and computer equipment
A heterogeneous computing architecture with multiple processors optimizes retrieval efficiency and accuracy by adaptively allocating database searches, addressing the inefficiencies in current hardware systems handling large and complex unstructured data.
Patent Information
- Application Number
- CN202311197640.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-06-28
- Filing Date
- 2023-09-15
- Publication Date
- 2024-12-31
AI Technical Summary
Current hardware systems face challenges in supporting high-concurrency retrieval of large and complex datasets, leading to low retrieval efficiency when processing unstructured data such as images, text, and video.
A retrieval method utilizing a heterogeneous computing architecture with multiple processors, where the first processor executes a first part of retrieval requests and the second processor executes a second part based on the database's characteristics, allowing parallel processing and optimizing the utilization of computing power without hardware expansion.
This approach enhances retrieval efficiency and accuracy by adaptively allocating database searches to multiple processors, improving the utilization rate of processor computing power and reducing costs.
Smart Images

Figure CN119226428A_ABST
Abstract
Description
[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on June 28, 2023, with application number 202310782717.5 and application name “A Retrieval Method”. The entire contents of these applications are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computers, and in particular to a retrieval method and a computer device. Background Art
[0003] At present, with the development of big data applications, massive amounts of data are bursting out, such as unstructured data such as images, text, video and voice. The process of converting unstructured data into high-dimensional vectors and using high-dimensional vectors to represent the semantics of unstructured data can be called embedding. Then, based on a single processor, the database is retrieved according to the retrieval request to obtain the retrieval results. For example, vectors similar to the query content are retrieved from the database to realize the analysis and retrieval of unstructured data. However, with the increase in data size and complexity, current hardware cannot support high-concurrency retrieval, resulting in low retrieval efficiency. Summary of the invention
[0004] The present application provides a retrieval method and a computer device, thereby improving retrieval efficiency.
[0005] In a first aspect, a retrieval method is provided, which is applied to a computing system, wherein the computing system includes a first processor and a second processor, and the method includes: first, after the first processor determines a database to be searched based on multiple retrieval requests, the first processor is determined to execute a first part of the retrieval requests among the multiple retrieval requests, and the second processor is determined to execute a second part of the retrieval requests among the multiple retrieval requests according to characteristics of the database; that is, the first processor executes the first part of the retrieval requests to obtain a first retrieval result, and the second processor executes the second part of the retrieval requests to obtain a second retrieval result; finally, the retrieval results of the multiple retrieval requests are obtained based on the first retrieval result and the second retrieval result.
[0006] Compared with only relying on a single processor to perform a search on the database according to the search request to obtain the search results, the solution provided by this application determines the search range based on which the two processors perform the search according to the characteristics of the database, that is, by adaptively sensing the characteristics of the database, the database and multiple search requests are allocated to the two processors, so that the two processors perform the search based on the allocated database and search request. Thus, the computing power of multiple types of processors is fully utilized, and the search is performed in parallel based on the heterogeneous computing architecture, which improves the search efficiency and the utilization rate of the processor computing power, and there is no need to expand the hardware, reducing costs.
[0007] In one possible implementation, determining that the first processor executes a first part of retrieval requests among multiple retrieval requests and the second processor executes a second part of retrieval requests among multiple retrieval requests based on characteristics of the database includes: when the size of the database is greater than the processing capacity of the first processor, sending the multiple retrieval requests to the first processor and the second processor respectively, the first part of retrieval requests and the second part of retrieval requests are both multiple retrieval requests.
[0008] In another possible implementation, the method includes dividing the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor; the first processor executes the first part of the retrieval request to obtain a first retrieval result, and the second processor executes the second part of the retrieval request to obtain a second retrieval result, including: the first processor queries the first part of the retrieval request in the first sub-database to obtain the first retrieval result, and the second processor queries the second part of the retrieval request in the second sub-database to obtain the second retrieval result.
[0009] In this way, when the computing power of a single processor cannot support the scale of the database, the database is divided according to the capabilities of different types of processors. Two processors respectively perform retrieval on multiple retrieval requests based on part of the content in the database, that is, retrieval is performed in parallel based on different sub-databases, thereby effectively improving the retrieval efficiency.
[0010] In another possible implementation, obtaining the retrieval results of the multiple retrieval requests according to the first retrieval result and the second retrieval result includes: selecting a retrieval result similar to the retrieval request from the first retrieval result and the second retrieval result to determine the retrieval results of the multiple retrieval requests.
[0011] In another possible implementation, determining that the first processor executes a first part of retrieval requests among multiple retrieval requests and the second processor executes a second part of retrieval requests among multiple retrieval requests based on characteristics of the database includes: when the size of the database is less than or equal to the processing capacity of the first processor, dividing the multiple retrieval requests into a first part of retrieval requests and a second part of retrieval requests based on the processing capacity of the first processor and the second processor.
[0012] In this way, the computing power of a single processor supports the scale of the database, and multiple search requests are divided according to the capabilities of different types of processors. Two processors respectively perform searches on the database based on some of the multiple search requests, that is, searches are performed in parallel based on different search requests, thereby effectively improving the search efficiency.
[0013] In another possible implementation, the first processor executes the first partial retrieval request to obtain the first retrieval result, and the second processor executes the second partial retrieval request to obtain the second retrieval result, including: the first processor queries the first partial retrieval request in the database to obtain the first retrieval result, and the second processor queries the second partial retrieval request in the database to obtain the second retrieval result.
[0014] Thus, by comparing the first search result and the second search result, a search result that is closer or more similar to the search request is obtained, thereby ensuring the accuracy of the search result.
[0015] In another possible implementation, the first processor executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, including: determining a retrieval algorithm according to the distribution characteristics of the database; the first processor executes the first part of the retrieval request according to the retrieval algorithm to obtain the first retrieval result, and the second processor executes the second part of the retrieval request according to the retrieval algorithm to obtain the second retrieval result.
[0016] In this way, a retrieval algorithm is determined based on the distribution characteristics of the database, and a retrieval is performed on the database based on the retrieval algorithm so that retrieval results similar to the retrieval request can be retrieved from the database as quickly as possible, thereby improving retrieval efficiency and retrieval accuracy.
[0017] In another possible implementation, determining the retrieval algorithm according to the distribution characteristics of the database includes: when the distribution characteristics are random distribution, determining the retrieval algorithm to be an exact retrieval algorithm; when the distribution characteristics are dense distribution or sparse distribution, determining the retrieval algorithm to be an approximate retrieval algorithm.
[0018] Since randomly distributed data has poor regularity, performing retrieval based on the exact retrieval algorithm ensures that similar results can be retrieved. Compared with the approximate retrieval algorithm, it avoids missed detection and thus improves the retrieval accuracy.
[0019] Since densely distributed or sparsely distributed data has regularity, performing retrieval based on approximate retrieval algorithms ensures that similar results can be retrieved as quickly as possible, which improves retrieval efficiency compared to precise retrieval algorithms.
[0020] In another possible implementation manner, the method further includes: determining distribution characteristics according to statistical characteristics and attributes of the database.
[0021] Therefore, the retrieval algorithm is determined by the distribution characteristics of the database determined by the statistical characteristics and attributes of the database to improve the retrieval accuracy.
[0022] In another possible implementation, determining the retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database includes: determining multiple retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database; and determining the retrieval algorithm indicated by the user from the multiple retrieval algorithms.
[0023] In another possible implementation, the database includes vectors, and multiple search requests perform vector searches on the database. The first processor determines a vector library to be searched according to the multiple search requests; the first processor determines a search scheme according to the characteristics of the vector library, the search scheme is used to indicate the vector search range and the vector search algorithm based on which at least two processors in the computing system perform the vector search, and the vector search range is used to indicate the range of the vector library and the range of multiple search requests; the first processor performs the vector search according to the vector search range and the vector search algorithm based on which the first processor indicates the search scheme, and obtains a first search result; the second processor performs the vector search according to the vector search range and the vector search algorithm based on which the second processor indicates the search scheme, and obtains a second search result; the first processor obtains the search results of the multiple search requests according to the first search result and the second search result.
[0024] In a second aspect, a retrieval device is provided, the retrieval device comprising modules for executing the internal retrieval method in the first aspect or any possible design of the first aspect. For example, the retrieval device comprises a communication module, a data perception module and a data retrieval module.
[0025] The data sensing module is used to determine the database to be searched based on multiple search requests; the data sensing module is also used to determine that the first processor executes the first part of the search requests among the multiple search requests, and the second processor executes the second part of the search requests among the multiple search requests according to the characteristics of the database; the data retrieval module is used to execute the first part of the search requests to obtain the first search result; the data retrieval module is also used to execute the second part of the search requests to obtain the second search result; the data retrieval module is also used to obtain the search results of multiple search requests based on the first search result and the second search result.
[0026] In one possible implementation, the data perception module determines, based on characteristics of a database, that the first processor executes a first part of retrieval requests among multiple retrieval requests and the second processor executes a second part of retrieval requests among multiple retrieval requests. Specifically, when the size of the database is greater than the processing capability of the first processor, the multiple retrieval requests are sent to the first processor and the second processor respectively, and both the first part of retrieval requests and the second part of retrieval requests are multiple retrieval requests.
[0027] In another possible implementation, the data perception module is also used to divide the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor; when the first processor of the data retrieval module executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, it is specifically used for: the first processor queries the first part of the retrieval request in the first sub-database to obtain the first retrieval result, and the second processor queries the second part of the retrieval request in the second sub-database to obtain the second retrieval result.
[0028] In another possible implementation, when the data retrieval module obtains retrieval results of multiple retrieval requests based on the first retrieval result and the second retrieval result, it is specifically used to: select retrieval results similar to the retrieval request from the first retrieval result and the second retrieval result to determine the retrieval results of the multiple retrieval requests.
[0029] In another possible implementation, the data perception module determines, based on characteristics of a database, that the first processor executes a first part of retrieval requests among multiple retrieval requests, and that the second processor executes a second part of retrieval requests among multiple retrieval requests. Specifically, when the size of the database is less than or equal to the processing capability of the first processor, the multiple retrieval requests are divided into the first part of retrieval requests and the second part of retrieval requests according to the processing capabilities of the first processor and the second processor.
[0030] In another possible implementation, when the first processor of the data retrieval module executes a first part of the retrieval request to obtain a first retrieval result, and the second processor executes a second part of the retrieval request to obtain a second retrieval result, it is specifically used for: the first processor queries the first part of the retrieval request in the database to obtain the first retrieval result, and the second processor queries the second part of the retrieval request in the database to obtain the second retrieval result.
[0031] In another possible implementation, when the first processor of the data perception module executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result, it is specifically used to: determine the retrieval algorithm according to the distribution characteristics of the database; the first processor executes the first part of the retrieval request according to the retrieval algorithm to obtain the first retrieval result, and the second processor executes the second part of the retrieval request according to the retrieval algorithm to obtain the second retrieval result.
[0032] In another possible implementation, when the data perception module determines the retrieval algorithm according to the distribution characteristics of the database, it is specifically used to: when the distribution characteristics are random distribution, determine the retrieval algorithm as an exact retrieval algorithm; when the distribution characteristics are dense distribution or sparse distribution, determine the retrieval algorithm as an approximate retrieval algorithm.
[0033] In another possible implementation, the data perception module is further used to determine distribution characteristics according to statistical characteristics and attributes of the database.
[0034] In another possible implementation, when the data perception module determines the retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database, it is specifically used to: determine multiple retrieval algorithms on which the first processor and the second processor perform the retrieval based on the distribution characteristics of the database; and determine the retrieval algorithm indicated by the user from the multiple retrieval algorithms.
[0035] In another possible implementation, the database includes vectors, and multiple search requests perform vector searches on the database. The data perception module is used to determine the vector library to be searched according to the multiple search requests; and determine the search scheme according to the characteristics of the vector library, the search scheme is used to indicate the vector search range and vector search algorithm based on which at least two processors in the computing system perform the vector search, and the vector search range is used to indicate the range of the vector library and the range of multiple search requests; the data search module is used to perform the vector search according to the vector search range and vector search algorithm based on which the first processor indicates the search scheme, and obtain the first search result; the data search module is also used to perform the vector search according to the vector search range and vector search algorithm based on which the second processor indicates the search scheme, and obtain the second search result; the data search module is also used to obtain the search results of multiple search requests according to the first search result and the second search result.
[0036] In a third aspect, a computer device is provided, which includes a memory and multiple different types of processors, the memory being used to store a set of computer instructions; when the processor executes the set of computer instructions, the operating steps of the retrieval method in the first aspect or any possible implementation of the first aspect are executed.
[0037] In a fourth aspect, a data processing system is provided, which includes a client and multiple computer devices. The client is used to send a retrieval request to the computer device, and the computer device is used to execute the operating steps of the retrieval method in the first aspect or any possible implementation of the first aspect to realize the retrieval of multiple retrieval requests.
[0038] In a fifth aspect, a computer-readable storage medium is provided, comprising: computer software instructions; when the computer software instructions are executed in a computer device, the computer device executes the operating steps of the method described in the first aspect or any possible implementation of the first aspect.
[0039] In a sixth aspect, a computer program product is provided. When the computer program product is run on a computer, the computer is caused to execute the operation steps of the method described in the first aspect or any possible implementation manner of the first aspect.
[0040] The technical effects brought about by any design method in the second to sixth aspects can refer to the technical effects brought about by the first aspect or different design methods, and will not be repeated here.
[0041] Based on the implementations provided in the above aspects, the present application can be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of the architecture of a data processing system provided for this application;
[0043] Figure 2 A flowchart of a search method provided in this application;
[0044] Figure 3 A schematic diagram of performing vector retrieval based on a heterogeneous computing architecture provided in this application;
[0045] Figure 4 A schematic diagram of a data-aware retrieval solution provided for this application;
[0046] Figure 5 A schematic diagram of performing a search based on a search scheme provided in this application;
[0047] Figure 6 A schematic diagram of the structure of a retrieval device provided in this application;
[0048] Figure 7 A schematic diagram of the structure of a computer device provided in this application. DETAILED DESCRIPTION
[0049] To facilitate understanding, the main terms involved in this application are first explained.
[0050] Vector: It can also be called Euclidean vector or geometric vector. In mathematics, a vector refers to a quantity with magnitude and direction. A vector can be represented by a line segment with an arrow; the direction of the arrow represents the direction of the vector; the length of the line segment represents the magnitude of the vector. The quantity corresponding to a vector can be called a quantity or scalar, which only has magnitude but no direction.
[0051] Since computer devices can only recognize numbers, a set of numbers is used to represent or recognize things. A set of numbers can be a vector. A vector contains n numbers, so this vector can be called an n-dimensional vector. For example, a computer device recognizes an image and converts the image into an n-dimensional or higher-dimensional vector.
[0052] Vector retrieval: refers to retrieving vectors from the database that are similar or close to the search request.
[0053] The application scenarios of vector retrieval include but are not limited to: recommendation systems, image search, video fingerprints, speech processing, natural language processing, etc. For example, advertising recommendations, search engine associative word recommendations, image search, image search, image search for videos, image search for products, file retrieval, etc.
[0054] In order to solve the problem of low retrieval efficiency, the present application provides a retrieval method, that is, after the first processor determines the database to be searched based on multiple retrieval requests, the first processor is determined to execute a first part of the retrieval requests among the multiple retrieval requests, and the second processor is determined to execute a second part of the retrieval requests among the multiple retrieval requests according to the characteristics of the database; that is, the first processor executes the first part of the retrieval request to obtain a first retrieval result, and the second processor executes the second part of the retrieval request to obtain a second retrieval result; finally, the retrieval results of the multiple retrieval requests are obtained based on the first retrieval result and the second retrieval result.
[0055] Compared with only relying on a single processor to perform a search on the database according to a search request to obtain the search results, the solution provided by the present application determines the search range based on which the two processors perform the search according to the characteristics of the database, that is, by adaptively sensing the characteristics of the database, the database and multiple search requests are allocated to the two processors, so that the two processors perform the search based on the allocated database and search request. Thus, the computing power of multiple types of processors is fully utilized, and the search is performed in parallel based on the heterogeneous computing architecture, which improves the search efficiency and the utilization rate of the processor computing power.
[0056] The implementation of the search method provided by the present application is described in detail below with reference to the accompanying drawings.
[0057] The solution provided in the present application can be applied to a network with a client / server (C / S) architecture. A network with a client / server (C / S) architecture can include a single server or a server cluster. The present application does not limit the type and function of the server. For example, the types of servers include blade servers, tower servers, cabinet servers, and rack servers. For another example, the server includes a storage server with a storage function or a computing server with a computing function, and the computing server also has a storage function.
[0058] For example, Figure 1 This is a schematic diagram of the architecture of a data processing system provided in this application. Figure 1 As shown, data processing system 100 includes client 110 , computing cluster 120 , and storage cluster 130 .
[0059] The storage cluster 130 includes at least two storage nodes 131. A storage node 131 includes one or more controllers, a network card and multiple hard disks. The hard disk is used to store data. The hard disk can be a magnetic disk or other types of storage media, such as a solid-state hard disk or a shingled magnetic recording hard disk. The network card is used to communicate with the computing node 121 included in the computing cluster 120. The controller is used to write data to the hard disk or read data from the hard disk according to the read / write data request sent by the computing node 121. In the process of reading and writing data, the controller needs to convert the address carried in the read / write data request into an address that the hard disk can recognize.
[0060] The computing cluster 120 includes at least two computing nodes 121, and the computing nodes 121 can communicate with each other. The computing node 121 is a computing device, such as a server, a desktop computer, or a controller of a storage array.
[0061] The client 110 communicates with the computing cluster 120 and the storage cluster 130 through the network 140. For example, the client 110 sends a search request to the computing cluster 120 through the network 140, requesting the computing cluster 120 to perform a search on the database based on the search request and obtain a search result similar to the search request. The network 140 may refer to an internal network of an enterprise (such as a local area network (LAN)) or the Internet. The client 110 refers to a computer connected to the network 140, which may also be called a workstation. Different clients can share resources on the network (such as computing resources and storage resources).
[0062] For another example, the client 110 sends a service request for a big data service to the computing cluster 120 through the network 140. A big data service can be called a job. A job can be divided into multiple tasks, which are executed in parallel by multiple computing nodes. When all tasks are completed, a job is completed. A task is generally a processing process for a part of data or stages in a job. All tasks are scheduled to be completed in parallel or serially.
[0063] In some embodiments, the computing cluster 120 includes a control node 122. The control node and the computing node may be independent physical devices, and the control node may also be referred to as a control device or a named node. The computing node may be referred to as a computing device or a data node. The control node 122 is used to manage and allocate tasks or retrieval requests, and multiple computing nodes execute multiple tasks or retrieval requests in parallel to increase the data processing rate.
[0064] In an embodiment of the present application, the storage cluster 130 stores a database. For example, the database includes vectors after unstructured data is vectorized (embedding). Among them, the vectors contained in a database may be obtained after vectorizing the same type of unstructured data. Or, the vectors contained in a database may be obtained after vectorizing different types of unstructured data. For example, the vectors contained in the database are all obtained after image vectorization. For another example, the vectors contained in the database are all obtained after video vectorization. For another example, the vectors contained in the database are all obtained after image and video vectorization. In addition, the dimensions of the vectors contained in a database are the same. The dimensions of the vectors contained in different databases may be the same or different.
[0065] The computing cluster 120 includes a heterogeneous computing architecture to provide high-performance computing. For example, the computing node 121 may include a central processing unit (CPU), a graphics processing unit (GPU), a data processing unit (DPU), a neural processing unit (NPU), and an embedded neural-network processing unit (NPU) and other computing units with computing capabilities to provide high-performance computing.
[0066] The client 110 is installed with a client program 111. The client 110 runs the client program 111 to display a user interface (UI). The user 150 operates the user interface to submit a search request. For example, the user 150 operates the user interface to submit multiple search requests. After the computing node 121 obtains the search request, it loads the database from the storage cluster 130, performs a search based on the database, and obtains a search result that is close or similar to the search request. In some embodiments, after the computing node 121 obtains the search request, it loads the database from the storage cluster 130, the database includes vectors, performs a vector search based on the database, and obtains a vector that is close or similar to the search request.
[0067] In other embodiments, the computing node 121 performs retrieval based on a heterogeneous computing architecture. After the first processor determines the database to be searched based on multiple retrieval requests, it determines that the first processor executes the first part of the retrieval requests and the second processor executes the second part of the retrieval requests according to the characteristics of the database; that is, the first processor executes the first part of the retrieval request to obtain the first retrieval result, and the second processor executes the second part of the retrieval request to obtain the second retrieval result; finally, the retrieval results of the multiple retrieval requests are obtained based on the first retrieval result and the second retrieval result.
[0068] Optionally, the system administrator 160 can call the application platform interface (API) 112 or the command-line interface (CLI) interface 113 through the client 110 to configure system information, such as the retrieval strategy configured for the computing node provided in the embodiment of the present application.
[0069] Figure 1 This is only a schematic diagram. The embodiments of the present application do not limit the device connection mode and the number of devices in the data processing system. For example, the data processing system may include multiple clients. A client may be connected to multiple computing nodes. Different clients establish connections with different computing nodes.
[0070] It should be noted that the vector retrieval function provided in this application can be implemented by a software system, can also be implemented by a hardware device, or can also be implemented by a combination of a software system and a hardware device.
[0071] In a possible implementation, the cloud service provider abstracts the search function into a cloud service and deploys the cloud service in a cloud data center. Users can consult and purchase the cloud service through the cloud service platform. After purchasing the cloud service, users can submit a search request to the cloud data center through a terminal device, and the cloud data center runs a search module to implement the search function provided by the present application.
[0072] In another possible implementation, the retrieval module can be packaged as a software package by a software provider. The user purchases the software package, and the user deploys the software package on his own server, or the user deploys the software package on a cloud server. For example, the retrieval module is deployed by the tenant in the computing resources (such as a virtual machine) of the cloud data center rented by the tenant. The tenant purchases the computing resource cloud service provided by the cloud service provider through the cloud service platform, and runs the retrieval module in the purchased computing resources, so that the retrieval module performs the retrieval function provided by this application. Optionally, the retrieval module can also encrypt the data uploaded by the user and the file path of the data, and avoid direct contact with the data uploaded by the user without hindering the implementation effect, so as to ensure information security.
[0073] Next, the search process is described in detail with reference to the accompanying drawings.
[0074] Figure 2A flowchart of a retrieval method provided in the present application. Here, a heterogeneous computing architecture included in a computer device is used as an example to perform database perception and retrieval. Assume that the computer device includes a first processor and a second processor, and the first processor and the second processor form a heterogeneous computing architecture. The first processor perceives the characteristics of the database to determine a retrieval scheme, and the first processor and the second processor perform retrieval according to the retrieval scheme. The first processor can be a CPU. The second processor can be a GPU. The client can be Figure 1 The computer device can be a client Figure 1 The computing nodes in the computing cluster described in . Figure 2 As shown, the method includes the following steps.
[0075] Step 210: The client sends a search request.
[0076] The client can send a search request to the computer device through a network between the computer device and the client device. The network can be an internal network of an enterprise (such as a local area network) or the Internet.
[0077] A search request is used to indicate a search requirement. For example, the search requirement is to search for images by image, search for videos by image, or search for objects by image. A search request may include images, videos, or text.
[0078] Step 220: The first processor determines the databases to be searched by the multiple search requests.
[0079] If the search request includes unstructured data, after receiving the search request, the first processor can use the deep coding model to convert the unstructured data into a vector, and determine a database similar to the converted vector for searching. Optionally, the control node in the system can also use the deep coding model to convert the unstructured data into a vector.
[0080] If the search request includes a vector, after receiving the search request, the first processor determines to search a database similar to the converted vector.
[0081] In some embodiments, the dimensions of the vectors indicated by the multiple search requests are the same, and the database is determined according to the dimensions of the vectors included in the search requests.
[0082] In some other embodiments, the multiple search requests indicate identifiers of databases to be searched, and the first processor determines the databases to be searched by the multiple search requests based on the identifiers of the databases.
[0083] Step 230: Determine, based on the characteristics of the database, that the first processor executes a first portion of the plurality of retrieval requests, and that the second processor executes a second portion of the plurality of retrieval requests.
[0084] The first processor determines a search scheme according to the characteristics of the database. The search scheme is used to indicate the search request, database and search algorithm based on which two different types of processors in the computing system perform the search. It can also be understood that the first processor determines a search range according to the characteristics of the database, and the search range is used to indicate the range of the database and the range of multiple search requests based on which the two different types of processors perform the search.
[0085] Solution 1: The first processor divides the database to be searched into two sub-databases according to the characteristics of the database, and the two processors perform search based on different sub-databases and multiple search requests and a search algorithm determined according to the characteristics of the database.
[0086] Solution 2: The first processor divides multiple search requests into a first part of search requests and a second part of search requests according to the characteristics of the database. The two processors perform searches based on different search requests and the databases searched and the search algorithm determined according to the characteristics of the database.
[0087] In some embodiments, the first processor determines the search request and database on which the first processor and the second processor perform the search based on the attributes of the database. For example, the attributes include the size of the database. For example, the size of the database can refer to the vector dimension and the number of vectors in the database. The larger the vector dimension and the more vectors there are, the larger the size of the database. The first processor can determine the database and the search algorithm on which the first processor and the second processor perform the search based on the size of the database.
[0088] For example, when the computing power of a single processor in the computing system supports the size of the database, or the size of the database is less than or equal to the processing power of the first processor, the retrieval scheme is determined to divide the retrieval requests into multiple retrieval requests so that the first processor and the second processor perform retrieval based on different retrieval requests.
[0089] The scale of a database supported by the computing power of a single processor means that the computing power of a single processor meets the computing requirements for performing retrieval based on the database; or, alternatively, the storage capacity of a storage medium associated with a single processor meets the size of the database, and the database can be loaded into the storage medium of a single processor. For example, the database can be loaded into the high bandwidth memory (HBM) of a GPU, and the database can be loaded into the memory of a CPU, so that retrieval results close to or similar to the retrieval request can be achieved from the database.
[0090] Divide the multiple search requests into two parts, such as dividing the multiple search requests into a first part of search requests and a second part of search requests, and the first part of search requests and the second part of search requests constitute the multiple search requests. For example, divide the multiple search requests into a first part of search requests and a second part of search requests according to the processing capabilities of the first processor and the second processor. The two processors retrieve vectors that are close or similar to the search requests of different parts based on the same database. That is, the two processors perform the search based on different search requests.
[0091] Compared with using a single processor to retrieve search results close to or similar to multiple search requests from a database, multiple search requests are divided, and two processors are used to perform searches on the two parts of the search requests respectively, thereby effectively improving the search efficiency.
[0092] For another example, when the computing power of a single processor in a heterogeneous retrieval architecture does not support the size of the database, or the size of the database is larger than the processing capability of the first processor, a retrieval scheme is determined to partition the database so that the first processor and the second processor perform retrieval based on different sub-databases.
[0093] The computing power of a single processor does not support the scale of the database, which means that the computing power of a single processor does not meet the computing requirements for performing retrieval based on the database; or, alternatively, the storage capacity of the storage medium associated with a single processor does not meet the size of the database, and the database cannot be loaded into the storage medium of a single processor. For example, the database cannot be loaded into the HBM of the GPU, and the database cannot be loaded into the memory of the CPU. Errors or downtime may occur during the process of retrieving retrieval results from the database that are close or similar to the retrieval request.
[0094] The database is divided into two parts, such as the database is divided into a first sub-database and a second sub-database, and the first sub-database and the second sub-database constitute a database. For example, the database is divided into a first sub-database and a second sub-database according to the capabilities of a first processor and a second processor. The two processors retrieve similar or similar search results based on different databases and the same multiple search requests. That is, the two processors perform searches based on different databases.
[0095] Optionally, before the first processor core and the second processor execute the retrieval of the multiple retrieval requests, the database is divided into the first sub-database and the second sub-database according to the capabilities of the first processor and the second processor. Alternatively, after the first processor receives the multiple retrieval requests, the database is divided into the first sub-database and the second sub-database according to the capabilities of the first processor and the second processor. The present application may not limit the timing of dividing the database.
[0096] Compared with using a single processor to retrieve search results that are close or similar to multiple search requests from a database, multiple databases are divided, and two processors are used to perform searches on multiple search requests based on two parts of the database respectively, thereby effectively improving the search efficiency without the need to expand hardware and reducing costs.
[0097] In other embodiments, the retrieval algorithm used by the first processor and the second processor to perform the retrieval is determined based on the distribution characteristics of the database. Compared with performing the retrieval based on a retrieval algorithm or randomly selecting a retrieval algorithm, performing the retrieval based on the retrieval algorithm determined by the distribution characteristics of the database effectively improves the retrieval accuracy.
[0098] Distribution characteristics include the central tendency of distribution, the degree of dispersion of distribution and the shape of distribution. The central tendency of distribution reflects the degree to which each data converges or clusters towards its central value. The degree of dispersion of distribution reflects the tendency of each data to move away from its central value. The shape of distribution reflects the skewness and kurtosis of data distribution.
[0099] Relatively speaking, the central tendency is also called "the central position of the data", "the central quantity", etc. It is the representative value of a group of data. The concept of central tendency is the concept of average. It can be representative of a certain characteristic of the whole, indicating the common nature and general level of the public opinion phenomenon under certain time and space conditions.
[0100] In the embodiment of the present application, the distribution characteristics include random distribution, dense distribution and sparse distribution.
[0101] In some embodiments, the first processor determines the distribution feature according to the statistical features and attributes of the database. The statistical features include at least one of the mean, standard deviation or variance of the database.
[0102] When the distribution feature is random distribution, the retrieval algorithm is determined to be an accurate retrieval algorithm. Accurate retrieval algorithms include brute force retrieval algorithms. Since the regularity of randomly distributed data is poor, performing retrieval based on an accurate retrieval algorithm ensures that possible results can be retrieved. Compared with approximate retrieval algorithms, it avoids missed detection, thereby improving retrieval accuracy.
[0103] When the distribution feature is densely distributed or sparsely distributed, the retrieval algorithm is determined to be an approximate retrieval algorithm. For example, approximate retrieval algorithms include tree-based vector retrieval (such as Annoy, KD-Tree), space-partition-based vector retrieval (such as LSH), graph-based vector retrieval (such as NSW, HNSW) and quantization-encoding-based vector retrieval (such as SQ, PQ). Due to the regularity of densely distributed or sparsely distributed data, performing retrieval based on an approximate retrieval algorithm ensures that possible results can be retrieved. Compared with an exact retrieval algorithm, the retrieval accuracy is ensured to reduce the amount of calculation.
[0104] For example, for the retrieval of high-dimensional vectors, a graph-based vector retrieval can be used to perform vector retrieval. For the retrieval of high-dimensional vectors, a space-partition-based vector retrieval can be used to perform vector retrieval.
[0105] For another example, for vectors of integer data, vector retrieval based on space partitioning may be used to perform vector retrieval.
[0106] Optionally, the database may be searched according to a search algorithm indicated by the user. For example, multiple search algorithms according to which the first processor and the second processor perform the search are determined according to the distribution characteristics of the database; and the search algorithm indicated by the user is determined from multiple search algorithms. For example, the search algorithm indicated by the user is determined from multiple approximate search algorithms.
[0107] Optionally, the retrieval algorithms used by the first processor and the second processor to perform the retrieval may be the same or different.
[0108] In some embodiments, the first processor may instruct the second processor to perform the database and the search request based on which the search is performed. For example, for the partitioned search request scheme, the first processor performs the search of the first part of the search request on the database, and the first processor may send the second part of the search request to the second processor; the first processor performs the search of the second part of the search request on the database, and the first processor may send the first part of the search request to the second processor.
[0109] For another example, for a partitioned database scheme, the first processor performs a search for multiple search requests on a first sub-database, and the first processor instructs the second processor to perform a search for multiple search requests based on the second sub-database; the first processor performs a search for multiple search requests on a second sub-database, and the first processor instructs the second processor to perform a search for multiple search requests based on the first sub-database.
[0110] Step 240: The first processor executes the first partial search request to obtain a first search result.
[0111] The first processor performs a search according to the database, search request and search algorithm indicated by the search scheme, and obtains a first search result.
[0112] The search scheme indicates a database partitioning scheme, for example, the search scheme indicates a first sub-database based on which the first processor performs the search. The first processor performs the search based on the first sub-database according to the search algorithm and multiple search requests to obtain a first search result, and the first search result includes search results similar to the multiple search requests.
[0113] The first processor queries the first part of the search request in the first sub-database to obtain a first search result. For example, it is assumed that the database includes 1 million vectors, and the dimension of each vector is 128 dimensions. The first sub-database includes 500,000 vectors, and the second sub-database includes 500,000 vectors. It is necessary to perform vector search on 100 search requests, and the dimension of the search request is 128 dimensions. The first processor performs a search on the 100 search requests based on the 500,000 vectors to obtain a first search result, and the first search result includes search results similar to the 100 search requests.
[0114] The search scheme indicates that a plurality of search requests are divided. For example, the search scheme indicates that the first processor performs the first part of the search request based on which the search is performed. The first processor performs the search based on the database according to the search algorithm and the first part of the search request to obtain the first search result. The first search result includes the search result similar to the first part of the search request.
[0115] The first processor queries the first part of the search request in the database to obtain a first search result. For example, it is assumed that the database includes 1 million vectors, and the dimension of each vector is 128. It is necessary to perform vector search on 100 search requests, and the dimension of the search request is 128. The first part of the search request includes 50 search requests, and the second part of the search request includes 50 search requests. The first processor performs a search on the 50 search requests based on the 1 million vectors to obtain a first search result, and the first search result includes search results similar to the 50 search requests.
[0116] Step 250: The second processor executes the second part of the search request to obtain a second search result.
[0117] The second processor performs a search according to the database, search request and search algorithm indicated by the search plan, and obtains a second search result.
[0118] The search scheme indicates a database partitioning scheme, for example, the search scheme indicates a second sub-database based on which the second processor performs the search. The second processor performs the search based on the second sub-database according to the search algorithm and the multiple search requests to obtain a second search result, and the second search result includes search results similar to the multiple search requests. The second processor queries the second part of the search request in the second sub-database to obtain the second search result.
[0119] The search scheme indicates the division of multiple search requests. For example, the search scheme indicates the second processor to perform the second part of the search request based on which the search is performed. The second processor performs the search based on the database according to the search algorithm and the second part of the search request to obtain the second search result, and the second search result includes the search result similar to the second part of the search request. The second processor queries the database for the second part of the search request to obtain the second search result.
[0120] Step 260: The first processor obtains search results of multiple search requests according to the first search result and the second search result.
[0121] The search scheme indicates a database partitioning scheme, and the first search result and the second search result respectively include two possible search results of multiple search requests. The first processor selects search results similar to the search request from the first search result and the second search result to determine the search results of the multiple search requests, that is, the search results of the multiple search requests can be selected from the first search result and the second search result according to the similarity. For example, by comparing the first search result and the second search result, a vector that is closer or more similar to the search request is selected.
[0122] Assume that vector search needs to be performed on 10 search requests. The first processor performs vector search on 3 search requests, and the first search result includes the search results of the 3 search requests. The second processor performs vector search on the 3 search requests, and the second search result includes the search results of the 3 search requests. Comparing the first search result and the second search result, if the result of the first search request in the first search result is closer or more similar to the first search request than the result of the first search request in the second search result, the result of the second search request in the first search result is closer or more similar to the first search request than the result of the second search request in the second search result, and the result of the third search request in the second search result is closer or more similar to the first search request than the result of the third search request in the first search result, then the search results of the three search requests include the result of the first search request in the first search result, the result of the second search request in the first search result, and the result of the third search request in the second search result.
[0123] The retrieval scheme indicates that multiple retrieval requests are divided, and the first retrieval result and the second retrieval result respectively include a part of the retrieval results of the multiple retrieval requests. Then the first processor merges the first retrieval result and the second retrieval result, and the retrieval results of the multiple retrieval requests include the first retrieval result and the second retrieval result.
[0124] For example, taking the sift1M data set as an example, the data set includes 1 million vectors, and the dimension of each vector is 128. It is necessary to perform vector retrieval on 100 retrieval requests, and the dimension of the retrieval request is 128. The first processor performs vector retrieval on the 1st retrieval request to the 50th retrieval request, and the first retrieval result includes the retrieval results of the 1st retrieval request to the 50th retrieval request. The second processor performs vector retrieval on the 51st retrieval request to the 100th retrieval request, and the second retrieval result includes the retrieval results of the 51st retrieval request to the 100th retrieval request. The first retrieval result and the second retrieval result are merged to obtain the retrieval results of the 100 retrieval requests.
[0125] Optionally, the first processor may also feed back retrieval results of multiple retrieval requests, and the client displays the retrieval results of the multiple retrieval requests.
[0126] It should be noted that the above embodiment is described by taking two processors executing retrieval in parallel as an example. In some embodiments, retrieval can also be performed in parallel based on three or more processors. That is, the database is divided into three or more parts, or multiple retrieval requests are divided into three or more parts. The retrieval results of the retrieval performed by more than three processors are merged or a better retrieval result is selected from the retrieval results of the retrieval performed by more than three processors. In order to improve the retrieval efficiency. Among them, the scheme of the division method can refer to the description of the above embodiment and will not be repeated.
[0127] The application scenarios of the search method provided in the embodiments of the present application include but are not limited to the following scenarios:
[0128] Recommendation scenario: Based on the parallel retrieval of heterogeneous computing architecture, multi-source heterogeneous data such as user behavior, product attributes, content features, etc. are retrieved and matched to improve the effect and performance of the recommendation system and increase user satisfaction and retention rate.
[0129] Internet scenarios: Retrieve and analyze multimedia data such as web pages, texts, images, and videos based on parallel retrieval of heterogeneous computing architectures, improve the ability to obtain and understand Internet information, and support various search, advertising, social, and other business scenarios.
[0130] Large model scenario: Retrieve and optimize large-scale deep learning model parameters based on parallel retrieval of heterogeneous computing architecture, improve the training and deployment efficiency of large models, and reduce the computing and storage costs of large models.
[0131] As the amount of data and data dimensions of the database grow, more storage resources and computing resources are needed. For example, taking a database containing 100 million 1024-dimensional vectors as an example, the graph index construction of vector retrieval may occupy about 350 gigabytes (GB) of storage capacity. A single processor cannot carry such a large-scale database, and the amount of calculation for performing retrieval based on a large-scale database is huge, which cannot meet the high concurrency requirements. In order to solve the problem of large-scale databases and high-concurrency vector retrieval, the hardware can be expanded, but the hardware cost increases. If the database is compressed based on quantization and compression technology, the retrieval accuracy is reduced. For example, taking the IVFPQ algorithm as an example, the higher the model compression rate, the lower the algorithm accuracy. Therefore, the retrieval method provided in the embodiment of the present application determines whether to divide the database or divide multiple retrieval requests according to the characteristics of the database, so that two processors perform retrieval on multiple retrieval requests in parallel based on different databases or different retrieval requests, and retrieve the retrieval results of multiple retrieval requests faster, thereby, there is no need to expand the hardware, and perform retrieval in parallel based on heterogeneous computing architecture, and realize efficient retrieval on databases of different sizes, thereby improving the utilization rate and retrieval rate of processor computing power. In addition, determining the retrieval algorithm based on the retrieval according to the distribution characteristics of the database effectively improves the retrieval accuracy compared to performing the retrieval based on a retrieval algorithm or randomly selecting a retrieval algorithm.
[0132] The vector search process is described below with reference to the accompanying drawings.
[0133] Figure 3 A schematic diagram of performing vector retrieval based on a heterogeneous computing architecture provided for the present application. The heterogeneous computing architecture includes a CPU 310 and an NPU 320. The CPU 310 is used for index construction and resource scheduling. Index construction may refer to recalculating a vector into a vector index. Resource scheduling may refer to the database, multiple retrieval requests, and retrieval algorithms on which the processor performs vector retrieval. The CPU 310 and the NPU 320 perform vector retrieval, so that the computing power of the CPU 310 and the NPU 320 is fully utilized.
[0134] The CPU 310 and the NPU 320 first process the query data, for example, pre-process the retrieval request.
[0135] 1) The CPU 310 reads the database and determines whether to divide the database or divide the search request according to the data size, data distribution, and demand constraints.
[0136] 2) CPU 310 selects different partitioning schemes based on data scale perception and performs parallel vector retrieval based on heterogeneous computing architecture.
[0137] 3) The CPU 310 adaptively determines the retrieval algorithm by sensing the data distribution and selects a retrieval algorithm with affinity computing power.
[0138] 4) The CPU 310 determines the final search solution based on the requirements.
[0139] 5) The NPU 320 performs vector search based on the approximate search algorithm 1. The CPU 310 performs vector search based on the approximate search algorithm 2.
[0140] 6) The CPU 310 determines the search results of the plurality of search requests based on the search results of the NPU 320 and the search results of the CPU 310 .
[0141] Figure 4 A schematic diagram of a data-awareness-based retrieval solution provided for this application.
[0142] Data scale awareness is used to determine a partitioning scheme based on the size of the database. For example, a large-scale database may determine a partitioning scheme as partitioning the database, and a small-scale database may determine a partitioning scheme as partitioning the search request.
[0143] Data distribution awareness is used to determine the retrieval algorithm based on the distribution characteristics of the database. For example, the distribution characteristics are determined based on the statistical characteristics and attributes of the database, and the retrieval algorithm is determined based on the distribution characteristics. Statistical characteristics include at least one of the mean, standard deviation, or variance of the database. Attributes include vector dimension, number of vectors, and vector format. When the distribution characteristics are random distribution, the retrieval algorithm is determined to be a brute force retrieval algorithm. When the distribution characteristics are dense distribution, the retrieval algorithm is determined to be a vector retrieval based on space partitioning. When the distribution characteristics are sparse distribution, the retrieval algorithm is determined to be a vector retrieval based on space partitioning or a vector retrieval based on graph.
[0144] Requirement-limited awareness is used to indicate whether to perform retrieval based on an exact retrieval algorithm or an approximate retrieval algorithm.
[0145] Figure 5 A schematic diagram of performing a search based on a search scheme provided in this application. Figure 5 As shown in (a) of FIG. 1 , the partitioning scheme is to partition the database. The database to be searched (ALLBase) is partitioned according to the partitioning ratio parameter (ratio) to obtain database 1 (base1) and database 2 (base2).
[0146] Database 1 is used as a database for CPU to perform retrieval. CPU obtains the index of the corresponding affinity CPU by training database 1 and stores it in a memory associated with CPU.
[0147] Database 2 is used as a database for NPU to perform retrieval. NPU obtains the index of the corresponding affinity NPU by training database 2 and stores it in a memory associated with NPU.
[0148] Optionally, constructing training database 1 and training database 2 may be performed before partitioning the database, that is, the database may be trained to obtain an index of the database, and partitioning the database may refer to partitioning the trained database. Training the database may refer to converting the database into an index structure suitable for querying. For example, performing a hash operation on the database to obtain a hash index.
[0149] In the retrieval stage, the CPU performs a search of the retrieval request based on database 1 to obtain retrieval result 1. The NPU performs a search of the retrieval request based on database 2 to obtain retrieval result 2. A retrieval result that is closer or more similar to the retrieval request is selected from retrieval result 1 and retrieval result 2 according to the similarity.
[0150] like Figure 5 As shown in (b) of FIG. 1 , the partitioning scheme is to partition the search request. The CPU and NPU perform vector search based on the database to be searched (ALLBase).
[0151] The database (ALLBase) is used as the database for the CPU to perform retrieval. The CPU obtains the index of the corresponding affinity CPU by training the database and stores it in the memory associated with the CPU.
[0152] The database (ALLBase) is used as the database on which the NPU performs retrieval. The NPU obtains the index of the corresponding affinity CPU through the training database and stores it in the memory associated with the CPU.
[0153] In the retrieval stage, multiple retrieval requests (ALLQuery) are divided according to a division ratio parameter (ratio) to obtain a retrieval request 1 (query1) and a retrieval request 2 (query2). The retrieval request 1 and the retrieval request 2 may include one or more retrieval requests.
[0154] The CPU performs a search of search request 1 based on the index of the database constructed by the CPU to obtain search result 1. The NPU performs a search of search request 2 based on the index of the database constructed by the NPU to obtain search result 2. The search result 1 and the search result 2 are combined to obtain the search result of the search request (ALLQuery).
[0155] It is understandable that, in order to implement the functions in the above embodiments, the client and the server (such as a storage server) include hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0156] Combined with the above Figures 1 to 5 , describes in detail the search method provided by this application, and will be combined with Figure 6 , describing the apparatus provided according to the present application. These apparatuses can be used to implement the functions of the computer device in the above method embodiment, and thus can also achieve the beneficial effects possessed by the above method embodiment. In this embodiment, the apparatus can be as follows Figure 2 The computing node or control node shown may also be a module (such as a chip) applied to a computer device.
[0157] like Figure 6 As shown, the retrieval device 600 includes a communication module 610, a data perception module 620, a data retrieval module 630 and a storage module 640. The retrieval device 600 is used to implement the above Figure 2 The functions of the computer device in the method embodiment shown in FIG.
[0158] The communication module 610 is used to obtain multiple search requests.
[0159] The data sensing module 620 is used to determine the database to be searched according to the multiple search requests. Figure 2 Step 220.
[0160] The data sensing module 620 is further configured to determine, based on the characteristics of the database, that the first processor executes a first part of the retrieval requests among the multiple retrieval requests, and that the second processor executes a second part of the retrieval requests among the multiple retrieval requests. Figure 2 Step 230.
[0161] The data perception module 620 is specifically used to send multiple search requests to the first processor and the second processor respectively when the size of the database is greater than the processing capacity of the first processor, and the first part of the search requests and the second part of the search requests are both multiple search requests.
[0162] The data sensing module 620 is specifically used to divide the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor.
[0163] The data perception module 620 is specifically used to divide multiple search requests into a first part of search requests and a second part of search requests according to the processing capabilities of the first processor and the second processor when the size of the database is less than or equal to the processing capability of the first processor.
[0164] The data perception module 620 is also used to perform demand-limited perception, that is, to determine the retrieval algorithm according to the distribution characteristics of the database; the first processor executes the first part of the retrieval request according to the retrieval algorithm to obtain the first retrieval result, and the second processor executes the second part of the retrieval request according to the retrieval algorithm to obtain the second retrieval result.
[0165] The data retrieval module 630 is used to execute the first part of the retrieval request to obtain the first retrieval result; execute the second part of the retrieval request to obtain the second retrieval result. Figure 2 Step 240 and step 250.
[0166] The data retrieval module 630 is further configured to obtain retrieval results of multiple retrieval requests based on the first retrieval result and the second retrieval result. Figure 2 Step 260.
[0167] The storage module 640 is used to store the database and the search algorithm to facilitate the search. The storage module 640 can also store the search results.
[0168] It should be understood that the retrieval device 600 of the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), and the PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. It can also be implemented by software. Figure 2 The search method shown in the figure and its various modules may also be software modules, and the search device 600 and its various modules may also be software modules.
[0169] The retrieval device 600 according to the embodiment of the present application may correspond to executing the method described in the embodiment of the present application, and the above and other operations and / or functions of each unit in the retrieval device 600 are respectively to implement Figure 2 For the sake of brevity, the corresponding processes of each method in are not repeated here.
[0170] Figure 7 Schematic diagram of the structure of a computer device 700 provided in this application. Figure 7As shown, computer device 700 includes processor 710, bus 720, storage 730, communication interface 740, memory 750 (also referred to as main memory unit) and processor 760. Processor 710, processor 760, storage 730, memory 750 and communication interface 740 are connected via bus 720.
[0171] It should be understood that in this embodiment, the processor 710 may be a CPU, and the processor 710 may also be other general-purpose processors, digital signal processors (DSP), ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0172] The computer device 700 may also include a graphics processing unit (GPU), a neural network processing unit (NPU), a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the program of the present application. For example, the processor 760 may be a GPU or an NPU.
[0173] The communication interface 740 is used to implement the communication between the computer device 700 and an external device or device. Figure 2 When the client functions shown in FIG. 1 , the communication interface 740 is used to send a search request. In order to facilitate the processor 710 and the processor 760 to jointly perform the search. The computer device 700 is used to implement Figure 2 When the functions of the computer device are shown, the communication interface 740 is used to obtain a search request so that the processor 710 and the processor 760 can jointly perform the search.
[0174] The bus 720 may include a path for transmitting information between the above components (such as the processor 710, the memory 750, and the storage 730). In addition to the data bus, the bus 720 may also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus 720 in the figure. The bus 720 may be a Peripheral Component Interconnect Express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a computer express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 720 can be divided into an address bus, a data bus, a control bus, etc.
[0175] As an example, the computer device 700 may include multiple processors. The processor may be a multi-core (multi-CPU) processor. The processor here may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions).
[0176] It is worth mentioning that Figure 7 In the example, a computer device 700 including one processor 710 and one memory 730 is taken. Here, the processor 710 and the memory 730 are respectively used to indicate a type of device or equipment. In a specific embodiment, the number of each type of device or equipment can be determined according to business requirements.
[0177] The memory 750 may be a volatile memory pool or a non-volatile memory pool, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM). Memory 750 is used to store databases, search algorithms and search results, etc.
[0178] The memory 730 may correspond to a storage medium used to store information such as a database and a retrieval algorithm in the above method embodiment, for example, a disk such as a mechanical hard disk or a solid state disk.
[0179] The computer device 700 may be a general-purpose device or a dedicated device. For example, the computer device 700 may be an edge device (e.g., a box carrying a chip with processing capabilities), etc. Alternatively, the computer device 700 may also be a server or other device with computing capabilities.
[0180] It should be understood that the computer device 700 according to this embodiment may correspond to the retrieval device 600 in this embodiment, and may correspond to the computer device 700 executing the search result according to the embodiment. Figure 2 The corresponding subject in any method, and the above and other operations and / or functions of each module in the retrieval device 600 are respectively to achieve Figure 2 For the sake of brevity, the corresponding processes of each method in are not repeated here.
[0181] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a computing device. Of course, the processor and the storage medium can also exist in a computing device as discrete components.
[0182] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program or instruction may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc (DVD); it may also be a semiconductor medium, for example, a solid state drive (SSD). The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A search method, characterized in that: Applied to a computing system, the computing system includes a first processor and a second processor, the method includes: The first processor determines a database to be searched by a plurality of search requests; Determine, according to the characteristics of the database, that the first processor executes a first part of the plurality of retrieval requests, and the second processor executes a second part of the plurality of retrieval requests; The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result; The search results of the multiple search requests are obtained according to the first search result and the second search result.
2. The method according to claim 1, characterized in that The determining, according to the characteristics of the database, that the first processor executes a first part of the plurality of retrieval requests, and the second processor executes a second part of the plurality of retrieval requests comprises: When the size of the database is greater than the processing capability of the first processor, the multiple search requests are sent to the first processor and the second processor respectively, and the first partial search request and the second partial search request are both the multiple search requests.
3. The method according to claim 2, characterized in that The method includes dividing the database into a first sub-database and a second sub-database according to the capabilities of the first processor and the second processor; The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result, including: The first processor queries the first sub-database for the first partial search request to obtain the first search result, and the second processor queries the second sub-database for the second partial search request to obtain the second search result.
4. The method according to claim 3, characterized in that The retrieval results of the multiple retrieval requests obtained according to the first retrieval result and the second retrieval result include: The search results of the plurality of search requests are determined by selecting search results similar to the search request from the first search results and the second search results.
5. The method according to claim 1, characterized in that The determining, according to the characteristics of the database, that the first processor executes a first part of the plurality of retrieval requests, and the second processor executes a second part of the plurality of retrieval requests comprises: When the size of the database is less than or equal to the processing capability of the first processor, the multiple search requests are divided into the first part of search requests and the second part of search requests according to the processing capabilities of the first processor and the second processor.
6. The method according to claim 5, characterized in that The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result, including: The first processor queries the database for the first partial search request to obtain the first search result, and the second processor queries the database for the second partial search request to obtain the second search result.
7. The method according to claim 3 or 6, characterized in that: The first processor executes the first part of the search request to obtain a first search result, and the second processor executes the second part of the search request to obtain a second search result, including: Determining a retrieval algorithm according to the distribution characteristics of the database; The first processor executes the first partial search request according to the search algorithm to obtain a first search result, and the second processor executes the second partial search request according to the search algorithm to obtain a second search result.
8. The method according to claim 7, characterized in that Determining a retrieval algorithm according to the distribution characteristics of the database includes: When the distribution feature is a random distribution, determining that the retrieval algorithm is an accurate retrieval algorithm; When the distribution feature is dense distribution or sparse distribution, it is determined that the retrieval algorithm is an approximate retrieval algorithm.
9. The method according to claim 7 or 8, characterized in that: The method further comprises: The distribution characteristics are determined according to statistical characteristics and attributes of the database.
10. A computer device, characterized in that: The computer device includes a memory and multiple different types of processors, the memory is used to store a set of computer instructions; when the processor executes the set of computer instructions, the multiple different types of processors jointly execute the operating steps of any one of the methods described in claims 1-9.
Citation Information
Cited By
Retrieval enhancement generation large language model system and method
CN120562570A
Retrieval-augmented generation large language model system and method
CN120562570B
Retrieval method and computer device
WO2025002246A1
