Load balancing method and device and electronic equipment

By filtering and utilizing the status information of GPU nodes for load balancing, the problem of long time-consuming inference of large language models is solved, the utilization of hardware resources and service quality are improved, and low-latency, high-throughput inference services are achieved.

CN118819841AActive Publication Date: 2024-10-22MOORE THREADS TECH CO LTD

Patent Information

Application Number
CN202410881450.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-22
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

In practical applications, large language models take a long time to infer, resulting in the inability to meet low-latency requirements when hardware resources are limited, affecting their ability to be implemented in scenarios such as conversational robots, document rewriting, and intelligent search.

Method used

By obtaining the status information of GPU nodes, GPU nodes with higher priority are selected for load balancing, and these nodes are used to process service requests to improve cache hit rate and resource utilization and reduce computing power bottlenecks.

Benefits of technology

It effectively improves the throughput of large language models when processing large-traffic concurrent service requests, reduces user waiting time, and improves the quality of inference services and the utilization of hardware resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819841A_ABST
    Figure CN118819841A_ABST
Patent Text Reader

Abstract

The invention relates to a load balancing method and apparatus, and an electronic device. The method comprises the steps of obtaining a target service request; obtaining state information of each GPU node in the first GPU node set; the first GPU node set comprises GPU nodes which can be used for processing the target service request at present; wherein the state information of any GPU node comprises the longest duration of each reasoning task currently executed by the GPU node and the number of times of processing historical service requests in a session to which the target service request belongs; based on the state information of each GPU node in the first GPU node set, screening out at least one target GPU node from the first GPU node set; and processing the target service request based on the target large language model by using the at least one target GPU node. According to the method and the device, the probability that the cache data of the large language model is hit is effectively improved, the computing power is saved, and the efficiency of the GPU node is improved; and the quality of reasoning service provided by the large language model is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a load balancing method, device and electronic equipment. Background Art

[0002] Large Language Model (LLM) is a prediction model in the field of artificial intelligence natural language processing. It has the ability to handle dialogue tasks and can give logical and comprehensive answers to questions raised by humans. It can be applied to dialogue robots, document rewriting, intelligent search and other scenarios. The prediction output process of the large language model can be called the reasoning process. Although the large language model has a good comprehensive prediction effect, its parameter scale is large, the reasoning takes a long time, and it requires certain hardware resources such as graphics processing unit (GPU) to provide reasoning services, which has high requirements for hardware resources. Since the dialogue robot, document rewriting, intelligent search and other scenarios where the large language model is applied require low latency and high availability, the current large language model has certain landing difficulties in practical applications. At present, in response to the problems of long reasoning time and poor landing ability of large language models, the existing acceleration technologies can be divided into two categories, namely model calculation side optimization and I / O (input / output) optimization. Computational optimization refers to reducing storage space waste in the calculation process of large language models through methods such as KV Cache (key-value cache), distributed reasoning, operator fusion, and quantization compression. I / O optimization refers to utilizing the speed and storage capacity differences of multi-level storage such as cache, memory, and video memory in GPU storage to reduce the speed bottleneck of storage access. The main technologies include Flash Attention and Countinous Batching.

[0003] In actual application scenarios, for example, when processing high-traffic concurrent service requests, the large language model inference service needs to receive dozens or even hundreds of service requests within seconds. With limited hardware resources (such as GPU resources), the above model acceleration method cannot meet the low latency requirements, which greatly affects the quality of inference services provided by the large language model. Summary of the invention

[0004] In view of this, the present disclosure proposes a load balancing method, device, electronic device, storage medium and computer program product.

[0005] According to one aspect of the present disclosure, a load balancing method is provided, comprising:

[0006] Get the target service request;

[0007] Obtaining status information of each GPU node in a first graphics processor GPU node set; the first GPU node set includes: GPU nodes that are currently available for processing the target service request; wherein the status information of any GPU node includes: the maximum duration of each inference task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs;

[0008] Based on the status information of each GPU node in the first GPU node set, screening out at least one target GPU node in the first GPU node set;

[0009] The target service request is processed using the at least one target GPU node based on a target large language model.

[0010] In a possible implementation, the selecting at least one target GPU node from the first set of GPU nodes based on the status information of each GPU node in the first set of GPU nodes includes:

[0011] Calculate, based on the status information of each GPU node in the first GPU node set, a priority score of each GPU node, wherein the priority score indicates a priority of processing the target service request;

[0012] At least one GPU node is selected from the first GPU node set in descending order of the priority scores of the GPU nodes as the at least one target GPU node.

[0013] In one possible implementation, the priority score of the first GPU node is positively correlated with the longest duration of each inference task currently executed by the first GPU node, and is positively correlated with the number of historical service requests in the session to which the target service request belongs processed by the first GPU node; wherein the first GPU node is any GPU node in the first GPU node set.

[0014] In a possible implementation, the calculating the priority score of each GPU node based on the status information of each GPU node in the first GPU node set includes:

[0015] Calculate the absolute value of the difference between the longest duration of each inference task currently executed by the first GPU node and the average duration of processing historical inference tasks; wherein the average duration of processing historical inference tasks represents the average duration from when the GPU node obtains the historical inference task to when it completes the execution of the historical inference task;

[0016] Calculate the product of the number of times the first GPU node processes historical service requests in the session to which the target service request belongs and the saved time corresponding to one historical service request, wherein the saved time corresponding to one historical service request represents the time saved by directly using the cache information corresponding to one historical service request during the GPU node's execution of the inference task relative to the GPU node calculating the cache information;

[0017] Based on the absolute value of the difference and the product, a priority score of the first GPU node is calculated; wherein the priority score of the first GPU node is positively correlated with the absolute value of the difference and positively correlated with the product.

[0018] In a possible implementation, calculating the priority score of the first GPU node based on the absolute value of the difference and the product includes:

[0019] Performing a weighted sum on the absolute value of the difference and the product to obtain a priority score of the first GPU node.

[0020] In a possible implementation, the method further includes:

[0021] Determining a resource type that can be used to process the target service request;

[0022] Acquire a second GPU node set, where the second GPU node set includes: GPU nodes that currently have a service request processing capability;

[0023] A GPU node matching the resource type is determined in the second GPU node set as the GPU node currently available for processing the target service request.

[0024] In a possible implementation manner, the resource type includes: a type of a GPU node and / or a type of a large language model.

[0025] In a possible implementation, the method further includes:

[0026] Determine the minimum number of GPU nodes corresponding to the target service request;

[0027] The step of selecting at least one target GPU node from the first GPU node set based on the status information of each GPU node in the first GPU node set includes:

[0028] In a case where the minimum number of GPU nodes does not exceed the number of GPU nodes in the first GPU node set, based on the status information of each GPU node in the first GPU node set, selecting the GPU nodes with the minimum number of GPU nodes in the first GPU node set as the at least one target GPU node;

[0029] and / or,

[0030] When the minimum number of GPU nodes exceeds the number of GPU nodes in the first GPU node set, the first GPU node set is updated; and when the number of GPU nodes in the updated first GPU node set is not less than the minimum number of GPU nodes, based on the status information of each GPU node in the updated first GPU node set, the GPU nodes with the minimum number of GPU nodes are screened out in the updated first GPU node set as the at least one target GPU node.

[0031] In a possible implementation, when the longest duration of each inference task currently executed by the first GPU node exceeds the average duration of the processing historical inference tasks, the weight of the absolute value of the difference is positively correlated with the longest duration of each inference task currently executed by the first GPU node, and the weight of the product is negatively correlated with the longest duration of each inference task currently executed by the first GPU node;

[0032] and / or,

[0033] When the longest duration of each inference task currently executed by the first GPU node does not exceed the average duration of the processing historical inference tasks, the weight of the absolute value of the difference is negatively correlated with the longest duration of each inference task currently executed by the first GPU node, and the weight of the product is positively correlated with the longest duration of each inference task currently executed by the first GPU node.

[0034] In a possible implementation, obtaining the second GPU node set includes:

[0035] According to the distributed semaphore corresponding to each candidate GPU node in the candidate GPU node set, the GPU node currently having the service request processing capability is screened out from the candidate GPU node set;

[0036] The method further comprises:

[0037] Update the distributed semaphore corresponding to the at least one target GPU node.

[0038] In a possible implementation, the method further includes: using a key-value pair database as a message middleware to synchronize messages between the at least one target GPU node and a node that issues the target service request.

[0039] According to another aspect of the present disclosure, a load balancing device is provided, the device comprising:

[0040] An acquisition module, used to acquire a target service request;

[0041] The acquisition module is further used to acquire status information of each GPU node in a first graphics processor GPU node set; the first GPU node set includes: GPU nodes that can currently be used to process the target service request; wherein the status information of any GPU node includes: the maximum duration of each inference task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs to be processed;

[0042] A screening module, configured to screen out at least one target GPU node from the first GPU node set based on status information of each GPU node in the first GPU node set;

[0043] A processing module is used to process the target service request based on a target large language model using the at least one target GPU node.

[0044] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0045] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.

[0046] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0047] Through the disclosed embodiment, based on the cache characteristics of the large language model in the service process, according to the status information of each GPU node in the first GPU node set, that is, the longest duration of each reasoning task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs, at least one target GPU node is screened out from the first GPU node set; since the number of historical service requests in the session to which the target service request belongs is large, the probability of hitting the cached data when processing the target service request is higher, and at the same time, the longer the longest duration of each reasoning task currently executed is, the faster more computing resources can be released to perform other reasoning tasks; in this way, the probability of the screened target GPU node hitting the cached data of the target GPU node when processing the target service request based on the target large language model is higher, which saves computing power and improves the efficiency of the GPU node; reduces the computing power bottleneck under the condition of limited hardware resources, and when processing large-traffic concurrent service requests, it can make more full use of hardware resources and effectively exert the throughput of the large language model, thereby avoiding frequent queuing and waiting of user service requests, and the service delay is low, which greatly improves the quality of reasoning services provided by the large language model.

[0048] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0050] Figure 1 A schematic diagram showing the structure of a large language model service system according to an embodiment of the present disclosure is shown;

[0051] Figure 2 A flow chart of a load balancing method according to an embodiment of the present disclosure is shown.

[0052] Figure 3 A flowchart of a target GPU node screening method according to an embodiment of the present disclosure is shown.

[0053] Figure 4 A flow chart of a load balancing method according to an embodiment of the present disclosure is shown.

[0054] Figure 5 A flow chart of a load balancing method according to an embodiment of the present disclosure is shown.

[0055] Figure 6 A structural diagram of a load balancing device according to an embodiment of the present disclosure is shown.

[0056] Figure 7A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0057] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0058] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "exemplary", "in one embodiment", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0059] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0060] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0061] Figure 1 FIG. 2 is a schematic diagram showing the structure of a large language model service system according to an embodiment of the present disclosure. Figure 1 As shown, the large language model service system may include: a GPU node set 101 and a load balancing device 102.

[0062] The GPU node set 101 may include one or more GPU nodes (also referred to as service nodes or nodes). Figure 1 The GPU node set 101 shown in the figure includes N GPU nodes, namely GPU node 1, GPU node 2 ... GPU node N, where N is a positive integer; these GPU nodes are used to execute the reasoning task of the large language model.

[0063] Exemplarily, a GPU node may be a physical entity device configured with a GPU, wherein the physical entity may be a computer device such as a terminal or a server or a part of a computer device, wherein the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms, etc.; wherein one server may serve as a GPU node. The terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, an intelligent voice interaction device, a smart home appliance, and a vehicle-mounted terminal, etc.; wherein one terminal may serve as a GPU node. As an example, one or more processors may be configured in a computer device such as a terminal or a server, and when the computer device is configured with multiple processors, all or part of the multiple processors may be used as a GPU node; for example, if a computer device is configured with multiple GPUs, each GPU may be used as a GPU node, or a number of GPUs may be used as a GPU node.

[0064] The load balancing device 102 is used to receive the user's service request, and determine some or all of the GPU nodes in the GPU node set 101 as GPU nodes for processing the service request through a load balancing method, and then use these GPU nodes to process the service request based on the large language model. Exemplarily, these GPU nodes each perform a corresponding reasoning task to complete the processing of the service request.

[0065] Exemplarily, the load balancing device 102 may be software, hardware, or a combination of software and hardware, which is not limited thereto.

[0066] In order to improve the quality of reasoning services provided by large language models, in related technologies, such as the vLLM framework, the load balancing device 102 can be configured with a traditional load balancing method. After receiving a user's service request, the GPU node that processes the service request can be directly determined based on the traffic of each GPU node in the GPU node set 101; in the process of the GPU node processing the service request, the discontinuous large language model cache data storage is realized through paging attention (PageAttention), which improves the utilization rate of hardware resources and reduces latency to a certain extent. However, the vLLM framework adopts a traditional load balancing method, which only distributes service requests based on the traffic of GPU nodes. In the case of limited hardware resources, computing power becomes a bottleneck. When processing large-traffic concurrent service requests, there will still be the problem of frequent queuing of user service requests. In addition, although the large language model cache data is stored for acceleration in the process of the GPU node processing the service request, the probability of the cache data being hit in the subsequent processing process is extremely low.

[0067] In order to solve the above technical problems, the embodiments of the present disclosure provide a dynamic load balancing method in a large language model inference service scenario (see below for detailed description), which considers the actual load capacity of the GPU node and the cache characteristics of the large language model in the service process, schedules the GPU node to process the service request, effectively improves the probability of the large language model cache data being hit, saves computing power, and improves the efficiency of the GPU node; reduces the computing power bottleneck under the condition of limited hardware resources, and can make more full use of hardware resources when processing large-volume concurrent service requests, effectively exerting the throughput of the large language model, thereby avoiding frequent queuing of user service requests, and reducing service latency, greatly improving the quality of inference services provided by the large language model.

[0068] It should be noted that the large language model service system described in the embodiment of the present disclosure is for the purpose of more clearly illustrating the technical solution of the embodiment of the present disclosure, and does not constitute a limitation on the application scenarios of the technical solution provided by the embodiment of the present disclosure. A person of ordinary skill in the art can know that the technical solution provided by the embodiment of the present disclosure is also applicable to similar technical problems in response to the emergence of other similar or new scenarios.

[0069] The load balancing method provided by the embodiment of the present disclosure is described in detail below.

[0070] Figure 2 FIG. 1 is a flow chart showing a load balancing method according to an embodiment of the present disclosure. Figure 1 The language model service system 10 or the load balancing device 102 executes, such as Figure 2 As shown, the method may include the following steps:

[0071] Step 201: Obtain a target service request.

[0072] Among them, the service request can also be called an inference request, for example, it can include requests for natural language processing tasks such as text generation, translation, question and answer, etc.

[0073] Exemplarily, the large language model service system can provide multiple access interfaces and support multiple access protocols, so as to receive different types of service requests, for example, HTTP or GRPC type service requests. As an example, users or applications can send service requests to the load balancing device 102 through an interactive interface, interface, etc. For example, in a dialogue robot scenario, users can input questions in the form of voice or text input through an interactive interface, and trigger a service request to answer the question. The service request is the target service request. After the responsible balancing device 102 receives the service request triggered by the above user, it further performs the following steps to call the appropriate GPU node to process the service request. It can be understood that in a dialogue robot scenario, multiple rounds of questions can be asked in a conversation between a user and a machine. Each time the user asks a question, a service request is triggered; that is, in this scenario, the user can trigger multiple service requests, and the target service request is any service request in the multiple service requests.

[0074] Exemplarily, after the load balancing device 102 receives the target service request, the target service request can be parsed and preprocessed. For example, the target service request can be converted into a data format. As an example, the load balancing device 102 can implement the authentication and parsing of the target service request through the Golang language and its ecological components.

[0075] Exemplarily, after the load balancing device 102 parses the target service request, relevant parameters of the target service request may be checked. For example, the relevant parameters may include keywords and phrases indicated by the target service request.

[0076] Exemplarily, a globally unique identifier in the large language model service system may be configured for the target service request to identify the target service request to distinguish it from other service requests.

[0077] Step 202: Obtain status information of each GPU node in the first GPU node set.

[0078] The first GPU node set includes: GPU nodes that are currently available for processing the target service request. As an example, when the large language model service system is configured with homogeneous GPU nodes, the GPU nodes that currently have available load can be used as GPU nodes that are currently available for processing the target service request; as another example, when heterogeneous GPU nodes are configured in the large language model service system, the GPU nodes that are currently available for processing the target service request can be screened out from the GPU nodes that currently have available load. The specific method of screening is described in the relevant description below.

[0079] In one possible implementation, a monitoring and reporting mechanism can be used to monitor the stability of the large language model service system's sorting links and related indicators (for example, signal strength, bit error rate, delay, etc.), measure the overall pressure of the large language model service system, and configure new GPU nodes or delete existing GPU nodes in the large language model service system according to changes in the overall pressure, thereby achieving dynamic expansion or reduction of the large language model service system.

[0080] In the first GPU node set, the status information of any GPU node includes: the longest duration of each reasoning task currently executed by the GPU node and the number of times the historical service requests in the session to which the target service request belongs are processed.

[0081] Exemplarily, for the case of clustered deployment of GPU nodes, multiple model instances (also referred to as service instances) can be configured in the large language model service system. Each model instance can accept a certain number of concurrent service requests. At the same time, multiple model instances may be running simultaneously to handle large-volume concurrent service requests. Among them, the model instance represents a specific implementation of the large language model base, which contains the model structure file and model weights of the large language model. The model structure contains the hierarchical construction information of the model, and the model weights are the parameter information learned during the model pre-training process; each model instance can be used to generate text, answer questions or perform general natural language processing tasks; each model instance is consistent and uses the same large language model architecture and parameter set, so as to ensure that all model instances have consistent performance and behavior when processing the same task. Among them, each model instance can be implemented by one or more GPU nodes, that is, one or more GPU nodes can process a service request. At the same time, each GPU node can have the ability to implement one or more model instances, that is, for each GPU node, one or more model instances can be implemented at the same time, that is, reasoning tasks of multiple large language models can be executed at the same time; it can be understood that the process of the GPU node executing each reasoning task needs to last for a period of time, among which the longest period of time is the longest duration of each reasoning task currently executed by the GPU node, which can also be called the current longest reasoning task time of the GPU node. As an example, a GPU node can be configured to execute up to four reasoning tasks simultaneously. For example, the GPU node is currently executing reasoning task A and reasoning task B, where the duration of reasoning task A is 5s, that is, as of the current moment, the GPU node has continuously executed the reasoning task A for 5s and is still executing it; the duration of reasoning task B is 8s, that is, as of the current moment, the GPU node has continuously executed the reasoning task B for 8s; then the maximum duration of each reasoning task currently executed by the GPU node is 8s; for another example, the GPU node is currently executing reasoning task C, where the duration of reasoning task C is 10s, that is, as of the current moment, the GPU node has continuously executed the reasoning task C for 10s and is still executing it, then the maximum duration of each reasoning task currently executed by the GPU node is 10s.

[0082] In a conversational robot scenario, a user can have a conversation with a large language model service system, wherein during the conversation, the user can have multiple "question-and-answer" conversations with the robot, and each question asked by the user is a service request. After receiving a question, the large language model service system can generate reply information through reasoning and present the reply information to the user; and in the same conversation between the large language model service system and the user, there may be a connection between the user's multiple questions. For example, the user may ask questions about one thing from different angles or progressively; therefore, after executing each reasoning task, the GPU node will cache the corresponding data (such as the reasoning results or intermediate data of this time) in the GPU node, so that the GPU node can directly call the cached data when processing the service request after the same conversation, thereby improving the reasoning efficiency of the GPU node. For example, after ending a conversation, the large language model service system can release the data cached by each GPU node. It is understandable that for each service request, a suitable GPU node will be screened out from the first GPU node set as the target GPU node for processing this service request. In this way, different GPU nodes may be screened out for different service requests before and after, that is, in the same session, the GPU nodes processing different service requests may be different or the same. For any GPU node, in the session to which the target service request belongs, the number of service requests in the session that the GPU node has processed is the number of historical service requests in the session to which the target service request belongs that the GPU node has processed. If the GPU node has not processed any historical service request in the session to which the target service request belongs, the corresponding number is 0. If the GPU node has processed one historical service request in the session to which the target service request belongs, the corresponding number is 1, and so on.

[0083] Since the volume of service requests in a large language model service system is usually large, each GPU node in the large language model service system will perform a large number of inference tasks, and the data cached by each GPU node is relatively complex, which causes the status information of each GPU node in the large language model service system to change frequently. By way of example, the status information of each GPU node in the large language model service system can be dynamically updated, so that the latest status information of each GPU node in the large language model service system can be obtained at any time.

[0084] Step 203: Based on the status information of each GPU node in the first GPU node set, select at least one target GPU node from the first GPU node set.

[0085] In this step, the load balancing device 102 can screen out at least one target GPU node in the first GPU node set based on the longest duration of each inference task currently executed by each GPU node in the first GPU node set and the number of historical service requests in the session to which the target service request belongs. Considering that when processing service requests based on a large language model, the duration for executing each inference task for a GPU node is usually limited, therefore, for any GPU node, the longer the longest duration of each inference task currently executed by the GPU node, the more likely the inference task corresponding to the longest duration is to be completed, so that the GPU node can release more computing resources faster to perform other inference tasks. At the same time, for a certain service request, if a GPU node processes more historical service requests in the session to which the service request belongs, the greater the correlation between the cached data in the GPU node and the data involved in processing the service request, therefore, for any GPU node, the more the number of historical service requests in the session to which the target service request belongs, the efficiency of the GPU node in processing the target service request will usually be higher. Therefore, based on the longest duration of each inference task currently executed by each GPU node in the first GPU node set and the number of historical service requests in the session to which the target service request belongs, suitable target GPU nodes can be screened out, which can effectively improve the efficiency of subsequent target GPU nodes in processing target service requests.

[0086] In a possible implementation, before executing step 203, the minimum number of GPU nodes corresponding to the target service request may also be determined; and then different strategies may be flexibly executed according to the relative size between the minimum number of GPU nodes corresponding to the target service request and the number of GPU nodes in the first GPU node set, so as to screen out at least one target GPU node in the first GPU node set. The minimum number of GPU nodes may be configured according to demand, for example, may be 1.

[0087] Scenario 1: When the minimum number of GPU nodes does not exceed the number of GPU nodes in the first GPU node set, based on the status information of each GPU node in the first GPU node set, the GPU nodes with the minimum number of GPU nodes are screened out in the first GPU node set as the at least one target GPU node; in this scenario, the minimum number of GPU nodes corresponding to the target service request does not exceed the number of GPU nodes in the first GPU node set, that is, there are currently sufficient GPU node computing resources in the large language model service system to process the target service request, and therefore, the strategy of directly screening the target GPU nodes is executed.

[0088] Scenario 2: When the minimum number of GPU nodes exceeds the number of GPU nodes in the first GPU node set, the first GPU node set is updated; and when the number of GPU nodes in the updated first GPU node set is not less than the minimum number of GPU nodes, based on the status information of each GPU node in the updated first GPU node set, the GPU nodes with the minimum number of GPU nodes are screened out from the updated first GPU node set as the at least one target GPU node. In this scenario, the minimum number of GPU nodes corresponding to the target service request exceeds the number of GPU nodes in the first GPU node set, that is, all currently idle GPU node computing resources in the large language model service system are insufficient to process the target service request. Therefore, it is necessary to execute a queuing waiting strategy, and the target service request enters the queuing queue and waits, and the first GPU node set is dynamically updated. With continuous updates, the number of GPU nodes in the first GPU node set will change in real time. When the minimum number of GPU nodes corresponding to the target service request does not exceed the number of GPU nodes in the first GPU node set, the target GPU node is screened out.

[0089] Exemplarily, the load status of each GPU node in the large language model service system can be updated in real time. Accordingly, the number of GPU nodes currently available for processing the target service request contained in the first GPU node set will also change dynamically. In this way, the first GPU node set is dynamically updated. When there are enough GPU nodes available for processing the target service request in the first GPU node set, the target GPU node for processing the target service request can be screened out in time.

[0090] Step 204: Utilize the at least one target GPU node to process the target service request based on the target large language model.

[0091] In this step, each target GPU node in the at least one target GPU node determined in step 203 is used to process the target service request, so as to schedule the at least one target GPU node to execute the corresponding reasoning task of the target large language model. The target large language model can be used to provide language generation capability during the reasoning process. Since each target GPU node is determined based on the longest duration of each reasoning task currently executed by each GPU node in the first GPU node set and the number of historical service requests in the session to which the target service request belongs, the probability of the target GPU node hitting the cached data when executing the reasoning task is improved, thereby saving the computing resources of the target GPU node and improving the processing efficiency of the target service request.

[0092] Exemplarily, the target large language model may be pre-configured or determined according to relevant parameters of the target service request. For example, if the relevant parameters of the target service request include the type of the large language model, the large language model of that type may be used as the target large language model.

[0093] In a possible implementation, the method further includes: using a key-value (KV) database as a message middleware to synchronize messages between the at least one target GPU node and the node that issues the target service request. The node that issues the target service request is the load balancing device 102; exemplarily, the KV database may be Redis. In this way, the load balancing device 102 can schedule the target GPU node through the message middleware, and the target GPU node pulls the message of the load balancing device 102 through the message middleware and performs the corresponding reasoning task; while the target GPU node executes the target service request, the large language model service system can subscribe to the target service request, and then continue to obtain new service requests, and perform the above steps for the new service request to determine the GPU node that processes the new service request, thereby achieving asynchronous scheduling.

[0094] As an example, the target service request can be distributed to multiple target GPU nodes, so that multiple target GPU nodes can execute the corresponding reasoning tasks in parallel and obtain the corresponding reasoning results; finally, after each target GPU node completes the reasoning task, the corresponding reasoning result is reported; after all target GPU nodes complete the reasoning task, the reasoning results reported by all target GPU nodes are summarized to generate the processing result corresponding to the target service request; and the processing result can be fed back to the user through the user access interface. In this way, users can access the large language model system using the preset access interface and obtain the processing results of the service request, which is convenient and simple, and has stronger versatility.

[0095] In the disclosed embodiment, based on the cache characteristics of the large language model in the service process, at least one target GPU node is screened out from the first GPU node set according to the status information of each GPU node in the first GPU node set, that is, the longest duration of each reasoning task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs. Since the number of historical service requests in the session to which the target service request belongs is large, the probability of hitting the cached data when processing the target service request is higher. At the same time, the longer the longest duration of each reasoning task currently executed is, the faster more computing resources can be released to perform other reasoning tasks. In this way, the screened target GPU node has a higher probability of hitting the cached data of the target GPU node when processing the target service request based on the target large language model, which saves computing power and improves the efficiency of the GPU node. The computing power bottleneck under the condition of limited hardware resources is reduced. When processing large-traffic concurrent service requests, the hardware resources can be more fully utilized, and the throughput of the large language model can be effectively exerted, thereby avoiding frequent queuing and waiting of user service requests, and the service delay is low, which greatly improves the quality of reasoning services provided by the large language model.

[0096] The following is an exemplary description of possible implementations of screening the target GPU node in the above step 203.

[0097] Figure 3 FIG. 1 is a flow chart showing a method for selecting a target GPU node according to an embodiment of the present disclosure. Figure 1 The language model service system 10 or the load balancing device 102 executes, such as Figure 3 As shown, the method may include the following steps:

[0098] Step 301: Calculate a priority score of each GPU node based on status information of each GPU node in the first GPU node set, where the priority score represents a priority for processing the target service request.

[0099] Based on the foregoing, for any GPU node, the longer the longest duration of each inference task currently executed by the GPU node, the more likely the inference task corresponding to the longest duration is to be nearing completion, so that the GPU node can release computing resources faster to better process the target service request. At the same time, for any GPU node, the more times the GPU node processes historical service requests in the session to which the target service request belongs, the more efficient the GPU node is in processing the target service request. Therefore, the priority score of each GPU node can be calculated based on the longest duration of each inference task currently executed by each GPU node in the first GPU node set and the number of times the historical service requests in the session to which the target service request belongs are processed.

[0100] Exemplarily, the priority score of the first GPU node is positively correlated with the longest duration of each inference task currently executed by the first GPU node, and is positively correlated with the number of times the first GPU node processes historical service requests in the session to which the target service request belongs; wherein the first GPU node is any GPU node in the first GPU node set. That is, the longer the longest duration of each inference task currently executed by the GPU node, and the more times the GPU node processes historical service requests in the session to which the target service request belongs, the higher the corresponding priority score, that is, the higher the priority of processing the target service request; conversely, the lower the corresponding priority score, that is, the lower the priority of processing the target service request.

[0101] In one possible implementation, step 301 may include: calculating the absolute value of the difference between the longest duration of each reasoning task currently executed by the first GPU node and the average duration of processing historical reasoning tasks; calculating the product of the number of times the first GPU node processes historical service requests in the session to which the target service request belongs and the time saved corresponding to one historical service request; calculating the priority score of the first GPU node based on the absolute value of the difference and the product; wherein the priority score of the first GPU node is positively correlated with the absolute value of the difference and with the product.

[0102] Among them, the average time for processing historical reasoning tasks represents the average time for the GPU node to obtain the historical reasoning task and complete the execution of the historical reasoning task; the average time can be a quantitative statistical value. For example, information of multiple historical reasoning tasks can be collected. For any historical reasoning task, the corresponding information collected may include the time for the GPU node to obtain the historical reasoning task and complete the execution of the historical reasoning task, and then the average of the corresponding time of multiple historical reasoning tasks is calculated as the average time for processing the historical reasoning task; as an example, the average time for the GPU node to process the historical reasoning task can be 20s.

[0103] The saved time corresponding to the historical service request indicates the time saved by directly using the cache information corresponding to the historical service request relative to the GPU node calculating the cache information during the GPU node's execution of the inference task. The saved time may be a quantitative statistical value. For example, processing information of multiple historical service requests may be collected. For each historical service request, the collected processing information may include the time saved by directly using the cache information corresponding to the historical service request relative to the GPU node calculating the cache information.

[0104] Exemplarily, calculating the priority score of the first GPU node based on the absolute value of the difference and the product may include: taking a weighted sum of the absolute value of the difference between the longest duration of each inference task currently executed by the first GPU node and the average duration of processing historical inference tasks, and the product of the number of times the first GPU node processes historical service requests in the session to which the target service request belongs and the time saved corresponding to one historical service request, to obtain the priority score of the first GPU node.

[0105] For example, the priority score Score of the first GPU node can be calculated by the following formula (1):

[0106] Score=a×T×n+b×∣tM∣……………………(1)

[0107] Among them, T represents the saved time corresponding to a historical service request, n represents the number of times the first GPU node processes historical service requests in the session to which the target service request belongs, then T×n represents the product of the number of times the first GPU node processes historical service requests in the session to which the target service request belongs and the saved time corresponding to a historical service request, a is the weight of the product T×n, t represents the maximum duration of each reasoning task currently executed by the first GPU node, M represents the average duration of processing historical reasoning tasks, |tM| represents the absolute value of the difference between the maximum duration of each reasoning task currently executed by the first GPU node and the average duration of processing historical reasoning tasks, and b is the weight of the absolute value of the difference |tM|.

[0108] In one possible implementation, when the longest duration of each reasoning task currently executed by the first GPU node exceeds the average duration of the processing historical reasoning tasks, the weight of the absolute value of the difference is positively correlated with the longest duration of each reasoning task currently executed by the first GPU node, and the weight of the product is negatively correlated with the longest duration of each reasoning task currently executed by the first GPU node; and / or, when the longest duration of each reasoning task currently executed by the first GPU node does not exceed the average duration of the processing historical reasoning tasks, the weight of the absolute value of the difference is negatively correlated with the longest duration of each reasoning task currently executed by the first GPU node, and the weight of the product is positively correlated with the longest duration of each reasoning task currently executed by the first GPU node.

[0109] Since in the large language model service system, the average duration of any GPU node processing historical reasoning tasks basically conforms to the normal distribution and has a certain long-tail effect; for the first GPU node, if the longest duration of each reasoning task currently executed by the first GPU node exceeds the average duration of processing the historical reasoning tasks, the larger the value of the longest duration, the more likely it is that the first GPU node will be close to the end of the corresponding reasoning task, and thus the more likely it is to schedule the computing resources of the first GPU node as soon as possible to execute other reasoning tasks. At this time, relative to the product of the number of historical service requests in the session to which the target service request belongs processed by the first GPU node and the time saved corresponding to one historical service request, the absolute value of the difference between the longest duration of each reasoning task currently executed by the first GPU node and the average duration of processing historical reasoning tasks has a greater impact on the first GPU node. The greater the impact on the priority score of the GPU node, the greater the weight of the absolute value of the difference, and correspondingly, the smaller the weight of the product; if the longest duration of each reasoning task currently executed by the first GPU node does not exceed the average duration of the processing historical reasoning tasks, the smaller the value of the longest duration, the lower the possibility that the first GPU node is nearing the end of executing the corresponding reasoning task. At this time, relative to the absolute value of the difference between the longest duration of each reasoning task currently executed by the first GPU node and the average duration of processing historical reasoning tasks, the product of the number of historical service requests in the session to which the target service request belongs processed by the first GPU node and the time saved corresponding to a historical service request has a greater impact on the priority score of the first GPU node, then the smaller the weight of the absolute value of the difference, and correspondingly, the greater the weight of the product.

[0110] For example, taking the above formula (1) as an example, the values ​​of weights a and b can be adjusted according to the relative size of the longest duration t of each inference task currently executed by the first GPU node and the average duration M of processing historical inference tasks. When t exceeds M and the larger t is, the smaller a is and the larger b is. When t exceeds M and the smaller t is, the larger a is and the smaller b is.

[0111] Step 302: Filter out at least one GPU node from the first GPU node set as the at least one target GPU node in descending order of priority scores of the GPU nodes.

[0112] In this way, by executing steps 301-302, the priority scores of GPU nodes are quantitatively calculated, so that according to the priority scores of GPU nodes, suitable GPU nodes are screened out as target GPU nodes. For example, in the above scenario 1, there are enough GPU node computing resources in the first GPU node set in this scenario that can be used to process the target service request, then step 301 can be executed to calculate the priority score of each GPU node, and then step 302 is executed to screen out the target GPU node in the order of the priority scores of each GPU node from high to low. In the above scenario 2, since there are not enough GPU nodes in the first GPU node set in this scenario, the target service request will be queued through the queue maintained by the system, and the large language model service system will maintain a certain frequency of GPU node load detection and update the first GPU node set. When there are enough GPU nodes in the first GPU node set, step 301 can be executed to calculate the priority score of each GPU node, and then step 302 is executed to screen out the target GPU node in the order of the priority scores of each GPU node from high to low to provide services for the queued target service requests.

[0113] Furthermore, considering the presence of heterogeneous GPU nodes in a large language model service system, for example, in a scenario where heterogeneous GPU nodes are deployed in a cluster, taking one GPU as a GPU node as an example, different GPU nodes correspond to different GPU types. In related technologies such as the vLLM framework, when distributing service requests to GPU nodes, the service capability differences of different types of GPUs are not considered. In the disclosed embodiment, based on the above considerations of the actual load capacity of GPU nodes and the caching characteristics of large language models during the service process, the service capability differences of heterogeneous GPU nodes are combined to use computing power in a more refined manner.

[0114] Figure 4 FIG. 1 is a flow chart showing a load balancing method according to an embodiment of the present disclosure. Figure 1 The language model service system 10 or the load balancing device 102 executes, such as Figure 4 As shown, the method may include the following steps:

[0115] Step 401: Obtain target service request;

[0116] This step is similar to the above Figure 2 The same as step 201.

[0117] As an example, the user may also specify a large language model for processing a target service request, i.e., a target large language model. For example, multiple large language models may be pre-configured, and the user may select a large language model for providing this reasoning service from among the multiple large language models according to their needs. As another example, a default large language model for providing reasoning services to the user, i.e., a target large language model, may be pre-configured.

[0118] Exemplarily, the relevant parameters of the target service request may also include: the type of the large language model and the type of the GPU node.

[0119] As an example, when different GPU nodes are configured with different types of GPUs, the type of the GPU node can be represented according to the GPU model, for example, a GPU node configured with a type A GPU, a GPU node configured with a type B GPU, and so on.

[0120] Exemplarily, there is a correspondence between the types of GPU nodes and different large language models. For example, for multiple large language models: large language model A, large language model B, and large language model C, there are four types of GPU nodes, namely, type a GPU nodes, type b GPU nodes, type c GPU nodes, and type d GPU nodes, wherein the number of each type of GPU node may be one or more. Then, the type a GPU node may be configured to correspond to the large language model A, that is, the type a GPU node may perform the reasoning task of the large language model A, the type b GPU node may correspond to the large language model B, that is, the type b GPU node may perform the reasoning task of the large language model B, and the type c GPU node and the type d GPU node may correspond to the large language model C, that is, the type c GPU node and the type d GPU node may perform the reasoning task of the large language model C.

[0121] Step 402: Determine the resource type that can be used to process the target service request.

[0122] Exemplarily, the type of resources available for processing the target service request can be determined by the relevant parameters of the target service request; as an example, the resource type may include the type of GPU node and / or the type of large language model; wherein the type of large language model available for processing the target service request is the type of large language model indicated by the relevant parameters of the target service request, and the type of GPU node available for processing the target service request is the type of GPU node indicated by the relevant parameters of the target service request.

[0123] Step 403: Obtain a second GPU node set.

[0124] The second GPU node set includes: GPU nodes that currently have the service request processing capability. The GPU nodes that currently have the service request processing capability represent GPU nodes that are currently accessible and whose load status is idle or not fully loaded.

[0125] Exemplarily, a list of accessible GPU nodes in a large language model service system can be obtained, and the GPU node list can record the load conditions of each GPU node in the large language model service system. Then, the GPU nodes with service request processing capabilities can be screened out according to the load conditions of each GPU node to obtain a second GPU node set. The load conditions of each GPU node can be determined by the available load of the GPU node. For example, the load conditions can include idle, non-full load, full load, etc.; idle means that the GPU node is not currently performing an inference task, and the maximum load of the GPU node is the current available load; non-full load means that the GPU node is performing an inference task, and a part of the load has been occupied, but there is still a certain amount of available load remaining; full load means that the GPU node is performing an inference task, and the current occupied load has reached the maximum load of the GPU node, that is, the available load is zero.

[0126] As an example, the load can be identified by a distributed semaphore. For example, the distributed semaphore S corresponding to a GPU node can be N, indicating that the GPU node can currently process N inference tasks, where N is an integer with a value range of 0-M, and M represents the maximum number of inference tasks that the GPU node can process simultaneously; for any GPU node, if the value of the distributed semaphore S corresponding to the GPU node is 0, it means that the GPU node currently has no available load, that is, the load condition of the GPU node is fully loaded; if the value of the distributed semaphore S corresponding to the GPU node is M, it means that the current available load of the GPU node is the maximum load, that is, the load condition of the GPU node is idle; if the value of the distributed semaphore S corresponding to the GPU node is between 0-M, it means that the GPU node currently still has a certain amount of available load, that is, the load condition of the GPU node is not fully loaded.

[0127] Since the service request volume in the large language model service system is usually large, the load situation of each GPU node in the large language model service system changes frequently. For example, the load situation of each GPU node in the large language model service system can be dynamically updated. For example, the load balancing device 102 can synchronize the load of each GPU node in real time through the distributed semaphore mechanism, so that the current and latest load situation of each GPU node in the large language model service system can be obtained at any time. For example, for any GPU node, when the GPU node processes an inference task, the inference task needs to occupy a certain load of the GPU node, and the value of the distributed semaphore S of the corresponding GPU node will be reduced by one; when the GPU node completes an inference task, the GPU node will release the load occupied by processing the inference task, and the value of the distributed semaphore S of the corresponding GPU node will increase by one; in this way, using the distributed semaphore as the identifier of the load of each GPU node, by updating the distributed semaphore corresponding to each GPU node, the current load situation of each GPU node can be mastered, and the maintainability of the load capacity of each GPU node in the large language model service system is improved.

[0128] In a possible implementation, in this step, obtaining the second GPU node set includes: filtering out the GPU nodes that currently have the service request processing capability from the candidate GPU node set according to the distributed semaphores corresponding to each candidate GPU node in the candidate GPU node set. Exemplarily, the candidate GPU node set may include GPU nodes configured by the large language model service system; through the distributed semaphores corresponding to each candidate GPU node, the GPU nodes that currently have the service request processing capability may be quickly and accurately filtered out.

[0129] Exemplarily, the resource type of each GPU node in the second GPU node set can also be obtained, for example, the type of each GPU node and / or the type of large language model adapted by each GPU node; as an example, the accessible GPU node list can also record the resource type of each GPU node, so that the GPU nodes with service request processing capabilities can be obtained and filtered out through the GPU node list.

[0130] In this way, for heterogeneous GPU nodes, the service capabilities of the heterogeneous GPU nodes can be distinguished by the resource types of the GPU nodes.

[0131] Step 404: Determine a GPU node that matches the resource type in the second GPU node set as the GPU node that is currently available to process the target service request.

[0132] Exemplarily, based on the resource type of each GPU node in the second GPU node set, as an example, the resource type may include: the type of GPU node and / or the type of large language model; then the GPU node type that is the type of GPU node that can be used to process the target service request and the GPU node whose adapted large language model is the target large language model are filtered out as all GPU nodes that can currently be used to process the target service request, thereby obtaining the first GPU node set.

[0133] Step 405: Obtain status information of each GPU node in the first GPU node set.

[0134] This step is similar to the above Figure 2 The same as step 202.

[0135] Step 406: Based on the status information of each GPU node in the first GPU node set, select at least one target GPU node from the first GPU node set.

[0136] This step is similar to the above Figure 2 The same as step 203.

[0137] In a possible implementation, in this step, after at least one target GPU node is screened out from the first GPU node set, the distributed semaphore of the at least one target GPU node is updated. Exemplarily, when the number of screened out target GPU nodes is multiple, the distributed semaphore of each target GPU node is updated, for example, the value of the distributed semaphore of each target GPU node may be reduced by 1.

[0138] Step 407: Utilize the at least one target GPU node to process the target service request based on the target large language model.

[0139] This step is similar to the above Figure 2 The same as step 204.

[0140] In a possible implementation, in this step, after the at least one target GPU node completes processing the target service request, the distributed semaphore of the at least one target GPU node is updated. Exemplarily, when there are multiple target GPU nodes processing the target service request, when any target GPU node completes the corresponding reasoning task, the distributed semaphore of the target GPU node is updated; for example, the value of the distributed semaphore of the target GPU node may be increased by 1.

[0141] In the disclosed embodiment, the resource type of the GPU node that can be used to process the target service request is determined; a GPU node matching the resource type is determined in the second GPU node set as the GPU node that can currently be used to process the target service request; and then, at least one target GPU node is screened out based on the status information of the GPU node that can currently be used to process the target service request, that is, the longest duration of each reasoning task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs. In this way, based on the above considerations of the actual load capacity of the GPU node and the cache characteristics of the large language model in the service process, combined with the differences in the service capabilities of heterogeneous GPU nodes, the computing power is used in a more refined manner, thereby scientifically scheduling heterogeneous GPU nodes based on multi-dimensional factors, evenly distributing service requests, and further improving the quality of large language model reasoning services.

[0142] As an example, the load balancing device 102 may include a GPU node registration module, a message synchronization module, a node status maintenance module, and a load balancing scheduling module.

[0143] Among them, the GPU node registration module is used to manage each GPU node in the large language model service system, and can support other functional modules to query the information of each GPU node, reducing the coupling of the large language model service system; exemplarily, the information of each GPU node can be managed based on the Redis KV database, for example, the type of each GPU node, the large language model adapted by the GPU node and other information can be managed. Exemplarily, the KV database can be encapsulated in an interface-type manner to provide an interface for GPU node registration, and the GPU node can register its own information to facilitate the management of GPU nodes with different characteristics. In order to reduce the load pressure of KV database storage, the GPU node registration and query functions can be implemented under the premise of maintaining data correctness and consistency through snapshots, read-write isolation, subscriptions and notifications.

[0144] The message synchronization module is used to handle the one-to-many working relationship between the model instance and the GPU node, and can asynchronously transmit messages between different GPU nodes and between the load balancing scheduling module and the GPU nodes, eliminating the extra overhead caused by communication time. Exemplarily, the message synchronization module is implemented through the Stream method of the KV database, and the message synchronization of the load balancing scheduling module and the inference results generated by each GPU node is performed through the push-pull method of messages.

[0145] The node status maintenance module is used to dynamically update and maintain the working status and load of the GPU nodes. For example, the status information and load of each GPU node in the large language model service system can be periodically detected, or the GPU node can report the changed status information or load when its own status information or load changes. For example, the status information and load of the GPU nodes can be synchronized through a distributed semaphore mechanism.

[0146] The load balancing scheduling module is the main entry point for users to obtain services through the large language model service system. As an example, Figure 5 A flow chart of a load balancing method according to an embodiment of the present disclosure is shown as follows: Figure 5 As shown, the load balancing module can receive service requests, obtain GPU node information from the GPU node registration module, and determine whether there are enough GPU nodes available to process the service request. If not, the service request is queued. If so, the status information of the GPU nodes that can be used to process the service request is obtained from the node status maintenance module, thereby filtering out target GPU nodes based on the status information of the GPU nodes, and distributing the service request to each target GPU node through the message synchronization module. After receiving the inference results of each target GPU node, these inference results are aggregated to generate the processing result of the service request, and the processing result is fed back to the user.

[0147] Based on the same inventive concept of the above method embodiment, the embodiment of the present disclosure also provides a load balancing device, which can be used to execute the technical solution described in the above method embodiment. Figure 2-Figure 5 The steps of the load balancing method shown in .

[0148] Figure 6 A structural diagram of a load balancing device according to an embodiment of the present disclosure is shown as follows: Figure 6 As shown, the device includes: an acquisition module 601, used to obtain a target service request; the acquisition module 601 is also used to obtain status information of each GPU node in a first graphics processor GPU node set; the first GPU node set includes: a GPU node that can currently be used to process the target service request; wherein the status information of any GPU node includes: the longest duration of each reasoning task currently executed by the GPU node and the number of historical service requests processed in the session to which the target service request belongs; a screening module 602, used to screen out at least one target GPU node in the first GPU node set based on the status information of each GPU node in the first GPU node set; a processing module 603, used to use the at least one target GPU node to process the target service request based on a target large language model.

[0149] In the disclosed embodiment, based on the cache characteristics of the large language model in the service process, at least one target GPU node is screened out from the first GPU node set according to the status information of each GPU node in the first GPU node set, that is, the longest duration of each reasoning task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs. Since the number of historical service requests in the session to which the target service request belongs is large, the probability of hitting the cached data when processing the target service request is higher. At the same time, the longer the longest duration of each reasoning task currently executed is, the faster more computing resources can be released to perform other reasoning tasks. In this way, the screened target GPU node has a higher probability of hitting the cached data of the target GPU node when processing the target service request based on the target large language model, which saves computing power and improves the efficiency of the GPU node. The computing power bottleneck under the condition of limited hardware resources is reduced. When processing large-traffic concurrent service requests, the hardware resources can be more fully utilized, and the throughput of the large language model can be effectively exerted, thereby avoiding frequent queuing and waiting of user service requests, and the service delay is low, which greatly improves the quality of reasoning services provided by the large language model.

[0150] In one possible implementation, the screening module 602 is further used to: calculate the priority score of each GPU node in the first GPU node set based on the status information of each GPU node in the first GPU node set, and the priority score indicates the priority of processing the target service request; and screen out at least one GPU node in the first GPU node set as the at least one target GPU node in descending order of the priority scores of the GPU nodes.

[0151] In one possible implementation, the priority score of the first GPU node is positively correlated with the longest duration of each inference task currently executed by the first GPU node, and is positively correlated with the number of historical service requests in the session to which the target service request belongs processed by the first GPU node; wherein the first GPU node is any GPU node in the first GPU node set.

[0152] In one possible implementation, the screening module 602 is also used to: calculate the absolute value of the difference between the longest duration of each reasoning task currently executed by the first GPU node and the average duration of processing historical reasoning tasks; wherein the average duration of processing historical reasoning tasks represents the average duration from the GPU node obtaining the historical reasoning task to completing the historical reasoning task; calculate the product of the number of times the first GPU node processes the historical service request in the session to which the target service request belongs and the saved time corresponding to a historical service request, wherein the saved time corresponding to a historical service request represents the time saved by directly using the cache information corresponding to a historical service request during the GPU node's execution of the reasoning task relative to the GPU node calculating the cache information; calculate the priority score of the first GPU node based on the absolute value of the difference and the product; wherein the priority score of the first GPU node is positively correlated with the absolute value of the difference and is positively correlated with the product.

[0153] In a possible implementation, the screening module 602 is further configured to perform a weighted summation on the absolute value of the difference and the product to obtain a priority score of the first GPU node.

[0154] In one possible implementation, the acquisition model 601 is also used to: determine the resource type that can be used to process the target service request; obtain a second GPU node set, the second GPU node set including: GPU nodes that currently have service request processing capabilities; determine a GPU node that matches the resource type in the second GPU node set as the GPU node that can currently be used to process the target service request.

[0155] In a possible implementation manner, the resource type includes: a type of a GPU node and / or a type of a large language model.

[0156] In a possible implementation, the screening module 602 is further used to: determine the minimum number of GPU nodes corresponding to the target service request; and screen out at least one target GPU node in the first GPU node set based on the status information of each GPU node in the first GPU node set, including: when the minimum number of GPU nodes does not exceed the number of GPU nodes in the first GPU node set, based on the status information of each GPU node in the first GPU node set, screen out the GPU nodes with the minimum number of GPU nodes in the first GPU node set as the at least one target GPU node; and / or, when the minimum number of GPU nodes exceeds the number of GPU nodes in the first GPU node set, update the first GPU node set; and when the number of GPU nodes in the updated first GPU node set is not less than the minimum number of GPU nodes, based on the status information of each GPU node in the updated first GPU node set, screen out the GPU nodes with the minimum number of GPU nodes in the updated first GPU node set as the at least one target GPU node.

[0157] In one possible implementation, when the longest duration of each reasoning task currently executed by the first GPU node exceeds the average duration of the processing historical reasoning tasks, the weight of the absolute value of the difference is positively correlated with the longest duration of each reasoning task currently executed by the first GPU node, and the weight of the product is negatively correlated with the longest duration of each reasoning task currently executed by the first GPU node; and / or, when the longest duration of each reasoning task currently executed by the first GPU node does not exceed the average duration of the processing historical reasoning tasks, the weight of the absolute value of the difference is negatively correlated with the longest duration of each reasoning task currently executed by the first GPU node, and the weight of the product is positively correlated with the longest duration of each reasoning task currently executed by the first GPU node.

[0158] In one possible implementation, the acquisition model 601 is also used to: filter out the GPU nodes that currently have the service request processing capability from the candidate GPU node set based on the distributed semaphores corresponding to each candidate GPU node in the candidate GPU node set; the processing model 603 is also used to: update the distributed semaphore corresponding to the at least one target GPU node.

[0159] In a possible implementation, the processing model 603 is further used to: use a key-value pair database as a message middleware to synchronize messages between the at least one target GPU node and the node that issues the target service request.

[0160] Above Figure 6 The technical effects and specific descriptions of the load balancing device shown and its various possible implementations can be found in the above-mentioned load balancing method, which will not be repeated here.

[0161] It should be understood that the division of the modules in the above device is only a division of logical functions, and in actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. In addition, the modules in the device can be implemented in the form of a processor calling software; for example, the device includes a processor, the processor is connected to a memory, and instructions are stored in the memory. The processor calls the instructions stored in the memory to implement any of the above methods or realize the functions of the modules of the device, wherein the processor is, for example, a general-purpose processor, such as a CPU or a microprocessor, and the memory is a memory inside the device or a memory outside the device. Alternatively, the modules in the device can be implemented in the form of hardware circuits, and the functions of some or all modules can be realized by designing the hardware circuits, and the hardware circuits can be understood as one or more processors; for example, in one implementation, the hardware circuit is an application-specific integrated circuit (ASIC), and the functions of some or all modules above are realized by designing the logical relationship of the components in the circuit; for another example, in another implementation, the hardware circuit can be realized by a programmable logic device (PLD), taking a field programmable gate array (FPGA) as an example, which can include a large number of logic gate circuits, and the connection relationship between the logic gate circuits is configured by a configuration file, so as to realize the functions of some or all modules above. All modules of the above device can be realized in the form of a processor calling software, or in the form of a hardware circuit, or in part by a processor calling software, and the rest by a hardware circuit.

[0162] In the embodiments of the present disclosure, the processor is a circuit with the ability to process signals. In one implementation, the processor may be a circuit with the ability to read and run instructions, such as a CPU, a microprocessor, a graphics processing unit (GPU), a digital signal processor (DSP), a neural-network processing unit (NPU), a tensor processing unit (TPU), etc.; in another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit is fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the functions of some or all of the above modules.

[0163] It can be seen that each module in the above device can be one or more processors (or processing circuits) configured to implement the above embodiment method, such as: CPU, GPU, NPU, TPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms. In addition, each module in the above device can be fully or partially integrated together, or can be implemented independently, which is not limited.

[0164] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0165] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0166] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0167] Figure 7 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal device. Figure 7, the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0168] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.

[0169] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0170] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0171] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0172] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0173] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0174] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0175] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0176] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0177] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0178] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A load balancing method, It is characterized in that include: Get the target service request; Obtaining status information of each GPU node in the first graphics processor GPU node set; The first GPU node set includes: GPU nodes that are currently available for processing the target service request; wherein the status information of any GPU node includes: the maximum duration of each inference task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs; Based on the status information of each GPU node in the first GPU node set, screening out at least one target GPU node in the first GPU node set; The target service request is processed using the at least one target GPU node based on a target large language model.

2. The method according to claim 1, It is characterized in that The step of selecting at least one target GPU node from the first GPU node set based on the status information of each GPU node in the first GPU node set includes: Calculate, based on the status information of each GPU node in the first GPU node set, a priority score of each GPU node, wherein the priority score indicates a priority of processing the target service request; At least one GPU node is selected from the first GPU node set in descending order of the priority scores of the GPU nodes as the at least one target GPU node.

3. The method according to claim 2, It is characterized in that The priority score of the first GPU node is positively correlated with the longest duration of each inference task currently executed by the first GPU node, and is positively correlated with the number of historical service requests in the session to which the target service request belongs processed by the first GPU node; wherein, the first GPU node is any GPU node in the first GPU node set.

4. The method according to claim 2, It is characterized in that The calculating the priority score of each GPU node based on the status information of each GPU node in the first GPU node set includes: Calculate the absolute value of the difference between the longest duration of each inference task currently executed by the first GPU node and the average duration of processing historical inference tasks; wherein the average duration of processing historical inference tasks represents the average duration from when the GPU node obtains the historical inference task to when it completes the execution of the historical inference task; Calculate the product of the number of times the first GPU node processes historical service requests in the session to which the target service request belongs and the saved time corresponding to one historical service request, wherein the saved time corresponding to one historical service request represents the time saved by directly using the cache information corresponding to one historical service request during the GPU node's execution of the inference task relative to the GPU node calculating the cache information; Based on the absolute value of the difference and the product, a priority score of the first GPU node is calculated; wherein the priority score of the first GPU node is positively correlated with the absolute value of the difference and positively correlated with the product.

5. The method according to claim 4, It is characterized in that The calculating the priority score of the first GPU node based on the absolute value of the difference and the product includes: Performing a weighted sum on the absolute value of the difference and the product to obtain a priority score of the first GPU node.

6. The method according to claim 1, It is characterized in that The method further comprises: Determining a resource type that can be used to process the target service request; Acquire a second GPU node set, where the second GPU node set includes: GPU nodes that currently have a service request processing capability; A GPU node matching the resource type is determined in the second GPU node set as the GPU node currently available for processing the target service request.

7. The method according to claim 6, It is characterized in that The resource type includes: a type of GPU node and / or a type of large language model.

8. The method according to claim 1, It is characterized in that The method further comprises: Determine the minimum number of GPU nodes corresponding to the target service request; The step of selecting at least one target GPU node from the first GPU node set based on the status information of each GPU node in the first GPU node set includes: In a case where the minimum number of GPU nodes does not exceed the number of GPU nodes in the first GPU node set, based on the status information of each GPU node in the first GPU node set, selecting the GPU nodes with the minimum number of GPU nodes in the first GPU node set as the at least one target GPU node; and / or, When the minimum number of GPU nodes exceeds the number of GPU nodes in the first GPU node set, the first GPU node set is updated; and when the number of GPU nodes in the updated first GPU node set is not less than the minimum number of GPU nodes, based on the status information of each GPU node in the updated first GPU node set, the GPU nodes with the minimum number of GPU nodes are screened out in the updated first GPU node set as the at least one target GPU node.

9. The method according to claim 5, It is characterized in that In the case where the longest duration of each inference task currently executed by the first GPU node exceeds the average duration of the processing historical inference tasks, the weight of the absolute value of the difference is positively correlated with the longest duration of each inference task currently executed by the first GPU node, and the weight of the product is negatively correlated with the longest duration of each inference task currently executed by the first GPU node; and / or, When the longest duration of each inference task currently executed by the first GPU node does not exceed the average duration of the processing historical inference tasks, the weight of the absolute value of the difference is negatively correlated with the longest duration of each inference task currently executed by the first GPU node, and the weight of the product is positively correlated with the longest duration of each inference task currently executed by the first GPU node.

10. The method according to claim 6, It is characterized in that The obtaining of the second GPU node set includes: According to the distributed semaphore corresponding to each candidate GPU node in the candidate GPU node set, the GPU node currently having the service request processing capability is screened out from the candidate GPU node set; The method further comprises: Update the distributed semaphore corresponding to the at least one target GPU node.

11. The method according to any one of claims 1 to 10, It is characterized in that The method further includes: using a key-value pair database as a message middleware to synchronize messages between the at least one target GPU node and a node that issues the target service request.

12. A load balancing device, It is characterized in that The device comprises: An acquisition module, used to acquire a target service request; The acquisition module is further used to acquire status information of each GPU node in a first graphics processor GPU node set; the first GPU node set includes: GPU nodes that can currently be used to process the target service request; wherein the status information of any GPU node includes: the maximum duration of each inference task currently executed by the GPU node and the number of historical service requests in the session to which the target service request belongs to be processed; A screening module, configured to screen out at least one target GPU node from the first GPU node set based on status information of each GPU node in the first GPU node set; A processing module is used to process the target service request based on a target large language model using the at least one target GPU node.

13. An electronic device, It is characterized in that include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method described in any one of claims 1 to 11 when executing the instructions stored in the memory.

14. A non-volatile computer-readable storage medium having computer program instructions stored thereon, It is characterized in that When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Determining a schedule for a job to replicate an object stored on a storage appliance

    CN104067219A

  • Multi-service processing method, device and system, electronic equipment and storage medium

    CN113127166A

  • Load balancing method and device, electronic equipment and medium

    CN116996517A

  • Task scheduling method with lightweight expert system strategy and application thereof

    CN117992234A

  • Data transmission control method and device, electronic equipment and storage medium

    CN118175112A

Cited By

  • Load-aware scheduling method of inference system and inference system

    CN119149252A

  • Load-Aware Scheduling Method for Inference System and Inference System

    CN119149252B

  • Inference service management method, equipment, medium and computer program product

    CN119415273A

  • Data processing system, method, device, medium and program product

    CN119887498A

  • Sparse LLM data parallel processing system and method based on MLA

    CN120276850A